using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; using Tango.SharedUI; namespace Tango.MachineStudio.Common { /// /// Represents a Machine Studio view model /// /// The type of the module. /// /// public abstract class StudioViewModelInternal : ViewModel, IStudioViewModel { /// /// Gets or sets a value indicating whether this view model studio module is currently loaded. /// public bool IsModuleLoaded { get; private set; } /// /// Initializes a new instance of the class. /// public StudioViewModelInternal() : base() { } /// /// Called when another module has wants to navigate to this module with some arguments. /// /// The arguments. public virtual void OnModuleRequest(params object[] args) { } /// /// Called when the user has navigated out of the module. /// public virtual void OnNavigatedFrom() { IsModuleLoaded = false; } /// /// Called when the user has navigated in to the module. /// public virtual void OnNavigatedTo() { IsModuleLoaded = true; } /// /// Called before the application is shutting down. /// Return false to cancel the shutdown in case an important process is in progress. /// /// public virtual Task OnShutdownRequest() { return Task.FromResult(true); } /// /// Called when application is shutting down. /// public virtual void OnShuttingDown() { } /// /// Called when the application has been started /// public virtual void OnApplicationStarted() { } } /// /// Represents a Machine Studio view model /// /// The type of the module. /// /// public abstract class StudioViewModel : ViewModel, IStudioViewModel where Module : IStudioModule { /// /// Gets or sets a value indicating whether this view model studio module is currently loaded. /// public bool IsModuleLoaded { get; private set; } /// /// Initializes a new instance of the class. /// public StudioViewModel() : base() { } /// /// Called when another module has wants to navigate to this module with some arguments. /// /// The arguments. public virtual void OnModuleRequest(params object[] args) { } /// /// Called when the user has navigated out of the module. /// public virtual void OnNavigatedFrom() { IsModuleLoaded = false; } /// /// Called when the user has navigated in to the module. /// public virtual void OnNavigatedTo() { IsModuleLoaded = true; } /// /// Called before the application is shutting down. /// Return false to cancel the shutdown in case an important process is in progress. /// /// public virtual Task OnShutdownRequest() { return Task.FromResult(true); } /// /// Called when application is shutting down. /// public virtual void OnShuttingDown() { } /// /// Called when the application has been started /// public virtual void OnApplicationStarted() { } } /// /// Represents a Machine Studio view model. /// /// The type of the module. /// /// /// public abstract class StudioViewModel : ViewModel, IStudioViewModel where Module : IStudioModule where T : IView { /// /// Initializes a new instance of the class. /// /// The view. public StudioViewModel(T view) : base(view) { } /// /// Called when the application has been started /// public virtual void OnApplicationStarted() { } /// /// Called when another module has wants to navigate to this module with some arguments. /// /// The arguments. public virtual void OnModuleRequest(params object[] args) { } /// /// Called when the user has navigated out of the module. /// public virtual void OnNavigatedFrom() { } /// /// Called when the user has navigated in to the module. /// public virtual void OnNavigatedTo() { } /// /// Called before the application is shutting down. /// Return false to cancel the shutdown in case an important process is in progress. /// /// public virtual Task OnShutdownRequest() { return Task.FromResult(true); } /// /// Called when application is shutting down. /// public virtual void OnShuttingDown() { } } }