aboutsummaryrefslogtreecommitdiffstats
path: root/Software
diff options
context:
space:
mode:
authorRoy Ben-Shabat <Roy@Twine-s.com>2018-07-03 17:15:11 +0300
committerRoy Ben-Shabat <Roy@Twine-s.com>2018-07-03 17:15:11 +0300
commit39c49d522d68a591d60aecdeab8149f1bb04415c (patch)
tree380740ed10aed79aa531009703c641158f0938d7 /Software
parent856773f7eafb9d04500ede0cfae9c0e75231418b (diff)
downloadTango-39c49d522d68a591d60aecdeab8149f1bb04415c.tar.gz
Tango-39c49d522d68a591d60aecdeab8149f1bb04415c.zip
Stubs working good on Machine Studio...
Diffstat (limited to 'Software')
-rw-r--r--Software/DB/Tango.mdfbin75497472 -> 75497472 bytes
-rw-r--r--Software/DB/Tango_log.ldfbin1572864 -> 1572864 bytes
-rw-r--r--Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Stubs/ViewModels/MainViewVM.cs2
-rw-r--r--Software/Visual_Studio/Tango.Stubs/ViewModels/StubsViewVM.cs35
-rw-r--r--Software/Visual_Studio/Tango.Stubs/Views/StubsView.xaml.cs5
5 files changed, 25 insertions, 17 deletions
diff --git a/Software/DB/Tango.mdf b/Software/DB/Tango.mdf
index fd19b6140..3d183bcd4 100644
--- a/Software/DB/Tango.mdf
+++ b/Software/DB/Tango.mdf
Binary files differ
diff --git a/Software/DB/Tango_log.ldf b/Software/DB/Tango_log.ldf
index db39d922f..e31a2abc0 100644
--- a/Software/DB/Tango_log.ldf
+++ b/Software/DB/Tango_log.ldf
Binary files differ
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 f222b7584..b1ffd9071 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
@@ -97,7 +97,7 @@ namespace Tango.MachineStudio.Stubs.ViewModels
/// <returns></returns>
public override void OnShuttingDown()
{
-
+ StubsViewVM.SaveSettings();
}
#endregion
diff --git a/Software/Visual_Studio/Tango.Stubs/ViewModels/StubsViewVM.cs b/Software/Visual_Studio/Tango.Stubs/ViewModels/StubsViewVM.cs
index dbcf0887b..64f5a2913 100644
--- a/Software/Visual_Studio/Tango.Stubs/ViewModels/StubsViewVM.cs
+++ b/Software/Visual_Studio/Tango.Stubs/ViewModels/StubsViewVM.cs
@@ -419,8 +419,6 @@ namespace Tango.Stubs.ViewModels
Examples = Examples.OrderBy(x => x.Name).ToList();
- Application.Current.Exit += Current_Exit;
-
LogManager.RegisterLogger(new Logging.FileLogger() { Enabled = true });
LogManager.Log("Application Started!");
}
@@ -546,6 +544,8 @@ namespace Tango.Stubs.ViewModels
File.WriteAllText(SelectedCodeTab.File, SelectedCodeTab.Code);
await Task.Delay(1000);
Status = "Ready";
+
+ SaveSettings();
}
}
}
@@ -567,10 +567,21 @@ namespace Tango.Stubs.ViewModels
SelectedCodeTab.File = dlg.FileName;
await Task.Delay(1000);
Status = "Ready";
+
+ SaveSettings();
}
}
}
+ public void SaveSettings()
+ {
+ _settings.AutoLogResponse = AppendLogAuto;
+ _settings.SelectedPort = SelectedPort;
+ _settings.BaudRate = BaudRate;
+ _settings.LastTabs = CodeTabs.Select(x => x.File).ToList();
+ _settings.Save();
+ }
+
/// <summary>
/// Opens a script from HD.
/// </summary>
@@ -623,7 +634,7 @@ namespace Tango.Stubs.ViewModels
}
catch (Exception ex)
{
- MessageBox.Show(ex.ToString(), "Tango");
+ AppendTextLog(ex.Message);
}
}
@@ -646,6 +657,12 @@ namespace Tango.Stubs.ViewModels
if (SelectedCodeTab.Errors.Count > 0) return;
+ if (MachineOperator == null || MachineOperator.State != TransportComponentState.Connected)
+ {
+ AppendTextLog("Machine operator is not initialized or connected. Could not execute script.");
+ return;
+ }
+
IsRunning = true;
SelectedCodeTab.IsRunning = true;
_logTextBox.Text = (DateTime.Now.ToTimeString() + ": ") + "Executing script '" + SelectedCodeTab.Title + "'..." + Environment.NewLine;
@@ -687,7 +704,6 @@ namespace Tango.Stubs.ViewModels
{
IsRunning = false;
SelectedCodeTab.IsRunning = false;
- MessageBox.Show(ex.Message, "Tango");
}
});
}
@@ -807,17 +823,6 @@ namespace Tango.Stubs.ViewModels
Status = "Completed";
}
- private void Current_Exit(object sender, ExitEventArgs e)
- {
- LogManager.OverrideQueue = true;
- LogManager.Log("Application Terminated");
- _settings.AutoLogResponse = AppendLogAuto;
- _settings.SelectedPort = SelectedPort;
- _settings.BaudRate = BaudRate;
- _settings.LastTabs = CodeTabs.Select(x => x.File).ToList();
- _settings.Save();
- }
-
private void AppendTextLog(String log)
{
LogManager.Log(log);
diff --git a/Software/Visual_Studio/Tango.Stubs/Views/StubsView.xaml.cs b/Software/Visual_Studio/Tango.Stubs/Views/StubsView.xaml.cs
index 0f772f4ba..8c0619fdf 100644
--- a/Software/Visual_Studio/Tango.Stubs/Views/StubsView.xaml.cs
+++ b/Software/Visual_Studio/Tango.Stubs/Views/StubsView.xaml.cs
@@ -34,7 +34,10 @@ namespace Tango.Stubs.Views
_vm = DataContext as StubsViewVM;
_vm.SetLogTextBox(txtLog);
-
+ var source = tabControl.ItemsSource;
+ tabControl.ItemsSource = null;
+ tabControl.ItemsSource = source;
+ tabControl.SelectedIndex = 0;
};
}