From b934b152eea671fa06678baa0cdf7f8811e6d2d9 Mon Sep 17 00:00:00 2001 From: Roy Date: Wed, 14 Feb 2018 22:51:52 +0200 Subject: MERGE. --- .../DataCaptureModule.cs | 84 ++++++ .../Images/capture-device.png | Bin 0 -> 1812 bytes .../Images/data-capture.jpg | Bin 0 -> 121309 bytes .../Images/recordings.png | Bin 0 -> 858 bytes .../Images/tape.png | Bin 0 -> 713 bytes .../Images/video-frame.png | Bin 0 -> 97254 bytes .../Properties/AssemblyInfo.cs | 18 ++ .../Properties/Resources.Designer.cs | 62 +++++ .../Properties/Resources.resx | 117 ++++++++ .../Properties/Settings.Designer.cs | 30 +++ .../Properties/Settings.settings | 7 + .../Recording/DataRecording.cs | 37 +++ .../Tango.MachineStudio.DataCapture.csproj | 174 ++++++++++++ .../ViewModelLocator.cs | 33 +++ .../ViewModels/MainViewVM.cs | 297 +++++++++++++++++++++ .../Views/MainView.xaml | 250 +++++++++++++++++ .../Views/MainView.xaml.cs | 28 ++ .../Views/RecordingBarView.xaml | 50 ++++ .../Views/RecordingBarView.xaml.cs | 28 ++ .../packages.config | 8 + .../Converters/OneToPercentConverter.cs | 23 ++ .../Converters/TechIosToDigitalInsConverter.cs | 35 +++ .../Converters/TechIosToDigitalOutsConverter.cs | 35 +++ .../Editors/DigitalInElementEditor.xaml | 92 +++++++ .../Editors/DigitalInElementEditor.xaml.cs | 90 +++++++ .../Editors/DigitalOutElementEditor.xaml | 103 +++++++ .../Editors/DigitalOutElementEditor.xaml.cs | 90 +++++++ .../Images/digital-in.png | Bin 0 -> 2082 bytes .../PropertiesTemplates/DigitalInTemplate.xaml | 33 +++ .../PropertiesTemplates/DigitalInTemplate.xaml.cs | 28 ++ .../PropertiesTemplates/DigitalOutTemplate.xaml | 33 +++ .../PropertiesTemplates/DigitalOutTemplate.xaml.cs | 28 ++ .../TechItems/DigitalInItem.cs | 73 +++++ .../TechItems/DigitalOutItem.cs | 98 +++++++ .../TechItems/TechItemAttribute.cs | 29 ++ 35 files changed, 2013 insertions(+) create mode 100644 Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.DataCapture/DataCaptureModule.cs create mode 100644 Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.DataCapture/Images/capture-device.png create mode 100644 Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.DataCapture/Images/data-capture.jpg create mode 100644 Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.DataCapture/Images/recordings.png create mode 100644 Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.DataCapture/Images/tape.png create mode 100644 Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.DataCapture/Images/video-frame.png create mode 100644 Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.DataCapture/Properties/AssemblyInfo.cs create mode 100644 Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.DataCapture/Properties/Resources.Designer.cs create mode 100644 Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.DataCapture/Properties/Resources.resx create mode 100644 Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.DataCapture/Properties/Settings.Designer.cs create mode 100644 Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.DataCapture/Properties/Settings.settings create mode 100644 Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.DataCapture/Recording/DataRecording.cs create mode 100644 Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.DataCapture/Tango.MachineStudio.DataCapture.csproj create mode 100644 Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.DataCapture/ViewModelLocator.cs create mode 100644 Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.DataCapture/ViewModels/MainViewVM.cs create mode 100644 Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.DataCapture/Views/MainView.xaml create mode 100644 Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.DataCapture/Views/MainView.xaml.cs create mode 100644 Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.DataCapture/Views/RecordingBarView.xaml create mode 100644 Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.DataCapture/Views/RecordingBarView.xaml.cs create mode 100644 Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.DataCapture/packages.config create mode 100644 Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Developer/Converters/OneToPercentConverter.cs create mode 100644 Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/Converters/TechIosToDigitalInsConverter.cs create mode 100644 Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/Converters/TechIosToDigitalOutsConverter.cs create mode 100644 Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/Editors/DigitalInElementEditor.xaml create mode 100644 Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/Editors/DigitalInElementEditor.xaml.cs create mode 100644 Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/Editors/DigitalOutElementEditor.xaml create mode 100644 Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/Editors/DigitalOutElementEditor.xaml.cs create mode 100644 Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/Images/digital-in.png create mode 100644 Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/PropertiesTemplates/DigitalInTemplate.xaml create mode 100644 Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/PropertiesTemplates/DigitalInTemplate.xaml.cs create mode 100644 Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/PropertiesTemplates/DigitalOutTemplate.xaml create mode 100644 Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/PropertiesTemplates/DigitalOutTemplate.xaml.cs create mode 100644 Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/TechItems/DigitalInItem.cs create mode 100644 Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/TechItems/DigitalOutItem.cs create mode 100644 Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/TechItems/TechItemAttribute.cs (limited to 'Software/Visual_Studio/MachineStudio/Modules') diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.DataCapture/DataCaptureModule.cs b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.DataCapture/DataCaptureModule.cs new file mode 100644 index 000000000..ee650dc13 --- /dev/null +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.DataCapture/DataCaptureModule.cs @@ -0,0 +1,84 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using System.Windows; +using System.Windows.Media.Imaging; +using Tango.Integration.Observables; +using Tango.MachineStudio.Common; +using Tango.MachineStudio.DataCapture.Views; +using Tango.SharedUI.Helpers; + +namespace Tango.MachineStudio.DataCapture +{ + /// + /// Represents the machine studio data capturing and playing module. + /// + /// + public class DataCaptureModule : StudioModuleBase + { + /// + /// Gets the module name. + /// + public override string Name + { + get + { + return "Data Capture"; + } + } + + /// + /// Gets the module description. + /// + public override string Description + { + get + { + return "Capture and synchronize diagnostics machine data with video capturing devices for later analysis"; + } + } + + /// + /// Gets the module cover image. + /// + public override BitmapSource Image + { + get + { + return ResourceHelper.GetImageFromResources("Images/data-capture.jpg"); + } + } + + /// + /// Gets the module entry point view. + /// + public override FrameworkElement MainView + { + get + { + return new MainView(); + } + } + + /// + /// Gets the permission required to see and load this module. + /// + public override Permissions Permission + { + get + { + return Permissions.RunTechnicianModule; + } + } + + /// + /// Performs application-defined tasks associated with freeing, releasing, or resetting unmanaged resources. + /// + public override void Dispose() + { + + } + } +} diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.DataCapture/Images/capture-device.png b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.DataCapture/Images/capture-device.png new file mode 100644 index 000000000..5f04b660a Binary files /dev/null and b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.DataCapture/Images/capture-device.png differ diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.DataCapture/Images/data-capture.jpg b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.DataCapture/Images/data-capture.jpg new file mode 100644 index 000000000..87524f07a Binary files /dev/null and b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.DataCapture/Images/data-capture.jpg differ diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.DataCapture/Images/recordings.png b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.DataCapture/Images/recordings.png new file mode 100644 index 000000000..a965c62af Binary files /dev/null and b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.DataCapture/Images/recordings.png differ diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.DataCapture/Images/tape.png b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.DataCapture/Images/tape.png new file mode 100644 index 000000000..8a4739b23 Binary files /dev/null and b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.DataCapture/Images/tape.png differ diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.DataCapture/Images/video-frame.png b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.DataCapture/Images/video-frame.png new file mode 100644 index 000000000..9c29dc438 Binary files /dev/null and b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.DataCapture/Images/video-frame.png differ diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.DataCapture/Properties/AssemblyInfo.cs b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.DataCapture/Properties/AssemblyInfo.cs new file mode 100644 index 000000000..0fd6e93b2 --- /dev/null +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.DataCapture/Properties/AssemblyInfo.cs @@ -0,0 +1,18 @@ +using System.Reflection; +using System.Resources; +using System.Runtime.CompilerServices; +using System.Runtime.InteropServices; +using System.Windows; + +[assembly: AssemblyTitle("Tango - Machine Studio Data Capturing Module")] + +[assembly: ComVisible(false)] + +[assembly:ThemeInfo( + ResourceDictionaryLocation.None, //where theme specific resource dictionaries are located + //(used if a resource is not found in the page, + // or application resource dictionaries) + ResourceDictionaryLocation.SourceAssembly //where the generic resource dictionary is located + //(used if a resource is not found in the page, + // app, or any theme specific resource dictionaries) +)] diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.DataCapture/Properties/Resources.Designer.cs b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.DataCapture/Properties/Resources.Designer.cs new file mode 100644 index 000000000..fdd6d78b8 --- /dev/null +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.DataCapture/Properties/Resources.Designer.cs @@ -0,0 +1,62 @@ +//------------------------------------------------------------------------------ +// +// This code was generated by a tool. +// Runtime Version:4.0.30319.42000 +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +// +//------------------------------------------------------------------------------ + +namespace Tango.MachineStudio.DataCapture.Properties { + + + /// + /// A strongly-typed resource class, for looking up localized strings, etc. + /// + // This class was auto-generated by the StronglyTypedResourceBuilder + // class via a tool like ResGen or Visual Studio. + // To add or remove a member, edit your .ResX file then rerun ResGen + // with the /str option, or rebuild your VS project. + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "4.0.0.0")] + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] + internal class Resources { + + private static global::System.Resources.ResourceManager resourceMan; + + private static global::System.Globalization.CultureInfo resourceCulture; + + [global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")] + internal Resources() { + } + + /// + /// Returns the cached ResourceManager instance used by this class. + /// + [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] + internal static global::System.Resources.ResourceManager ResourceManager { + get { + if ((resourceMan == null)) { + global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("Tango.MachineStudio.DataCapture.Properties.Resources", typeof(Resources).Assembly); + resourceMan = temp; + } + return resourceMan; + } + } + + /// + /// Overrides the current thread's CurrentUICulture property for all + /// resource lookups using this strongly typed resource class. + /// + [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] + internal static global::System.Globalization.CultureInfo Culture { + get { + return resourceCulture; + } + set { + resourceCulture = value; + } + } + } +} diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.DataCapture/Properties/Resources.resx b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.DataCapture/Properties/Resources.resx new file mode 100644 index 000000000..af7dbebba --- /dev/null +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.DataCapture/Properties/Resources.resx @@ -0,0 +1,117 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 2.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + \ No newline at end of file diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.DataCapture/Properties/Settings.Designer.cs b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.DataCapture/Properties/Settings.Designer.cs new file mode 100644 index 000000000..8a9ab67ad --- /dev/null +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.DataCapture/Properties/Settings.Designer.cs @@ -0,0 +1,30 @@ +//------------------------------------------------------------------------------ +// +// This code was generated by a tool. +// Runtime Version:4.0.30319.42000 +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +// +//------------------------------------------------------------------------------ + +namespace Tango.MachineStudio.DataCapture.Properties +{ + + + [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "11.0.0.0")] + internal sealed partial class Settings : global::System.Configuration.ApplicationSettingsBase + { + + private static Settings defaultInstance = ((Settings)(global::System.Configuration.ApplicationSettingsBase.Synchronized(new Settings()))); + + public static Settings Default + { + get + { + return defaultInstance; + } + } + } +} diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.DataCapture/Properties/Settings.settings b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.DataCapture/Properties/Settings.settings new file mode 100644 index 000000000..033d7a5e9 --- /dev/null +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.DataCapture/Properties/Settings.settings @@ -0,0 +1,7 @@ + + + + + + + \ No newline at end of file diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.DataCapture/Recording/DataRecording.cs b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.DataCapture/Recording/DataRecording.cs new file mode 100644 index 000000000..a191c244e --- /dev/null +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.DataCapture/Recording/DataRecording.cs @@ -0,0 +1,37 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using Tango.Core; + +namespace Tango.MachineStudio.DataCapture.Recording +{ + public class DataRecording : ExtendedObject + { + private DateTime _date; + + public DateTime Date + { + get { return _date; } + set { _date = value; RaisePropertyChangedAuto(); } + } + + private String _name; + + public String Name + { + get { return _name; } + set { _name = value; RaisePropertyChangedAuto(); } + } + + private String _file; + + public String FilePath + { + get { return _file; } + set { _file = value; RaisePropertyChangedAuto(); } + } + + } +} diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.DataCapture/Tango.MachineStudio.DataCapture.csproj b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.DataCapture/Tango.MachineStudio.DataCapture.csproj new file mode 100644 index 000000000..1c13be809 --- /dev/null +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.DataCapture/Tango.MachineStudio.DataCapture.csproj @@ -0,0 +1,174 @@ + + + + + Debug + AnyCPU + {FC337A7F-1214-41D8-9992-78092A3B961E} + library + Tango.MachineStudio.DataCapture + Tango.MachineStudio.DataCapture + v4.6 + 512 + {60dc8134-eba5-43b8-bcc9-bb4bc16c2548};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC} + 4 + + + true + full + false + ..\..\..\Build\Debug\ + DEBUG;TRACE + prompt + 4 + + + pdbonly + true + bin\Release\ + TRACE + prompt + 4 + + + + ..\..\..\packages\MvvmLightLibs.5.3.0.0\lib\net45\GalaSoft.MvvmLight.dll + + + ..\..\..\packages\MvvmLightLibs.5.3.0.0\lib\net45\GalaSoft.MvvmLight.Extras.dll + + + ..\..\..\packages\MvvmLightLibs.5.3.0.0\lib\net45\GalaSoft.MvvmLight.Platform.dll + + + ..\..\..\packages\MahApps.Metro.1.5.0\lib\net45\MahApps.Metro.dll + + + ..\..\..\packages\MaterialDesignColors.1.1.2\lib\net45\MaterialDesignColors.dll + + + ..\..\..\packages\MaterialDesignThemes.2.3.1.953\lib\net45\MaterialDesignThemes.Wpf.dll + + + ..\..\..\packages\CommonServiceLocator.1.3\lib\portable-net4+sl5+netcore45+wpa81+wp8\Microsoft.Practices.ServiceLocation.dll + + + + + ..\..\..\packages\MahApps.Metro.1.5.0\lib\net45\System.Windows.Interactivity.dll + + + + + + + + + 4.0 + + + + + + + + + + + MainView.xaml + + + GlobalVersionInfo.cs + + + + RecordingBarView.xaml + + + Designer + MSBuild:Compile + + + Designer + MSBuild:Compile + + + + + Code + + + True + True + Resources.resx + + + True + Settings.settings + True + + + ResXFileCodeGenerator + Resources.Designer.cs + + + + SettingsSingleFileGenerator + Settings.Designer.cs + + + + + {a34ee0f0-649d-41c8-8489-b6f1cc6924ee} + Tango.Core + + + {4206ac58-3b57-4699-8835-90bf6db01a61} + Tango.Integration + + + {bc932dbd-7cdb-488c-99e4-f02cf441f55e} + Tango.Logging + + + {e4927038-348d-4295-aaf4-861c58cb3943} + Tango.PMR + + + {d8f1ad85-526a-4f50-b6dc-d437af63d8d8} + Tango.Settings + + + {8491d07b-c1f6-4b62-a412-41b9fd2d6538} + Tango.SharedUI + + + {74e700b0-1156-4126-be40-ee450d3c3026} + Tango.Transport + + + {9652f972-2bd1-4283-99cb-fc6240434c17} + Tango.Video + + + {cb0b0aa2-bb24-4bca-a720-45e397684e12} + Tango.MachineStudio.Common + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.DataCapture/ViewModelLocator.cs b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.DataCapture/ViewModelLocator.cs new file mode 100644 index 000000000..98c5db8fe --- /dev/null +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.DataCapture/ViewModelLocator.cs @@ -0,0 +1,33 @@ +using GalaSoft.MvvmLight; +using GalaSoft.MvvmLight.Ioc; +using Microsoft.Practices.ServiceLocation; +using Tango.MachineStudio.DataCapture.ViewModels; +using Tango.MachineStudio.DataCapture.Views; + +namespace Tango.MachineStudio.DataCapture +{ + /// + /// This class contains static references to all the view models in the + /// application and provides an entry point for the bindings. + /// + public static class ViewModelLocator + { + /// + /// Initializes a new instance of the ViewModelLocator class. + /// + static ViewModelLocator() + { + ServiceLocator.SetLocatorProvider(() => SimpleIoc.Default); + + SimpleIoc.Default.Register(); + } + + public static MainViewVM MainViewVM + { + get + { + return ServiceLocator.Current.GetInstance(); + } + } + } +} \ No newline at end of file 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 new file mode 100644 index 000000000..b63ee51d0 --- /dev/null +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.DataCapture/ViewModels/MainViewVM.cs @@ -0,0 +1,297 @@ +using System; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.IO; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using System.Windows.Controls; +using Tango.Core.Commands; +using Tango.Integration.Diagnostics; +using Tango.Integration.Operators; +using Tango.MachineStudio.Common.Diagnostics; +using Tango.MachineStudio.Common.Notifications; +using Tango.MachineStudio.Common.StudioApplication; +using Tango.MachineStudio.Common.Video; +using Tango.MachineStudio.DataCapture.Recording; +using Tango.MachineStudio.DataCapture.Views; +using Tango.PMR.Diagnostics; +using Tango.Settings; +using Tango.SharedUI; +using Tango.Video.DirectCapture; + +namespace Tango.MachineStudio.DataCapture.ViewModels +{ + /// + /// Represents the data capture main view, view model. + /// + /// + public class MainViewVM : ViewModel + { + private INotificationProvider _notification; + private IStudioApplicationManager _applicationManager; + private IDiagnosticsFrameProvider _frameProvider; + private String _recordingsFolder; + + #region Properties + + private ObservableCollection _recordings; + /// + /// Gets or sets the recordings collection. + /// + public ObservableCollection Recordings + { + get { return _recordings; } + set { _recordings = value; RaisePropertyChangedAuto(); } + } + + private DataRecording _selectedRecording; + /// + /// Gets or sets the selected recording. + /// + public DataRecording SelectedRecording + { + get { return _selectedRecording; } + set { _selectedRecording = value; RaisePropertyChangedAuto(); } + } + + /// + /// Gets or sets the video capture provider. + /// + public IVideoCaptureProvider VideoCaptureProvider { get; set; } + + private DiagnosticsFileRecorder _recorder; + /// + /// Gets or sets the diagnostics file recorder. + /// + public DiagnosticsFileRecorder Recorder + { + get { return _recorder; } + set { _recorder = value; RaisePropertyChangedAuto(); } + } + + private DiagnosticsFilePlayer _player; + /// + /// Gets or sets the diagnostics file player. + /// + public DiagnosticsFilePlayer Player + { + get { return _player; } + set { _player = value; RaisePropertyChangedAuto(); } + } + + /// + /// Gets or sets the machine operator. + /// + public IMachineOperator MachineOperator { get; set; } + + #endregion + + #region Commands + + /// + /// Gets or sets the remove recording command. + /// + public RelayCommand RemoveRecordingCommand { get; set; } + + /// + /// Gets or sets the toggle camera command. + /// + public RelayCommand ToggleCameraCommand { get; set; } + + /// + /// Gets or sets the media recording command. + /// + public RelayCommand MediaRecordingCommand { get; set; } + + /// + /// Gets or sets the media stop command. + /// + public RelayCommand MediaStopCommand { get; set; } + + /// + /// Gets or sets the media toggle play pause command. + /// + public RelayCommand MediaTogglePlayPauseCommand { get; set; } + + /// + /// Gets or sets the media play pause command. + /// + public RelayCommand MediaPlayPauseCommand { get; set; } + + #endregion + + #region Constructors + + /// + /// Initializes a new instance of the class. + /// + public MainViewVM(IVideoCaptureProvider videoCaptureProvider, INotificationProvider notification, IStudioApplicationManager applicationManager, IDiagnosticsFrameProvider frameProvider) + { + _notification = notification; + _applicationManager = applicationManager; + _frameProvider = frameProvider; + + Recorder = new DiagnosticsFileRecorder(); + Player = new DiagnosticsFilePlayer(); + + VideoCaptureProvider = videoCaptureProvider; + Recordings = new ObservableCollection(); + + ToggleCameraCommand = new RelayCommand(ToggleCamera); + + Recordings.Add(new DataRecording() + { + Name = "Recording 1" + }); + Recordings.Add(new DataRecording() + { + Name = "Recording 2" + }); + Recordings.Add(new DataRecording() + { + Name = "Recording 3" + }); + + RemoveRecordingCommand = new RelayCommand(RemoveRecording); + + MediaRecordingCommand = new RelayCommand(StartDiagnosticsRecording, () => !Recorder.IsRecording && MachineOperator != null && !Player.IsPlaying); + MediaStopCommand = new RelayCommand(StopRecorderOrPlayer, () => Recorder.IsRecording || Player.IsPlaying); + MediaPlayPauseCommand = new RelayCommand(DiagnosticsTogglePlayPause, () => !Recorder.IsRecording && Player.IsLoaded); + + _recordingsFolder = Path.Combine(SettingsManager.DefaultFolder, "Recordings"); + Directory.CreateDirectory(_recordingsFolder); + + _frameProvider.FrameReceived += _frameProvider_FrameReceived; + + _notification.PushBarItem(new RecordingBarView() { DataContext = this }); + + applicationManager.ConnectedMachineChanged += ApplicationManager_ConnectedMachineChanged; + } + + private void ApplicationManager_ConnectedMachineChanged(object sender, Integration.Services.IExternalBridgeClient machine) + { + MachineOperator = machine; + InvalidateRelayCommands(); + } + + private void _frameProvider_FrameReceived(object sender, PushDiagnosticsResponse frame) + { + if (!_frameProvider.Disable) + { + if (Recorder.IsRecording) + { + Recorder.Write(frame); + } + } + } + + #endregion + + #region Private Methods + + /// + /// Removes the recording. + /// + /// The recording. + private void RemoveRecording(DataRecording recording) + { + Recordings.Remove(recording); + } + + /// + /// Toggles the camera. + /// + /// The capture device. + private void ToggleCamera(CaptureDevice captureDevice) + { + if (captureDevice.Device != null) + { + captureDevice.IsStarted = !captureDevice.IsStarted; + } + } + + private void DiagnosticsTogglePlayPause() + { + if (!Player.IsPlaying || Player.IsPaused) + { + _frameProvider.Disable = true; + Player.Play(); + } + else + { + Player.Pause(); + } + + InvalidateRelayCommands(); + } + + private async void LoadSelectedRecording() + { + using (_notification.PushTaskItem("Loading Recording...")) + { + if (Player != null) + { + Player.Dispose(); + } + + Player = new DiagnosticsFilePlayer(); + Player.FrameReceived += Player_FrameReceived; + await Player.Load(SelectedRecording.FilePath); + } + + InvalidateRelayCommands(); + } + + private void Player_FrameReceived(object sender, DataFileFrame frame) + { + if (_frameProvider.Disable) + { + _frameProvider.PushFrame(frame.PushDiagnosticsResponse); + } + } + + private void StartDiagnosticsRecording() + { + using (_notification.PushTaskItem("Starting Recording...")) + { + Recorder.Start(); + } + + InvalidateRelayCommands(); + } + + private async void StopRecorderOrPlayer() + { + if (Recorder.IsRecording) + { + using (_notification.PushTaskItem("Stopping Recording...")) + { + await Recorder.Stop(); + } + + String recordingName = _notification.ShowTextInput("Enter recording name", "Recording name"); + + if (!String.IsNullOrWhiteSpace(recordingName)) + { + using (_notification.PushTaskItem("Saving Recording...")) + { + await Recorder.Save(Path.Combine(_recordingsFolder, recordingName + ".tdr")); + } + } + + Recorder.Dispose(); + Recorder = new DiagnosticsFileRecorder(); + } + else if (Player.IsPlaying) + { + await Player.Stop(); + _frameProvider.Disable = false; + } + + InvalidateRelayCommands(); + } + + #endregion + } +} diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.DataCapture/Views/MainView.xaml b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.DataCapture/Views/MainView.xaml new file mode 100644 index 000000000..74addf942 --- /dev/null +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.DataCapture/Views/MainView.xaml @@ -0,0 +1,250 @@ + + + + + + + + + + + + + + + + + + + + + RECORDINGS + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + CAPTURE DEVICES + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Total Frames: + + + + File Size: + + + + + + + + + + + + + + + + + + + + / + + + + + + + + + + + diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.DataCapture/Views/MainView.xaml.cs b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.DataCapture/Views/MainView.xaml.cs new file mode 100644 index 000000000..624840d66 --- /dev/null +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.DataCapture/Views/MainView.xaml.cs @@ -0,0 +1,28 @@ +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.DataCapture.Views +{ + /// + /// Interaction logic for MainView.xaml + /// + public partial class MainView : UserControl + { + public MainView() + { + InitializeComponent(); + } + } +} diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.DataCapture/Views/RecordingBarView.xaml b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.DataCapture/Views/RecordingBarView.xaml new file mode 100644 index 000000000..d076eb631 --- /dev/null +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.DataCapture/Views/RecordingBarView.xaml @@ -0,0 +1,50 @@ + + + + + + + + + + + + + + + + + + + + diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.DataCapture/Views/RecordingBarView.xaml.cs b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.DataCapture/Views/RecordingBarView.xaml.cs new file mode 100644 index 000000000..97389a1e5 --- /dev/null +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.DataCapture/Views/RecordingBarView.xaml.cs @@ -0,0 +1,28 @@ +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.DataCapture.Views +{ + /// + /// Interaction logic for RecordingBarView.xaml + /// + public partial class RecordingBarView : UserControl + { + public RecordingBarView() + { + InitializeComponent(); + } + } +} diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.DataCapture/packages.config b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.DataCapture/packages.config new file mode 100644 index 000000000..4fd672b32 --- /dev/null +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.DataCapture/packages.config @@ -0,0 +1,8 @@ + + + + + + + + \ No newline at end of file diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Developer/Converters/OneToPercentConverter.cs b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Developer/Converters/OneToPercentConverter.cs new file mode 100644 index 000000000..292de5cb4 --- /dev/null +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Developer/Converters/OneToPercentConverter.cs @@ -0,0 +1,23 @@ +using System; +using System.Collections.Generic; +using System.Globalization; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using System.Windows.Data; + +namespace Tango.MachineStudio.Developer.Converters +{ + public class OneToPercentConverter : IValueConverter + { + public object Convert(object value, Type targetType, object parameter, CultureInfo culture) + { + return System.Convert.ToDouble(value) * 100d; + } + + public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture) + { + return System.Convert.ToDouble(value) / 100d; + } + } +} diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/Converters/TechIosToDigitalInsConverter.cs b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/Converters/TechIosToDigitalInsConverter.cs new file mode 100644 index 000000000..4b587743d --- /dev/null +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/Converters/TechIosToDigitalInsConverter.cs @@ -0,0 +1,35 @@ +using System; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Globalization; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using System.Windows.Data; +using Tango.Integration.Observables; +using Tango.Integration.Observables.Enumerations; + +namespace Tango.MachineStudio.Technician.Converters +{ + public class TechIosToDigitalInsConverter : IValueConverter + { + public object Convert(object value, Type targetType, object parameter, CultureInfo culture) + { + ObservableCollection ios = value as ObservableCollection; + + if (ios != null) + { + return ios.Where(x => x.Type == IOType.DigitalInput.ToInt32()).ToObservableCollection(); + } + else + { + return null; + } + } + + public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture) + { + throw new NotImplementedException(); + } + } +} diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/Converters/TechIosToDigitalOutsConverter.cs b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/Converters/TechIosToDigitalOutsConverter.cs new file mode 100644 index 000000000..734c4bebf --- /dev/null +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/Converters/TechIosToDigitalOutsConverter.cs @@ -0,0 +1,35 @@ +using System; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Globalization; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using System.Windows.Data; +using Tango.Integration.Observables; +using Tango.Integration.Observables.Enumerations; + +namespace Tango.MachineStudio.Technician.Converters +{ + public class TechIosToDigitalOutsConverter : IValueConverter + { + public object Convert(object value, Type targetType, object parameter, CultureInfo culture) + { + ObservableCollection ios = value as ObservableCollection; + + if (ios != null) + { + return ios.Where(x => x.Type == IOType.DigitalOutput.ToInt32()).ToObservableCollection(); + } + else + { + return null; + } + } + + public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture) + { + throw new NotImplementedException(); + } + } +} diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/Editors/DigitalInElementEditor.xaml b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/Editors/DigitalInElementEditor.xaml new file mode 100644 index 000000000..29eab7042 --- /dev/null +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/Editors/DigitalInElementEditor.xaml @@ -0,0 +1,92 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/Editors/DigitalInElementEditor.xaml.cs b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/Editors/DigitalInElementEditor.xaml.cs new file mode 100644 index 000000000..e884e70b9 --- /dev/null +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/Editors/DigitalInElementEditor.xaml.cs @@ -0,0 +1,90 @@ +using System; +using System.Collections.Generic; +using System.Diagnostics; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using System.Windows; +using System.Windows.Controls; +using System.Windows.Controls.Primitives; +using System.Windows.Data; +using System.Windows.Documents; +using System.Windows.Input; +using System.Windows.Markup; +using System.Windows.Media; +using System.Windows.Media.Imaging; +using System.Windows.Navigation; +using System.Windows.Shapes; +using Tango.Editors; +using Tango.Integration.Observables; +using Tango.MachineStudio.Technician.TechItems; + +namespace Tango.MachineStudio.Technician.Editors +{ + [ContentProperty("InnerContent")] + public partial class DigitalInElementEditor : ElementEditor + { + public DigitalInElementEditor() + : base() + { + InitializeComponent(); + } + + public DigitalInElementEditor(DigitalInItem digitalInItem) + : this() + { + DigitalInItem = digitalInItem; + DataContext = DigitalInItem; + } + + public DigitalInElementEditor(DigitalInItem digitalInItem, Rect bounds) + : this(digitalInItem) + { + Left = bounds.Left; + Top = bounds.Top; + Width = bounds.Width; + Height = bounds.Height; + } + + private DigitalInItem _digitalInItem; + + public DigitalInItem DigitalInItem + { + get { return _digitalInItem; } + set { _digitalInItem = value; RaisePropertyChanged(nameof(DigitalInItem)); } + } + + + /// + /// Clones this instance. + /// + /// + public override IElementEditor Clone() + { + try + { + var clonedItem = DigitalInItem.Clone() as DigitalInItem; + DigitalInElementEditor cloned = new DigitalInElementEditor(clonedItem); + cloned.Top = Top; + cloned.Left = Left; + cloned.Width = Width; + cloned.Height = Height; + cloned.Angle = Angle; + return cloned; + } + catch (Exception ex) + { + throw new InvalidOperationException("Could not clone this editor. You may have to create a custom editor and implement a custom Clone method.", ex); + } + } + + /// + /// Gets the hosted element. + /// + [ParameterIgnore] + public override Object HostedElement + { + get { return DigitalInItem; } + } + } +} diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/Editors/DigitalOutElementEditor.xaml b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/Editors/DigitalOutElementEditor.xaml new file mode 100644 index 000000000..dcf78ca69 --- /dev/null +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/Editors/DigitalOutElementEditor.xaml @@ -0,0 +1,103 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/Editors/DigitalOutElementEditor.xaml.cs b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/Editors/DigitalOutElementEditor.xaml.cs new file mode 100644 index 000000000..6428ccf1d --- /dev/null +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/Editors/DigitalOutElementEditor.xaml.cs @@ -0,0 +1,90 @@ +using System; +using System.Collections.Generic; +using System.Diagnostics; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using System.Windows; +using System.Windows.Controls; +using System.Windows.Controls.Primitives; +using System.Windows.Data; +using System.Windows.Documents; +using System.Windows.Input; +using System.Windows.Markup; +using System.Windows.Media; +using System.Windows.Media.Imaging; +using System.Windows.Navigation; +using System.Windows.Shapes; +using Tango.Editors; +using Tango.Integration.Observables; +using Tango.MachineStudio.Technician.TechItems; + +namespace Tango.MachineStudio.Technician.Editors +{ + [ContentProperty("InnerContent")] + public partial class DigitalOutElementEditor : ElementEditor + { + public DigitalOutElementEditor() + : base() + { + InitializeComponent(); + } + + public DigitalOutElementEditor(DigitalOutItem digitalOutItem) + : this() + { + DigitalOutItem = digitalOutItem; + DataContext = DigitalOutItem; + } + + public DigitalOutElementEditor(DigitalOutItem digitalOutItem, Rect bounds) + : this(digitalOutItem) + { + Left = bounds.Left; + Top = bounds.Top; + Width = bounds.Width; + Height = bounds.Height; + } + + private DigitalOutItem _digitalOutItem; + + public DigitalOutItem DigitalOutItem + { + get { return _digitalOutItem; } + set { _digitalOutItem = value; RaisePropertyChanged(nameof(DigitalOutItem)); } + } + + + /// + /// Clones this instance. + /// + /// + public override IElementEditor Clone() + { + try + { + var clonedItem = DigitalOutItem.Clone() as DigitalOutItem; + DigitalOutElementEditor cloned = new DigitalOutElementEditor(clonedItem); + cloned.Top = Top; + cloned.Left = Left; + cloned.Width = Width; + cloned.Height = Height; + cloned.Angle = Angle; + return cloned; + } + catch (Exception ex) + { + throw new InvalidOperationException("Could not clone this editor. You may have to create a custom editor and implement a custom Clone method.", ex); + } + } + + /// + /// Gets the hosted element. + /// + [ParameterIgnore] + public override Object HostedElement + { + get { return DigitalOutItem; } + } + } +} diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/Images/digital-in.png b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/Images/digital-in.png new file mode 100644 index 000000000..3b5ebac18 Binary files /dev/null and b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/Images/digital-in.png differ diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/PropertiesTemplates/DigitalInTemplate.xaml b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/PropertiesTemplates/DigitalInTemplate.xaml new file mode 100644 index 000000000..1121fe9e1 --- /dev/null +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/PropertiesTemplates/DigitalInTemplate.xaml @@ -0,0 +1,33 @@ + + + + + + + + + + + + + Selected Pin + + + + + + diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/PropertiesTemplates/DigitalInTemplate.xaml.cs b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/PropertiesTemplates/DigitalInTemplate.xaml.cs new file mode 100644 index 000000000..9862a95b9 --- /dev/null +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/PropertiesTemplates/DigitalInTemplate.xaml.cs @@ -0,0 +1,28 @@ +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.PropertiesTemplates +{ + /// + /// Interaction logic for MonitorTemplate.xaml + /// + public partial class DigitalInTemplate : UserControl + { + public DigitalInTemplate() + { + InitializeComponent(); + } + } +} diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/PropertiesTemplates/DigitalOutTemplate.xaml b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/PropertiesTemplates/DigitalOutTemplate.xaml new file mode 100644 index 000000000..dafceefcb --- /dev/null +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/PropertiesTemplates/DigitalOutTemplate.xaml @@ -0,0 +1,33 @@ + + + + + + + + + + + + + Selected Pin + + + + + + diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/PropertiesTemplates/DigitalOutTemplate.xaml.cs b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/PropertiesTemplates/DigitalOutTemplate.xaml.cs new file mode 100644 index 000000000..58a3fcb8f --- /dev/null +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/PropertiesTemplates/DigitalOutTemplate.xaml.cs @@ -0,0 +1,28 @@ +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.PropertiesTemplates +{ + /// + /// Interaction logic for MonitorTemplate.xaml + /// + public partial class DigitalOutTemplate : UserControl + { + public DigitalOutTemplate() + { + InitializeComponent(); + } + } +} diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/TechItems/DigitalInItem.cs b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/TechItems/DigitalInItem.cs new file mode 100644 index 000000000..7f1548254 --- /dev/null +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/TechItems/DigitalInItem.cs @@ -0,0 +1,73 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using System.Windows.Media; +using System.Xml.Serialization; +using Tango.Integration.Observables; +using Tango.SharedUI.Helpers; + +namespace Tango.MachineStudio.Technician.TechItems +{ + /// + /// Represents a digital input pin item. + /// + /// + [TechItem(0)] + public class DigitalInItem : TechItem + { + private TechIo _techIo; + /// + /// Gets or sets the DB tech item. + /// + [XmlIgnore] + public TechIo TechIo + { + get { return _techIo; } + set { _techIo = value; RaisePropertyChangedAuto(); TechName = _techIo != null ? _techIo.Description : null; ItemGuid = value != null ? value.Guid : null; } + } + + private bool _value; + /// + /// Gets or sets whether the input is on. + /// + [XmlIgnore] + public bool Value + { + get { return _value; } + set { _value = value; RaisePropertyChangedAuto(); } + } + + /// + /// Initializes a new instance of the class. + /// + public DigitalInItem() : base() + { + Name = "Digital In"; + Description = "Digital Input Pin LED"; + Image = ResourceHelper.GetImageFromResources("Images/digital-in.png"); + Color = Colors.White; + } + + /// + /// Initializes a new instance of the class. + /// + /// The db tech. + public DigitalInItem(TechIo techIo) : this() + { + TechIo = techIo; + } + + /// + /// Clones this instance. + /// + /// + public override TechItem Clone() + { + DigitalInItem cloned = base.Clone() as DigitalInItem; + cloned.TechIo = TechIo; + return cloned; + } + } +} diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/TechItems/DigitalOutItem.cs b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/TechItems/DigitalOutItem.cs new file mode 100644 index 000000000..2a0625c53 --- /dev/null +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/TechItems/DigitalOutItem.cs @@ -0,0 +1,98 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using System.Windows.Media; +using System.Xml.Serialization; +using Tango.Integration.Observables; +using Tango.SharedUI.Helpers; + +namespace Tango.MachineStudio.Technician.TechItems +{ + /// + /// Represents a digital output pin item. + /// + /// + [TechItem(1)] + public class DigitalOutItem : TechItem + { + /// + /// Occurs when the user has changed the current value. + /// + public event EventHandler ValueChanged; + + private TechIo _techIo; + /// + /// Gets or sets the db tech item. + /// + [XmlIgnore] + public TechIo TechIo + { + get { return _techIo; } + set { _techIo = value; RaisePropertyChangedAuto(); TechName = _techIo != null ? _techIo.Description : null; ItemGuid = value != null ? value.Guid : null; } + } + + private bool _value; + /// + /// Gets or sets a value indicating whether this is on. + /// + [XmlIgnore] + public bool Value + { + get { return _value; } + set { _value = value; RaisePropertyChangedAuto(); ValueChanged?.Invoke(this, value); } + } + + private bool _effectiveValue; + /// + /// Gets or sets the effective value received from the embedded device. + /// + [XmlIgnore] + public bool EffectiveValue + { + get { return _effectiveValue; } + set + { + if (_effectiveValue != value) + { + _effectiveValue = value; + RaisePropertyChangedAuto(); + _value = value; + RaisePropertyChanged(nameof(Value)); + } + } + } + + /// + /// Initializes a new instance of the class. + /// + public DigitalOutItem() : base() + { + Name = "Digital Out"; + Description = "Digital Output Pin Controller"; + Image = ResourceHelper.GetImageFromResources("Images/binary.png"); + Color = Colors.White; + } + + /// + /// Initializes a new instance of the class. + /// + /// The db tech item. + public DigitalOutItem(TechIo techIo) : this() + { + TechIo = techIo; + } + + /// + /// Clones this instance. + /// + /// + public override TechItem Clone() + { + DigitalOutItem cloned = base.Clone() as DigitalOutItem; + cloned.TechIo = TechIo; + return cloned; + } + } +} diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/TechItems/TechItemAttribute.cs b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/TechItems/TechItemAttribute.cs new file mode 100644 index 000000000..fafd00954 --- /dev/null +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/TechItems/TechItemAttribute.cs @@ -0,0 +1,29 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace Tango.MachineStudio.Technician.TechItems +{ + /// + /// Represents a tech item attribute + /// + /// + public class TechItemAttribute : Attribute + { + /// + /// Gets or sets the item index. + /// + public int Index { get; set; } + + /// + /// Initializes a new instance of the class. + /// + /// The index. + public TechItemAttribute(int index) + { + Index = index; + } + } +} -- cgit v1.3.1 From e4c917c43e90a4453c6cd5b1842a418dc0f1b514 Mon Sep 17 00:00:00 2001 From: Roy Date: Thu, 15 Feb 2018 00:29:13 +0200 Subject: Working on Data Capture Module.. --- Software/DB/Tango.mdf | Bin 75497472 -> 75497472 bytes Software/DB/Tango_log.ldf | Bin 8388608 -> 8388608 bytes .../Recording/DataRecording.cs | 23 +++++- .../Tango.MachineStudio.DataCapture.csproj | 7 ++ .../ViewModels/MainViewVM.cs | 83 ++++++++++++++------- .../Views/MainView.xaml | 5 +- .../Views/PlayingBarView.xaml | 53 +++++++++++++ .../Views/PlayingBarView.xaml.cs | 28 +++++++ .../ViewModels/MainViewVM.cs | 31 +++++--- .../Notifications/BarItem.cs | 5 ++ .../Diagnostics/DiagnosticsFilePlayer.cs | 7 +- 11 files changed, 195 insertions(+), 47 deletions(-) create mode 100644 Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.DataCapture/Views/PlayingBarView.xaml create mode 100644 Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.DataCapture/Views/PlayingBarView.xaml.cs (limited to 'Software/Visual_Studio/MachineStudio/Modules') diff --git a/Software/DB/Tango.mdf b/Software/DB/Tango.mdf index da65c19c8..11640e60d 100644 Binary files a/Software/DB/Tango.mdf and b/Software/DB/Tango.mdf differ diff --git a/Software/DB/Tango_log.ldf b/Software/DB/Tango_log.ldf index c6adffec8..ecbb1e3f1 100644 Binary files a/Software/DB/Tango_log.ldf and b/Software/DB/Tango_log.ldf differ diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.DataCapture/Recording/DataRecording.cs b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.DataCapture/Recording/DataRecording.cs index a191c244e..ddf24e113 100644 --- a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.DataCapture/Recording/DataRecording.cs +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.DataCapture/Recording/DataRecording.cs @@ -1,14 +1,31 @@ using System; using System.Collections.Generic; +using System.IO; using System.Linq; using System.Text; using System.Threading.Tasks; using Tango.Core; +using Tango.Integration.Diagnostics; namespace Tango.MachineStudio.DataCapture.Recording { public class DataRecording : ExtendedObject { + public DataRecording() + { + Date = DateTime.Now; + } + + public DataRecording(String filePath) : this() + { + FilePath = filePath; + } + + public DataRecording(String filePath, DateTime date) : this(filePath) + { + Date = date; + } + private DateTime _date; public DateTime Date @@ -17,12 +34,9 @@ namespace Tango.MachineStudio.DataCapture.Recording set { _date = value; RaisePropertyChangedAuto(); } } - private String _name; - public String Name { - get { return _name; } - set { _name = value; RaisePropertyChangedAuto(); } + get { return Path.GetFileNameWithoutExtension(FilePath); } } private String _file; @@ -33,5 +47,6 @@ namespace Tango.MachineStudio.DataCapture.Recording set { _file = value; RaisePropertyChangedAuto(); } } + public DiagnosticsFilePlayer Player { get; set; } } } diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.DataCapture/Tango.MachineStudio.DataCapture.csproj b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.DataCapture/Tango.MachineStudio.DataCapture.csproj index 1c13be809..8936a66db 100644 --- a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.DataCapture/Tango.MachineStudio.DataCapture.csproj +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.DataCapture/Tango.MachineStudio.DataCapture.csproj @@ -81,6 +81,9 @@ GlobalVersionInfo.cs + + PlayingBarView.xaml + RecordingBarView.xaml @@ -88,6 +91,10 @@ Designer MSBuild:Compile + + MSBuild:Compile + Designer + Designer MSBuild:Compile 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 b63ee51d0..269007dac 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 @@ -3,6 +3,7 @@ using System.Collections.Generic; using System.Collections.ObjectModel; using System.IO; using System.Linq; +using System.Runtime.CompilerServices; using System.Text; using System.Threading.Tasks; using System.Windows.Controls; @@ -32,6 +33,8 @@ namespace Tango.MachineStudio.DataCapture.ViewModels private IStudioApplicationManager _applicationManager; private IDiagnosticsFrameProvider _frameProvider; private String _recordingsFolder; + private BarItem _recordingBarItem; + private BarItem _playerBarItem; #region Properties @@ -52,7 +55,7 @@ namespace Tango.MachineStudio.DataCapture.ViewModels public DataRecording SelectedRecording { get { return _selectedRecording; } - set { _selectedRecording = value; RaisePropertyChangedAuto(); } + set { _selectedRecording = value; RaisePropertyChangedAuto(); InvalidateRelayCommands(); } } /// @@ -140,35 +143,29 @@ namespace Tango.MachineStudio.DataCapture.ViewModels ToggleCameraCommand = new RelayCommand(ToggleCamera); - Recordings.Add(new DataRecording() - { - Name = "Recording 1" - }); - Recordings.Add(new DataRecording() - { - Name = "Recording 2" - }); - Recordings.Add(new DataRecording() - { - Name = "Recording 3" - }); - RemoveRecordingCommand = new RelayCommand(RemoveRecording); MediaRecordingCommand = new RelayCommand(StartDiagnosticsRecording, () => !Recorder.IsRecording && MachineOperator != null && !Player.IsPlaying); MediaStopCommand = new RelayCommand(StopRecorderOrPlayer, () => Recorder.IsRecording || Player.IsPlaying); - MediaPlayPauseCommand = new RelayCommand(DiagnosticsTogglePlayPause, () => !Recorder.IsRecording && Player.IsLoaded); + MediaPlayPauseCommand = new RelayCommand(DiagnosticsTogglePlayPause, () => !Recorder.IsRecording && SelectedRecording != null); _recordingsFolder = Path.Combine(SettingsManager.DefaultFolder, "Recordings"); Directory.CreateDirectory(_recordingsFolder); _frameProvider.FrameReceived += _frameProvider_FrameReceived; - _notification.PushBarItem(new RecordingBarView() { DataContext = this }); - applicationManager.ConnectedMachineChanged += ApplicationManager_ConnectedMachineChanged; + + _recordingBarItem = new BarItem(_notification, new RecordingBarView() { DataContext = this }); + _playerBarItem = new BarItem(_notification, new PlayingBarView() { DataContext = this }); + + LoadRecordings(); } + #endregion + + #region Event Handlers + private void ApplicationManager_ConnectedMachineChanged(object sender, Integration.Services.IExternalBridgeClient machine) { MachineOperator = machine; @@ -186,10 +183,19 @@ namespace Tango.MachineStudio.DataCapture.ViewModels } } + #endregion #region Private Methods + private void LoadRecordings() + { + foreach (var file in Directory.GetFiles(_recordingsFolder, "*.tdr")) + { + Recordings.Add(new DataRecording(file, File.GetCreationTime(file))); + } + } + /// /// Removes the recording. /// @@ -211,11 +217,28 @@ namespace Tango.MachineStudio.DataCapture.ViewModels } } - private void DiagnosticsTogglePlayPause() + private async void DiagnosticsTogglePlayPause() { if (!Player.IsPlaying || Player.IsPaused) { _frameProvider.Disable = true; + + if (SelectedRecording.Player == null) + { + using (_notification.PushTaskItem("Loading Recording...")) + { + SelectedRecording.Player = new DiagnosticsFilePlayer(); + await SelectedRecording.Player.Load(SelectedRecording.FilePath); + } + } + + RegisterPlayer(SelectedRecording.Player); + + if (!Player.IsPlaying) + { + _playerBarItem.Push(); + } + Player.Play(); } else @@ -226,21 +249,21 @@ namespace Tango.MachineStudio.DataCapture.ViewModels InvalidateRelayCommands(); } - private async void LoadSelectedRecording() + private void RegisterPlayer(DiagnosticsFilePlayer player) { - using (_notification.PushTaskItem("Loading Recording...")) + foreach (var recording in Recordings) { - if (Player != null) + if (recording.Player != null) { - Player.Dispose(); + recording.Player.FrameReceived -= Player_FrameReceived; } + } - Player = new DiagnosticsFilePlayer(); + if (player != null) + { + Player = player; Player.FrameReceived += Player_FrameReceived; - await Player.Load(SelectedRecording.FilePath); } - - InvalidateRelayCommands(); } private void Player_FrameReceived(object sender, DataFileFrame frame) @@ -256,6 +279,8 @@ namespace Tango.MachineStudio.DataCapture.ViewModels using (_notification.PushTaskItem("Starting Recording...")) { Recorder.Start(); + + _recordingBarItem.Push(); } InvalidateRelayCommands(); @@ -268,6 +293,7 @@ namespace Tango.MachineStudio.DataCapture.ViewModels using (_notification.PushTaskItem("Stopping Recording...")) { await Recorder.Stop(); + _recordingBarItem.Pop(); } String recordingName = _notification.ShowTextInput("Enter recording name", "Recording name"); @@ -276,7 +302,9 @@ namespace Tango.MachineStudio.DataCapture.ViewModels { using (_notification.PushTaskItem("Saving Recording...")) { - await Recorder.Save(Path.Combine(_recordingsFolder, recordingName + ".tdr")); + String filePath = Path.Combine(_recordingsFolder, recordingName + ".tdr"); + await Recorder.Save(filePath); + Recordings.Insert(0, new DataRecording(filePath)); } } @@ -287,6 +315,7 @@ namespace Tango.MachineStudio.DataCapture.ViewModels { await Player.Stop(); _frameProvider.Disable = false; + _playerBarItem.Pop(); } InvalidateRelayCommands(); diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.DataCapture/Views/MainView.xaml b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.DataCapture/Views/MainView.xaml index 74addf942..72f7da03d 100644 --- a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.DataCapture/Views/MainView.xaml +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.DataCapture/Views/MainView.xaml @@ -17,6 +17,7 @@ + @@ -38,7 +39,7 @@ - + @@ -50,7 +51,7 @@ - + diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.DataCapture/Views/PlayingBarView.xaml b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.DataCapture/Views/PlayingBarView.xaml new file mode 100644 index 000000000..3e76ce6ef --- /dev/null +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.DataCapture/Views/PlayingBarView.xaml @@ -0,0 +1,53 @@ + + + + + + + + / + + + + + + + + + + + + + diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.DataCapture/Views/PlayingBarView.xaml.cs b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.DataCapture/Views/PlayingBarView.xaml.cs new file mode 100644 index 000000000..f9e502f8b --- /dev/null +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.DataCapture/Views/PlayingBarView.xaml.cs @@ -0,0 +1,28 @@ +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.DataCapture.Views +{ + /// + /// Interaction logic for RecordingBarView.xaml + /// + public partial class PlayingBarView : UserControl + { + public PlayingBarView() + { + InitializeComponent(); + } + } +} 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 148e4375c..10c35b3b9 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 @@ -29,6 +29,7 @@ using Tango.Integration.Printing; using Tango.Integration.Diagnostics; using Microsoft.Win32; using Tango.MachineStudio.Technician.ViewModels; +using Tango.MachineStudio.Common.Diagnostics; namespace Tango.MachineStudio.Developer.ViewModels { @@ -496,10 +497,11 @@ namespace Tango.MachineStudio.Developer.ViewModels /// The application manager. /// The notification provider. [PreferredConstructor] - public MainViewVM(IStudioApplicationManager applicationManager, INotificationProvider notificationProvider, IMainView view) : this(view) + public MainViewVM(IStudioApplicationManager applicationManager, INotificationProvider notificationProvider, IMainView view, IDiagnosticsFrameProvider diagnosticsFrameProvider) : this(view) { _notification = notificationProvider; ApplicationManager = applicationManager; + diagnosticsFrameProvider.FrameReceived += DiagnosticsFrameProvider_FrameReceived; //Initialize Commands... EditMachineCommand = new RelayCommand(EditMachine, () => SelectedMachine != null); @@ -520,8 +522,8 @@ namespace Tango.MachineStudio.Developer.ViewModels ExitFullScreenCommand = new RelayCommand(ExitFullScreen); MediaRecordingCommand = new RelayCommand(StartDiagnosticsRecording, () => !Recorder.IsRecording && MachineOperator != null && !Player.IsPlaying); MediaStopCommand = new RelayCommand(StopRecorderOrPlayer, () => Recorder.IsRecording || Player.IsPlaying); - MediaLoadCommand = new RelayCommand(LoadDiagnosticsRecordingFile,() => !Recorder.IsRecording && !Player.IsPlaying); - MediaPlayPauseCommand = new RelayCommand(DiagnosticsTogglePlayPause,() => !Recorder.IsRecording && Player.IsLoaded); + MediaLoadCommand = new RelayCommand(LoadDiagnosticsRecordingFile, () => !Recorder.IsRecording && !Player.IsPlaying); + MediaPlayPauseCommand = new RelayCommand(DiagnosticsTogglePlayPause, () => !Recorder.IsRecording && Player.IsLoaded); CaptureDevices = new ObservableCollection(); var availableDevices = CaptureDevice.GetAvailableCaptureDevices(); @@ -549,6 +551,11 @@ namespace Tango.MachineStudio.Developer.ViewModels #region Event Handlers + private void DiagnosticsFrameProvider_FrameReceived(object sender, PushDiagnosticsResponse response) + { + PopulateDiagnosticsData(response); + } + private void Player_FrameReceived(object sender, DataFileFrame frame) { PopulateDiagnosticsData(frame.PushDiagnosticsResponse); @@ -567,15 +574,15 @@ namespace Tango.MachineStudio.Developer.ViewModels private void MachineOperator_DiagnosticsDataAvailable(object sender, PushDiagnosticsResponse response) { - if (Recorder.IsRecording) - { - Recorder.Write(response); - } + //if (Recorder.IsRecording) + //{ + // Recorder.Write(response); + //} - if (!Player.IsPlaying) - { - PopulateDiagnosticsData(response); - } + //if (!Player.IsPlaying) + //{ + // PopulateDiagnosticsData(response); + //} } /// @@ -1085,7 +1092,7 @@ namespace Tango.MachineStudio.Developer.ViewModels if (SelectedBrushStop != null && SelectedSegment != null) { SelectedSegment.BrushStops.Remove(SelectedBrushStop); - + if (SelectedSegment.BrushStops.Count > 1) { SelectedSegment.BrushStops.Last().OffsetPercent = 100; diff --git a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.Common/Notifications/BarItem.cs b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.Common/Notifications/BarItem.cs index 8d3cefa40..d46bf5b5d 100644 --- a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.Common/Notifications/BarItem.cs +++ b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.Common/Notifications/BarItem.cs @@ -19,6 +19,11 @@ namespace Tango.MachineStudio.Common.Notifications _notificationProvider = notificationProvider; } + public BarItem(INotificationProvider notificationProvider, FrameworkElement element) : this(notificationProvider) + { + Element = element; + } + /// /// Removed this item from the queue. /// diff --git a/Software/Visual_Studio/Tango.Integration/Diagnostics/DiagnosticsFilePlayer.cs b/Software/Visual_Studio/Tango.Integration/Diagnostics/DiagnosticsFilePlayer.cs index 7e5927648..1900e49e1 100644 --- a/Software/Visual_Studio/Tango.Integration/Diagnostics/DiagnosticsFilePlayer.cs +++ b/Software/Visual_Studio/Tango.Integration/Diagnostics/DiagnosticsFilePlayer.cs @@ -122,9 +122,9 @@ namespace Tango.Integration.Diagnostics /// /// Absolute file path. /// - public Task Load(String fileName) + public async Task Load(String fileName) { - return Task.Factory.StartNew(() => + Task task = new Task(() => { try { @@ -161,6 +161,9 @@ namespace Tango.Integration.Diagnostics throw LogManager.Log(ex); } }); + + task.Start(); + await task; } /// -- cgit v1.3.1