diff options
| author | Roy Ben-Shabat <Roy@Twine-s.com> | 2018-05-16 18:22:47 +0300 |
|---|---|---|
| committer | Roy Ben-Shabat <Roy@Twine-s.com> | 2018-05-16 18:22:47 +0300 |
| commit | b9ff3e2b899b22090b5d206c1f95189aa7fd7ecb (patch) | |
| tree | 2e2851d21fbf8304ff2ada7e3089c342547dd95d /Software/Visual_Studio/MachineStudio | |
| parent | 62600b93f932aa2751d6f0c00f4699a7eb2d7c7b (diff) | |
| download | Tango-b9ff3e2b899b22090b5d206c1f95189aa7fd7ecb.tar.gz Tango-b9ff3e2b899b22090b5d206c1f95189aa7fd7ecb.zip | |
New Settings Library.
Diffstat (limited to 'Software/Visual_Studio/MachineStudio')
46 files changed, 325 insertions, 918 deletions
diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.DataCapture/ViewModels/MainViewVM.cs b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.DataCapture/ViewModels/MainViewVM.cs index fdd0fed5b..427d1d003 100644 --- a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.DataCapture/ViewModels/MainViewVM.cs +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.DataCapture/ViewModels/MainViewVM.cs @@ -206,7 +206,7 @@ namespace Tango.MachineStudio.DataCapture.ViewModels MediaSeekCommand = new RelayCommand<double>(MediaSeek, (x) => Player.IsPlaying); MediaSeekHoldCommand = new RelayCommand(MediaSeekHold, () => Player.IsPlaying); - _recordingsFolder = Path.Combine(SettingsManager.DefaultFolder, "Recordings"); + _recordingsFolder = Path.Combine(SettingsManager.Default.Folder, "Recordings"); Directory.CreateDirectory(_recordingsFolder); _frameProvider.FrameReceived += _frameProvider_FrameReceived; diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Developer/DeveloperModuleSettings.cs b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Developer/DeveloperModuleSettings.cs new file mode 100644 index 000000000..73d979662 --- /dev/null +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Developer/DeveloperModuleSettings.cs @@ -0,0 +1,16 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using Tango.Settings; + +namespace Tango.MachineStudio.Developer +{ + public class DeveloperModuleSettings : SettingsBase + { + public String LastSelectedMachineGuid { get; set; } + + public String LastSelectedJobGuid { get; set; } + } +} diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Developer/Tango.MachineStudio.Developer.csproj b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Developer/Tango.MachineStudio.Developer.csproj index ddea73858..5a81c358f 100644 --- a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Developer/Tango.MachineStudio.Developer.csproj +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Developer/Tango.MachineStudio.Developer.csproj @@ -108,6 +108,7 @@ <Compile Include="Converters\SegmentToGradientStopsConverterMulti.cs" /> <Compile Include="Converters\SegmentToGradientStopsConverter.cs" /> <Compile Include="DeveloperModule.cs" /> + <Compile Include="DeveloperModuleSettings.cs" /> <Compile Include="Navigation\DeveloperNavigationManager.cs" /> <Compile Include="Navigation\DeveloperNavigationView.cs" /> <Compile Include="ViewModelLocator.cs" /> diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Developer/ViewModels/MainViewVM.cs b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Developer/ViewModels/MainViewVM.cs index 739f0bcde..106848b7a 100644 --- a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Developer/ViewModels/MainViewVM.cs +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Developer/ViewModels/MainViewVM.cs @@ -63,6 +63,7 @@ namespace Tango.MachineStudio.Developer.ViewModels private ISpeechProvider _speech; private DataCapture.ViewModels.MainViewVM _dataCaptureVM; private bool _isRecording; + private DeveloperModuleSettings _settings; #region Properties @@ -620,6 +621,8 @@ namespace Tango.MachineStudio.Developer.ViewModels /// <param name="notificationProvider">The notification provider.</param> public MainViewVM(IStudioApplicationManager applicationManager, INotificationProvider notificationProvider, IDiagnosticsFrameProvider diagnosticsFrameProvider, IVideoCaptureProvider videoCaptureProvider, DeveloperNavigationManager navigation, IAuthenticationProvider authentication, IEventLogger eventLogger, ISpeechProvider speech) { + _settings = SettingsManager.Default.GetOrCreate<DeveloperModuleSettings>(); + SelectedJobs = new ObservableCollection<Job>(); JobEvents = new ObservableCollection<MachinesEvent>(); @@ -629,16 +632,16 @@ namespace Tango.MachineStudio.Developer.ViewModels Machines = _machineDbContext.Machines.ToObservableCollection(); - if (SettingsManager.Default.MachineStudio.DeveloperModule.LastSelectedMachineGuid != null) + if (_settings.LastSelectedMachineGuid != null) { LogManager.Log("Setting last selected machine from settings..."); - SelectedMachine = _machineDbContext.Machines.SingleOrDefault(x => x.Guid == SettingsManager.Default.MachineStudio.DeveloperModule.LastSelectedMachineGuid); + SelectedMachine = _machineDbContext.Machines.SingleOrDefault(x => x.Guid == _settings.LastSelectedMachineGuid); } - if (SettingsManager.Default.MachineStudio.DeveloperModule.LastSelectedJobGuid != null && SelectedMachine != null) + if (_settings.LastSelectedJobGuid != null && SelectedMachine != null) { LogManager.Log("Setting last selected job from settings..."); - SelectedMachineJob = SelectedMachine.Jobs.SingleOrDefault(x => x.Guid == SettingsManager.Default.MachineStudio.DeveloperModule.LastSelectedJobGuid); + SelectedMachineJob = SelectedMachine.Jobs.SingleOrDefault(x => x.Guid == _settings.LastSelectedJobGuid); } _authentication = authentication; @@ -1907,8 +1910,8 @@ namespace Tango.MachineStudio.Developer.ViewModels public override void OnShuttingDown() { - SettingsManager.Default.MachineStudio.DeveloperModule.LastSelectedMachineGuid = SelectedMachine != null ? SelectedMachine.Guid : null; - SettingsManager.Default.MachineStudio.DeveloperModule.LastSelectedJobGuid = SelectedMachineJob != null ? SelectedMachineJob.Guid : null; + _settings.LastSelectedMachineGuid = SelectedMachine != null ? SelectedMachine.Guid : null; + _settings.LastSelectedJobGuid = SelectedMachineJob != null ? SelectedMachineJob.Guid : null; } #endregion diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Logging/Parsing/EmbeddedLogFileParser.cs b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Logging/Parsing/EmbeddedLogFileParser.cs index e97ffb249..09cb9a8b6 100644 --- a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Logging/Parsing/EmbeddedLogFileParser.cs +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Logging/Parsing/EmbeddedLogFileParser.cs @@ -22,7 +22,7 @@ namespace Tango.MachineStudio.Logging.Parsing String logFile = logger != null ? logger.LogFile : null; - foreach (var file in Directory.GetFiles(SettingsManager.DefaultFolder + "\\embedded logs", "*.log").Where(x => Path.GetFileName(x).StartsWith("embedded") && x != logFile)) + foreach (var file in Directory.GetFiles(SettingsManager.Default.Folder + "\\embedded logs", "*.log").Where(x => Path.GetFileName(x).StartsWith("embedded") && x != logFile)) { String dateString = Path.GetFileNameWithoutExtension(file).Replace("embedded-", ""); DateTime date = DateTime.ParseExact(dateString, "dd-MM-yyyy_HH-mm-ss", CultureInfo.InvariantCulture); diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Stubs/StubsModuleSettings.cs b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Stubs/StubsModuleSettings.cs new file mode 100644 index 000000000..1aa775fdc --- /dev/null +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Stubs/StubsModuleSettings.cs @@ -0,0 +1,30 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using Tango.Settings; + +namespace Tango.MachineStudio.Stubs +{ + public class StubsModuleSettings : SettingsBase + { + /// <summary> + /// Gets or sets the last selected port. + /// </summary> + public String SelectedPort { get; set; } + + /// <summary> + /// Gets or sets the last tabs. + /// </summary> + public List<String> LastTabs { get; set; } + + /// <summary> + /// Initializes a new instance of the <see cref="StubsModule"/> class. + /// </summary> + public StubsModuleSettings() + { + LastTabs = new List<string>(); + } + } +} diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Stubs/Tango.MachineStudio.Stubs.csproj b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Stubs/Tango.MachineStudio.Stubs.csproj index eb2248f61..ca3e77628 100644 --- a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Stubs/Tango.MachineStudio.Stubs.csproj +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Stubs/Tango.MachineStudio.Stubs.csproj @@ -71,6 +71,7 @@ <None Include="Resources\CodeTabTemplate.cs" /> <Compile Include="StubManager.cs" /> <Compile Include="StubOnExecuteParameters.cs" /> + <Compile Include="StubsModuleSettings.cs" /> <Compile Include="ViewModelLocator.cs" /> <Compile Include="ViewModels\CodeTabVM.cs" /> <Compile Include="ViewModels\MainViewVM.cs" /> diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Stubs/ViewModels/MainViewVM.cs b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Stubs/ViewModels/MainViewVM.cs index df47273d0..afd5e4d70 100644 --- a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Stubs/ViewModels/MainViewVM.cs +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Stubs/ViewModels/MainViewVM.cs @@ -30,6 +30,7 @@ namespace Tango.MachineStudio.Stubs.ViewModels private UsbTransportAdapter _adapter; //Holds the USB transport adapter. private StubManager _stubManager; private INotificationProvider _notification; + private StubsModuleSettings _settings; #region Properties @@ -220,6 +221,8 @@ namespace Tango.MachineStudio.Stubs.ViewModels /// </summary> public MainViewVM(IStudioApplicationManager applicationManager, INotificationProvider notification) { + _settings = SettingsManager.Default.GetOrCreate<StubsModuleSettings>(); + ApplicationManager = applicationManager; _notification = notification; @@ -264,13 +267,13 @@ namespace Tango.MachineStudio.Stubs.ViewModels "COM9", }; - SelectedPort = SettingsManager.Default.MachineStudio.StubsModule.SelectedPort != null ? SettingsManager.Default.MachineStudio.StubsModule.SelectedPort : Ports.First(); + SelectedPort = _settings.SelectedPort != null ? _settings.SelectedPort : Ports.First(); Status = "Ready"; - if (SettingsManager.Default.MachineStudio.StubsModule.LastTabs.Count > 0) + if (_settings.LastTabs.Count > 0) { - foreach (var file in SettingsManager.Default.MachineStudio.StubsModule.LastTabs) + foreach (var file in _settings.LastTabs) { if (File.Exists(file)) { @@ -534,8 +537,8 @@ namespace Tango.MachineStudio.Stubs.ViewModels /// <returns></returns> public override void OnShuttingDown() { - SettingsManager.Default.MachineStudio.StubsModule.SelectedPort = SelectedPort; - SettingsManager.Default.MachineStudio.StubsModule.LastTabs = CodeTabs.Select(x => x.File).ToList(); + _settings.SelectedPort = SelectedPort; + _settings.LastTabs = CodeTabs.Select(x => x.File).ToList(); } #endregion diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Synchronization/SynchronizationModuleSettings.cs b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Synchronization/SynchronizationModuleSettings.cs new file mode 100644 index 000000000..9b9e10a7f --- /dev/null +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Synchronization/SynchronizationModuleSettings.cs @@ -0,0 +1,27 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using Tango.Settings; + +namespace Tango.MachineStudio.Synchronization +{ + public class SynchronizationModuleSettings : SettingsBase + { + /// <summary> + /// Gets or sets the local master database file. + /// </summary> + public String LocalMasterDBFile { get; set; } + + /// <summary> + /// Gets or sets the local slave database file. + /// </summary> + public String LocalSlaveDBFile { get; set; } + + /// <summary> + /// Gets or sets the remote SQLite file. + /// </summary> + public String RemoteSQLiteFile { get; set; } + } +} diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Synchronization/Tango.MachineStudio.Synchronization.csproj b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Synchronization/Tango.MachineStudio.Synchronization.csproj index f863df9c2..f38fe5dbf 100644 --- a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Synchronization/Tango.MachineStudio.Synchronization.csproj +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Synchronization/Tango.MachineStudio.Synchronization.csproj @@ -93,6 +93,7 @@ <Compile Include="AutoComplete\MachinesProvider.cs" /> <Compile Include="Navigation\NavigationView.cs" /> <Compile Include="Navigation\SyncNavigationManager.cs" /> + <Compile Include="SynchronizationModuleSettings.cs" /> <Compile Include="ViewModelLocator.cs" /> <Compile Include="ViewModels\DirectSynchronizationViewVM.cs" /> <Compile Include="ViewModels\LocalSynchronizationViewVM.cs" /> diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Synchronization/ViewModels/LocalSynchronizationViewVM.cs b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Synchronization/ViewModels/LocalSynchronizationViewVM.cs index d3cb23d64..879f6e493 100644 --- a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Synchronization/ViewModels/LocalSynchronizationViewVM.cs +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Synchronization/ViewModels/LocalSynchronizationViewVM.cs @@ -33,6 +33,7 @@ namespace Tango.MachineStudio.Synchronization.ViewModels private INotificationProvider _notification; private bool _isWorking; private MainViewVM _mainView; + private SynchronizationModuleSettings _settings; #region Constructors @@ -43,6 +44,8 @@ namespace Tango.MachineStudio.Synchronization.ViewModels /// <param name="notification">The notification.</param> public LocalSynchronizationViewVM(SyncNavigationManager navigation, INotificationProvider notification) { + _settings = SettingsManager.Default.GetOrCreate<SynchronizationModuleSettings>(); + _navigation = navigation; _notification = notification; @@ -57,15 +60,15 @@ namespace Tango.MachineStudio.Synchronization.ViewModels CommitAllCommand = new RelayCommand(CommitAll, (x) => Differences.Count > 0 && !_isWorking); CleanCommand = new RelayCommand(CleanSlave, (x) => !_isWorking && SlaveDBFile != null); - if (File.Exists(SettingsManager.Default.MachineStudio.SynchronizationModule.LocalMasterDBFile)) + if (File.Exists(_settings.LocalMasterDBFile)) { - MasterDBFile = SettingsManager.Default.MachineStudio.SynchronizationModule.LocalMasterDBFile; + MasterDBFile = _settings.LocalMasterDBFile; MasterDBName = Path.GetFileName(MasterDBFile); } - if (File.Exists(SettingsManager.Default.MachineStudio.SynchronizationModule.LocalSlaveDBFile)) + if (File.Exists(_settings.LocalSlaveDBFile)) { - SlaveDBFile = SettingsManager.Default.MachineStudio.SynchronizationModule.LocalSlaveDBFile; + SlaveDBFile = _settings.LocalSlaveDBFile; SlaveDBName = Path.GetFileName(SlaveDBFile); } } @@ -268,9 +271,9 @@ namespace Tango.MachineStudio.Synchronization.ViewModels SelectedDifference = null; InvalidateRelayCommands(); - SettingsManager.Default.MachineStudio.SynchronizationModule.LocalMasterDBFile = MasterDBFile; - SettingsManager.Default.MachineStudio.SynchronizationModule.LocalSlaveDBFile = SlaveDBFile; - SettingsManager.SaveDefaultSettings(); + _settings.LocalMasterDBFile = MasterDBFile; + _settings.LocalSlaveDBFile = SlaveDBFile; + _settings.Save(); } } }); diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Synchronization/ViewModels/RemoteSynchronizationViewVM.cs b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Synchronization/ViewModels/RemoteSynchronizationViewVM.cs index 75b5fe95a..2896f3e58 100644 --- a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Synchronization/ViewModels/RemoteSynchronizationViewVM.cs +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Synchronization/ViewModels/RemoteSynchronizationViewVM.cs @@ -41,6 +41,7 @@ namespace Tango.MachineStudio.Synchronization.ViewModels private RemoteDB _remoteDB; private LocalDB _localDB; private MainViewVM _mainView; + private SynchronizationModuleSettings _settings; #region Constructors @@ -51,6 +52,8 @@ namespace Tango.MachineStudio.Synchronization.ViewModels /// <param name="notification">The notification.</param> public RemoteSynchronizationViewVM(SyncNavigationManager navigation, INotificationProvider notification) { + _settings = SettingsManager.Default.GetOrCreate<SynchronizationModuleSettings>(); + _navigation = navigation; _notification = notification; @@ -64,9 +67,9 @@ namespace Tango.MachineStudio.Synchronization.ViewModels CommitAllCommand = new RelayCommand(CommitAll, (x) => Differences.Count > 0 && !_isWorking && SelectedMachine != null); CleanCommand = new RelayCommand(CleanSlave, (x) => !_isWorking && SlaveDBFile != null); - if (File.Exists(SettingsManager.Default.MachineStudio.SynchronizationModule.RemoteSQLiteFile)) + if (File.Exists(_settings.RemoteSQLiteFile)) { - SlaveDBFile = SettingsManager.Default.MachineStudio.SynchronizationModule.RemoteSQLiteFile; + SlaveDBFile = _settings.RemoteSQLiteFile; SlaveDBName = Path.GetFileName(SlaveDBFile); } } @@ -266,8 +269,8 @@ namespace Tango.MachineStudio.Synchronization.ViewModels SelectedDifference = null; InvalidateRelayCommands(); - SettingsManager.Default.MachineStudio.SynchronizationModule.RemoteSQLiteFile = SlaveDBFile; - SettingsManager.SaveDefaultSettings(); + _settings.RemoteSQLiteFile = SlaveDBFile; + _settings.Save(); } } }); diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/Helpers/GraphsHelper.cs b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/Helpers/GraphsHelper.cs index 78466ace8..0cd14f917 100644 --- a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/Helpers/GraphsHelper.cs +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/Helpers/GraphsHelper.cs @@ -3,6 +3,7 @@ using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; +using Tango.MachineStudio.Common; using Tango.Settings; namespace Tango.MachineStudio.Technician.Helpers @@ -21,8 +22,9 @@ namespace Tango.MachineStudio.Technician.Helpers { try { - double seconds = SettingsManager.Default.MachineStudio.TechnicianModule.GraphsDuration; - double pullRate = SettingsManager.Default.MachineStudio.TechnicianModule.GraphsPullingInterval; + var settings = SettingsManager.Default.GetOrCreate<TechnicianModuleSettings>(); + double seconds = settings.GraphsViewDurationSeconds; + double pullRate = settings.DiagnosticsResponseIntervalMilli; return (int)(((pullRate * pointsPerFrame * 10 * seconds) * (10 / pullRate)) * 0.65); } catch (Exception) diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/Navigation/TechNavigationManager.cs b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/Navigation/TechNavigationManager.cs deleted file mode 100644 index ddfb84920..000000000 --- a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/Navigation/TechNavigationManager.cs +++ /dev/null @@ -1,24 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; -using Tango.MachineStudio.Technician.Views; - -namespace Tango.MachineStudio.Technician.Navigation -{ - /// <summary> - /// Represents the technician module navigation manager. - /// </summary> - public class TechNavigationManager - { - /// <summary> - /// Navigates to the specified view. - /// </summary> - /// <param name="view">The view.</param> - public void NavigateTo(TechNavigationView view) - { - MainView.Instance.TransitionControl.AutoNavigate(view.ToString()); - } - } -} diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/Navigation/TechNavigationView.cs b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/Navigation/TechNavigationView.cs deleted file mode 100644 index b4a85f92a..000000000 --- a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/Navigation/TechNavigationView.cs +++ /dev/null @@ -1,18 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; - -namespace Tango.MachineStudio.Technician.Navigation -{ - /// <summary> - /// Represents the available technician module views. - /// </summary> - public enum TechNavigationView - { - Overview, - Motors, - Sensors, - } -} diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/Tango.MachineStudio.Technician.csproj b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/Tango.MachineStudio.Technician.csproj index 93a99667a..f7bf69bc8 100644 --- a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/Tango.MachineStudio.Technician.csproj +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/Tango.MachineStudio.Technician.csproj @@ -198,30 +198,15 @@ <Compile Include="TechItems\SingleGraphItem.cs" /> <Compile Include="TechItems\MonitorItem.cs" /> <Compile Include="TechItems\TechItem.cs" /> - <Compile Include="Navigation\TechNavigationView.cs" /> - <Compile Include="Navigation\TechNavigationManager.cs" /> <Compile Include="TechItems\TechItemAttribute.cs" /> <Compile Include="TechItems\ThreadMotionItem.cs" /> <Compile Include="TechnicianModule.cs" /> + <Compile Include="TechnicianModuleSettings.cs" /> <Compile Include="ViewModelLocator.cs" /> <Compile Include="ViewModels\MachineTechViewVM.cs" /> - <Compile Include="ViewModels\MainViewVM.cs" /> - <Compile Include="ViewModels\SensorsViewVM.cs" /> <Compile Include="Views\MachineTechView.xaml.cs"> <DependentUpon>MachineTechView.xaml</DependentUpon> </Compile> - <Compile Include="Views\MotorsView.xaml.cs"> - <DependentUpon>MotorsView.xaml</DependentUpon> - </Compile> - <Compile Include="Views\OverviewView.xaml.cs"> - <DependentUpon>OverviewView.xaml</DependentUpon> - </Compile> - <Compile Include="Views\SensorsView.xaml.cs"> - <DependentUpon>SensorsView.xaml</DependentUpon> - </Compile> - <Compile Include="Views\MainView.xaml.cs"> - <DependentUpon>MainView.xaml</DependentUpon> - </Compile> <Compile Include="..\..\..\Versioning\GlobalVersionInfo.cs"> <Link>GlobalVersionInfo.cs</Link> </Compile> @@ -353,22 +338,6 @@ <Generator>MSBuild:Compile</Generator> <SubType>Designer</SubType> </Page> - <Page Include="Views\MotorsView.xaml"> - <SubType>Designer</SubType> - <Generator>MSBuild:Compile</Generator> - </Page> - <Page Include="Views\OverviewView.xaml"> - <SubType>Designer</SubType> - <Generator>MSBuild:Compile</Generator> - </Page> - <Page Include="Views\SensorsView.xaml"> - <SubType>Designer</SubType> - <Generator>MSBuild:Compile</Generator> - </Page> - <Page Include="Views\MainView.xaml"> - <SubType>Designer</SubType> - <Generator>MSBuild:Compile</Generator> - </Page> </ItemGroup> <ItemGroup> <Compile Include="Properties\AssemblyInfo.cs"> diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/TechItems/MultiGraphItem.cs b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/TechItems/MultiGraphItem.cs index 887417cf8..bd165623a 100644 --- a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/TechItems/MultiGraphItem.cs +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/TechItems/MultiGraphItem.cs @@ -6,6 +6,7 @@ using System.Threading.Tasks; using System.Xml.Serialization; using Tango.BL.Entities; using Tango.MachineStudio.Technician.Editors; +using Tango.MachineStudio.Technician.Helpers; using Tango.SharedUI.Helpers; namespace Tango.MachineStudio.Technician.TechItems @@ -34,7 +35,7 @@ namespace Tango.MachineStudio.Technician.TechItems if (_techMonitor != old && Editor != null) { - Editor.InnerGraph.InnerGraph.MaxPoints = Common.Helpers.GraphsHelper.GetMaxPoints(TechMonitor.PointsPerFrame); + Editor.InnerGraph.InnerGraph.MaxPoints = GraphsHelper.GetMaxPoints(TechMonitor.PointsPerFrame); Editor.InnerGraph.InvalidateGraph(); } diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/TechItems/SingleGraphItem.cs b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/TechItems/SingleGraphItem.cs index 648d8eda3..19cbab426 100644 --- a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/TechItems/SingleGraphItem.cs +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/TechItems/SingleGraphItem.cs @@ -7,6 +7,7 @@ using System.Windows.Media; using System.Xml.Serialization; using Tango.BL.Entities; using Tango.MachineStudio.Technician.Editors; +using Tango.MachineStudio.Technician.Helpers; using Tango.SharedUI.Helpers; namespace Tango.MachineStudio.Technician.TechItems @@ -35,7 +36,7 @@ namespace Tango.MachineStudio.Technician.TechItems if (_techMonitor != old && Editor != null) { - Editor.InnerGraph.InnerGraph.MaxPoints = Common.Helpers.GraphsHelper.GetMaxPoints(TechMonitor.PointsPerFrame); + Editor.InnerGraph.InnerGraph.MaxPoints = GraphsHelper.GetMaxPoints(TechMonitor.PointsPerFrame); Editor.InnerGraph.InvalidateGraph(); } diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/TechnicianModuleSettings.cs b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/TechnicianModuleSettings.cs new file mode 100644 index 000000000..12acaf3ee --- /dev/null +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/TechnicianModuleSettings.cs @@ -0,0 +1,36 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using Tango.Settings; + +namespace Tango.MachineStudio.Technician +{ + public class TechnicianModuleSettings : SettingsBase + { + /// <summary> + /// Gets or sets the graphs view duration in seconds. + /// </summary> + public int GraphsViewDurationSeconds { get; set; } + + /// <summary> + /// Gets or sets the diagnostics response interval in milliseconds. + /// </summary> + public int DiagnosticsResponseIntervalMilli { get; set; } + + /// <summary> + /// Gets or sets the las tech project file. + /// </summary> + public String LastTechProjectFile { get; set; } + + /// <summary> + /// Initializes a new instance of the <see cref="TechnicianModuleSettings"/> class. + /// </summary> + public TechnicianModuleSettings() + { + GraphsViewDurationSeconds = 10; + DiagnosticsResponseIntervalMilli = 30; + } + } +} diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/ViewModelLocator.cs b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/ViewModelLocator.cs index 5921a2f15..a7d08eb45 100644 --- a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/ViewModelLocator.cs +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/ViewModelLocator.cs @@ -1,5 +1,4 @@ using Tango.Core.DI; -using Tango.MachineStudio.Technician.Navigation; using Tango.MachineStudio.Technician.ViewModels; namespace Tango.MachineStudio.Technician @@ -15,29 +14,7 @@ namespace Tango.MachineStudio.Technician /// </summary> static ViewModelLocator() { - TangoIOC.Default.Register<MainViewVM>(); - TangoIOC.Default.Register<SensorsViewVM>(); TangoIOC.Default.Register<MachineTechViewVM>(); - - TangoIOC.Default.Unregister<TechNavigationManager>(); - - TangoIOC.Default.Register<TechNavigationManager, TechNavigationManager>(); - } - - public static MainViewVM MainViewVM - { - get - { - return TangoIOC.Default.GetInstance<MainViewVM>(); - } - } - - public static SensorsViewVM SensorsViewVM - { - get - { - return TangoIOC.Default.GetInstance<SensorsViewVM>(); - } } public static MachineTechViewVM MachineTechViewVM diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/ViewModels/MachineTechViewVM.cs b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/ViewModels/MachineTechViewVM.cs index ac78ef488..d8369ea7b 100644 --- a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/ViewModels/MachineTechViewVM.cs +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/ViewModels/MachineTechViewVM.cs @@ -31,6 +31,7 @@ using Tango.BL; using Tango.MachineStudio.Common.EventLogging; using Tango.MachineStudio.Common; using Tango.Core.Commands; +using Tango.MachineStudio.Technician.Helpers; namespace Tango.MachineStudio.Technician.ViewModels { @@ -50,6 +51,8 @@ namespace Tango.MachineStudio.Technician.ViewModels private IEventLogger _eventLogger; private DateTime _lastDiagnosticsResponseUpdate; private const int MIN_DIAGNOSTICS_UPDATE_MILI = 500; + private TechnicianModuleSettings _settings; + #region Properties @@ -191,6 +194,8 @@ namespace Tango.MachineStudio.Technician.ViewModels /// <param name="notificationProvider">The notification provider.</param> public MachineTechViewVM(IStudioApplicationManager applicationManager, INotificationProvider notificationProvider, IDiagnosticsFrameProvider _diagnosticsFrameProvider, IEventLogger eventLogger) { + _settings = SettingsManager.Default.GetOrCreate<TechnicianModuleSettings>(); + _notification = notificationProvider; _eventLogger = eventLogger; _singleControllers = new Dictionary<SingleGraphItem, GraphController>(); @@ -208,7 +213,7 @@ namespace Tango.MachineStudio.Technician.ViewModels SaveAsProjectCommand = new RelayCommand(SaveAsProject); SaveProjectCommand = new RelayCommand(SaveProject); - _lastTechProjectFile = SettingsManager.Default.MachineStudio.TechnicianModule.LasTechProjectFile; + _lastTechProjectFile = _settings.LastTechProjectFile; if (File.Exists(_lastTechProjectFile)) { @@ -680,7 +685,7 @@ namespace Tango.MachineStudio.Technician.ViewModels var graphItem = element.HostedElement as SingleGraphItem; var editor = element as SingleGraphElementEditor; graphItem.Editor = editor; - editor.InnerGraph.InnerGraph.MaxPoints = Common.Helpers.GraphsHelper.GetMaxPoints(graphItem.TechMonitor.PointsPerFrame); + editor.InnerGraph.InnerGraph.MaxPoints = GraphsHelper.GetMaxPoints(graphItem.TechMonitor.PointsPerFrame); GraphController controller = new GraphController(); editor.InnerGraph.Controller = controller; @@ -691,7 +696,7 @@ namespace Tango.MachineStudio.Technician.ViewModels { var graphItem = element.HostedElement as MultiGraphItem; var editor = element as MultiGraphElementEditor; - editor.InnerGraph.InnerGraph.MaxPoints = Common.Helpers.GraphsHelper.GetMaxPoints(graphItem.TechMonitor.PointsPerFrame); + editor.InnerGraph.InnerGraph.MaxPoints = GraphsHelper.GetMaxPoints(graphItem.TechMonitor.PointsPerFrame); graphItem.Editor = editor; @@ -923,7 +928,7 @@ namespace Tango.MachineStudio.Technician.ViewModels /// <param name="editor">The editor.</param> private void InitSingleGraphitem(SingleGraphItem item, SingleGraphElementEditor editor) { - editor.InnerGraph.InnerGraph.MaxPoints = Common.Helpers.GraphsHelper.GetMaxPoints(item.TechMonitor.PointsPerFrame); + editor.InnerGraph.InnerGraph.MaxPoints = GraphsHelper.GetMaxPoints(item.TechMonitor.PointsPerFrame); item.Editor = editor; GraphController controller = new GraphController(); @@ -939,7 +944,7 @@ namespace Tango.MachineStudio.Technician.ViewModels /// <param name="editor">The editor.</param> private void InitMultiGraphItem(MultiGraphItem item, MultiGraphElementEditor editor) { - editor.InnerGraph.InnerGraph.MaxPoints = Common.Helpers.GraphsHelper.GetMaxPoints(item.TechMonitor.PointsPerFrame); + editor.InnerGraph.InnerGraph.MaxPoints = GraphsHelper.GetMaxPoints(item.TechMonitor.PointsPerFrame); item.Editor = editor; GraphMultiController controller = new GraphMultiController(); @@ -1280,7 +1285,7 @@ namespace Tango.MachineStudio.Technician.ViewModels { InvokeUINow(() => { - SettingsManager.Default.MachineStudio.TechnicianModule.LasTechProjectFile = _lastTechProjectFile; + _settings.LastTechProjectFile = _lastTechProjectFile; }); } diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/ViewModels/MainViewVM.cs b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/ViewModels/MainViewVM.cs deleted file mode 100644 index 306f15c5c..000000000 --- a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/ViewModels/MainViewVM.cs +++ /dev/null @@ -1,56 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; -using Tango.Core.Commands; -using Tango.MachineStudio.Technician.Navigation; -using Tango.SharedUI; - -namespace Tango.MachineStudio.Technician.ViewModels -{ - /// <summary> - /// Represents the technician module main view, view model. - /// </summary> - /// <seealso cref="Tango.SharedUI.ViewModel" /> - public class MainViewVM : ViewModel - { - private TechNavigationManager _navigation; - - #region Constructors - - /// <summary> - /// Initializes a new instance of the <see cref="MainViewVM"/> class. - /// </summary> - /// <param name="navigationManager">The navigation manager.</param> - public MainViewVM(TechNavigationManager navigationManager) - { - _navigation = navigationManager; - NavigateToViewCommand = new RelayCommand<string>(NavigateToView); - } - - #endregion - - #region Commands - - /// <summary> - /// Gets or sets the navigate to view command. - /// </summary> - public RelayCommand<String> NavigateToViewCommand { get; set; } - - #endregion - - #region Private Methods - - /// <summary> - /// Navigates to the specified view. - /// </summary> - /// <param name="view">The view.</param> - private void NavigateToView(string view) - { - _navigation.NavigateTo((TechNavigationView)Enum.Parse(typeof(TechNavigationView), view, true)); - } - - #endregion - } -} diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/ViewModels/SensorsViewVM.cs b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/ViewModels/SensorsViewVM.cs deleted file mode 100644 index 403a6d510..000000000 --- a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/ViewModels/SensorsViewVM.cs +++ /dev/null @@ -1,193 +0,0 @@ -using RealTimeGraphEx.Controllers; -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; -using Tango.Integration.Operation; -using Tango.Integration.Services; -using Tango.Logging; -using Tango.MachineStudio.Common.Modules; -using Tango.MachineStudio.Common.StudioApplication; -using Tango.PMR.Diagnostics; -using Tango.Settings; -using Tango.SharedUI; - -namespace Tango.MachineStudio.Technician.ViewModels -{ - /// <summary> - /// Represents the technician module sensors view, view model. - /// </summary> - /// <seealso cref="Tango.SharedUI.ViewModel" /> - public class SensorsViewVM : ViewModel - { - private List<GraphControllerBase> _controllers; - - #region Properties - - /// <summary> - /// Gets or sets the application manager. - /// </summary> - public IStudioApplicationManager ApplicationManager { get; set; } - - private IMachineOperator _machineOperator; - /// <summary> - /// Gets or sets the machine operator. - /// </summary> - public IMachineOperator MachineOperator - { - get { return _machineOperator; } - set { _machineOperator = value; RaisePropertyChangedAuto(); } - } - - private int _graphSeconds; - /// <summary> - /// Gets or sets the graphs number of seconds to complete FIFO capacity. - /// </summary> - public int GraphSeconds - { - get { return _graphSeconds; } - set { _graphSeconds = value; RaisePropertyChanged(nameof(GraphSeconds)); } - } - - /// <summary> - /// Clears the graphs. - /// </summary> - public void ClearGraphs() - { - _controllers.ForEach(x => x.Clear()); - } - - #endregion - - #region Constructors - - /// <summary> - /// Initializes a new instance of the <see cref="SensorsViewVM"/> class. - /// </summary> - /// <param name="applicationManager">The application manager.</param> - /// <param name="moduleLoader">The module loader.</param> - public SensorsViewVM(IStudioApplicationManager applicationManager, IStudioModuleLoader moduleLoader) - { - ApplicationManager = applicationManager; - ApplicationManager.ConnectedMachineChanged += ApplicationManager_ConnectedMachineChanged; - - InitializeConnectedMachine(ApplicationManager.ConnectedMachine); - - if (!DesignMode) - { - //Set graphs FIFO capacity by seconds (this will be converted to MaxPoints by the view). - GraphSeconds = SettingsManager.Default.MachineStudio.TechnicianModule.GraphsDuration; - - _controllers = new List<GraphControllerBase>(); - - TemperatureController = new GraphController(); - PressureController = new GraphController(); - VelocityController = new GraphController(); - - _controllers.Add(TemperatureController); - _controllers.Add(PressureController); - _controllers.Add(VelocityController); - - var module = moduleLoader.GetStudioModule<TechnicianModule>(); - - if (module != null) - { - module.IsLoadedChanged += Module_IsLoadedChanged; - } - } - } - - #endregion - - #region Event Handlers - - /// <summary> - /// Handles the technician module IsLoaded changed event. - /// </summary> - /// <param name="sender">The sender.</param> - /// <param name="loaded">if set to <c>true</c> [loaded].</param> - private void Module_IsLoadedChanged(object sender, bool loaded) - { - _controllers.ForEach(x => x.ChangeRenderMode(loaded)); - } - - /// <summary> - /// Handles the application manager connected machine changed event. - /// </summary> - /// <param name="sender">The sender.</param> - /// <param name="machineOperator">The machine operator.</param> - private void ApplicationManager_ConnectedMachineChanged(object sender, IExternalBridgeClient machineOperator) - { - InitializeConnectedMachine(machineOperator); - } - - /// <summary> - /// Handles the machine operator diagnostics data available event - /// </summary> - /// <param name="sender">The sender.</param> - /// <param name="data">The data.</param> - private void MachineOperator_DiagnosticsDataAvailable(object sender, StartDiagnosticsResponse data) - { - //TemperatureController.PushData(data.Temperature.ToArray()); - //PressureController.PushData(data.Temperature.ToArray()); - //VelocityController.PushData(data.Velocity.ToArray()); - } - - #endregion - - #region Private Methods - - /// <summary> - /// Initializes the connected machine. - /// </summary> - /// <param name="machineOperator">The machine operator.</param> - private void InitializeConnectedMachine(IMachineOperator machineOperator) - { - //MachineOperator = machineOperator; - - //if (MachineOperator != null) - //{ - // MachineOperator.EnableSensorsUpdate = true; - // MachineOperator.DiagnosticsDataAvailable -= MachineOperator_DiagnosticsDataAvailable; - // MachineOperator.DiagnosticsDataAvailable += MachineOperator_DiagnosticsDataAvailable; - //} - } - - #endregion - - #region Graphs Controllers - - private GraphController _temperatureController; - /// <summary> - /// Gets or sets the temperature sensor graph controller . - /// </summary> - public GraphController TemperatureController - { - get { return _temperatureController; } - set { _temperatureController = value; RaisePropertyChanged(nameof(TemperatureController)); } - } - - private GraphController _pressureController; - /// <summary> - /// Gets or sets the pressure sensor graph controller . - /// </summary> - public GraphController PressureController - { - get { return _pressureController; } - set { _pressureController = value; RaisePropertyChanged(nameof(PressureController)); } - } - - private GraphController _velocityController; - /// <summary> - /// Gets or sets the velocity sensor graph controller . - /// </summary> - public GraphController VelocityController - { - get { return _velocityController; } - set { _velocityController = value; RaisePropertyChanged(nameof(VelocityController)); } - } - - #endregion - } -} diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/Views/MainView.xaml b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/Views/MainView.xaml deleted file mode 100644 index 6b84881fd..000000000 --- a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/Views/MainView.xaml +++ /dev/null @@ -1,102 +0,0 @@ -<UserControl x:Class="Tango.MachineStudio.Technician.Views.MainView" - xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" - xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" - xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" - xmlns:d="http://schemas.microsoft.com/expression/blend/2008" - xmlns:global="clr-namespace:Tango.MachineStudio.Technician" - xmlns:vm="clr-namespace:Tango.MachineStudio.Technician.ViewModels" - xmlns:materialDesign="http://materialdesigninxaml.net/winfx/xaml/themes" - xmlns:sharedUI="clr-namespace:Tango.SharedUI.Controls;assembly=Tango.SharedUI" - xmlns:local="clr-namespace:Tango.MachineStudio.Technician.Views" - xmlns:converters="clr-namespace:Tango.MachineStudio.Technician.Converters" - mc:Ignorable="d" - d:DesignHeight="720" d:DesignWidth="1280" d:DataContext="{d:DesignInstance Type=vm:MainViewVM, IsDesignTimeCreatable=False}" DataContext="{x:Static global:ViewModelLocator.MainViewVM}" Background="White"> - - <UserControl.Resources> - <ResourceDictionary> - <ResourceDictionary.MergedDictionaries> - <ResourceDictionary Source="../Resources/GraphEx.xaml"></ResourceDictionary> - <ResourceDictionary> - <converters:TransitionLinkConverter x:Key="linkConverter"></converters:TransitionLinkConverter> - </ResourceDictionary> - </ResourceDictionary.MergedDictionaries> - </ResourceDictionary> - </UserControl.Resources> - - - <Grid> - <Grid.RowDefinitions> - <RowDefinition Height="50"/> - <RowDefinition Height="1*"/> - </Grid.RowDefinitions> - - <Grid Background="#F1F1F1"> - <Grid.Resources> - <Style TargetType="Border" x:Key="glowBorder"> - <Setter Property="Height" Value="2"></Setter> - <Setter Property="Margin" Value="0 0 0 -15"></Setter> - <Setter Property="HorizontalAlignment" Value="Stretch"></Setter> - <Setter Property="Background" Value="{StaticResource AccentColorBrush3}"></Setter> - <Setter Property="CornerRadius" Value="3"></Setter> - <Style.Triggers> - <DataTrigger Binding="{Binding RelativeSource={RelativeSource AncestorType=Button},Path=FontWeight}" Value="Normal"> - <DataTrigger.EnterActions> - <BeginStoryboard> - <Storyboard> - <DoubleAnimation To="0" Duration="00:00:1" Storyboard.TargetProperty="Opacity"></DoubleAnimation> - </Storyboard> - </BeginStoryboard> - </DataTrigger.EnterActions> - <DataTrigger.ExitActions> - <BeginStoryboard> - <Storyboard> - <DoubleAnimation To="1" Duration="00:00:0.2" Storyboard.TargetProperty="Opacity"></DoubleAnimation> - </Storyboard> - </BeginStoryboard> - </DataTrigger.ExitActions> - </DataTrigger> - </Style.Triggers> - </Style> - </Grid.Resources> - <StackPanel Orientation="Horizontal" Margin="10 0 0 0"> - <Button Width="110" Style="{StaticResource LinkButton}" FontSize="{StaticResource LargeFontSize}" FontWeight="{Binding ElementName=TransitionControl,Path=SelectedControl,Converter={StaticResource linkConverter}, ConverterParameter='Overview'}" VerticalAlignment="Center" Command="{Binding NavigateToViewCommand}" CommandParameter="Overview"> - <StackPanel Orientation="Vertical"> - <TextBlock Text="OVERVIEW"></TextBlock> - <Border Style="{StaticResource glowBorder}"> - </Border> - </StackPanel> - </Button> - <Button IsEnabled="{Binding IsResultsAvailable}" Width="100" Style="{StaticResource LinkButton}" Margin="20 0 0 0" FontSize="{StaticResource LargeFontSize}" VerticalAlignment="Center" FontWeight="{Binding ElementName=TransitionControl,Path=SelectedControl,Converter={StaticResource linkConverter}, ConverterParameter='Motors'}" Command="{Binding NavigateToViewCommand}" CommandParameter="Motors"> - <StackPanel Orientation="Vertical"> - <TextBlock Text="MOTORS"></TextBlock> - <Border Style="{StaticResource glowBorder}"> - </Border> - </StackPanel> - </Button> - <Grid Visibility="{Binding IsDebugViewEnabled,Converter={StaticResource BooleanToVisibilityConverter}}"> - <Button Visibility="{Binding IsDebugViewAttached,Converter={StaticResource BooleanToVisibilityConverter}}" Width="150" Style="{StaticResource LinkButton}" Margin="20 0 0 0" FontSize="{StaticResource LargeFontSize}" VerticalAlignment="Center" FontWeight="{Binding ElementName=TransitionControl,Path=SelectedControl,Converter={StaticResource linkConverter}, ConverterParameter='Sensors'}" Command="{Binding NavigateToViewCommand}" CommandParameter="Sensors"> - <StackPanel Orientation="Vertical"> - <TextBlock Text="SENSORS"></TextBlock> - <Border Style="{StaticResource glowBorder}" > - </Border> - </StackPanel> - </Button> - </Grid> - </StackPanel> - </Grid> - - <sharedUI:MultiTransitionControl Grid.Row="1" x:Name="TransitionControl" x:FieldModifier="public" AlwaysFade="True" TransitionType="Slide" Grid.RowSpan="2"> - <sharedUI:MultiTransitionControl.Controls> - <ContentControl Tag="Overview"> - <local:OverviewView></local:OverviewView> - </ContentControl> - <ContentControl Tag="Motors"> - <local:MotorsView></local:MotorsView> - </ContentControl> - <ContentControl Tag="Sensors"> - <local:SensorsView></local:SensorsView> - </ContentControl> - </sharedUI:MultiTransitionControl.Controls> - </sharedUI:MultiTransitionControl> - </Grid> -</UserControl> diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/Views/MainView.xaml.cs b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/Views/MainView.xaml.cs deleted file mode 100644 index b07fc597e..000000000 --- a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/Views/MainView.xaml.cs +++ /dev/null @@ -1,31 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; -using System.Windows; -using System.Windows.Controls; -using System.Windows.Data; -using System.Windows.Documents; -using System.Windows.Input; -using System.Windows.Media; -using System.Windows.Media.Imaging; -using System.Windows.Navigation; -using System.Windows.Shapes; - -namespace Tango.MachineStudio.Technician.Views -{ - /// <summary> - /// Interaction logic for MainView.xaml - /// </summary> - public partial class MainView : UserControl - { - public static MainView Instance { get; set; } - - public MainView() - { - InitializeComponent(); - Instance = this; - } - } -} diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/Views/MotorsView.xaml b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/Views/MotorsView.xaml deleted file mode 100644 index 3fb49d457..000000000 --- a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/Views/MotorsView.xaml +++ /dev/null @@ -1,12 +0,0 @@ -<UserControl x:Class="Tango.MachineStudio.Technician.Views.MotorsView" - xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" - xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" - xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" - xmlns:d="http://schemas.microsoft.com/expression/blend/2008" - xmlns:local="clr-namespace:Tango.MachineStudio.Technician.Views" - mc:Ignorable="d" - d:DesignHeight="300" d:DesignWidth="300"> - <Grid> - <TextBlock HorizontalAlignment="Center" VerticalAlignment="Center" FontSize="40">MOTORS</TextBlock> - </Grid> -</UserControl> diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/Views/MotorsView.xaml.cs b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/Views/MotorsView.xaml.cs deleted file mode 100644 index bd548766c..000000000 --- a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/Views/MotorsView.xaml.cs +++ /dev/null @@ -1,28 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; -using System.Windows; -using System.Windows.Controls; -using System.Windows.Data; -using System.Windows.Documents; -using System.Windows.Input; -using System.Windows.Media; -using System.Windows.Media.Imaging; -using System.Windows.Navigation; -using System.Windows.Shapes; - -namespace Tango.MachineStudio.Technician.Views -{ - /// <summary> - /// Interaction logic for MotorsView.xaml - /// </summary> - public partial class MotorsView : UserControl - { - public MotorsView() - { - InitializeComponent(); - } - } -} diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/Views/OverviewView.xaml b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/Views/OverviewView.xaml deleted file mode 100644 index 3c064346d..000000000 --- a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/Views/OverviewView.xaml +++ /dev/null @@ -1,12 +0,0 @@ -<UserControl x:Class="Tango.MachineStudio.Technician.Views.OverviewView" - xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" - xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" - xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" - xmlns:d="http://schemas.microsoft.com/expression/blend/2008" - xmlns:local="clr-namespace:Tango.MachineStudio.Technician.Views" - mc:Ignorable="d" - d:DesignHeight="300" d:DesignWidth="300"> - <Grid> - <TextBlock HorizontalAlignment="Center" VerticalAlignment="Center" FontSize="40">OVERVIEW</TextBlock> - </Grid> -</UserControl> diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/Views/OverviewView.xaml.cs b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/Views/OverviewView.xaml.cs deleted file mode 100644 index aeba42c00..000000000 --- a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/Views/OverviewView.xaml.cs +++ /dev/null @@ -1,28 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; -using System.Windows; -using System.Windows.Controls; -using System.Windows.Data; -using System.Windows.Documents; -using System.Windows.Input; -using System.Windows.Media; -using System.Windows.Media.Imaging; -using System.Windows.Navigation; -using System.Windows.Shapes; - -namespace Tango.MachineStudio.Technician.Views -{ - /// <summary> - /// Interaction logic for OverviewView.xaml - /// </summary> - public partial class OverviewView : UserControl - { - public OverviewView() - { - InitializeComponent(); - } - } -} diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/Views/SensorsView.xaml b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/Views/SensorsView.xaml deleted file mode 100644 index 63feae2f3..000000000 --- a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/Views/SensorsView.xaml +++ /dev/null @@ -1,173 +0,0 @@ -<UserControl x:Class="Tango.MachineStudio.Technician.Views.SensorsView" - xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" - xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" - xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" - xmlns:d="http://schemas.microsoft.com/expression/blend/2008" - xmlns:local="clr-namespace:Tango.MachineStudio.Technician.Views" - xmlns:global="clr-namespace:Tango.MachineStudio.Technician" - xmlns:vm="clr-namespace:Tango.MachineStudio.Technician.ViewModels" - xmlns:materialDesign="http://materialdesigninxaml.net/winfx/xaml/themes" - xmlns:graphEx="clr-namespace:RealTimeGraphEx.FastGraphs;assembly=RealTimeGraphEx" - xmlns:components="clr-namespace:RealTimeGraphEx.Components;assembly=RealTimeGraphEx" - xmlns:converters="clr-namespace:Tango.MachineStudio.Technician.Converters" - mc:Ignorable="d" - d:DesignHeight="720" d:DesignWidth="1280" d:DataContext="{d:DesignInstance Type=vm:SensorsViewVM, IsDesignTimeCreatable=False}" DataContext="{x:Static global:ViewModelLocator.SensorsViewVM}" Background="White"> - - <UserControl.Resources> - <ResourceDictionary> - <ResourceDictionary.MergedDictionaries> - <!--RealTimeGraphEx--> - <ResourceDictionary Source="pack://application:,,,/RealTimeGraphEx;component/Resources/Resources.xaml"></ResourceDictionary> - <ResourceDictionary Source="../Resources/GraphEx.xaml"></ResourceDictionary> - - <ResourceDictionary> - <Style TargetType="ContentControl" x:Key="graphContent"> - <Style.Setters> - <Setter Property="ContentTemplate"> - <Setter.Value> - <DataTemplate> - <Grid MouseEnter="Graph_MouseEnter" MouseLeave="Graph_MouseLeave" ClipToBounds="True"> - <ContentControl Content="{Binding}"></ContentControl> - <Grid Opacity="0.8" HorizontalAlignment="Stretch" VerticalAlignment="Top" ClipToBounds="True" Height="35" Margin="0 -35 0 0"> - <Button Click="OnGraphFullScreen" Margin="5" ToolTip="Full Screen" HorizontalAlignment="Right" VerticalAlignment="Top" Width="24" Height="24" BorderBrush="Transparent" Background="{StaticResource AccentColorBrush}" Style="{StaticResource MaterialDesignFloatingActionAccentButton}" > - <materialDesign:PackIcon Kind="Fullscreen" HorizontalAlignment="Right" Width="20" Height="20" Foreground="{StaticResource WhiteBrush}" /> - </Button> - </Grid> - </Grid> - </DataTemplate> - </Setter.Value> - </Setter> - </Style.Setters> - </Style> - </ResourceDictionary> - - <ResourceDictionary> - <converters:SecondsToGraphPointsConverter x:Key="secondsToPoints"></converters:SecondsToGraphPointsConverter> - </ResourceDictionary> - </ResourceDictionary.MergedDictionaries> - </ResourceDictionary> - </UserControl.Resources> - - <Grid Margin="10"> - <Grid.RowDefinitions> - <RowDefinition Height="1*"/> - <RowDefinition Height="60"/> - </Grid.RowDefinitions> - - <Grid> - <Grid.ColumnDefinitions> - <ColumnDefinition Width="1*"/> - <ColumnDefinition Width="1*"/> - <ColumnDefinition Width="1*"/> - </Grid.ColumnDefinitions> - <Grid.RowDefinitions> - <RowDefinition Height="1*"/> - <RowDefinition Height="1*"/> - <RowDefinition Height="1*"/> - </Grid.RowDefinitions> - - <!--Temperature--> - <ContentControl Style="{StaticResource graphContent}" Margin="0 0 5 5" MinHeight="5"> - <Grid> - <Grid.ColumnDefinitions> - <ColumnDefinition Width="40"/> - <ColumnDefinition Width="438*"/> - </Grid.ColumnDefinitions> - - <Border BorderBrush="{StaticResource AccentColorBrush}" BorderThickness="1 1 0 1"> - <StackPanel Orientation="Horizontal"> - <components:YAxisScroll Interval="6" Graph="{Binding ElementName=graphTemperature}" Width="35" Foreground="{StaticResource MaterialDesignLightForeground}" VerticalOffset="-5" FontSize="8" StringFormat="#0.0"></components:YAxisScroll> - <components:YAxisTicks SmallTickTemplate="{StaticResource graphTicksTemplate}" Width="5" SmallTicks="6" Foreground="{StaticResource MaterialDesignLightForeground}" BigTicks="10" Graph="{Binding ElementName=graphTemperature}"></components:YAxisTicks> - </StackPanel> - </Border> - <Border Grid.Column="1" BorderThickness="1" BorderBrush="{StaticResource borderBrush}" Background="{DynamicResource graphBackground}" Margin="5 0 0 0"> - <graphEx:RealTimeGraphExLineErase x:Name="graphTemperature" Controller="{Binding TemperatureController}" Antialiased="True" RefreshRate="30" MaxPoints="{Binding GraphSeconds,Converter={StaticResource secondsToPoints}, ConverterParameter=10}" Minimum="0" Maximum="255" MarkerColor="{StaticResource graphsMarkerColor}" FillGraph="False" Stroke="DodgerBlue"> - <graphEx:RealTimeGraphExLineErase.Components> - <components:MouseValueToolTip ToolTipTemplate="{StaticResource graphTooltipTemplate}" /> - <components:GridLines Rows="4" Columns="6" GridBrush="{DynamicResource graphGridLinesBrush}"></components:GridLines> - </graphEx:RealTimeGraphExLineErase.Components> - <graphEx:RealTimeGraphExLineErase.InnerContent> - <Grid> - <Label Style="{StaticResource graphLabel}"> - TEMPERATURE - </Label> - </Grid> - </graphEx:RealTimeGraphExLineErase.InnerContent> - </graphEx:RealTimeGraphExLineErase> - </Border> - </Grid> - </ContentControl> - - <!--Pressure--> - <ContentControl Grid.Column="1" Style="{StaticResource graphContent}" Margin="0 0 5 5" MinHeight="5"> - <Grid> - <Grid.ColumnDefinitions> - <ColumnDefinition Width="40"/> - <ColumnDefinition Width="438*"/> - </Grid.ColumnDefinitions> - - <Border BorderBrush="{StaticResource AccentColorBrush}" BorderThickness="1 1 0 1"> - <StackPanel Orientation="Horizontal"> - <components:YAxisWave Interval="6" Graph="{Binding ElementName=graphPressure}" Width="35" Foreground="{StaticResource MaterialDesignLightForeground}" VerticalOffset="-5" FontSize="8" StringFormat="#0.0"></components:YAxisWave> - <components:YAxisTicks SmallTickTemplate="{StaticResource graphTicksTemplate}" Width="5" SmallTicks="6" Foreground="{StaticResource MaterialDesignLightForeground}" BigTicks="10" Graph="{Binding ElementName=graphPressure}"></components:YAxisTicks> - </StackPanel> - </Border> - <Border Grid.Column="1" BorderThickness="1" BorderBrush="{StaticResource borderBrush}" Background="{DynamicResource graphBackground}" Margin="5 0 0 0"> - <graphEx:RealTimeGraphExWaveScroll x:Name="graphPressure" Controller="{Binding PressureController}" Antialiased="True" RefreshRate="30" MaxPoints="{Binding GraphSeconds,Converter={StaticResource secondsToPoints}, ConverterParameter=10}" Minimum="0" Maximum="255" FillGraph="True" Fill="#70FF0000" Stroke="Red"> - <graphEx:RealTimeGraphExWaveScroll.Components> - <components:MouseValueToolTip ToolTipTemplate="{StaticResource graphTooltipTemplate}" /> - <components:GridLines Rows="4" Columns="6" GridBrush="{DynamicResource graphGridLinesBrush}"></components:GridLines> - </graphEx:RealTimeGraphExWaveScroll.Components> - <graphEx:RealTimeGraphExWaveScroll.InnerContent> - <Grid> - <Label Style="{StaticResource graphLabel}"> - PRESSURE - </Label> - </Grid> - </graphEx:RealTimeGraphExWaveScroll.InnerContent> - </graphEx:RealTimeGraphExWaveScroll> - </Border> - </Grid> - </ContentControl> - - <!--Velocity--> - <ContentControl Grid.Column="2" Style="{StaticResource graphContent}" Margin="0 0 5 5" MinHeight="5"> - <Grid> - <Grid.ColumnDefinitions> - <ColumnDefinition Width="40"/> - <ColumnDefinition Width="438*"/> - </Grid.ColumnDefinitions> - - <Border BorderBrush="{StaticResource AccentColorBrush}" BorderThickness="1 1 0 1"> - <StackPanel Orientation="Horizontal"> - <components:YAxisScroll Interval="6" Graph="{Binding ElementName=graphVelocity}" Width="35" Foreground="{StaticResource MaterialDesignLightForeground}" VerticalOffset="-5" FontSize="8" StringFormat="#0.0"></components:YAxisScroll> - <components:YAxisTicks SmallTickTemplate="{StaticResource graphTicksTemplate}" Width="5" SmallTicks="6" Foreground="{StaticResource MaterialDesignLightForeground}" BigTicks="10" Graph="{Binding ElementName=graphVelocity}"></components:YAxisTicks> - </StackPanel> - </Border> - <Border Grid.Column="1" BorderThickness="1" BorderBrush="{StaticResource borderBrush}" Background="{DynamicResource graphBackground}" Margin="5 0 0 0"> - <graphEx:RealTimeGraphExLineScroll x:Name="graphVelocity" Controller="{Binding VelocityController}" Antialiased="True" RefreshRate="30" MaxPoints="{Binding GraphSeconds,Converter={StaticResource secondsToPoints}, ConverterParameter=1}" Minimum="0" Maximum="1080" FillGraph="True" Fill="#70002BFF" Stroke="#0500FF"> - <graphEx:RealTimeGraphExLineScroll.Components> - <components:MouseValueToolTip ToolTipTemplate="{StaticResource graphTooltipTemplate}" /> - <components:GridLines Rows="4" Columns="6" GridBrush="{DynamicResource graphGridLinesBrush}"></components:GridLines> - </graphEx:RealTimeGraphExLineScroll.Components> - <graphEx:RealTimeGraphExLineScroll.InnerContent> - <Grid> - <Label Style="{StaticResource graphLabel}"> - VELOCITY - </Label> - </Grid> - </graphEx:RealTimeGraphExLineScroll.InnerContent> - </graphEx:RealTimeGraphExLineScroll> - </Border> - </Grid> - </ContentControl> - </Grid> - - <Grid Grid.Row="1"> - <StackPanel Orientation="Horizontal" HorizontalAlignment="Right"> - <Button Width="140" Height="40" Margin="0 0 10 0">STOP</Button> - <Button Width="140" Height="40">START</Button> - </StackPanel> - </Grid> - </Grid> -</UserControl> diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/Views/SensorsView.xaml.cs b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/Views/SensorsView.xaml.cs deleted file mode 100644 index e60deacbd..000000000 --- a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/Views/SensorsView.xaml.cs +++ /dev/null @@ -1,53 +0,0 @@ -using RealTimeGraphEx.Synchronization; -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; -using System.Windows; -using System.Windows.Controls; -using System.Windows.Data; -using System.Windows.Documents; -using System.Windows.Input; -using System.Windows.Media; -using System.Windows.Media.Imaging; -using System.Windows.Navigation; -using System.Windows.Shapes; - -namespace Tango.MachineStudio.Technician.Views -{ - /// <summary> - /// Interaction logic for DebugView.xaml - /// </summary> - public partial class SensorsView : UserControl - { - private SyncManager _syncManager; - - public SensorsView() - { - InitializeComponent(); - - _syncManager = new SyncManager(); - _syncManager.AddGraph(graphTemperature); - _syncManager.AddGraph(graphPressure); - _syncManager.AddGraph(graphVelocity); - _syncManager.RefreshRate = 30; - _syncManager.Start(); - } - - private void OnGraphFullScreen(object sender, RoutedEventArgs e) - { - - } - - private void Graph_MouseEnter(object sender, MouseEventArgs e) - { - - } - - private void Graph_MouseLeave(object sender, MouseEventArgs e) - { - - } - } -} diff --git a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.Common/Controls/RealTimeGraphControl.xaml b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.Common/Controls/RealTimeGraphControl.xaml index 2f43869d5..fc36b28d3 100644 --- a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.Common/Controls/RealTimeGraphControl.xaml +++ b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.Common/Controls/RealTimeGraphControl.xaml @@ -18,36 +18,32 @@ <ResourceDictionary Source="pack://application:,,,/RealTimeGraphEx;component/Resources/Resources.xaml"></ResourceDictionary> <ResourceDictionary Source="../Resources/MaterialDesign.xaml"></ResourceDictionary> - <ResourceDictionary> - <Style TargetType="ContentControl" x:Key="graphContent"> - <Style.Setters> - <Setter Property="ContentTemplate"> - <Setter.Value> - <DataTemplate> - <Grid MouseEnter="Graph_MouseEnter" MouseLeave="Graph_MouseLeave" ClipToBounds="True"> - <ContentControl Content="{Binding}"></ContentControl> - <Grid Opacity="0.8" HorizontalAlignment="Stretch" VerticalAlignment="Top" ClipToBounds="True" Height="35" Margin="0 -35 0 0"> - <StackPanel Orientation="Horizontal" Margin="5" HorizontalAlignment="Right" VerticalAlignment="Top"> - <Button Margin="0 0 5 0" Click="OnGraphFullScreen" ToolTip="Full Screen" Width="24" Height="24" BorderBrush="Transparent" Background="{StaticResource AccentColorBrush}" Style="{StaticResource MaterialDesignFloatingActionAccentButton}" > - <materialDesign:PackIcon Kind="Fullscreen" HorizontalAlignment="Right" Width="20" Height="20" Foreground="{StaticResource WhiteBrush}" /> - </Button> - <Button Click="OnGraphRemove" ToolTip="Remove" Width="24" Height="24" BorderBrush="Transparent" Background="#FF7777" Style="{StaticResource MaterialDesignFloatingActionAccentButton}" > - <materialDesign:PackIcon Kind="CloseCircle" HorizontalAlignment="Right" Width="20" Height="20" Foreground="{StaticResource WhiteBrush}" /> - </Button> - </StackPanel> - </Grid> - </Grid> - </DataTemplate> - </Setter.Value> - </Setter> - </Style.Setters> - </Style> - </ResourceDictionary> - - <ResourceDictionary> - <converters:SecondsToGraphPointsConverter x:Key="secondsToPoints"></converters:SecondsToGraphPointsConverter> - </ResourceDictionary> - </ResourceDictionary.MergedDictionaries> + <ResourceDictionary> + <Style TargetType="ContentControl" x:Key="graphContent"> + <Style.Setters> + <Setter Property="ContentTemplate"> + <Setter.Value> + <DataTemplate> + <Grid MouseEnter="Graph_MouseEnter" MouseLeave="Graph_MouseLeave" ClipToBounds="True"> + <ContentControl Content="{Binding}"></ContentControl> + <Grid Opacity="0.8" HorizontalAlignment="Stretch" VerticalAlignment="Top" ClipToBounds="True" Height="35" Margin="0 -35 0 0"> + <StackPanel Orientation="Horizontal" Margin="5" HorizontalAlignment="Right" VerticalAlignment="Top"> + <Button Margin="0 0 5 0" Click="OnGraphFullScreen" ToolTip="Full Screen" Width="24" Height="24" BorderBrush="Transparent" Background="{StaticResource AccentColorBrush}" Style="{StaticResource MaterialDesignFloatingActionAccentButton}" > + <materialDesign:PackIcon Kind="Fullscreen" HorizontalAlignment="Right" Width="20" Height="20" Foreground="{StaticResource WhiteBrush}" /> + </Button> + <Button Click="OnGraphRemove" ToolTip="Remove" Width="24" Height="24" BorderBrush="Transparent" Background="#FF7777" Style="{StaticResource MaterialDesignFloatingActionAccentButton}" > + <materialDesign:PackIcon Kind="CloseCircle" HorizontalAlignment="Right" Width="20" Height="20" Foreground="{StaticResource WhiteBrush}" /> + </Button> + </StackPanel> + </Grid> + </Grid> + </DataTemplate> + </Setter.Value> + </Setter> + </Style.Setters> + </Style> + </ResourceDictionary> + </ResourceDictionary.MergedDictionaries> </ResourceDictionary> </UserControl.Resources> diff --git a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.Common/Controls/RealTimeGraphMultiControl.xaml b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.Common/Controls/RealTimeGraphMultiControl.xaml index 5548c452e..657cc2683 100644 --- a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.Common/Controls/RealTimeGraphMultiControl.xaml +++ b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.Common/Controls/RealTimeGraphMultiControl.xaml @@ -18,36 +18,32 @@ <ResourceDictionary Source="pack://application:,,,/RealTimeGraphEx;component/Resources/Resources.xaml"></ResourceDictionary> <ResourceDictionary Source="../Resources/MaterialDesign.xaml"></ResourceDictionary> - <ResourceDictionary> - <Style TargetType="ContentControl" x:Key="graphContent"> - <Style.Setters> - <Setter Property="ContentTemplate"> - <Setter.Value> - <DataTemplate> - <Grid MouseEnter="Graph_MouseEnter" MouseLeave="Graph_MouseLeave" ClipToBounds="True"> - <ContentControl Content="{Binding}"></ContentControl> - <Grid Opacity="0.8" HorizontalAlignment="Stretch" VerticalAlignment="Top" ClipToBounds="True" Height="35" Margin="0 -35 0 0"> - <StackPanel Orientation="Horizontal" Margin="5" HorizontalAlignment="Right" VerticalAlignment="Top"> - <Button Margin="0 0 5 0" Click="OnGraphFullScreen" ToolTip="Full Screen" Width="24" Height="24" BorderBrush="Transparent" Background="{StaticResource AccentColorBrush}" Style="{StaticResource MaterialDesignFloatingActionAccentButton}" > - <materialDesign:PackIcon Kind="Fullscreen" HorizontalAlignment="Right" Width="20" Height="20" Foreground="{StaticResource WhiteBrush}" /> - </Button> - <Button Click="OnGraphRemove" ToolTip="Remove" Width="24" Height="24" BorderBrush="Transparent" Background="#FF7777" Style="{StaticResource MaterialDesignFloatingActionAccentButton}" > - <materialDesign:PackIcon Kind="CloseCircle" HorizontalAlignment="Right" Width="20" Height="20" Foreground="{StaticResource WhiteBrush}" /> - </Button> - </StackPanel> - </Grid> - </Grid> - </DataTemplate> - </Setter.Value> - </Setter> - </Style.Setters> - </Style> - </ResourceDictionary> - - <ResourceDictionary> - <converters:SecondsToGraphPointsConverter x:Key="secondsToPoints"></converters:SecondsToGraphPointsConverter> - </ResourceDictionary> - </ResourceDictionary.MergedDictionaries> + <ResourceDictionary> + <Style TargetType="ContentControl" x:Key="graphContent"> + <Style.Setters> + <Setter Property="ContentTemplate"> + <Setter.Value> + <DataTemplate> + <Grid MouseEnter="Graph_MouseEnter" MouseLeave="Graph_MouseLeave" ClipToBounds="True"> + <ContentControl Content="{Binding}"></ContentControl> + <Grid Opacity="0.8" HorizontalAlignment="Stretch" VerticalAlignment="Top" ClipToBounds="True" Height="35" Margin="0 -35 0 0"> + <StackPanel Orientation="Horizontal" Margin="5" HorizontalAlignment="Right" VerticalAlignment="Top"> + <Button Margin="0 0 5 0" Click="OnGraphFullScreen" ToolTip="Full Screen" Width="24" Height="24" BorderBrush="Transparent" Background="{StaticResource AccentColorBrush}" Style="{StaticResource MaterialDesignFloatingActionAccentButton}" > + <materialDesign:PackIcon Kind="Fullscreen" HorizontalAlignment="Right" Width="20" Height="20" Foreground="{StaticResource WhiteBrush}" /> + </Button> + <Button Click="OnGraphRemove" ToolTip="Remove" Width="24" Height="24" BorderBrush="Transparent" Background="#FF7777" Style="{StaticResource MaterialDesignFloatingActionAccentButton}" > + <materialDesign:PackIcon Kind="CloseCircle" HorizontalAlignment="Right" Width="20" Height="20" Foreground="{StaticResource WhiteBrush}" /> + </Button> + </StackPanel> + </Grid> + </Grid> + </DataTemplate> + </Setter.Value> + </Setter> + </Style.Setters> + </Style> + </ResourceDictionary> + </ResourceDictionary.MergedDictionaries> </ResourceDictionary> </UserControl.Resources> diff --git a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.Common/Helpers/GraphsHelper.cs b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.Common/Helpers/GraphsHelper.cs index 53e832eb5..80e54d143 100644 --- a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.Common/Helpers/GraphsHelper.cs +++ b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.Common/Helpers/GraphsHelper.cs @@ -21,8 +21,10 @@ namespace Tango.MachineStudio.Common.Helpers { try { - double seconds = SettingsManager.Default.MachineStudio.TechnicianModule.GraphsDuration; - double pullRate = SettingsManager.Default.MachineStudio.TechnicianModule.GraphsPullingInterval; + var settings = SettingsManager.Default.GetOrCreate<MachineStudioSettings>(); + + double seconds = settings.GraphsViewDurationSeconds; + double pullRate = settings.DiagnosticsResponseIntervalMilli; return (int)(((pullRate * pointsPerFrame * 10 * seconds) * (10 / pullRate)) * 0.65); } catch (Exception) diff --git a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.Common/Helpers/OutlookHelper.cs b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.Common/Helpers/OutlookHelper.cs deleted file mode 100644 index 58138b625..000000000 --- a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.Common/Helpers/OutlookHelper.cs +++ /dev/null @@ -1,13 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; - -namespace Tango.MachineStudio.Common.Helpers -{ - public static class OutlookHelper - { - - } -} diff --git a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.Common/MachineStudioSettings.cs b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.Common/MachineStudioSettings.cs new file mode 100644 index 000000000..b12d9a580 --- /dev/null +++ b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.Common/MachineStudioSettings.cs @@ -0,0 +1,52 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using Tango.Logging; +using Tango.Settings; + +namespace Tango.MachineStudio.Common +{ + public class MachineStudioSettings : SettingsBase + { + /// <summary> + /// Gets or sets the last login email. + /// </summary> + public String LastLoginEmail { get; set; } + + /// <summary> + /// Gets or sets the last login password. + /// </summary> + public String LastLoginPassword { get; set; } + + /// <summary> + /// Gets or sets a value indicating whether to save the user credentials. + /// </summary> + public bool RememberMe { get; set; } + + /// <summary> + /// Gets or sets the last virtual machine serial number. + /// </summary> + public String LastVirtualMachineSerialNumber { get; set; } + + /// <summary> + /// Gets or sets the update service address. + /// </summary> + public String UpdateServiceAddress { get; set; } + + /// <summary> + /// Gets or sets the logging categories. + /// </summary> + public List<LogCategory> LoggingCategories { get; set; } + + /// <summary> + /// Initializes a new instance of the <see cref="MachineStudio"/> class. + /// </summary> + public MachineStudioSettings() + { + LoggingCategories = new List<LogCategory>(); + UpdateServiceAddress = "http://twine01/MachineStudioUpdateService/MachineStudioUpdateService.svc"; + } + } +} diff --git a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.Common/Tango.MachineStudio.Common.csproj b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.Common/Tango.MachineStudio.Common.csproj index df1ee23dc..a635e17ed 100644 --- a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.Common/Tango.MachineStudio.Common.csproj +++ b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.Common/Tango.MachineStudio.Common.csproj @@ -90,17 +90,17 @@ </Compile> <Compile Include="Controls\TableGrid.cs" /> <Compile Include="Converters\PermissionToVisibilityConverter.cs" /> - <Compile Include="Converters\SecondsToGraphPointsConverter.cs" /> + <None Include="Converters\SecondsToGraphPointsConverter.cs" /> <Compile Include="Diagnostics\DefaultDiagnosticsFrameProvider.cs" /> <Compile Include="Diagnostics\IDiagnosticsFrameProvider.cs" /> <Compile Include="EventLogging\DefaultEventLogger.cs" /> <Compile Include="EventLogging\IEventLogger.cs" /> <Compile Include="ExtensionMethods\CommonDialogExtensions.cs" /> <Compile Include="ExtensionMethods\TangoIOCExtensions.cs" /> - <Compile Include="Helpers\OutlookHelper.cs" /> <Compile Include="Html\IHtmlPresenter.cs" /> - <Compile Include="Helpers\GraphsHelper.cs" /> + <None Include="Helpers\GraphsHelper.cs" /> <Compile Include="IStudioViewModel.cs" /> + <Compile Include="MachineStudioSettings.cs" /> <Compile Include="Messages\MachineConnectionChangedMessage.cs" /> <Compile Include="Notifications\BarItem.cs" /> <Compile Include="Notifications\DialogViewVM.cs" /> diff --git a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.Common/Update/UpdateServiceHelper.cs b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.Common/Update/UpdateServiceHelper.cs index 87b974b99..2194ec5cf 100644 --- a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.Common/Update/UpdateServiceHelper.cs +++ b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.Common/Update/UpdateServiceHelper.cs @@ -23,7 +23,7 @@ namespace Tango.MachineStudio.Common.Update binding.ReaderQuotas.MaxArrayLength = 6553600; binding.ReaderQuotas.MaxBytesPerRead = 6553600; - return new ChannelFactory<IMachineStudioUpdateService>(binding, SettingsManager.Default.MachineStudio.UpdateServiceAddress); + return new ChannelFactory<IMachineStudioUpdateService>(binding, SettingsManager.Default.GetOrCreate<MachineStudioSettings>().UpdateServiceAddress); } } } diff --git a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.Publisher/MainWindowVM.cs b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.Publisher/MainWindowVM.cs index 3b92ac686..847503e42 100644 --- a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.Publisher/MainWindowVM.cs +++ b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.Publisher/MainWindowVM.cs @@ -13,6 +13,7 @@ using System.Windows; using Tango.Core.Commands; using Tango.Core.Cryptography; using Tango.Core.Helpers; +using Tango.MachineStudio.Common; using Tango.MachineStudio.Common.Update; using Tango.Settings; using Tango.SharedUI; @@ -102,10 +103,12 @@ namespace Tango.MachineStudio.Publisher UpdateVersions(); - Email = SettingsManager.Default.MachineStudio.LastLoginEmail; + var settings = SettingsManager.Default.GetOrCreate<MachineStudioSettings>(); + + Email = settings.LastLoginEmail; var cryptographer = new Rfc2898Cryptographer(); - Password = cryptographer.Decrypt(SettingsManager.Default.MachineStudio.LastLoginPassword); + Password = cryptographer.Decrypt(settings.LastLoginPassword); } private void UpdateVersions() diff --git a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/App.config b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/App.config index 1a0e57043..1775bf7d1 100644 --- a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/App.config +++ b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/App.config @@ -67,6 +67,14 @@ <assemblyIdentity name="System.Diagnostics.StackTrace" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" /> <bindingRedirect oldVersion="0.0.0.0-4.0.3.0" newVersion="4.0.3.0" /> </dependentAssembly> + <dependentAssembly> + <assemblyIdentity name="System.Xml.ReaderWriter" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" /> + <bindingRedirect oldVersion="0.0.0.0-4.1.0.0" newVersion="4.1.0.0" /> + </dependentAssembly> + <dependentAssembly> + <assemblyIdentity name="Newtonsoft.Json" publicKeyToken="30ad4fe6b2a6aeed" culture="neutral" /> + <bindingRedirect oldVersion="0.0.0.0-8.0.0.0" newVersion="8.0.0.0" /> + </dependentAssembly> </assemblyBinding> </runtime> </configuration>
\ No newline at end of file diff --git a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/App.xaml.cs b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/App.xaml.cs index f124ebb54..568529534 100644 --- a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/App.xaml.cs +++ b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/App.xaml.cs @@ -20,6 +20,7 @@ using Tango.TFS; using Tango.MachineStudio.Common.Notifications; using Tango.MachineStudio.UI.ViewModels; using Tango.MachineStudio.UI.Views; +using Tango.MachineStudio.Common; namespace Tango.MachineStudio.UI { @@ -42,15 +43,17 @@ namespace Tango.MachineStudio.UI LogManager.Categories.Clear(); - if (SettingsManager.Default.MachineStudio.LoggingCategories.Count == 0) + var settings = SettingsManager.Default.GetOrCreate<MachineStudioSettings>(); + + if (settings.LoggingCategories.Count == 0) { - SettingsManager.Default.MachineStudio.LoggingCategories.Add(LogCategory.Critical); - SettingsManager.Default.MachineStudio.LoggingCategories.Add(LogCategory.Error); - SettingsManager.Default.MachineStudio.LoggingCategories.Add(LogCategory.Info); - SettingsManager.Default.MachineStudio.LoggingCategories.Add(LogCategory.Warning); + settings.LoggingCategories.Add(LogCategory.Critical); + settings.LoggingCategories.Add(LogCategory.Error); + settings.LoggingCategories.Add(LogCategory.Info); + settings.LoggingCategories.Add(LogCategory.Warning); } - LogManager.Categories.AddRange(SettingsManager.Default.MachineStudio.LoggingCategories); + LogManager.Categories.AddRange(settings.LoggingCategories); exceptionTrapper = new WpfGlobalExceptionTrapper(); exceptionTrapper.Initialize(this); diff --git a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/StudioApplication/DefaultStudioApplicationManager.cs b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/StudioApplication/DefaultStudioApplicationManager.cs index 4c02be2b2..48b0fdada 100644 --- a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/StudioApplication/DefaultStudioApplicationManager.cs +++ b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/StudioApplication/DefaultStudioApplicationManager.cs @@ -175,7 +175,7 @@ namespace Tango.MachineStudio.UI.StudioApplication try { - SettingsManager.SaveDefaultSettings(); + SettingsManager.Default.Save(); } catch (Exception ex) { diff --git a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/ViewModels/LoadingViewVM.cs b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/ViewModels/LoadingViewVM.cs index 29f9102ac..5c8fb80ba 100644 --- a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/ViewModels/LoadingViewVM.cs +++ b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/ViewModels/LoadingViewVM.cs @@ -107,7 +107,7 @@ namespace Tango.MachineStudio.UI.ViewModels } else { - Environment.Exit(0); + ApplicationManager.ShutDown(); } }); } diff --git a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/ViewModels/LoginViewVM.cs b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/ViewModels/LoginViewVM.cs index fafa752c5..786951b06 100644 --- a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/ViewModels/LoginViewVM.cs +++ b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/ViewModels/LoginViewVM.cs @@ -8,6 +8,7 @@ using System.Text; using System.Threading.Tasks; using Tango.Core.Commands; using Tango.Core.Cryptography; +using Tango.MachineStudio.Common; using Tango.MachineStudio.Common.Authentication; using Tango.MachineStudio.Common.EventLogging; using Tango.MachineStudio.Common.Navigation; @@ -28,6 +29,7 @@ namespace Tango.MachineStudio.UI.ViewModels private INotificationProvider _notificationProvider; private IEventLogger _eventLogger; private Rfc2898Cryptographer cryptographer; + private MachineStudioSettings _settings; private String _email; /// <summary> @@ -73,6 +75,8 @@ namespace Tango.MachineStudio.UI.ViewModels /// <param name="notificationProvider">The notification provider.</param> public LoginViewVM(IAuthenticationProvider authenticationProvider, INavigationManager navigationManager, INotificationProvider notificationProvider, IEventLogger eventLogger) { + _settings = SettingsManager.Default.GetOrCreate<MachineStudioSettings>(); + _notificationProvider = notificationProvider; _navigationManager = navigationManager; _authenticationProvider = authenticationProvider; @@ -80,9 +84,9 @@ namespace Tango.MachineStudio.UI.ViewModels LoginCommand = new RelayCommand(Login); cryptographer = new Rfc2898Cryptographer(); - Email = SettingsManager.Default.MachineStudio.LastLoginEmail; - RememberMe = SettingsManager.Default.MachineStudio.RememberMe; - Password = cryptographer.Decrypt(SettingsManager.Default.MachineStudio.LastLoginPassword); + Email = _settings.LastLoginEmail; + RememberMe = _settings.RememberMe; + Password = cryptographer.Decrypt(_settings.LastLoginPassword); } /// <summary> @@ -96,11 +100,11 @@ namespace Tango.MachineStudio.UI.ViewModels { _authenticationProvider.Login(Email, Password); _navigationManager.NavigateTo(NavigationView.MainView); - SettingsManager.Default.MachineStudio.LastLoginEmail = Email; - SettingsManager.Default.MachineStudio.RememberMe = RememberMe; + _settings.LastLoginEmail = Email; + _settings.RememberMe = RememberMe; - SettingsManager.Default.MachineStudio.LastLoginPassword = RememberMe ? cryptographer.Encrypt(Password) : null; - SettingsManager.SaveDefaultSettings(); + _settings.LastLoginPassword = RememberMe ? cryptographer.Encrypt(Password) : null; + _settings.Save(); _eventLogger.Log("User logged in"); } diff --git a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/ViewModels/MachineSerialViewVM.cs b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/ViewModels/MachineSerialViewVM.cs index 9f366829a..ad4cfa96d 100644 --- a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/ViewModels/MachineSerialViewVM.cs +++ b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/ViewModels/MachineSerialViewVM.cs @@ -6,6 +6,7 @@ using System.Threading.Tasks; using Tango.BL; using Tango.BL.Entities; using Tango.Core.Commands; +using Tango.MachineStudio.Common; using Tango.MachineStudio.Common.Notifications; using Tango.Settings; @@ -24,7 +25,10 @@ namespace Tango.MachineStudio.UI.ViewModels public MachineSerialViewVM() { OKCommand = new RelayCommand(Accept, () => SelectedMachine != null); - SelectedMachine = ObservablesEntitiesAdapter.Instance.Machines.SingleOrDefault(x => x.SerialNumber == SettingsManager.Default.MachineStudio.LastVirtualMachineSerialNumber); + + var settings = SettingsManager.Default.GetOrCreate<MachineStudioSettings>(); + + SelectedMachine = ObservablesEntitiesAdapter.Instance.Machines.SingleOrDefault(x => x.SerialNumber == settings.LastVirtualMachineSerialNumber); } } } diff --git a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/ViewModels/MainViewVM.cs b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/ViewModels/MainViewVM.cs index 04b973f23..d3d90c0cc 100644 --- a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/ViewModels/MainViewVM.cs +++ b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/ViewModels/MainViewVM.cs @@ -53,6 +53,7 @@ namespace Tango.MachineStudio.UI.ViewModels private Thread _updateCheckThread; private IEventLogger _eventLogger; private IHtmlPresenter _htmlPresenter; + private MachineStudioSettings _settings; /// <summary> /// Gets or sets the current loaded module. @@ -281,6 +282,8 @@ namespace Tango.MachineStudio.UI.ViewModels SpeechProvider = speechProvider; _htmlPresenter = htmlPresenter; + _settings = SettingsManager.Default.GetOrCreate<MachineStudioSettings>(); + StartModuleCommand = new RelayCommand<IStudioModule>(StartModule); HomeCommand = new RelayCommand(Home); @@ -473,8 +476,8 @@ namespace Tango.MachineStudio.UI.ViewModels PostMessage(new MachineConnectionChangedMessage() { Machine = x.SelectedMachine }); _eventLogger.Log(String.Format("Successfully connected to machine {0} via USB", x.SelectedMachine.SerialNumber)); - SettingsManager.Default.MachineStudio.LastVirtualMachineSerialNumber = vm.SelectedMachine.SerialNumber; - SettingsManager.SaveDefaultSettings(); + _settings.LastVirtualMachineSerialNumber = vm.SelectedMachine.SerialNumber; + _settings.Save(); } catch (Exception ex) { |
