diff options
| author | Roy Ben-Shabat <Roy@Twine-s.com> | 2018-06-14 15:57:24 +0300 |
|---|---|---|
| committer | Roy Ben-Shabat <Roy@Twine-s.com> | 2018-06-14 15:57:24 +0300 |
| commit | a775178c063082eb6a401b4254a046133840af03 (patch) | |
| tree | 4ba9572da806e6e5ec031853188f6f335546fb57 /Software/Visual_Studio/PPC/Tango.PPC.Common/PPCViewModel.cs | |
| parent | 099cb04861e293cf675d8b5216448a766eef7954 (diff) | |
| download | Tango-a775178c063082eb6a401b4254a046133840af03.tar.gz Tango-a775178c063082eb6a401b4254a046133840af03.zip | |
Working on PPC...
Diffstat (limited to 'Software/Visual_Studio/PPC/Tango.PPC.Common/PPCViewModel.cs')
| -rw-r--r-- | Software/Visual_Studio/PPC/Tango.PPC.Common/PPCViewModel.cs | 73 |
1 files changed, 70 insertions, 3 deletions
diff --git a/Software/Visual_Studio/PPC/Tango.PPC.Common/PPCViewModel.cs b/Software/Visual_Studio/PPC/Tango.PPC.Common/PPCViewModel.cs index ffe5c9a4f..dc7976884 100644 --- a/Software/Visual_Studio/PPC/Tango.PPC.Common/PPCViewModel.cs +++ b/Software/Visual_Studio/PPC/Tango.PPC.Common/PPCViewModel.cs @@ -11,29 +11,52 @@ using Tango.PPC.Common.Navigation; using Tango.PPC.Common.Notifications; using Tango.Settings; using Tango.SharedUI; +using static Tango.SharedUI.Controls.NavigationControl; namespace Tango.PPC.Common { - public abstract class PPCViewModel : ViewModel + /// <summary> + /// Represents a PPC view model base class. + /// </summary> + /// <seealso cref="Tango.SharedUI.ViewModel" /> + public abstract class PPCViewModel : ViewModel, INavigationViewModel { + /// <summary> + /// Gets the static observable entities adapter. + /// </summary> public ObservablesEntitiesAdapter Adapter { get { return ObservablesEntitiesAdapter.Instance; } } + /// <summary> + /// Gets or sets the application manager. + /// </summary> [TangoInject] public IPPCApplicationManager ApplicationManager { get; set; } + /// <summary> + /// Gets or sets the authentication provider. + /// </summary> [TangoInject] public IAuthenticationProvider AuthenticationProvider { get; set; } + /// <summary> + /// Gets or sets the navigation manager. + /// </summary> [TangoInject] public INavigationManager NavigationManager { get; set; } + /// <summary> + /// Gets or sets the notification provider. + /// </summary> [TangoInject] public INotificationProvider NotificationProvider { get; set; } private PPCSettings _settings; + /// <summary> + /// Gets the main PPC settings. + /// </summary> public PPCSettings Settings { get @@ -48,25 +71,66 @@ namespace Tango.PPC.Common private set { _settings = value; } } - public PPCViewModel() + private bool _visible; + /// <summary> + /// Gets or sets a value indicating whether this <see cref="PPCViewModel"/> view is visible. + /// </summary> + public bool Visible { - + get { return _visible; } + private set { _visible = value; RaisePropertyChangedAuto(); } } + /// <summary> + /// Called when the application has been started. + /// </summary> public abstract void OnApplicationStarted(); + /// <summary> + /// Called when the application is shutting down. + /// </summary> public virtual void OnApplicationShuttingDown() { } + + /// <summary> + /// Called when the navigation system has navigated to this VM view. + /// </summary> + public virtual void OnNavigatedTo() + { + Visible = true; + } + + /// <summary> + /// Called when the navigation system has navigated from this VM view. + /// </summary> + public virtual void OnNavigatedFrom() + { + Visible = false; + } } + /// <summary> + /// Represents a PPC view model base class a View property as an instance of a <see cref="IPPCView"/> contract. + /// </summary> + /// <typeparam name="T"></typeparam> + /// <seealso cref="Tango.SharedUI.ViewModel" /> public abstract class PPCViewModel<T> : PPCViewModel where T : IPPCView { + /// <summary> + /// Gets the IPPCView instance. + /// </summary> public T View { get; private set; } + /// <summary> + /// Gets a value indicating whether the instance of IPPCView is available. + /// </summary> public bool ViewAttached { get; private set; } + /// <summary> + /// Called when the application has been started. + /// </summary> public override void OnApplicationStarted() { TangoIOC.Default.GetInstanceWhenAvailable<T>((view) => @@ -77,6 +141,9 @@ namespace Tango.PPC.Common }); } + /// <summary> + /// Called when the instance of IPPCView is available. + /// </summary> public abstract void OnViewAttached(); } }
\ No newline at end of file |
