aboutsummaryrefslogtreecommitdiffstats
path: root/Software/Visual_Studio
diff options
context:
space:
mode:
Diffstat (limited to 'Software/Visual_Studio')
-rw-r--r--Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.DataCapture/ViewModels/MainViewVM.cs2
-rw-r--r--Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Developer/DeveloperModuleSettings.cs16
-rw-r--r--Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Developer/Tango.MachineStudio.Developer.csproj1
-rw-r--r--Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Developer/ViewModels/MainViewVM.cs15
-rw-r--r--Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Logging/Parsing/EmbeddedLogFileParser.cs2
-rw-r--r--Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Stubs/StubsModuleSettings.cs30
-rw-r--r--Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Stubs/Tango.MachineStudio.Stubs.csproj1
-rw-r--r--Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Stubs/ViewModels/MainViewVM.cs13
-rw-r--r--Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Synchronization/SynchronizationModuleSettings.cs27
-rw-r--r--Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Synchronization/Tango.MachineStudio.Synchronization.csproj1
-rw-r--r--Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Synchronization/ViewModels/LocalSynchronizationViewVM.cs17
-rw-r--r--Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Synchronization/ViewModels/RemoteSynchronizationViewVM.cs11
-rw-r--r--Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/Helpers/GraphsHelper.cs6
-rw-r--r--Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/Navigation/TechNavigationManager.cs24
-rw-r--r--Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/Navigation/TechNavigationView.cs18
-rw-r--r--Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/Tango.MachineStudio.Technician.csproj33
-rw-r--r--Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/TechItems/MultiGraphItem.cs3
-rw-r--r--Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/TechItems/SingleGraphItem.cs3
-rw-r--r--Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/TechnicianModuleSettings.cs36
-rw-r--r--Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/ViewModelLocator.cs23
-rw-r--r--Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/ViewModels/MachineTechViewVM.cs17
-rw-r--r--Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/ViewModels/MainViewVM.cs56
-rw-r--r--Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/ViewModels/SensorsViewVM.cs193
-rw-r--r--Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/Views/MainView.xaml102
-rw-r--r--Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/Views/MainView.xaml.cs31
-rw-r--r--Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/Views/MotorsView.xaml12
-rw-r--r--Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/Views/MotorsView.xaml.cs28
-rw-r--r--Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/Views/OverviewView.xaml12
-rw-r--r--Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/Views/OverviewView.xaml.cs28
-rw-r--r--Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/Views/SensorsView.xaml173
-rw-r--r--Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/Views/SensorsView.xaml.cs53
-rw-r--r--Software/Visual_Studio/MachineStudio/Tango.MachineStudio.Common/Controls/RealTimeGraphControl.xaml56
-rw-r--r--Software/Visual_Studio/MachineStudio/Tango.MachineStudio.Common/Controls/RealTimeGraphMultiControl.xaml56
-rw-r--r--Software/Visual_Studio/MachineStudio/Tango.MachineStudio.Common/Helpers/GraphsHelper.cs6
-rw-r--r--Software/Visual_Studio/MachineStudio/Tango.MachineStudio.Common/Helpers/OutlookHelper.cs13
-rw-r--r--Software/Visual_Studio/MachineStudio/Tango.MachineStudio.Common/MachineStudioSettings.cs52
-rw-r--r--Software/Visual_Studio/MachineStudio/Tango.MachineStudio.Common/Tango.MachineStudio.Common.csproj6
-rw-r--r--Software/Visual_Studio/MachineStudio/Tango.MachineStudio.Common/Update/UpdateServiceHelper.cs2
-rw-r--r--Software/Visual_Studio/MachineStudio/Tango.MachineStudio.Publisher/MainWindowVM.cs7
-rw-r--r--Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/App.config8
-rw-r--r--Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/App.xaml.cs15
-rw-r--r--Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/StudioApplication/DefaultStudioApplicationManager.cs2
-rw-r--r--Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/ViewModels/LoadingViewVM.cs2
-rw-r--r--Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/ViewModels/LoginViewVM.cs18
-rw-r--r--Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/ViewModels/MachineSerialViewVM.cs6
-rw-r--r--Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/ViewModels/MainViewVM.cs7
-rw-r--r--Software/Visual_Studio/PanelPC/Tango.PanelPC.UI/App.config10
-rw-r--r--Software/Visual_Studio/Tango.BL/ObservablesContextExtension.cs3
-rw-r--r--Software/Visual_Studio/Tango.Core/CoreSettings.cs25
-rw-r--r--Software/Visual_Studio/Tango.Core/Tango.Core.csproj5
-rw-r--r--Software/Visual_Studio/Tango.DAL.Remote/Partials/RemoteDB.cs3
-rw-r--r--Software/Visual_Studio/Tango.Integration/IntegrationSettings.cs43
-rw-r--r--Software/Visual_Studio/Tango.Integration/Operation/MachineOperator.cs2
-rw-r--r--Software/Visual_Studio/Tango.Integration/Services/ExternalBridgeScanner.cs6
-rw-r--r--Software/Visual_Studio/Tango.Integration/Services/ExternalBridgeTcpClient.cs2
-rw-r--r--Software/Visual_Studio/Tango.Integration/Tango.Integration.csproj1
-rw-r--r--Software/Visual_Studio/Tango.Settings/OLD/DataBase.cs (renamed from Software/Visual_Studio/Tango.Settings/DataBase.cs)0
-rw-r--r--Software/Visual_Studio/Tango.Settings/OLD/Integration.cs (renamed from Software/Visual_Studio/Tango.Settings/Integration.cs)0
-rw-r--r--Software/Visual_Studio/Tango.Settings/OLD/MachineStudioSettings/DeveloperModule.cs (renamed from Software/Visual_Studio/Tango.Settings/MachineStudioSettings/DeveloperModule.cs)0
-rw-r--r--Software/Visual_Studio/Tango.Settings/OLD/MachineStudioSettings/MachineStudio.cs (renamed from Software/Visual_Studio/Tango.Settings/MachineStudioSettings/MachineStudio.cs)0
-rw-r--r--Software/Visual_Studio/Tango.Settings/OLD/MachineStudioSettings/StubsModule.cs (renamed from Software/Visual_Studio/Tango.Settings/MachineStudioSettings/StubsModule.cs)0
-rw-r--r--Software/Visual_Studio/Tango.Settings/OLD/MachineStudioSettings/SynchronizationModule.cs (renamed from Software/Visual_Studio/Tango.Settings/MachineStudioSettings/SynchronizationModule.cs)0
-rw-r--r--Software/Visual_Studio/Tango.Settings/OLD/MachineStudioSettings/TechnicianModule.cs (renamed from Software/Visual_Studio/Tango.Settings/MachineStudioSettings/TechnicianModule.cs)0
-rw-r--r--Software/Visual_Studio/Tango.Settings/OLD/SettingsCollection.cs (renamed from Software/Visual_Studio/Tango.Settings/SettingsCollection.cs)0
-rw-r--r--Software/Visual_Studio/Tango.Settings/OLD/SettingsManager.cs162
-rw-r--r--Software/Visual_Studio/Tango.Settings/OLD/StubsUI.cs (renamed from Software/Visual_Studio/Tango.Settings/StubsUI.cs)0
-rw-r--r--Software/Visual_Studio/Tango.Settings/SettingsBase.cs28
-rw-r--r--Software/Visual_Studio/Tango.Settings/SettingsManager.cs190
-rw-r--r--Software/Visual_Studio/Tango.Settings/Tango.Settings.csproj24
-rw-r--r--Software/Visual_Studio/Tango.Settings/packages.config4
-rw-r--r--Software/Visual_Studio/Tango.Synchronization/Remote/RemoteDBSynchronizer.cs3
-rw-r--r--Software/Visual_Studio/Tango.UnitTesting/DAL_TST.cs5
-rw-r--r--Software/Visual_Studio/Tango.UnitTesting/Synchronization_TST.cs5
-rw-r--r--Software/Visual_Studio/Utilities/Tango.DBObservablesGenerator.CLI/ObservablesGenerator.cs5
-rw-r--r--Software/Visual_Studio/Utilities/Tango.SQLiteGenerator.CLI/Program.cs3
-rw-r--r--Software/Visual_Studio/Utilities/Tango.SQLiteGenerator.CLI/Tango.SQLiteGenerator.CLI.csproj4
-rw-r--r--Software/Visual_Studio/Utilities/Tango.Stubs.UI/StubsUISettings.cs42
-rw-r--r--Software/Visual_Studio/Utilities/Tango.Stubs.UI/Tango.Stubs.UI.csproj1
-rw-r--r--Software/Visual_Studio/Utilities/Tango.Stubs.UI/ViewModels/MainViewVM.cs23
79 files changed, 770 insertions, 1072 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)
{
diff --git a/Software/Visual_Studio/PanelPC/Tango.PanelPC.UI/App.config b/Software/Visual_Studio/PanelPC/Tango.PanelPC.UI/App.config
index 8324aa6ff..f2af62f53 100644
--- a/Software/Visual_Studio/PanelPC/Tango.PanelPC.UI/App.config
+++ b/Software/Visual_Studio/PanelPC/Tango.PanelPC.UI/App.config
@@ -1,6 +1,14 @@
-<?xml version="1.0" encoding="utf-8" ?>
+<?xml version="1.0" encoding="utf-8"?>
<configuration>
<startup>
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.6" />
</startup>
+ <runtime>
+ <assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
+ <dependentAssembly>
+ <assemblyIdentity name="System.Reactive.Core" publicKeyToken="94bc3704cddfc263" culture="neutral" />
+ <bindingRedirect oldVersion="0.0.0.0-3.0.3000.0" newVersion="3.0.3000.0" />
+ </dependentAssembly>
+ </assemblyBinding>
+ </runtime>
</configuration> \ No newline at end of file
diff --git a/Software/Visual_Studio/Tango.BL/ObservablesContextExtension.cs b/Software/Visual_Studio/Tango.BL/ObservablesContextExtension.cs
index 584e6c783..83c8ab69b 100644
--- a/Software/Visual_Studio/Tango.BL/ObservablesContextExtension.cs
+++ b/Software/Visual_Studio/Tango.BL/ObservablesContextExtension.cs
@@ -5,6 +5,7 @@ using System.IO;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
+using Tango.Core;
using Tango.Settings;
namespace Tango.BL
@@ -55,7 +56,7 @@ namespace Tango.BL
/// <returns></returns>
public static ObservablesContext CreateDefault()
{
- return new ObservablesContext(SettingsManager.Default.DataBase.SQLServerAddress);
+ return new ObservablesContext(SettingsManager.Default.GetOrCreate<CoreSettings>().SQLServerAddress);
}
/// <summary>
diff --git a/Software/Visual_Studio/Tango.Core/CoreSettings.cs b/Software/Visual_Studio/Tango.Core/CoreSettings.cs
new file mode 100644
index 000000000..82261183a
--- /dev/null
+++ b/Software/Visual_Studio/Tango.Core/CoreSettings.cs
@@ -0,0 +1,25 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+using Tango.Settings;
+
+namespace Tango.Core
+{
+ public class CoreSettings : SettingsBase
+ {
+ /// <summary>
+ /// Gets or sets the SQL server address.
+ /// </summary>
+ public String SQLServerAddress { get; set; }
+
+ /// <summary>
+ /// Initializes a new instance of the <see cref="CoreSettings"/> class.
+ /// </summary>
+ public CoreSettings()
+ {
+ SQLServerAddress = "twine01\\SQLTWINE";
+ }
+ }
+}
diff --git a/Software/Visual_Studio/Tango.Core/Tango.Core.csproj b/Software/Visual_Studio/Tango.Core/Tango.Core.csproj
index 97fbe7fd8..b68925208 100644
--- a/Software/Visual_Studio/Tango.Core/Tango.Core.csproj
+++ b/Software/Visual_Studio/Tango.Core/Tango.Core.csproj
@@ -63,6 +63,7 @@
</Compile>
<Compile Include="Commands\RelayCommand.cs" />
<Compile Include="ConcurrentList.cs" />
+ <Compile Include="CoreSettings.cs" />
<Compile Include="Cryptography\ICryptographer.cs" />
<Compile Include="Cryptography\Rfc2898Cryptographer.cs" />
<Compile Include="DI\ITangoIOC.cs" />
@@ -121,6 +122,10 @@
<Project>{22f87980-e990-4686-be81-be63d562c4d5}</Project>
<Name>Tango.Serialization</Name>
</ProjectReference>
+ <ProjectReference Include="..\Tango.Settings\Tango.Settings.csproj">
+ <Project>{d8f1ad85-526a-4f50-b6dc-d437af63d8d8}</Project>
+ <Name>Tango.Settings</Name>
+ </ProjectReference>
</ItemGroup>
<ItemGroup>
<EmbeddedResource Include="Properties\Resources.resx">
diff --git a/Software/Visual_Studio/Tango.DAL.Remote/Partials/RemoteDB.cs b/Software/Visual_Studio/Tango.DAL.Remote/Partials/RemoteDB.cs
index 96ddf9550..3508e1137 100644
--- a/Software/Visual_Studio/Tango.DAL.Remote/Partials/RemoteDB.cs
+++ b/Software/Visual_Studio/Tango.DAL.Remote/Partials/RemoteDB.cs
@@ -4,6 +4,7 @@ using System.Data.Entity;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
+using Tango.Core;
using Tango.Settings;
namespace Tango.DAL.Remote.DB
@@ -48,7 +49,7 @@ namespace Tango.DAL.Remote.DB
/// <returns></returns>
public static RemoteDB CreateDefault()
{
- return new RemoteDB(SettingsManager.Default.DataBase.SQLServerAddress, false);
+ return new RemoteDB(SettingsManager.Default.GetOrCreate<CoreSettings>().SQLServerAddress, false);
}
}
}
diff --git a/Software/Visual_Studio/Tango.Integration/IntegrationSettings.cs b/Software/Visual_Studio/Tango.Integration/IntegrationSettings.cs
new file mode 100644
index 000000000..778a03d7b
--- /dev/null
+++ b/Software/Visual_Studio/Tango.Integration/IntegrationSettings.cs
@@ -0,0 +1,43 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+using Tango.Settings;
+
+namespace Tango.Integration
+{
+ public class IntegrationSettings : SettingsBase
+ {
+ /// <summary>
+ /// Gets or sets the external bridge service port.
+ /// </summary>
+ public int ExternalBridgeServicePort { get; set; }
+
+ /// <summary>
+ /// Gets or sets the external bridge service discovery port.
+ /// </summary>
+ public int ExternalBridgeServiceDiscoveryPort { get; set; }
+
+ /// <summary>
+ /// Gets or sets the name of the embedded device.
+ /// </summary>
+ public String EmbeddedDeviceName { get; set; }
+
+ /// <summary>
+ /// Gets or sets a value indicating whether filter the detected USB machines via <see cref="EmbeddedDeviceName"/>.
+ /// </summary>
+ public bool FilterExternalBridgeUsbMachines { get; set; }
+
+ /// <summary>
+ /// Initializes a new instance of the <see cref="IntegrationSettings"/> class.
+ /// </summary>
+ public IntegrationSettings()
+ {
+ ExternalBridgeServicePort = 1984;
+ ExternalBridgeServiceDiscoveryPort = 8888;
+ EmbeddedDeviceName = "Tango USB Serial Port";
+ FilterExternalBridgeUsbMachines = true;
+ }
+ }
+}
diff --git a/Software/Visual_Studio/Tango.Integration/Operation/MachineOperator.cs b/Software/Visual_Studio/Tango.Integration/Operation/MachineOperator.cs
index 4ba69cc4c..a01375212 100644
--- a/Software/Visual_Studio/Tango.Integration/Operation/MachineOperator.cs
+++ b/Software/Visual_Studio/Tango.Integration/Operation/MachineOperator.cs
@@ -40,7 +40,7 @@ namespace Tango.Integration.Operation
{
EmbeddedLogManager = new LogManager();
- String folder = SettingsManager.DefaultFolder + "\\embedded logs";
+ String folder = SettingsManager.Default.Folder + "\\embedded logs";
Directory.CreateDirectory(folder);
FileLogger fileLogger = new FileLogger(folder, "embedded") { Enabled = true };
EmbeddedLogManager.RegisterLogger(fileLogger);
diff --git a/Software/Visual_Studio/Tango.Integration/Services/ExternalBridgeScanner.cs b/Software/Visual_Studio/Tango.Integration/Services/ExternalBridgeScanner.cs
index 43ce83b89..dfef25775 100644
--- a/Software/Visual_Studio/Tango.Integration/Services/ExternalBridgeScanner.cs
+++ b/Software/Visual_Studio/Tango.Integration/Services/ExternalBridgeScanner.cs
@@ -30,6 +30,7 @@ namespace Tango.Integration.Services
private Thread _tcpDiscoveryThread;
private Thread _usbDiscoveryThread;
private UdpClient _server;
+ private IntegrationSettings _settings;
private ObservableCollection<IExternalBridgeClient> _availableMachines;
/// <summary>
@@ -56,7 +57,8 @@ namespace Tango.Integration.Services
/// </summary>
public ExternalBridgeScanner()
{
- _server = new UdpClient(SettingsManager.Default.Integration.ExternalBridgeServiceDiscoveryPort);
+ _settings = SettingsManager.Default.GetOrCreate<IntegrationSettings>();
+ _server = new UdpClient(_settings.ExternalBridgeServiceDiscoveryPort);
AvailableMachines = new ObservableCollection<IExternalBridgeClient>();
}
@@ -102,7 +104,7 @@ namespace Tango.Integration.Services
{
foreach (var device in COMPortInfo.EnumerateComPorts())
{
- if (device.Description.Contains(SettingsManager.Default.Integration.EmbeddedDeviceName) || !SettingsManager.Default.Integration.FilterExternalBridgeUsbMachines)
+ if (device.Description.Contains(_settings.EmbeddedDeviceName) || !_settings.FilterExternalBridgeUsbMachines)
{
if (!AvailableMachines.OfType<ExternalBridgeUsbClient>().ToList().Exists(x => x.ComPort == device.Port))
{
diff --git a/Software/Visual_Studio/Tango.Integration/Services/ExternalBridgeTcpClient.cs b/Software/Visual_Studio/Tango.Integration/Services/ExternalBridgeTcpClient.cs
index 12f3f1b64..579484418 100644
--- a/Software/Visual_Studio/Tango.Integration/Services/ExternalBridgeTcpClient.cs
+++ b/Software/Visual_Studio/Tango.Integration/Services/ExternalBridgeTcpClient.cs
@@ -71,7 +71,7 @@ namespace Tango.Integration.Services
public override async Task Connect()
{
await Disconnect();
- Adapter = new TcpTransportAdapter(IPAddress, SettingsManager.Default.Integration.ExternalBridgeServicePort);
+ Adapter = new TcpTransportAdapter(IPAddress, SettingsManager.Default.GetOrCreate<IntegrationSettings>().ExternalBridgeServicePort);
await base.Connect();
}
diff --git a/Software/Visual_Studio/Tango.Integration/Tango.Integration.csproj b/Software/Visual_Studio/Tango.Integration/Tango.Integration.csproj
index 29f5a8b5e..32ad179a9 100644
--- a/Software/Visual_Studio/Tango.Integration/Tango.Integration.csproj
+++ b/Software/Visual_Studio/Tango.Integration/Tango.Integration.csproj
@@ -82,6 +82,7 @@
<Compile Include="Diagnostics\DiagnosticsTimeCodeChannel.cs" />
<Compile Include="Diagnostics\DiagnosticsTimeCodeChannelFrame.cs" />
<Compile Include="ExtensionMethods\IExternalBridgeClientExtensions.cs" />
+ <Compile Include="IntegrationSettings.cs" />
<Compile Include="Operation\DefaultMachineEventsStateProvider.cs" />
<Compile Include="Operation\EmbeddedLogItem.cs" />
<Compile Include="Operation\IMachineEventsStateProvider.cs" />
diff --git a/Software/Visual_Studio/Tango.Settings/DataBase.cs b/Software/Visual_Studio/Tango.Settings/OLD/DataBase.cs
index 22bbfe9a9..22bbfe9a9 100644
--- a/Software/Visual_Studio/Tango.Settings/DataBase.cs
+++ b/Software/Visual_Studio/Tango.Settings/OLD/DataBase.cs
diff --git a/Software/Visual_Studio/Tango.Settings/Integration.cs b/Software/Visual_Studio/Tango.Settings/OLD/Integration.cs
index d670cad8e..d670cad8e 100644
--- a/Software/Visual_Studio/Tango.Settings/Integration.cs
+++ b/Software/Visual_Studio/Tango.Settings/OLD/Integration.cs
diff --git a/Software/Visual_Studio/Tango.Settings/MachineStudioSettings/DeveloperModule.cs b/Software/Visual_Studio/Tango.Settings/OLD/MachineStudioSettings/DeveloperModule.cs
index 837dfcc2e..837dfcc2e 100644
--- a/Software/Visual_Studio/Tango.Settings/MachineStudioSettings/DeveloperModule.cs
+++ b/Software/Visual_Studio/Tango.Settings/OLD/MachineStudioSettings/DeveloperModule.cs
diff --git a/Software/Visual_Studio/Tango.Settings/MachineStudioSettings/MachineStudio.cs b/Software/Visual_Studio/Tango.Settings/OLD/MachineStudioSettings/MachineStudio.cs
index 6895f30a1..6895f30a1 100644
--- a/Software/Visual_Studio/Tango.Settings/MachineStudioSettings/MachineStudio.cs
+++ b/Software/Visual_Studio/Tango.Settings/OLD/MachineStudioSettings/MachineStudio.cs
diff --git a/Software/Visual_Studio/Tango.Settings/MachineStudioSettings/StubsModule.cs b/Software/Visual_Studio/Tango.Settings/OLD/MachineStudioSettings/StubsModule.cs
index b9263237a..b9263237a 100644
--- a/Software/Visual_Studio/Tango.Settings/MachineStudioSettings/StubsModule.cs
+++ b/Software/Visual_Studio/Tango.Settings/OLD/MachineStudioSettings/StubsModule.cs
diff --git a/Software/Visual_Studio/Tango.Settings/MachineStudioSettings/SynchronizationModule.cs b/Software/Visual_Studio/Tango.Settings/OLD/MachineStudioSettings/SynchronizationModule.cs
index c487fdd42..c487fdd42 100644
--- a/Software/Visual_Studio/Tango.Settings/MachineStudioSettings/SynchronizationModule.cs
+++ b/Software/Visual_Studio/Tango.Settings/OLD/MachineStudioSettings/SynchronizationModule.cs
diff --git a/Software/Visual_Studio/Tango.Settings/MachineStudioSettings/TechnicianModule.cs b/Software/Visual_Studio/Tango.Settings/OLD/MachineStudioSettings/TechnicianModule.cs
index 4f3ced8d7..4f3ced8d7 100644
--- a/Software/Visual_Studio/Tango.Settings/MachineStudioSettings/TechnicianModule.cs
+++ b/Software/Visual_Studio/Tango.Settings/OLD/MachineStudioSettings/TechnicianModule.cs
diff --git a/Software/Visual_Studio/Tango.Settings/SettingsCollection.cs b/Software/Visual_Studio/Tango.Settings/OLD/SettingsCollection.cs
index f72e70647..f72e70647 100644
--- a/Software/Visual_Studio/Tango.Settings/SettingsCollection.cs
+++ b/Software/Visual_Studio/Tango.Settings/OLD/SettingsCollection.cs
diff --git a/Software/Visual_Studio/Tango.Settings/OLD/SettingsManager.cs b/Software/Visual_Studio/Tango.Settings/OLD/SettingsManager.cs
new file mode 100644
index 000000000..7bc15d950
--- /dev/null
+++ b/Software/Visual_Studio/Tango.Settings/OLD/SettingsManager.cs
@@ -0,0 +1,162 @@
+using System;
+using System.Collections.Generic;
+using System.IO;
+using System.Linq;
+using System.Text;
+using System.Threading;
+using System.Threading.Tasks;
+using Tango.Logging;
+using Tango.Serialization;
+
+namespace Tango.Settings
+{
+ /// <summary>
+ /// Represents a settings manager for loading and saving application settings.
+ /// </summary>
+ public static class SettingsManager
+ {
+ private static LogManager LogManager = LogManager.Default;
+
+ /// <summary>
+ /// Gets or sets a value indicating whether the settings manager is initialized.
+ /// </summary>
+ public static bool IsInitialized { get; private set; }
+
+ /// <summary>
+ /// Gets or sets the default settings.
+ /// </summary>
+ /// <value>
+ /// The default.
+ /// </value>
+ public static SettingsCollection Default { get; private set; }
+
+ /// <summary>
+ /// Gets or sets the default file path.
+ /// </summary>
+ /// <value>
+ /// The default file path.
+ /// </value>
+ public static String DefaultFilePath { get; private set; }
+
+ /// <summary>
+ /// Gets or sets the default folder for application settings.
+ /// </summary>
+ public static String DefaultFolder { get; private set; }
+
+ /// <summary>
+ /// Saves application settings to XML file.
+ /// </summary>
+ /// <param name="filePath">The path to the XML file.</param>
+ /// <param name="stCollection">The instance of the SettingsCollection to save.</param>
+ public static void SaveToXML(String filePath, SettingsCollection stCollection)
+ {
+ LogManager.Log("Saving application configuration to " + "'" + filePath + "'");
+ XmlDataSerializer serializer = new XmlDataSerializer();
+ serializer.SerializeToFile<SettingsCollection>(stCollection, filePath);
+ }
+
+ /// <summary>
+ /// Loads application settings from XML file.
+ /// </summary>
+ /// <param name="filePath">The file path.</param>
+ /// <returns></returns>
+ public static SettingsCollection LoadFromXML(String filePath)
+ {
+ LogManager.Log("Loading application configuration from " + "'" + filePath + "'");
+ XmlDataSerializer serialier = new XmlDataSerializer();
+ return serialier.DeserializeFromFile<SettingsCollection>(filePath);
+ }
+
+ /// <summary>
+ /// Saves the default settings.
+ /// </summary>
+ public static void SaveDefaultSettings()
+ {
+ SaveToXML(DefaultFilePath, Default);
+ }
+
+ /// <summary>
+ /// Restores to default.
+ /// </summary>
+ public static void RestoreToDefault()
+ {
+ Default = new SettingsCollection();
+ SaveDefaultSettings();
+ }
+
+ /// <summary>
+ /// Initializes the <see cref="SettingsManager"/> class.
+ /// </summary>
+ static SettingsManager()
+ {
+ Initialize();
+ }
+
+ /// <summary>
+ /// Initializes the settings manager.
+ /// </summary>
+ private static void Initialize()
+ {
+ if (IsInitialized) return;
+
+ IsInitialized = true;
+
+ LogManager.Log("Initializing application configuration...");
+
+ DefaultFilePath = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData), "Twine", "Tango", "Settings.xml");
+ DefaultFolder = Path.GetDirectoryName(DefaultFilePath);
+
+ bool waited = false;
+
+ Retry:
+
+ try
+ {
+ Default = LoadFromXML(DefaultFilePath);
+ }
+ catch (Exception ex)
+ {
+ if (!waited)
+ {
+ LogManager.Log(ex, "Could not load application configuration. Retrying in 1 second...");
+ waited = true;
+ Thread.Sleep(1000);
+ goto Retry;
+ }
+ else
+ {
+ LogManager.Log(ex, "Could not load application configuration.");
+ }
+
+ try
+ {
+ LogManager.Log("Creating application configuration directory structure...");
+ Directory.CreateDirectory(DefaultFolder);
+ }
+ catch (Exception ex2)
+ {
+ LogManager.Log(ex2, "Could not generate directory structure.");
+ }
+ }
+
+ if (Default == null)
+ {
+ Default = new SettingsCollection();
+
+ try
+ {
+ LogManager.Log("Generating default configuration file.");
+ SaveToXML(DefaultFilePath, Default);
+ }
+ catch (Exception ex)
+ {
+ LogManager.Log(ex, "Could not generate default configuration file.");
+ }
+ }
+ else
+ {
+ LogManager.Log("Application configuration loaded successfully.");
+ }
+ }
+ }
+}
diff --git a/Software/Visual_Studio/Tango.Settings/StubsUI.cs b/Software/Visual_Studio/Tango.Settings/OLD/StubsUI.cs
index 9944ffc11..9944ffc11 100644
--- a/Software/Visual_Studio/Tango.Settings/StubsUI.cs
+++ b/Software/Visual_Studio/Tango.Settings/OLD/StubsUI.cs
diff --git a/Software/Visual_Studio/Tango.Settings/SettingsBase.cs b/Software/Visual_Studio/Tango.Settings/SettingsBase.cs
new file mode 100644
index 000000000..29ec767c9
--- /dev/null
+++ b/Software/Visual_Studio/Tango.Settings/SettingsBase.cs
@@ -0,0 +1,28 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace Tango.Settings
+{
+ /// <summary>
+ /// Represents a settings object base class.
+ /// </summary>
+ public abstract class SettingsBase
+ {
+ internal Action SaveAction { get; set; }
+
+ /// <summary>
+ /// Saves settings.
+ /// </summary>
+ /// <exception cref="System.InvalidOperationException">This settings instance is not registered with any settings manager.</exception>
+ public virtual void Save()
+ {
+ if (SaveAction == null)
+ {
+ throw new InvalidOperationException("This settings instance is not registered with any settings manager.");
+ }
+ }
+ }
+}
diff --git a/Software/Visual_Studio/Tango.Settings/SettingsManager.cs b/Software/Visual_Studio/Tango.Settings/SettingsManager.cs
index 7bc15d950..1f0083bb5 100644
--- a/Software/Visual_Studio/Tango.Settings/SettingsManager.cs
+++ b/Software/Visual_Studio/Tango.Settings/SettingsManager.cs
@@ -1,162 +1,128 @@
-using System;
+using Newtonsoft.Json;
+using Newtonsoft.Json.Converters;
+using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Text;
-using System.Threading;
using System.Threading.Tasks;
-using Tango.Logging;
-using Tango.Serialization;
namespace Tango.Settings
{
/// <summary>
- /// Represents a settings manager for loading and saving application settings.
+ /// Represents a settings manager capable of holding a collection of settings objects, saving and loading them using JSON.
/// </summary>
- public static class SettingsManager
+ public class SettingsManager
{
- private static LogManager LogManager = LogManager.Default;
+ #region Singleton
+ private static SettingsManager _default;
/// <summary>
- /// Gets or sets a value indicating whether the settings manager is initialized.
+ /// Gets the default settings manager instance.
/// </summary>
- public static bool IsInitialized { get; private set; }
+ public static SettingsManager Default
+ {
+ get
+ {
+ if (_default == null)
+ {
+ _default = new SettingsManager();
+ }
- /// <summary>
- /// Gets or sets the default settings.
- /// </summary>
- /// <value>
- /// The default.
- /// </value>
- public static SettingsCollection Default { get; private set; }
+ return _default;
+ }
+ }
- /// <summary>
- /// Gets or sets the default file path.
- /// </summary>
- /// <value>
- /// The default file path.
- /// </value>
- public static String DefaultFilePath { get; private set; }
+ #endregion
- /// <summary>
- /// Gets or sets the default folder for application settings.
- /// </summary>
- public static String DefaultFolder { get; private set; }
+ private List<SettingsBase> _settingsCollection;
+ private JsonSerializerSettings _jsonSettings;
+ private bool _loaded;
/// <summary>
- /// Saves application settings to XML file.
+ /// Gets or sets the settings file path.
/// </summary>
- /// <param name="filePath">The path to the XML file.</param>
- /// <param name="stCollection">The instance of the SettingsCollection to save.</param>
- public static void SaveToXML(String filePath, SettingsCollection stCollection)
- {
- LogManager.Log("Saving application configuration to " + "'" + filePath + "'");
- XmlDataSerializer serializer = new XmlDataSerializer();
- serializer.SerializeToFile<SettingsCollection>(stCollection, filePath);
- }
+ public String FilePath { get; protected set; }
/// <summary>
- /// Loads application settings from XML file.
+ /// Gets or sets the settings folder.
/// </summary>
- /// <param name="filePath">The file path.</param>
- /// <returns></returns>
- public static SettingsCollection LoadFromXML(String filePath)
- {
- LogManager.Log("Loading application configuration from " + "'" + filePath + "'");
- XmlDataSerializer serialier = new XmlDataSerializer();
- return serialier.DeserializeFromFile<SettingsCollection>(filePath);
- }
+ public String Folder { get; protected set; }
/// <summary>
- /// Saves the default settings.
+ /// Prevents a default instance of the <see cref="SettingsManager"/> class from being created.
/// </summary>
- public static void SaveDefaultSettings()
+ private SettingsManager()
{
- SaveToXML(DefaultFilePath, Default);
- }
+ FilePath = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData), "Twine", "Tango", "Settings.json");
+ Folder = Path.GetDirectoryName(FilePath);
+ _settingsCollection = new List<SettingsBase>();
- /// <summary>
- /// Restores to default.
- /// </summary>
- public static void RestoreToDefault()
- {
- Default = new SettingsCollection();
- SaveDefaultSettings();
+ _jsonSettings = new JsonSerializerSettings
+ {
+ TypeNameHandling = TypeNameHandling.All,
+ Formatting = Formatting.Indented,
+ };
+
+ _jsonSettings.Converters.Add(new StringEnumConverter(false));
}
- /// <summary>
- /// Initializes the <see cref="SettingsManager"/> class.
- /// </summary>
- static SettingsManager()
+ private void EnsureLoaded()
{
- Initialize();
+ if (!_loaded)
+ {
+ Load();
+ }
}
/// <summary>
- /// Initializes the settings manager.
+ /// Gets or creates the specified settings object type.
/// </summary>
- private static void Initialize()
+ /// <typeparam name="T"></typeparam>
+ /// <returns></returns>
+ public T GetOrCreate<T>() where T : SettingsBase
{
- if (IsInitialized) return;
-
- IsInitialized = true;
+ EnsureLoaded();
- LogManager.Log("Initializing application configuration...");
+ var settings = _settingsCollection.SingleOrDefault(x => x.GetType() == typeof(T)) as T;
- DefaultFilePath = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData), "Twine", "Tango", "Settings.xml");
- DefaultFolder = Path.GetDirectoryName(DefaultFilePath);
-
- bool waited = false;
-
- Retry:
-
- try
+ if (settings == null)
{
- Default = LoadFromXML(DefaultFilePath);
+ settings = Activator.CreateInstance<T>();
+ settings.SaveAction = Save;
+ _settingsCollection.Add(settings);
}
- catch (Exception ex)
- {
- if (!waited)
- {
- LogManager.Log(ex, "Could not load application configuration. Retrying in 1 second...");
- waited = true;
- Thread.Sleep(1000);
- goto Retry;
- }
- else
- {
- LogManager.Log(ex, "Could not load application configuration.");
- }
- try
- {
- LogManager.Log("Creating application configuration directory structure...");
- Directory.CreateDirectory(DefaultFolder);
- }
- catch (Exception ex2)
- {
- LogManager.Log(ex2, "Could not generate directory structure.");
- }
- }
+ return settings;
+ }
- if (Default == null)
+ /// <summary>
+ /// Loads the settings from the <see cref="FilePath"/>.
+ /// </summary>
+ protected virtual void Load()
+ {
+ if (File.Exists(FilePath))
{
- Default = new SettingsCollection();
+ _settingsCollection = JsonConvert.DeserializeObject<List<SettingsBase>>(File.ReadAllText(FilePath), _jsonSettings);
- try
+ foreach (var settings in _settingsCollection)
{
- LogManager.Log("Generating default configuration file.");
- SaveToXML(DefaultFilePath, Default);
+ settings.SaveAction = Save;
}
- catch (Exception ex)
- {
- LogManager.Log(ex, "Could not generate default configuration file.");
- }
- }
- else
- {
- LogManager.Log("Application configuration loaded successfully.");
}
+
+ _loaded = true;
+ }
+
+ /// <summary>
+ /// Saves settings.
+ /// </summary>
+ public virtual void Save()
+ {
+ EnsureLoaded();
+
+ String json = JsonConvert.SerializeObject(_settingsCollection, _jsonSettings);
+ File.WriteAllText(FilePath, json);
}
}
}
diff --git a/Software/Visual_Studio/Tango.Settings/Tango.Settings.csproj b/Software/Visual_Studio/Tango.Settings/Tango.Settings.csproj
index fa9eb1f61..6cfa77c3a 100644
--- a/Software/Visual_Studio/Tango.Settings/Tango.Settings.csproj
+++ b/Software/Visual_Studio/Tango.Settings/Tango.Settings.csproj
@@ -30,6 +30,9 @@
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<ItemGroup>
+ <Reference Include="Newtonsoft.Json, Version=8.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed, processorArchitecture=MSIL">
+ <HintPath>..\packages\Newtonsoft.Json.8.0.3\lib\net45\Newtonsoft.Json.dll</HintPath>
+ </Reference>
<Reference Include="System" />
<Reference Include="System.Core" />
<Reference Include="System.Xml.Linq" />
@@ -43,31 +46,18 @@
<Compile Include="..\Versioning\GlobalVersionInfo.cs">
<Link>GlobalVersionInfo.cs</Link>
</Compile>
- <Compile Include="DataBase.cs" />
- <Compile Include="Integration.cs" />
- <Compile Include="MachineStudioSettings\DeveloperModule.cs" />
- <Compile Include="MachineStudioSettings\MachineStudio.cs" />
- <Compile Include="MachineStudioSettings\StubsModule.cs" />
- <Compile Include="MachineStudioSettings\SynchronizationModule.cs" />
- <Compile Include="MachineStudioSettings\TechnicianModule.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
- <Compile Include="SettingsCollection.cs" />
+ <Compile Include="SettingsBase.cs" />
<Compile Include="SettingsManager.cs" />
- <Compile Include="StubsUI.cs" />
</ItemGroup>
<ItemGroup>
- <ProjectReference Include="..\Tango.Core\Tango.Core.csproj">
- <Project>{a34ee0f0-649d-41c8-8489-b6f1cc6924ee}</Project>
- <Name>Tango.Core</Name>
- </ProjectReference>
<ProjectReference Include="..\Tango.Logging\Tango.Logging.csproj">
<Project>{bc932dbd-7cdb-488c-99e4-f02cf441f55e}</Project>
<Name>Tango.Logging</Name>
</ProjectReference>
- <ProjectReference Include="..\Tango.Serialization\Tango.Serialization.csproj">
- <Project>{22f87980-e990-4686-be81-be63d562c4d5}</Project>
- <Name>Tango.Serialization</Name>
- </ProjectReference>
+ </ItemGroup>
+ <ItemGroup>
+ <None Include="packages.config" />
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
</Project> \ No newline at end of file
diff --git a/Software/Visual_Studio/Tango.Settings/packages.config b/Software/Visual_Studio/Tango.Settings/packages.config
new file mode 100644
index 000000000..92167d083
--- /dev/null
+++ b/Software/Visual_Studio/Tango.Settings/packages.config
@@ -0,0 +1,4 @@
+<?xml version="1.0" encoding="utf-8"?>
+<packages>
+ <package id="Newtonsoft.Json" version="8.0.3" targetFramework="net46" />
+</packages> \ No newline at end of file
diff --git a/Software/Visual_Studio/Tango.Synchronization/Remote/RemoteDBSynchronizer.cs b/Software/Visual_Studio/Tango.Synchronization/Remote/RemoteDBSynchronizer.cs
index 75d28af5b..09f7fe619 100644
--- a/Software/Visual_Studio/Tango.Synchronization/Remote/RemoteDBSynchronizer.cs
+++ b/Software/Visual_Studio/Tango.Synchronization/Remote/RemoteDBSynchronizer.cs
@@ -7,6 +7,7 @@ using remote = Tango.DAL.Remote.DB;
using local = Tango.DAL.Local.DB;
using Tango.Settings;
using Tango.Synchronization.Local;
+using Tango.Core;
namespace Tango.Synchronization.Remote
{
@@ -31,7 +32,7 @@ namespace Tango.Synchronization.Remote
sqlite.ClearDataBase();
}
- using (var remoteDB = new remote.RemoteDB(SettingsManager.Default.DataBase.SQLServerAddress, false))
+ using (var remoteDB = new remote.RemoteDB(SettingsManager.Default.GetOrCreate<CoreSettings>().SQLServerAddress, false))
{
using (var localDB = new local.LocalDB(sqliteDbFile))
{
diff --git a/Software/Visual_Studio/Tango.UnitTesting/DAL_TST.cs b/Software/Visual_Studio/Tango.UnitTesting/DAL_TST.cs
index 88ea53900..df6028b2e 100644
--- a/Software/Visual_Studio/Tango.UnitTesting/DAL_TST.cs
+++ b/Software/Visual_Studio/Tango.UnitTesting/DAL_TST.cs
@@ -3,6 +3,7 @@ using Microsoft.VisualStudio.TestTools.UnitTesting;
using Tango.DAL;
using System.Linq;
using Tango.Settings;
+using Tango.Core;
namespace Tango.UnitTesting
{
@@ -15,7 +16,7 @@ namespace Tango.UnitTesting
{
String guid = Guid.NewGuid().ToString();
- using (var db = new DAL.Remote.DB.RemoteDB(SettingsManager.Default.DataBase.SQLServerAddress, false))
+ using (var db = new DAL.Remote.DB.RemoteDB(SettingsManager.Default.GetOrCreate<CoreSettings>().SQLServerAddress, false))
{
var action = new DAL.Remote.DB.ACTION_TYPES();
action.CODE = 1;
@@ -28,7 +29,7 @@ namespace Tango.UnitTesting
db.SaveChanges();
}
- using (var db = new DAL.Remote.DB.RemoteDB(SettingsManager.Default.DataBase.SQLServerAddress, false))
+ using (var db = new DAL.Remote.DB.RemoteDB(SettingsManager.Default.GetOrCreate<CoreSettings>().SQLServerAddress, false))
{
var action = db.ACTION_TYPES.Single(x => x.GUID == guid);
db.ACTION_TYPES.Remove(action);
diff --git a/Software/Visual_Studio/Tango.UnitTesting/Synchronization_TST.cs b/Software/Visual_Studio/Tango.UnitTesting/Synchronization_TST.cs
index 3b949cf90..5135c5954 100644
--- a/Software/Visual_Studio/Tango.UnitTesting/Synchronization_TST.cs
+++ b/Software/Visual_Studio/Tango.UnitTesting/Synchronization_TST.cs
@@ -8,6 +8,7 @@ using remote = Tango.DAL.Remote.DB;
using local = Tango.DAL.Local.DB;
using Tango.Synchronization.Remote;
using Tango.Settings;
+using Tango.Core;
namespace Tango.UnitTesting
{
@@ -20,7 +21,7 @@ namespace Tango.UnitTesting
{
var console = Helper.InitializeLogging(true);
- using (var remoteDB = new remote.RemoteDB(SettingsManager.Default.DataBase.SQLServerAddress, false))
+ using (var remoteDB = new remote.RemoteDB(SettingsManager.Default.GetOrCreate<CoreSettings>().SQLServerAddress, false))
{
using (var localDB = new local.LocalDB(Helper.GetSQLiteFilePath()))
{
@@ -44,7 +45,7 @@ namespace Tango.UnitTesting
[TestMethod]
public void Generate_Demo_Remote_Machine()
{
- using (var remoteDB = new remote.RemoteDB(SettingsManager.Default.DataBase.SQLServerAddress, false))
+ using (var remoteDB = new remote.RemoteDB(SettingsManager.Default.GetOrCreate<CoreSettings>().SQLServerAddress, false))
{
var organization = new remote.ORGANIZATION()
{
diff --git a/Software/Visual_Studio/Utilities/Tango.DBObservablesGenerator.CLI/ObservablesGenerator.cs b/Software/Visual_Studio/Utilities/Tango.DBObservablesGenerator.CLI/ObservablesGenerator.cs
index 75cfffe50..fbe3af2e5 100644
--- a/Software/Visual_Studio/Utilities/Tango.DBObservablesGenerator.CLI/ObservablesGenerator.cs
+++ b/Software/Visual_Studio/Utilities/Tango.DBObservablesGenerator.CLI/ObservablesGenerator.cs
@@ -12,6 +12,7 @@ using Tango.DAL.Remote.DB;
using Tango.Settings;
using Humanizer;
using System.Globalization;
+using Tango.Core;
namespace Tango.DBObservablesGenerator.CLI
{
@@ -99,7 +100,7 @@ namespace Tango.DBObservablesGenerator.CLI
//Generate Entities...
//Generate Enumerations...
- using (RemoteDB db = new RemoteDB(SettingsManager.Default.DataBase.SQLServerAddress, false))
+ using (RemoteDB db = new RemoteDB(SettingsManager.Default.GetOrCreate<CoreSettings>().SQLServerAddress, false))
{
foreach (var tableProp in db.GetType().GetProperties(BindingFlags.Public | BindingFlags.Instance).Where(x => x.PropertyType.IsGenericType))
{
@@ -266,7 +267,7 @@ namespace Tango.DBObservablesGenerator.CLI
//Generate Entities...
//Generate Enumerations...
- using (RemoteDB db = new RemoteDB(SettingsManager.Default.DataBase.SQLServerAddress, false))
+ using (RemoteDB db = new RemoteDB(SettingsManager.Default.GetOrCreate<CoreSettings>().SQLServerAddress, false))
{
foreach (var tableProp in db.GetType().GetProperties(BindingFlags.Public | BindingFlags.Instance).Where(x => x.PropertyType.IsGenericType))
{
diff --git a/Software/Visual_Studio/Utilities/Tango.SQLiteGenerator.CLI/Program.cs b/Software/Visual_Studio/Utilities/Tango.SQLiteGenerator.CLI/Program.cs
index 242cdcfa9..9c39eeac6 100644
--- a/Software/Visual_Studio/Utilities/Tango.SQLiteGenerator.CLI/Program.cs
+++ b/Software/Visual_Studio/Utilities/Tango.SQLiteGenerator.CLI/Program.cs
@@ -4,6 +4,7 @@ using System.IO;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
+using Tango.Core;
using Tango.DAL.Remote.DB;
using Tango.Settings;
using Tango.Synchronization;
@@ -21,7 +22,7 @@ namespace Tango.SQLiteGenerator.CLI
bool completed = false;
- String connectionString = SettingsManager.Default.DataBase.SQLServerAddress;
+ String connectionString = SettingsManager.Default.GetOrCreate<CoreSettings>().SQLServerAddress;
Console.WriteLine("Connecting to " + connectionString + "...");
diff --git a/Software/Visual_Studio/Utilities/Tango.SQLiteGenerator.CLI/Tango.SQLiteGenerator.CLI.csproj b/Software/Visual_Studio/Utilities/Tango.SQLiteGenerator.CLI/Tango.SQLiteGenerator.CLI.csproj
index 46b458c90..e19a15436 100644
--- a/Software/Visual_Studio/Utilities/Tango.SQLiteGenerator.CLI/Tango.SQLiteGenerator.CLI.csproj
+++ b/Software/Visual_Studio/Utilities/Tango.SQLiteGenerator.CLI/Tango.SQLiteGenerator.CLI.csproj
@@ -57,6 +57,10 @@
<None Include="packages.config" />
</ItemGroup>
<ItemGroup>
+ <ProjectReference Include="..\..\Tango.Core\Tango.Core.csproj">
+ <Project>{a34ee0f0-649d-41c8-8489-b6f1cc6924ee}</Project>
+ <Name>Tango.Core</Name>
+ </ProjectReference>
<ProjectReference Include="..\..\Tango.DAL.Remote\Tango.DAL.Remote.csproj">
<Project>{38197109-8610-4d3f-92b9-16d48df94d7c}</Project>
<Name>Tango.DAL.Remote</Name>
diff --git a/Software/Visual_Studio/Utilities/Tango.Stubs.UI/StubsUISettings.cs b/Software/Visual_Studio/Utilities/Tango.Stubs.UI/StubsUISettings.cs
new file mode 100644
index 000000000..62d77a012
--- /dev/null
+++ b/Software/Visual_Studio/Utilities/Tango.Stubs.UI/StubsUISettings.cs
@@ -0,0 +1,42 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+using Tango.Settings;
+using Tango.Transport.Adapters;
+
+namespace Tango.Stubs.UI
+{
+ public class StubsUISettings : SettingsBase
+ {
+ /// <summary>
+ /// Gets or sets the selected port.
+ /// </summary>
+ public String SelectedPort { get; set; }
+
+ /// <summary>
+ /// Gets or sets the baud rate.
+ /// </summary>
+ public UsbSerialBaudRates BaudRate { get; set; }
+
+ /// <summary>
+ /// Gets or sets the last tabs.
+ /// </summary>
+ public List<String> LastTabs { get; set; }
+
+ /// <summary>
+ /// Gets or sets a value indicating whether [automatic log response].
+ /// </summary>
+ public bool AutoLogResponse { get; set; }
+
+ /// <summary>
+ /// Initializes a new instance of the <see cref="StubsUI"/> class.
+ /// </summary>
+ public StubsUISettings()
+ {
+ BaudRate = UsbSerialBaudRates.BR_9600;
+ LastTabs = new List<string>();
+ }
+ }
+}
diff --git a/Software/Visual_Studio/Utilities/Tango.Stubs.UI/Tango.Stubs.UI.csproj b/Software/Visual_Studio/Utilities/Tango.Stubs.UI/Tango.Stubs.UI.csproj
index 1fb840e90..d4b6391db 100644
--- a/Software/Visual_Studio/Utilities/Tango.Stubs.UI/Tango.Stubs.UI.csproj
+++ b/Software/Visual_Studio/Utilities/Tango.Stubs.UI/Tango.Stubs.UI.csproj
@@ -87,6 +87,7 @@
<EmbeddedResource Include="Examples\RequestTimeout.cs" />
<Compile Include="StubManager.cs" />
<Compile Include="StubOnExecuteParameters.cs" />
+ <Compile Include="StubsUISettings.cs" />
<Compile Include="ViewModels\CodeTabVM.cs" />
<Compile Include="ViewModels\CreateGroupVM.cs" />
<Compile Include="ViewModels\CreateItemVM.cs" />
diff --git a/Software/Visual_Studio/Utilities/Tango.Stubs.UI/ViewModels/MainViewVM.cs b/Software/Visual_Studio/Utilities/Tango.Stubs.UI/ViewModels/MainViewVM.cs
index 3bcdc823f..a2a9cf811 100644
--- a/Software/Visual_Studio/Utilities/Tango.Stubs.UI/ViewModels/MainViewVM.cs
+++ b/Software/Visual_Studio/Utilities/Tango.Stubs.UI/ViewModels/MainViewVM.cs
@@ -32,6 +32,7 @@ namespace Tango.Stubs.UI.ViewModels
private UsbTransportAdapter _adapter; //Holds the USB transport adapter.
private StubManager _stubManager;
private TextBox _logTextBox;
+ private StubsUISettings _settings;
#region Properties
@@ -234,6 +235,8 @@ namespace Tango.Stubs.UI.ViewModels
/// </summary>
public MainViewVM()
{
+ _settings = SettingsManager.Default.GetOrCreate<StubsUISettings>();
+
Examples = new List<ExampleVM>();
CodeTabs = new ObservableCollection<CodeTabVM>();
NewCommand = new RelayCommand(CreateNewTab);
@@ -317,15 +320,15 @@ namespace Tango.Stubs.UI.ViewModels
Ports.Add("COM" + i);
}
- SelectedPort = SettingsManager.Default.StubsUI.SelectedPort != null ? SettingsManager.Default.StubsUI.SelectedPort : Ports.First();
- BaudRate = (UsbSerialBaudRates)SettingsManager.Default.StubsUI.BaudRate;
- AppendLogAuto = SettingsManager.Default.StubsUI.AutoLogResponse;
+ SelectedPort = _settings.SelectedPort != null ? _settings.SelectedPort : Ports.First();
+ BaudRate = _settings.BaudRate;
+ AppendLogAuto = _settings.AutoLogResponse;
Status = "Ready";
- if (SettingsManager.Default.StubsUI.LastTabs.Count > 0)
+ if (_settings.LastTabs.Count > 0)
{
- foreach (var file in SettingsManager.Default.StubsUI.LastTabs)
+ foreach (var file in _settings.LastTabs)
{
if (File.Exists(file))
{
@@ -754,11 +757,11 @@ namespace Tango.Stubs.UI.ViewModels
private void Current_Exit(object sender, ExitEventArgs e)
{
- SettingsManager.Default.StubsUI.AutoLogResponse = AppendLogAuto;
- SettingsManager.Default.StubsUI.SelectedPort = SelectedPort;
- SettingsManager.Default.StubsUI.BaudRate = BaudRate.ToInt32();
- SettingsManager.Default.StubsUI.LastTabs = CodeTabs.Select(x => x.File).ToList();
- SettingsManager.SaveDefaultSettings();
+ _settings.AutoLogResponse = AppendLogAuto;
+ _settings.SelectedPort = SelectedPort;
+ _settings.BaudRate = BaudRate;
+ _settings.LastTabs = CodeTabs.Select(x => x.File).ToList();
+ _settings.Save();
}
private void AppendTextLog(String log)