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 | |
| parent | 099cb04861e293cf675d8b5216448a766eef7954 (diff) | |
| download | Tango-a775178c063082eb6a401b4254a046133840af03.tar.gz Tango-a775178c063082eb6a401b4254a046133840af03.zip | |
Working on PPC...
Diffstat (limited to 'Software/Visual_Studio/PPC')
21 files changed, 305 insertions, 40 deletions
diff --git a/Software/Visual_Studio/PPC/Modules/Tango.PPC.Jobs/ViewModels/JobsViewVM.cs b/Software/Visual_Studio/PPC/Modules/Tango.PPC.Jobs/ViewModels/JobsViewVM.cs index 413027d5d..eabf8b985 100644 --- a/Software/Visual_Studio/PPC/Modules/Tango.PPC.Jobs/ViewModels/JobsViewVM.cs +++ b/Software/Visual_Studio/PPC/Modules/Tango.PPC.Jobs/ViewModels/JobsViewVM.cs @@ -102,6 +102,11 @@ namespace Tango.PPC.Jobs.ViewModels LoadJobs(); } + public override void OnNavigatedTo() + { + base.OnNavigatedTo(); + } + private void LoadJobs() { Task.Factory.StartNew(() => diff --git a/Software/Visual_Studio/PPC/Tango.PPC.Common/Application/IPPCApplicationManager.cs b/Software/Visual_Studio/PPC/Tango.PPC.Common/Application/IPPCApplicationManager.cs index 62a8d4d05..d07a074fc 100644 --- a/Software/Visual_Studio/PPC/Tango.PPC.Common/Application/IPPCApplicationManager.cs +++ b/Software/Visual_Studio/PPC/Tango.PPC.Common/Application/IPPCApplicationManager.cs @@ -26,7 +26,7 @@ namespace Tango.PPC.Common.Application event EventHandler ModulesInitialized; /// <summary> - /// Gets or sets the DAL machine. + /// Gets the associated observable entity machine. /// </summary> Machine Machine { get; } @@ -36,7 +36,7 @@ namespace Tango.PPC.Common.Application event EventHandler<IMachineOperator> ConnectedMachineChanged; /// <summary> - /// Gets a value indicating whether Machine Studio is shutting down. + /// Gets a value indicating whether the application is shutting down. /// </summary> bool IsShuttingDown { get; } @@ -51,7 +51,7 @@ namespace Tango.PPC.Common.Application IMachineOperator ConnectedMachine { get; set; } /// <summary> - /// Gets the machine studio application version. + /// Gets the application version. /// </summary> String Version { get; } } diff --git a/Software/Visual_Studio/PPC/Tango.PPC.Common/Converters/SegmentsToPieConverter.cs b/Software/Visual_Studio/PPC/Tango.PPC.Common/Converters/SegmentsToPieConverter.cs index 77eab71b8..82f9bb744 100644 --- a/Software/Visual_Studio/PPC/Tango.PPC.Common/Converters/SegmentsToPieConverter.cs +++ b/Software/Visual_Studio/PPC/Tango.PPC.Common/Converters/SegmentsToPieConverter.cs @@ -28,7 +28,7 @@ namespace Tango.PPC.Common.Converters { foreach (var segment in segments) { - pie.DataList.Add(10); + pie.DataList.Add(segment.Length); pie.DataBrushes.Add(segment.GetSegmentBrush()); } } diff --git a/Software/Visual_Studio/PPC/Tango.PPC.Common/IPPCModule.cs b/Software/Visual_Studio/PPC/Tango.PPC.Common/IPPCModule.cs index 4226e7aad..ba83d9b5d 100644 --- a/Software/Visual_Studio/PPC/Tango.PPC.Common/IPPCModule.cs +++ b/Software/Visual_Studio/PPC/Tango.PPC.Common/IPPCModule.cs @@ -11,7 +11,7 @@ using Tango.BL.Enumerations; namespace Tango.PPC.Common { /// <summary> - /// Represents a Machine Studio module. + /// Represents a PCC module. /// </summary> /// <seealso cref="System.IDisposable" /> public interface IPPCModule : IDisposable diff --git a/Software/Visual_Studio/PPC/Tango.PPC.Common/IPPCView.cs b/Software/Visual_Studio/PPC/Tango.PPC.Common/IPPCView.cs index 35018a922..413a019e2 100644 --- a/Software/Visual_Studio/PPC/Tango.PPC.Common/IPPCView.cs +++ b/Software/Visual_Studio/PPC/Tango.PPC.Common/IPPCView.cs @@ -6,6 +6,9 @@ using System.Threading.Tasks; namespace Tango.PPC.Common { + /// <summary> + /// Represents a PPC view. + /// </summary> public interface IPPCView { diff --git a/Software/Visual_Studio/PPC/Tango.PPC.Common/Navigation/INavigationManager.cs b/Software/Visual_Studio/PPC/Tango.PPC.Common/Navigation/INavigationManager.cs index c0f7265fb..14648eab1 100644 --- a/Software/Visual_Studio/PPC/Tango.PPC.Common/Navigation/INavigationManager.cs +++ b/Software/Visual_Studio/PPC/Tango.PPC.Common/Navigation/INavigationManager.cs @@ -7,12 +7,12 @@ using System.Threading.Tasks; namespace Tango.PPC.Common.Navigation { /// <summary> - /// Represents the Machine Studio views navigation manager. + /// Represents the PPC views navigation manager. /// </summary> public interface INavigationManager { /// <summary> - /// Navigates to the specified view. + /// Navigates to the specified PPC view. /// </summary> /// <param name="view">The view.</param> void NavigateTo(NavigationView view); diff --git a/Software/Visual_Studio/PPC/Tango.PPC.Common/Notifications/DialogViewVM.cs b/Software/Visual_Studio/PPC/Tango.PPC.Common/Notifications/DialogViewVM.cs index b7a48f259..85237f08d 100644 --- a/Software/Visual_Studio/PPC/Tango.PPC.Common/Notifications/DialogViewVM.cs +++ b/Software/Visual_Studio/PPC/Tango.PPC.Common/Notifications/DialogViewVM.cs @@ -43,7 +43,7 @@ namespace Tango.PPC.Common.Notifications public RelayCommand CloseCommand { get; set; } /// <summary> - /// Gets or sets the ok command. + /// Gets or sets the OK command. /// </summary> public RelayCommand OKCommand { get; set; } diff --git a/Software/Visual_Studio/PPC/Tango.PPC.Common/Notifications/INotificationProvider.cs b/Software/Visual_Studio/PPC/Tango.PPC.Common/Notifications/INotificationProvider.cs index 917a3e168..9fc42c155 100644 --- a/Software/Visual_Studio/PPC/Tango.PPC.Common/Notifications/INotificationProvider.cs +++ b/Software/Visual_Studio/PPC/Tango.PPC.Common/Notifications/INotificationProvider.cs @@ -10,7 +10,7 @@ using System.Windows.Media; namespace Tango.PPC.Common.Notifications { /// <summary> - /// Represents the Machine Studio user notification provider responsible for displaying information, alerts and dialogs to the user. + /// Represents the PPC user notification provider responsible for displaying information, alerts and dialogs to the user. /// </summary> public interface INotificationProvider { diff --git a/Software/Visual_Studio/PPC/Tango.PPC.Common/PPCModuleAttribute.cs b/Software/Visual_Studio/PPC/Tango.PPC.Common/PPCModuleAttribute.cs index 45c750e56..933791268 100644 --- a/Software/Visual_Studio/PPC/Tango.PPC.Common/PPCModuleAttribute.cs +++ b/Software/Visual_Studio/PPC/Tango.PPC.Common/PPCModuleAttribute.cs @@ -6,11 +6,22 @@ using System.Threading.Tasks; namespace Tango.PPC.Common { + /// <summary> + /// Represents a <see cref="IPPCModule"/> attribute + /// </summary> + /// <seealso cref="System.Attribute" /> [AttributeUsage(AttributeTargets.Class)] public class PPCModuleAttribute : Attribute { - public int Index { get; set; } + /// <summary> + /// Gets or sets the module index. + /// </summary> + public int Index { get; private set; } + /// <summary> + /// Initializes a new instance of the <see cref="PPCModuleAttribute"/> class. + /// </summary> + /// <param name="index">The module index.</param> public PPCModuleAttribute(int index) { Index = index; diff --git a/Software/Visual_Studio/PPC/Tango.PPC.Common/PPCModuleBase.cs b/Software/Visual_Studio/PPC/Tango.PPC.Common/PPCModuleBase.cs index d4d00064c..45428f542 100644 --- a/Software/Visual_Studio/PPC/Tango.PPC.Common/PPCModuleBase.cs +++ b/Software/Visual_Studio/PPC/Tango.PPC.Common/PPCModuleBase.cs @@ -12,7 +12,7 @@ using Tango.BL.Enumerations; namespace Tango.PPC.Common { /// <summary> - /// Represents a base class for studio modules. + /// Represents a base class for PPC modules. /// </summary> /// <seealso cref="Tango.MachineStudio.Common.IStudioModule" /> public abstract class PPCModuleBase : ExtendedObject, IPPCModule diff --git a/Software/Visual_Studio/PPC/Tango.PPC.Common/PPCSettings.cs b/Software/Visual_Studio/PPC/Tango.PPC.Common/PPCSettings.cs index db04c04ee..2e7af8844 100644 --- a/Software/Visual_Studio/PPC/Tango.PPC.Common/PPCSettings.cs +++ b/Software/Visual_Studio/PPC/Tango.PPC.Common/PPCSettings.cs @@ -7,10 +7,20 @@ using Tango.Settings; namespace Tango.PPC.Common { + /// <summary> + /// Represents the main PPC settings. + /// </summary> + /// <seealso cref="Tango.Settings.SettingsBase" /> public class PPCSettings : SettingsBase { + /// <summary> + /// Gets or sets the machine serial number. + /// </summary> public String MachineSerialNumber { get; set; } + /// <summary> + /// Initializes a new instance of the <see cref="PPCSettings"/> class. + /// </summary> public PPCSettings() { MachineSerialNumber = "1111"; 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 diff --git a/Software/Visual_Studio/PPC/Tango.PPC.Common/Tango.PPC.Common.csproj b/Software/Visual_Studio/PPC/Tango.PPC.Common/Tango.PPC.Common.csproj index 9393d0612..f58ec7695 100644 --- a/Software/Visual_Studio/PPC/Tango.PPC.Common/Tango.PPC.Common.csproj +++ b/Software/Visual_Studio/PPC/Tango.PPC.Common/Tango.PPC.Common.csproj @@ -215,9 +215,7 @@ <Install>false</Install> </BootstrapperPackage> </ItemGroup> - <ItemGroup> - <Folder Include="Fonts\" /> - </ItemGroup> + <ItemGroup /> <Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" /> <Import Project="..\..\packages\System.Data.SQLite.Core.1.0.108.0\build\net46\System.Data.SQLite.Core.targets" Condition="Exists('..\..\packages\System.Data.SQLite.Core.1.0.108.0\build\net46\System.Data.SQLite.Core.targets')" /> <Target Name="EnsureNuGetPackageBuildImports" BeforeTargets="PrepareForBuild"> diff --git a/Software/Visual_Studio/PPC/Tango.PPC.UI/Authentication/DefaultAuthenticationProvider.cs b/Software/Visual_Studio/PPC/Tango.PPC.UI/Authentication/DefaultAuthenticationProvider.cs index 8a60caf6d..53a37c7f5 100644 --- a/Software/Visual_Studio/PPC/Tango.PPC.UI/Authentication/DefaultAuthenticationProvider.cs +++ b/Software/Visual_Studio/PPC/Tango.PPC.UI/Authentication/DefaultAuthenticationProvider.cs @@ -10,10 +10,22 @@ using Tango.PPC.Common.Authentication; namespace Tango.PPC.UI.Authentication { + /// <summary> + /// Represents the default PPC authentication provider. + /// </summary> + /// <seealso cref="Tango.Core.ExtendedObject" /> + /// <seealso cref="Tango.PPC.Common.Authentication.IAuthenticationProvider" /> public class DefaultAuthenticationProvider : ExtendedObject, IAuthenticationProvider { - private User _currentUser; + /// <summary> + /// Occurs when the current logged-in user has changed. + /// </summary> + public event EventHandler<User> CurrentUserChanged; + private User _currentUser; + /// <summary> + /// Gets the current logged-in user. + /// </summary> public User CurrentUser { get { return _currentUser; } @@ -24,8 +36,12 @@ namespace Tango.PPC.UI.Authentication } } - public event EventHandler<User> CurrentUserChanged; - + /// <summary> + /// Performs a user login by the specified email and password. + /// </summary> + /// <param name="email">The email.</param> + /// <param name="password">The password.</param> + /// <returns></returns> public Task<User> Login(string email, string password) { return Task.Factory.StartNew(() => @@ -36,6 +52,9 @@ namespace Tango.PPC.UI.Authentication }); } + /// <summary> + /// Logs-out the current logged-in user. + /// </summary> public void Logout() { CurrentUser = null; diff --git a/Software/Visual_Studio/PPC/Tango.PPC.UI/Navigation/DefaultNavigationManager.cs b/Software/Visual_Studio/PPC/Tango.PPC.UI/Navigation/DefaultNavigationManager.cs index 8c42a3a44..82640f899 100644 --- a/Software/Visual_Studio/PPC/Tango.PPC.UI/Navigation/DefaultNavigationManager.cs +++ b/Software/Visual_Studio/PPC/Tango.PPC.UI/Navigation/DefaultNavigationManager.cs @@ -13,15 +13,27 @@ using Tango.SharedUI.Controls; namespace Tango.PPC.UI.Navigation { + /// <summary> + /// Represents the default PPC navigation manager. + /// </summary> + /// <seealso cref="Tango.PPC.Common.Navigation.INavigationManager" /> public class DefaultNavigationManager : INavigationManager { private IPPCModuleLoader _moduleLoader; + /// <summary> + /// Initializes a new instance of the <see cref="DefaultNavigationManager"/> class. + /// </summary> + /// <param name="moduleLoader">The module loader.</param> public DefaultNavigationManager(IPPCModuleLoader moduleLoader) { _moduleLoader = moduleLoader; } + /// <summary> + /// Navigates to the specified PPC view. + /// </summary> + /// <param name="view">The view.</param> public void NavigateTo(NavigationView view) { if (view == NavigationView.HomeModule) @@ -36,6 +48,10 @@ namespace Tango.PPC.UI.Navigation } } + /// <summary> + /// Navigates to the specified module. + /// </summary> + /// <typeparam name="T"></typeparam> public void NavigateTo<T>() where T : IPPCModule { MainView.Instance.NavigationControl.NavigateTo(NavigationView.LayoutView.ToString()); @@ -44,11 +60,32 @@ namespace Tango.PPC.UI.Navigation navigationControl.NavigateTo(module.Name); } + /// <summary> + /// Navigates to the specified module name. + /// </summary> + /// <param name="moduleName">Name of the module.</param> + public void NavigateTo(string moduleName) + { + var navigationControl = LayoutView.Instance.NavigationControl; + navigationControl.NavigateTo(moduleName); + } + + /// <summary> + /// Navigates to the specified module using the view path (e.g MainView.JobsView). + /// </summary> + /// <typeparam name="T"></typeparam> + /// <param name="viewPath">The view path.</param> public void NavigateTo<T>(string viewPath) where T : IPPCModule { NavigateTo<T>(viewPath.Split(',')); } + /// <summary> + /// Navigates to the specified module using the view path (e.g MainView,JobsView). + /// This method makes it easy to do stuff like NavigateTo(nameof(MainView),nameof(JobsView)); + /// </summary> + /// <typeparam name="T"></typeparam> + /// <param name="viewPath">The view path.</param> public void NavigateTo<T>(params String[] viewPath) where T : IPPCModule { MainView.Instance.NavigationControl.NavigateTo(NavigationView.LayoutView.ToString()); @@ -72,11 +109,5 @@ namespace Tango.PPC.UI.Navigation }); } } - - public void NavigateTo(string moduleName) - { - var navigationControl = LayoutView.Instance.NavigationControl; - navigationControl.NavigateTo(moduleName); - } } } diff --git a/Software/Visual_Studio/PPC/Tango.PPC.UI/Notifications/DefaultNotificationProvider.cs b/Software/Visual_Studio/PPC/Tango.PPC.UI/Notifications/DefaultNotificationProvider.cs index 02e41e087..5e4bd7c30 100644 --- a/Software/Visual_Studio/PPC/Tango.PPC.UI/Notifications/DefaultNotificationProvider.cs +++ b/Software/Visual_Studio/PPC/Tango.PPC.UI/Notifications/DefaultNotificationProvider.cs @@ -14,22 +14,43 @@ using Tango.SharedUI.Helpers; namespace Tango.PPC.UI.Notifications { + /// <summary> + /// Represents the default PPC notification provider. + /// </summary> + /// <seealso cref="Tango.Core.ExtendedObject" /> + /// <seealso cref="Tango.PPC.Common.Notifications.INotificationProvider" /> public class DefaultNotificationProvider : ExtendedObject, INotificationProvider { + /// <summary> + /// Represents a pending message box. + /// </summary> private class PendingMessageBox { + /// <summary> + /// Gets or sets the message view model. + /// </summary> public MessageBoxVM VM { get; set; } + + /// <summary> + /// Gets or sets the message task completion source. + /// </summary> public TaskCompletionSource<bool> CompletionSource { get; set; } } private ConcurrentQueue<PendingMessageBox> _pendingMessageBoxes; + /// <summary> + /// Initializes a new instance of the <see cref="DefaultNotificationProvider"/> class. + /// </summary> public DefaultNotificationProvider() { _pendingMessageBoxes = new ConcurrentQueue<PendingMessageBox>(); } private MessageBoxVM _currentMessageBox; + /// <summary> + /// Gets the current message box if any. + /// </summary> public MessageBoxVM CurrentMessageBox { get { return _currentMessageBox; } @@ -41,6 +62,9 @@ namespace Tango.PPC.UI.Notifications } } + /// <summary> + /// Gets a value indicating whether a message box is available. + /// </summary> public bool HasMessageBox { get @@ -49,6 +73,11 @@ namespace Tango.PPC.UI.Notifications } } + /// <summary> + /// Shows an error message box. + /// </summary> + /// <param name="message">The message.</param> + /// <returns></returns> public Task ShowError(string message) { return ShowMessageBox(new MessageBoxVM() @@ -60,6 +89,11 @@ namespace Tango.PPC.UI.Notifications }); } + /// <summary> + /// Shows an information message box. + /// </summary> + /// <param name="message">The message.</param> + /// <returns></returns> public Task ShowInfo(string message) { return ShowMessageBox(new MessageBoxVM() @@ -71,6 +105,11 @@ namespace Tango.PPC.UI.Notifications }); } + /// <summary> + /// Shows warning message box. + /// </summary> + /// <param name="message">The message.</param> + /// <returns></returns> public Task ShowWarning(string message) { return ShowMessageBox(new MessageBoxVM() @@ -82,6 +121,11 @@ namespace Tango.PPC.UI.Notifications }); } + /// <summary> + /// Shows a question message box. + /// </summary> + /// <param name="message">The message.</param> + /// <returns></returns> public Task<bool> ShowQuestion(string message) { return ShowMessageBox(new MessageBoxVM() @@ -94,6 +138,11 @@ namespace Tango.PPC.UI.Notifications }); } + /// <summary> + /// Shows the message box. + /// </summary> + /// <param name="vm">The view model.</param> + /// <returns></returns> private Task<bool> ShowMessageBox(MessageBoxVM vm) { TaskCompletionSource<bool> source = new TaskCompletionSource<bool>(); @@ -117,6 +166,9 @@ namespace Tango.PPC.UI.Notifications return source.Task; } + /// <summary> + /// Called when the message box has been closed. + /// </summary> private void OnMessageBoxClosed() { CurrentMessageBox = null; diff --git a/Software/Visual_Studio/PPC/Tango.PPC.UI/PPCApplication/DefaultPPCApplicationManager.cs b/Software/Visual_Studio/PPC/Tango.PPC.UI/PPCApplication/DefaultPPCApplicationManager.cs index 2fbc6c34e..233751ddb 100644 --- a/Software/Visual_Studio/PPC/Tango.PPC.UI/PPCApplication/DefaultPPCApplicationManager.cs +++ b/Software/Visual_Studio/PPC/Tango.PPC.UI/PPCApplication/DefaultPPCApplicationManager.cs @@ -19,25 +19,60 @@ using System.Windows.Threading; namespace Tango.PPC.UI.PPCApplication { + /// <summary> + /// Represents the default PPC application manager. + /// </summary> + /// <seealso cref="Tango.Core.ExtendedObject" /> + /// <seealso cref="Tango.PPC.Common.Application.IPPCApplicationManager" /> public class DefaultPPCApplicationManager : ExtendedObject, IPPCApplicationManager { private List<PPCViewModel> _notifiedViewModels; + /// <summary> + /// Occurs when the connected machine property has changed. + /// </summary> + public event EventHandler<IMachineOperator> ConnectedMachineChanged; + + /// <summary> + /// Occurs when the application has started. + /// </summary> + public event EventHandler ApplicationStarted; + + /// <summary> + /// Occurs when all PPC modules are ready and initialized. + /// </summary> + public event EventHandler ModulesInitialized; + + /// <summary> + /// Gets a value indicating whether the application is shutting down. + /// </summary> public bool IsShuttingDown { get; private set; } + + private IMachineOperator _connectedMachine; + /// <summary> + /// Gets or sets the currently connected machine if any. + /// </summary> + /// <exception cref="NotImplementedException"> + /// </exception> public IMachineOperator ConnectedMachine { get { - throw new NotImplementedException(); + return _connectedMachine; } - set { - throw new NotImplementedException(); + _connectedMachine = value; + RaisePropertyChangedAuto(); + ConnectedMachineChanged?.Invoke(this, ConnectedMachine); } } + /// <summary> + /// Gets the application version. + /// </summary> + /// <exception cref="NotImplementedException"></exception> public string Version { get @@ -47,6 +82,9 @@ namespace Tango.PPC.UI.PPCApplication } private Machine _machine; + /// <summary> + /// Gets the associated observable entity machine. + /// </summary> public Machine Machine { private set @@ -59,8 +97,9 @@ namespace Tango.PPC.UI.PPCApplication } } - public event EventHandler<IMachineOperator> ConnectedMachineChanged; - + /// <summary> + /// Initializes a new instance of the <see cref="DefaultPPCApplicationManager"/> class. + /// </summary> public DefaultPPCApplicationManager() { if (!DesignMode) @@ -132,6 +171,9 @@ namespace Tango.PPC.UI.PPCApplication } } + /// <summary> + /// Shutdown the application. + /// </summary> public void ShutDown() { IsShuttingDown = true; @@ -141,11 +183,5 @@ namespace Tango.PPC.UI.PPCApplication vm.OnApplicationShuttingDown(); } } - - /// <summary> - /// Occurs when the application has started. - /// </summary> - public event EventHandler ApplicationStarted; - public event EventHandler ModulesInitialized; } } diff --git a/Software/Visual_Studio/PPC/Tango.PPC.UI/Tango.PPC.UI.csproj b/Software/Visual_Studio/PPC/Tango.PPC.UI/Tango.PPC.UI.csproj index fb0e35618..fdeff4fc4 100644 --- a/Software/Visual_Studio/PPC/Tango.PPC.UI/Tango.PPC.UI.csproj +++ b/Software/Visual_Studio/PPC/Tango.PPC.UI/Tango.PPC.UI.csproj @@ -262,9 +262,7 @@ <ItemGroup> <Resource Include="Images\MessageBox Icons\information.png" /> </ItemGroup> - <ItemGroup> - <Folder Include="Messages\" /> - </ItemGroup> + <ItemGroup /> <Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" /> <Import Project="..\..\packages\System.Data.SQLite.Core.1.0.108.0\build\net46\System.Data.SQLite.Core.targets" Condition="Exists('..\..\packages\System.Data.SQLite.Core.1.0.108.0\build\net46\System.Data.SQLite.Core.targets')" /> <Target Name="EnsureNuGetPackageBuildImports" BeforeTargets="PrepareForBuild"> diff --git a/Software/Visual_Studio/PPC/Tango.PPC.UI/ViewModels/LayoutViewVM.cs b/Software/Visual_Studio/PPC/Tango.PPC.UI/ViewModels/LayoutViewVM.cs index 168df019a..4e200ada6 100644 --- a/Software/Visual_Studio/PPC/Tango.PPC.UI/ViewModels/LayoutViewVM.cs +++ b/Software/Visual_Studio/PPC/Tango.PPC.UI/ViewModels/LayoutViewVM.cs @@ -11,22 +11,40 @@ using Tango.SharedUI; namespace Tango.PPC.UI.ViewModels { + /// <summary> + /// Represents the layout view containing the main menu and all modules. + /// </summary> + /// <seealso cref="Tango.PPC.Common.PPCViewModel{Tango.PPC.UI.ViewsContracts.ILayoutView}" /> public class LayoutViewVM : PPCViewModel<ILayoutView> { + /// <summary> + /// Gets or sets the module loader. + /// </summary> [TangoInject] public IPPCModuleLoader ModuleLoader { get; set; } + /// <summary> + /// Called when the application has been started. + /// </summary> public override void OnApplicationStarted() { base.OnApplicationStarted(); ModuleLoader.ModulesLoaded += ModuleLoader_ModulesLoaded; } + /// <summary> + /// Handles the ModulesLoaded event of the ModuleLoader. + /// </summary> + /// <param name="sender">The source of the event.</param> + /// <param name="e">The <see cref="EventArgs"/> instance containing the event data.</param> private void ModuleLoader_ModulesLoaded(object sender, EventArgs e) { View.ApplyModules(ModuleLoader.UserModules); } + /// <summary> + /// Called when the instance of IPPCView is available. + /// </summary> public override void OnViewAttached() { diff --git a/Software/Visual_Studio/PPC/Tango.PPC.UI/ViewModels/LoadingViewVM.cs b/Software/Visual_Studio/PPC/Tango.PPC.UI/ViewModels/LoadingViewVM.cs index 588cc8b64..f6b06ca61 100644 --- a/Software/Visual_Studio/PPC/Tango.PPC.UI/ViewModels/LoadingViewVM.cs +++ b/Software/Visual_Studio/PPC/Tango.PPC.UI/ViewModels/LoadingViewVM.cs @@ -19,11 +19,21 @@ using Tango.SharedUI; namespace Tango.PPC.UI.ViewModels { + /// <summary> + /// Represents the PPC loading splash screen view model. + /// </summary> + /// <seealso cref="Tango.PPC.Common.PPCViewModel" /> public class LoadingViewVM : PPCViewModel { + /// <summary> + /// Gets or sets the module loader. + /// </summary> [TangoInject] public IPPCModuleLoader ModuleLoader { get; set; } + /// <summary> + /// Called when the application has been started. + /// </summary> public async override void OnApplicationStarted() { await Task.Factory.StartNew(() => diff --git a/Software/Visual_Studio/PPC/Tango.PPC.UI/ViewModels/MainViewVM.cs b/Software/Visual_Studio/PPC/Tango.PPC.UI/ViewModels/MainViewVM.cs index deea33a0d..faac9ad16 100644 --- a/Software/Visual_Studio/PPC/Tango.PPC.UI/ViewModels/MainViewVM.cs +++ b/Software/Visual_Studio/PPC/Tango.PPC.UI/ViewModels/MainViewVM.cs @@ -14,8 +14,15 @@ using Tango.SharedUI; namespace Tango.PPC.UI.ViewModels { + /// <summary> + /// Represents the PPC main view model. + /// </summary> + /// <seealso cref="Tango.PPC.Common.PPCViewModel" /> public class MainViewVM : PPCViewModel { + /// <summary> + /// Called when the application has been started. + /// </summary> public override void OnApplicationStarted() { |
