1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465 |
- using IFramework.Message;
- namespace IFramework.MVVM
- {
- internal interface IViewModel
- {
- void Initialize();
- void SyncModelValue();
- void Listen(IEventArgs message);
- }
-
-
-
- public abstract class ViewModel : ObservableObject, IViewModel
- {
- internal MVVMGroup group { get; set; }
-
-
-
- protected IModel model { get { return group.model; } }
- void IViewModel.SyncModelValue()
- {
- SyncModelValue();
- }
- void IViewModel.Initialize()
- {
- Initialize();
- }
- void IViewModel.Listen(IEventArgs message)
- {
- Listen(message);
- }
-
-
-
- protected abstract void Initialize();
-
-
-
- protected abstract void SyncModelValue();
-
-
-
-
- protected abstract void Listen(IEventArgs message);
-
-
-
- protected override void OnDispose() { }
-
- }
-
-
-
- public abstract class ViewModel<T> : ViewModel where T : IModel
- {
-
-
-
- protected T Tmodel { get { return (T)group.model; } }
- }
- }
|