diff options
| author | Roy Ben Shabat <Roy@twine-s.com> | 2020-12-30 15:11:34 +0000 |
|---|---|---|
| committer | Roy Ben Shabat <Roy@twine-s.com> | 2020-12-30 15:11:34 +0000 |
| commit | d33c19b3ac6803de4b5c8d475832efef131c1a45 (patch) | |
| tree | ea725abc39def99a755b041c13cba1fe0d594ddc /Software/Visual_Studio/PPC/Modules | |
| parent | 1bdcaa9f51303bbff682507f31fb3b4414692ca4 (diff) | |
| download | Tango-d33c19b3ac6803de4b5c8d475832efef131c1a45.tar.gz Tango-d33c19b3ac6803de4b5c8d475832efef131c1a45.zip | |
Revert "Hope it is fine"
Diffstat (limited to 'Software/Visual_Studio/PPC/Modules')
232 files changed, 10942 insertions, 604 deletions
diff --git a/Software/Visual_Studio/PPC/Modules/Tango.PPC.BackupRestore/App.xaml b/Software/Visual_Studio/PPC/Modules/Tango.PPC.BackupRestore/App.xaml new file mode 100644 index 000000000..595ed2299 --- /dev/null +++ b/Software/Visual_Studio/PPC/Modules/Tango.PPC.BackupRestore/App.xaml @@ -0,0 +1,11 @@ +<Application x:Class="Tango.PPC.BackupRestore.App" + xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" + xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"> + <Application.Resources> + <ResourceDictionary> + <ResourceDictionary.MergedDictionaries> + <ResourceDictionary Source="pack://application:,,,/Tango.PPC.Common;component/Resources/Merged.xaml" /> + </ResourceDictionary.MergedDictionaries> + </ResourceDictionary> + </Application.Resources> +</Application>
\ No newline at end of file diff --git a/Software/Visual_Studio/PPC/Modules/Tango.PPC.BackupRestore/BackupRestoreModule.cs b/Software/Visual_Studio/PPC/Modules/Tango.PPC.BackupRestore/BackupRestoreModule.cs new file mode 100644 index 000000000..25cdfbb27 --- /dev/null +++ b/Software/Visual_Studio/PPC/Modules/Tango.PPC.BackupRestore/BackupRestoreModule.cs @@ -0,0 +1,84 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using System.Windows.Media.Imaging; +using Tango.BL.Enumerations; +using Tango.PPC.Common; +using Tango.PPC.BackupRestore.Views; +using Tango.SharedUI.Helpers; + +namespace Tango.PPC.BackupRestore +{ + /// <summary> + /// Represents a PPC <see cref="BackupRestoreModule"/>. + /// </summary> + /// <seealso cref="Tango.PPC.Common.PPCModuleBase" /> + [PPCModule(20)] + public class BackupRestoreModule : PPCModuleBase + { + /// <summary> + /// Gets the module name. + /// </summary> + public override string Name + { + get + { + return "Backup & Restore"; + } + } + + /// <summary> + /// Gets the module description. + /// </summary> + public override string Description + { + get + { + return "Tango Backup/Restore Module"; + } + } + + /// <summary> + /// Gets the module cover image. + /// </summary> + public override BitmapSource Image + { + get + { + return ResourceHelper.GetImageFromResources("Images/backup-big.png"); + } + } + + /// <summary> + /// Gets the module entry point view type. + /// </summary> + public override Type MainViewType + { + get + { + return typeof(MainView); + } + } + + /// <summary> + /// Gets the permission required to see and load this module. + /// </summary> + public override Permissions Permission + { + get + { + return Permissions.RunPPC; + } + } + + /// <summary> + /// Performs application-defined tasks associated with freeing, releasing, or resetting unmanaged resources. + /// </summary> + public override void Dispose() + { + //Dispose module here... + } + } +} diff --git a/Software/Visual_Studio/PPC/Modules/Tango.PPC.BackupRestore/Images/backup-big.png b/Software/Visual_Studio/PPC/Modules/Tango.PPC.BackupRestore/Images/backup-big.png Binary files differnew file mode 100644 index 000000000..3a712af49 --- /dev/null +++ b/Software/Visual_Studio/PPC/Modules/Tango.PPC.BackupRestore/Images/backup-big.png diff --git a/Software/Visual_Studio/PPC/Modules/Tango.PPC.BackupRestore/Images/backup-restore.png b/Software/Visual_Studio/PPC/Modules/Tango.PPC.BackupRestore/Images/backup-restore.png Binary files differnew file mode 100644 index 000000000..15be3b163 --- /dev/null +++ b/Software/Visual_Studio/PPC/Modules/Tango.PPC.BackupRestore/Images/backup-restore.png diff --git a/Software/Visual_Studio/PPC/Modules/Tango.PPC.BackupRestore/Images/restore.png b/Software/Visual_Studio/PPC/Modules/Tango.PPC.BackupRestore/Images/restore.png Binary files differnew file mode 100644 index 000000000..e60aaf425 --- /dev/null +++ b/Software/Visual_Studio/PPC/Modules/Tango.PPC.BackupRestore/Images/restore.png diff --git a/Software/Visual_Studio/PPC/Modules/Tango.PPC.BackupRestore/Properties/AssemblyInfo.cs b/Software/Visual_Studio/PPC/Modules/Tango.PPC.BackupRestore/Properties/AssemblyInfo.cs new file mode 100644 index 000000000..ac385e0ba --- /dev/null +++ b/Software/Visual_Studio/PPC/Modules/Tango.PPC.BackupRestore/Properties/AssemblyInfo.cs @@ -0,0 +1,20 @@ +using System.Reflection; +using System.Resources; +using System.Runtime.CompilerServices; +using System.Runtime.InteropServices; +using System.Windows; + +// General Information about an assembly is controlled through the following +// set of attributes. Change these attribute values to modify the information +// associated with an assembly. +[assembly: AssemblyTitle("Tango Backup & Restore Module")] +[assembly: AssemblyVersion("2.0.1.1407")] + +[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/PPC/Modules/Tango.PPC.BackupRestore/Properties/Resources.Designer.cs b/Software/Visual_Studio/PPC/Modules/Tango.PPC.BackupRestore/Properties/Resources.Designer.cs new file mode 100644 index 000000000..160bdf95c --- /dev/null +++ b/Software/Visual_Studio/PPC/Modules/Tango.PPC.BackupRestore/Properties/Resources.Designer.cs @@ -0,0 +1,63 @@ +//------------------------------------------------------------------------------ +// <auto-generated> +// 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. +// </auto-generated> +//------------------------------------------------------------------------------ + +namespace Tango.PPC.BackupRestore.Properties { + using System; + + + /// <summary> + /// A strongly-typed resource class, for looking up localized strings, etc. + /// </summary> + // 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", "15.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() { + } + + /// <summary> + /// Returns the cached ResourceManager instance used by this class. + /// </summary> + [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] + internal static global::System.Resources.ResourceManager ResourceManager { + get { + if (object.ReferenceEquals(resourceMan, null)) { + global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("Tango.PPC.BackupRestore.Properties.Resources", typeof(Resources).Assembly); + resourceMan = temp; + } + return resourceMan; + } + } + + /// <summary> + /// Overrides the current thread's CurrentUICulture property for all + /// resource lookups using this strongly typed resource class. + /// </summary> + [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/PPC/Modules/Tango.PPC.BackupRestore/Properties/Resources.resx b/Software/Visual_Studio/PPC/Modules/Tango.PPC.BackupRestore/Properties/Resources.resx new file mode 100644 index 000000000..af7dbebba --- /dev/null +++ b/Software/Visual_Studio/PPC/Modules/Tango.PPC.BackupRestore/Properties/Resources.resx @@ -0,0 +1,117 @@ +<?xml version="1.0" encoding="utf-8"?> +<root> + <!-- + Microsoft ResX Schema + + Version 2.0 + + The primary goals of this format is to allow a simple XML format + that is mostly human readable. The generation and parsing of the + various data types are done through the TypeConverter classes + associated with the data types. + + Example: + + ... ado.net/XML headers & schema ... + <resheader name="resmimetype">text/microsoft-resx</resheader> + <resheader name="version">2.0</resheader> + <resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader> + <resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader> + <data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data> + <data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data> + <data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64"> + <value>[base64 mime encoded serialized .NET Framework object]</value> + </data> + <data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64"> + <value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value> + <comment>This is a comment</comment> + </data> + + There are any number of "resheader" rows that contain simple + name/value pairs. + + Each data row contains a name, and value. The row also contains a + type or mimetype. Type corresponds to a .NET class that support + text/value conversion through the TypeConverter architecture. + Classes that don't support this are serialized and stored with the + mimetype set. + + The mimetype is used for serialized objects, and tells the + ResXResourceReader how to depersist the object. This is currently not + extensible. For a given mimetype the value must be set accordingly: + + Note - application/x-microsoft.net.object.binary.base64 is the format + that the ResXResourceWriter will generate, however the reader can + read any of the formats listed below. + + mimetype: application/x-microsoft.net.object.binary.base64 + value : The object must be serialized with + : System.Serialization.Formatters.Binary.BinaryFormatter + : and then encoded with base64 encoding. + + mimetype: application/x-microsoft.net.object.soap.base64 + value : The object must be serialized with + : System.Runtime.Serialization.Formatters.Soap.SoapFormatter + : and then encoded with base64 encoding. + + mimetype: application/x-microsoft.net.object.bytearray.base64 + value : The object must be serialized into a byte array + : using a System.ComponentModel.TypeConverter + : and then encoded with base64 encoding. + --> + <xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata"> + <xsd:element name="root" msdata:IsDataSet="true"> + <xsd:complexType> + <xsd:choice maxOccurs="unbounded"> + <xsd:element name="metadata"> + <xsd:complexType> + <xsd:sequence> + <xsd:element name="value" type="xsd:string" minOccurs="0" /> + </xsd:sequence> + <xsd:attribute name="name" type="xsd:string" /> + <xsd:attribute name="type" type="xsd:string" /> + <xsd:attribute name="mimetype" type="xsd:string" /> + </xsd:complexType> + </xsd:element> + <xsd:element name="assembly"> + <xsd:complexType> + <xsd:attribute name="alias" type="xsd:string" /> + <xsd:attribute name="name" type="xsd:string" /> + </xsd:complexType> + </xsd:element> + <xsd:element name="data"> + <xsd:complexType> + <xsd:sequence> + <xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" /> + <xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" /> + </xsd:sequence> + <xsd:attribute name="name" type="xsd:string" msdata:Ordinal="1" /> + <xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" /> + <xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" /> + </xsd:complexType> + </xsd:element> + <xsd:element name="resheader"> + <xsd:complexType> + <xsd:sequence> + <xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" /> + </xsd:sequence> + <xsd:attribute name="name" type="xsd:string" use="required" /> + </xsd:complexType> + </xsd:element> + </xsd:choice> + </xsd:complexType> + </xsd:element> + </xsd:schema> + <resheader name="resmimetype"> + <value>text/microsoft-resx</value> + </resheader> + <resheader name="version"> + <value>2.0</value> + </resheader> + <resheader name="reader"> + <value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value> + </resheader> + <resheader name="writer"> + <value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value> + </resheader> +</root>
\ No newline at end of file diff --git a/Software/Visual_Studio/PPC/Modules/Tango.PPC.BackupRestore/Properties/Settings.Designer.cs b/Software/Visual_Studio/PPC/Modules/Tango.PPC.BackupRestore/Properties/Settings.Designer.cs new file mode 100644 index 000000000..087ecdbcd --- /dev/null +++ b/Software/Visual_Studio/PPC/Modules/Tango.PPC.BackupRestore/Properties/Settings.Designer.cs @@ -0,0 +1,26 @@ +//------------------------------------------------------------------------------ +// <auto-generated> +// 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. +// </auto-generated> +//------------------------------------------------------------------------------ + +namespace Tango.PPC.BackupRestore.Properties { + + + [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "15.8.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/PPC/Modules/Tango.PPC.BackupRestore/Properties/Settings.settings b/Software/Visual_Studio/PPC/Modules/Tango.PPC.BackupRestore/Properties/Settings.settings new file mode 100644 index 000000000..033d7a5e9 --- /dev/null +++ b/Software/Visual_Studio/PPC/Modules/Tango.PPC.BackupRestore/Properties/Settings.settings @@ -0,0 +1,7 @@ +<?xml version='1.0' encoding='utf-8'?> +<SettingsFile xmlns="uri:settings" CurrentProfile="(Default)"> + <Profiles> + <Profile Name="(Default)" /> + </Profiles> + <Settings /> +</SettingsFile>
\ No newline at end of file diff --git a/Software/Visual_Studio/PPC/Modules/Tango.PPC.BackupRestore/Tango.PPC.BackupRestore.csproj b/Software/Visual_Studio/PPC/Modules/Tango.PPC.BackupRestore/Tango.PPC.BackupRestore.csproj new file mode 100644 index 000000000..99ac13ae4 --- /dev/null +++ b/Software/Visual_Studio/PPC/Modules/Tango.PPC.BackupRestore/Tango.PPC.BackupRestore.csproj @@ -0,0 +1,246 @@ +<?xml version="1.0" encoding="utf-8"?> +<Project ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> + <Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" /> + <PropertyGroup> + <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration> + <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform> + <ProjectGuid>{BC2753F8-C0F7-48F5-A85C-149EC7A2F8C7}</ProjectGuid> + <OutputType>library</OutputType> + <RootNamespace>Tango.PPC.BackupRestore</RootNamespace> + <AssemblyName>Tango.PPC.BackupRestore</AssemblyName> + <TargetFrameworkVersion>v4.6.1</TargetFrameworkVersion> + <FileAlignment>512</FileAlignment> + <ProjectTypeGuids>{60dc8134-eba5-43b8-bcc9-bb4bc16c2548};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids> + <WarningLevel>4</WarningLevel> + <TargetFrameworkProfile /> + </PropertyGroup> + <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' "> + <DebugSymbols>true</DebugSymbols> + <DebugType>full</DebugType> + <Optimize>false</Optimize> + <OutputPath>..\..\..\Build\PPC\Debug\</OutputPath> + <DefineConstants>DEBUG;TRACE</DefineConstants> + <ErrorReport>prompt</ErrorReport> + <WarningLevel>4</WarningLevel> + </PropertyGroup> + <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' "> + <DebugType>pdbonly</DebugType> + <Optimize>true</Optimize> + <OutputPath>..\..\..\Build\PPC\Release\</OutputPath> + <DefineConstants>TRACE</DefineConstants> + <ErrorReport>prompt</ErrorReport> + <WarningLevel>4</WarningLevel> + </PropertyGroup> + <ItemGroup> + <Reference Include="EntityFramework, Version=6.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089, processorArchitecture=MSIL"> + <HintPath>..\..\..\packages\EntityFramework.6.0.0\lib\net45\EntityFramework.dll</HintPath> + <Private>True</Private> + </Reference> + <Reference Include="EntityFramework.SqlServer, Version=6.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089, processorArchitecture=MSIL"> + <HintPath>..\..\..\packages\EntityFramework.6.0.0\lib\net45\EntityFramework.SqlServer.dll</HintPath> + </Reference> + <Reference Include="FontAwesome.WPF, Version=4.7.0.37774, Culture=neutral, PublicKeyToken=0758b07a11a4f466, processorArchitecture=MSIL"> + <HintPath>..\..\..\packages\FontAwesome.WPF.4.7.0.9\lib\net40\FontAwesome.WPF.dll</HintPath> + </Reference> + <Reference Include="Google.Protobuf, Version=3.4.1.0, Culture=neutral, PublicKeyToken=a7d26565bac4d604, processorArchitecture=MSIL"> + <HintPath>..\..\..\packages\Google.Protobuf.3.4.1\lib\net45\Google.Protobuf.dll</HintPath> + </Reference> + <Reference Include="System" /> + <Reference Include="System.ComponentModel.DataAnnotations" /> + <Reference Include="System.Data" /> + <Reference Include="System.Windows.Interactivity, Version=4.5.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL"> + <HintPath>..\..\..\packages\Expression.Blend.Sdk.1.0.2\lib\net45\System.Windows.Interactivity.dll</HintPath> + </Reference> + <Reference Include="System.Xml" /> + <Reference Include="Microsoft.CSharp" /> + <Reference Include="System.Core" /> + <Reference Include="System.Xml.Linq" /> + <Reference Include="System.Data.DataSetExtensions" /> + <Reference Include="System.Net.Http" /> + <Reference Include="System.Xaml"> + <RequiredTargetFramework>4.0</RequiredTargetFramework> + </Reference> + <Reference Include="WindowsBase" /> + <Reference Include="PresentationCore" /> + <Reference Include="PresentationFramework" /> + </ItemGroup> + <ItemGroup> + <Page Include="App.xaml"> + <Generator>MSBuild:Compile</Generator> + <SubType>Designer</SubType> + </Page> + <Page Include="Views\RestoreCompletedView.xaml"> + <Generator>MSBuild:Compile</Generator> + <SubType>Designer</SubType> + </Page> + <Page Include="Views\BackupCompletedView.xaml"> + <Generator>MSBuild:Compile</Generator> + <SubType>Designer</SubType> + </Page> + <Page Include="Views\RestoreErrorView.xaml"> + <Generator>MSBuild:Compile</Generator> + <SubType>Designer</SubType> + </Page> + <Page Include="Views\BackupErrorView.xaml"> + <Generator>MSBuild:Compile</Generator> + <SubType>Designer</SubType> + </Page> + <Page Include="Views\RestoreProgressView.xaml"> + <Generator>MSBuild:Compile</Generator> + <SubType>Designer</SubType> + </Page> + <Page Include="Views\BackupProgressView.xaml"> + <Generator>MSBuild:Compile</Generator> + <SubType>Designer</SubType> + </Page> + <Page Include="Views\BackupView.xaml"> + <SubType>Designer</SubType> + <Generator>MSBuild:Compile</Generator> + </Page> + <Page Include="Views\MainView.xaml"> + <SubType>Designer</SubType> + <Generator>MSBuild:Compile</Generator> + </Page> + <Page Include="Views\RestoreView.xaml"> + <SubType>Designer</SubType> + <Generator>MSBuild:Compile</Generator> + </Page> + <Page Include="Views\WelcomeView.xaml"> + <SubType>Designer</SubType> + <Generator>MSBuild:Compile</Generator> + </Page> + </ItemGroup> + <ItemGroup> + <Compile Include="..\..\..\Versioning\GlobalVersionInfo.cs"> + <Link>GlobalVersionInfo.cs</Link> + </Compile> + <Compile Include="BackupRestoreModule.cs" /> + <Compile Include="Properties\AssemblyInfo.cs"> + <SubType>Code</SubType> + </Compile> + <Compile Include="Properties\Resources.Designer.cs"> + <AutoGen>True</AutoGen> + <DesignTime>True</DesignTime> + <DependentUpon>Resources.resx</DependentUpon> + </Compile> + <Compile Include="Properties\Settings.Designer.cs"> + <AutoGen>True</AutoGen> + <DependentUpon>Settings.settings</DependentUpon> + <DesignTimeSharedInput>True</DesignTimeSharedInput> + </Compile> + <Compile Include="ViewModelLocator.cs" /> + <Compile Include="ViewModels\RestoreCompletedViewVM.cs" /> + <Compile Include="ViewModels\RestoreErrorViewVM.cs" /> + <Compile Include="ViewModels\BackupViewVM.cs" /> + <Compile Include="ViewModels\BackupCompletedViewVM.cs" /> + <Compile Include="ViewModels\BackupErrorViewVM.cs" /> + <Compile Include="ViewModels\MainViewVM.cs" /> + <Compile Include="ViewModels\RestoreViewVM.cs" /> + <Compile Include="ViewModels\WelcomeViewVM.cs" /> + <Compile Include="Views\RestoreCompletedView.xaml.cs"> + <DependentUpon>RestoreCompletedView.xaml</DependentUpon> + </Compile> + <Compile Include="Views\BackupCompletedView.xaml.cs"> + <DependentUpon>BackupCompletedView.xaml</DependentUpon> + </Compile> + <Compile Include="Views\RestoreErrorView.xaml.cs"> + <DependentUpon>RestoreErrorView.xaml</DependentUpon> + </Compile> + <Compile Include="Views\BackupErrorView.xaml.cs"> + <DependentUpon>BackupErrorView.xaml</DependentUpon> + </Compile> + <Compile Include="Views\RestoreProgressView.xaml.cs"> + <DependentUpon>RestoreProgressView.xaml</DependentUpon> + </Compile> + <Compile Include="Views\BackupProgressView.xaml.cs"> + <DependentUpon>BackupProgressView.xaml</DependentUpon> + </Compile> + <Compile Include="Views\BackupView.xaml.cs"> + <DependentUpon>BackupView.xaml</DependentUpon> + </Compile> + <Compile Include="Views\MainView.xaml.cs"> + <DependentUpon>MainView.xaml</DependentUpon> + </Compile> + <Compile Include="Views\RestoreView.xaml.cs"> + <DependentUpon>RestoreView.xaml</DependentUpon> + </Compile> + <Compile Include="Views\WelcomeView.xaml.cs"> + <DependentUpon>WelcomeView.xaml</DependentUpon> + </Compile> + <EmbeddedResource Include="Properties\Resources.resx"> + <Generator>ResXFileCodeGenerator</Generator> + <LastGenOutput>Resources.Designer.cs</LastGenOutput> + </EmbeddedResource> + <None Include="app.config" /> + <None Include="packages.config" /> + <None Include="Properties\Settings.settings"> + <Generator>SettingsSingleFileGenerator</Generator> + <LastGenOutput>Settings.Designer.cs</LastGenOutput> + </None> + </ItemGroup> + <ItemGroup> + <ProjectReference Include="..\..\..\Tango.BL\Tango.BL.csproj"> + <Project>{f441feee-322a-4943-b566-110e12fd3b72}</Project> + <Name>Tango.BL</Name> + </ProjectReference> + <ProjectReference Include="..\..\..\Tango.Core\Tango.Core.csproj"> + <Project>{a34ee0f0-649d-41c8-8489-b6f1cc6924ee}</Project> + <Name>Tango.Core</Name> + </ProjectReference> + <ProjectReference Include="..\..\..\Tango.DragAndDrop\Tango.DragAndDrop.csproj"> + <Project>{b112d89a-a106-41ae-a0c1-4abc84c477f5}</Project> + <Name>Tango.DragAndDrop</Name> + </ProjectReference> + <ProjectReference Include="..\..\..\Tango.Explorer\Tango.Explorer.csproj"> + <Project>{4399AF76-DB52-4CFB-8020-6F85BDB29FD5}</Project> + <Name>Tango.Explorer</Name> + </ProjectReference> + <ProjectReference Include="..\..\..\Tango.Logging\Tango.Logging.csproj"> + <Project>{bc932dbd-7cdb-488c-99e4-f02cf441f55e}</Project> + <Name>Tango.Logging</Name> + </ProjectReference> + <ProjectReference Include="..\..\..\Tango.PMR\Tango.PMR.csproj"> + <Project>{e4927038-348d-4295-aaf4-861c58cb3943}</Project> + <Name>Tango.PMR</Name> + </ProjectReference> + <ProjectReference Include="..\..\..\Tango.Settings\Tango.Settings.csproj"> + <Project>{d8f1ad85-526a-4f50-b6dc-d437af63d8d8}</Project> + <Name>Tango.Settings</Name> + </ProjectReference> + <ProjectReference Include="..\..\..\Tango.SharedUI\Tango.SharedUI.csproj"> + <Project>{8491d07b-c1f6-4b62-a412-41b9fd2d6538}</Project> + <Name>Tango.SharedUI</Name> + </ProjectReference> + <ProjectReference Include="..\..\..\Tango.Touch\Tango.Touch.csproj"> + <Project>{fd86424c-6e84-491b-8df9-3d0f5c236a2a}</Project> + <Name>Tango.Touch</Name> + </ProjectReference> + <ProjectReference Include="..\..\..\Tango.Transport\Tango.Transport.csproj"> + <Project>{74e700b0-1156-4126-be40-ee450d3c3026}</Project> + <Name>Tango.Transport</Name> + </ProjectReference> + <ProjectReference Include="..\..\Tango.PPC.Common\Tango.PPC.Common.csproj"> + <Project>{0be74eee-22cb-4dba-b896-793b9e1a3ac0}</Project> + <Name>Tango.PPC.Common</Name> + </ProjectReference> + <ProjectReference Include="..\Tango.PPC.Storage\Tango.PPC.Storage.csproj"> + <Project>{04FEBB02-F782-4B96-B47D-F6902AFA43BE}</Project> + <Name>Tango.PPC.Storage</Name> + </ProjectReference> + </ItemGroup> + <ItemGroup> + <Resource Include="Images\backup-big.png" /> + </ItemGroup> + <ItemGroup> + <Resource Include="Images\backup-restore.png" /> + </ItemGroup> + <ItemGroup> + <Resource Include="Images\restore.png" /> + </ItemGroup> + <Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" /> + <ProjectExtensions> + <VisualStudio> + <UserProperties BuildVersion_AssemblyInfoFilename="Properties\AssemblyInfo.cs" BuildVersion_UpdateAssemblyVersion="True" BuildVersion_BuildVersioningStyle="None.None.Increment.TimeStamp" BuildVersion_UseGlobalSettings="False" BuildVersion_StartDate="2000/1/1" /> + </VisualStudio> + </ProjectExtensions> +</Project>
\ No newline at end of file diff --git a/Software/Visual_Studio/PPC/Modules/Tango.PPC.BackupRestore/ViewModelLocator.cs b/Software/Visual_Studio/PPC/Modules/Tango.PPC.BackupRestore/ViewModelLocator.cs new file mode 100644 index 000000000..698a70cd7 --- /dev/null +++ b/Software/Visual_Studio/PPC/Modules/Tango.PPC.BackupRestore/ViewModelLocator.cs @@ -0,0 +1,95 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using Tango.Core.DI; +using Tango.PPC.BackupRestore.ViewModels; + +namespace Tango.PPC.BackupRestore +{ + public static class ViewModelLocator + { + /// <summary> + /// Initializes a new instance of the ViewModelLocator class. + /// </summary> + static ViewModelLocator() + { + TangoIOC.Default.Register<MainViewVM>(); + TangoIOC.Default.Register<WelcomeViewVM>(); + TangoIOC.Default.Register<BackupViewVM>(); + TangoIOC.Default.Register<RestoreViewVM>(); + TangoIOC.Default.Register<BackupErrorViewVM>(); + TangoIOC.Default.Register<BackupCompletedViewVM>(); + TangoIOC.Default.Register<RestoreErrorViewVM>(); + TangoIOC.Default.Register<RestoreCompletedViewVM>(); + } + + /// <summary> + /// Gets the main view VM. + /// </summary> + public static MainViewVM MainViewVM + { + get + { + return TangoIOC.Default.GetInstance<MainViewVM>(); + } + } + + public static WelcomeViewVM WelcomeViewVM + { + get + { + return TangoIOC.Default.GetInstance<WelcomeViewVM>(); + } + } + + public static BackupViewVM BackupViewVM + { + get + { + return TangoIOC.Default.GetInstance<BackupViewVM>(); + } + } + + public static RestoreViewVM RestoreViewVM + { + get + { + return TangoIOC.Default.GetInstance<RestoreViewVM>(); + } + } + + public static BackupErrorViewVM BackupErrorViewVM + { + get + { + return TangoIOC.Default.GetInstance<BackupErrorViewVM>(); + } + } + + public static BackupCompletedViewVM BackupCompletedViewVM + { + get + { + return TangoIOC.Default.GetInstance<BackupCompletedViewVM>(); + } + } + + public static RestoreErrorViewVM RestoreErrorViewVM + { + get + { + return TangoIOC.Default.GetInstance<RestoreErrorViewVM>(); + } + } + + public static RestoreCompletedViewVM RestoreCompletedViewVM + { + get + { + return TangoIOC.Default.GetInstance<RestoreCompletedViewVM>(); + } + } + } +} diff --git a/Software/Visual_Studio/PPC/Modules/Tango.PPC.BackupRestore/ViewModels/BackupCompletedViewVM.cs b/Software/Visual_Studio/PPC/Modules/Tango.PPC.BackupRestore/ViewModels/BackupCompletedViewVM.cs new file mode 100644 index 000000000..8c40bf288 --- /dev/null +++ b/Software/Visual_Studio/PPC/Modules/Tango.PPC.BackupRestore/ViewModels/BackupCompletedViewVM.cs @@ -0,0 +1,20 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using Tango.PPC.Common; +using Tango.PPC.Common.BackupRestore; +using Tango.PPC.Common.Navigation; +using static Tango.PPC.BackupRestore.ViewModels.BackupCompletedViewVM; + +namespace Tango.PPC.BackupRestore.ViewModels +{ + public class BackupCompletedViewVM : PPCViewModel + { + public override void OnApplicationStarted() + { + + } + } +} diff --git a/Software/Visual_Studio/PPC/Modules/Tango.PPC.BackupRestore/ViewModels/BackupErrorViewVM.cs b/Software/Visual_Studio/PPC/Modules/Tango.PPC.BackupRestore/ViewModels/BackupErrorViewVM.cs new file mode 100644 index 000000000..42f2c9e51 --- /dev/null +++ b/Software/Visual_Studio/PPC/Modules/Tango.PPC.BackupRestore/ViewModels/BackupErrorViewVM.cs @@ -0,0 +1,37 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using Tango.PPC.Common; +using Tango.PPC.Common.BackupRestore; +using Tango.PPC.Common.Navigation; +using static Tango.PPC.BackupRestore.ViewModels.BackupErrorViewVM; + +namespace Tango.PPC.BackupRestore.ViewModels +{ + public class BackupErrorViewVM : PPCViewModel, INavigationObjectReceiver<BackupErrorNavigationObject> + { + public class BackupErrorNavigationObject + { + public String Error { get; set; } + } + + private String _error; + public String Error + { + get { return _error; } + set { _error = value; RaisePropertyChangedAuto(); } + } + + public override void OnApplicationStarted() + { + + } + + public void OnNavigatedToWithObject(BackupErrorNavigationObject obj) + { + Error = obj.Error; + } + } +} diff --git a/Software/Visual_Studio/PPC/Modules/Tango.PPC.BackupRestore/ViewModels/BackupViewVM.cs b/Software/Visual_Studio/PPC/Modules/Tango.PPC.BackupRestore/ViewModels/BackupViewVM.cs new file mode 100644 index 000000000..ef5b3810c --- /dev/null +++ b/Software/Visual_Studio/PPC/Modules/Tango.PPC.BackupRestore/ViewModels/BackupViewVM.cs @@ -0,0 +1,163 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using Tango.Core.Commands; +using Tango.Core.DI; +using Tango.Explorer; +using Tango.PPC.BackupRestore.Views; +using Tango.PPC.Common; +using Tango.PPC.Common.BackupRestore; +using Tango.PPC.Storage; +using static Tango.PPC.BackupRestore.ViewModels.BackupErrorViewVM; + +namespace Tango.PPC.BackupRestore.ViewModels +{ + public class BackupViewVM : PPCViewModel + { + private String _backupFileName; + + [TangoInject] + public IBackupManager BackupManager { get; set; } + + private BackupRestoreProgressEventArgs _currentBackupProgress; + public BackupRestoreProgressEventArgs CurrentBackupProgress + { + get { return _currentBackupProgress; } + set { _currentBackupProgress = value; RaisePropertyChangedAuto(); } + } + + private bool _isBackupJobs; + public bool IsBackupJobs + { + get { return _isBackupJobs; } + set + { + if (value) + { + _isBackupJobs = value; + RaisePropertyChangedAuto(); + _isBackupFull = false; + RaisePropertyChanged(nameof(IsBackupFull)); + } + else + { + RaisePropertyChangedAuto(); + } + } + } + + private bool _isBackupFull; + public bool IsBackupFull + { + get { return _isBackupFull; } + set + { + if (value) + { + _isBackupFull = value; + RaisePropertyChangedAuto(); + _isBackupJobs = false; + RaisePropertyChanged(nameof(IsBackupJobs)); + } + else + { + RaisePropertyChangedAuto(); + } + } + } + + private String _backupLocation; + public String BackupLocation + { + get { return _backupLocation; } + set { _backupLocation = value; RaisePropertyChangedAuto(); InvalidateRelayCommands(); } + } + + private String _backupName; + public String BackupName + { + get { return _backupName; } + set { _backupName = value; RaisePropertyChangedAuto(); InvalidateRelayCommands(); } + } + + public RelayCommand BackupCommand { get; set; } + + public RelayCommand BrowseBackupLocationCommand { get; set; } + + public BackupViewVM() + { + BrowseBackupLocationCommand = new RelayCommand(BrowseBackupLocation); + BackupCommand = new RelayCommand(StartBackup, () => !String.IsNullOrWhiteSpace(BackupName) && BackupLocation != null); + IsBackupJobs = true; + } + + private async void StartBackup() + { + await NavigationManager.NavigateTo<BackupRestoreModule>(nameof(BackupProgressView), false); + + try + { + IsFree = false; + NavigationManager.IsBackEnabled = false; + await BackupManager.CreateBackup(_backupFileName, BackupName, new BackupSettings() + { + Mode = IsBackupFull ? BackupMode.Full : BackupMode.Jobs, + }); + await NavigationManager.NavigateTo<BackupRestoreModule>(nameof(BackupCompletedView), false); + } + catch (Exception ex) + { + LogManager.Log(ex, "The backup operation failed."); + + await NavigationManager.NavigateWithObject<BackupRestoreModule, BackupErrorView, BackupErrorNavigationObject>(new BackupErrorNavigationObject() + { + Error = ex.FlattenMessage(), + }, false); + } + finally + { + IsFree = true; + NavigationManager.IsBackEnabled = true; + } + } + + public override void OnApplicationStarted() + { + + } + + public override void OnApplicationReady() + { + base.OnApplicationReady(); + BackupManager.Progress += BackupManager_Progress; + } + + private void BackupManager_Progress(object sender, BackupRestoreProgressEventArgs e) + { + CurrentBackupProgress = e; + } + + private async void BrowseBackupLocation() + { + var result = await NavigationManager. + NavigateForResult<StorageModule, + Storage.Views.MainView, ExplorerFileItem, + Storage.Models.StorageNavigationRequest>( + new Storage.Models.StorageNavigationRequest() + { + Intent = Storage.Models.StorageNavigationIntent.SaveFile, + DefaultFileName = $"Tango-Backup-{DateTime.Now.ToFileName()}", + Filter = ExplorerFileDefinition.Backup.Extension, + Title = "Select Destination Backup File", + }); + + if (result != null) + { + _backupFileName = result.Path + ExplorerFileDefinition.Backup.Extension; + BackupLocation = result.Path + ExplorerFileDefinition.Backup.Extension; + } + } + } +} diff --git a/Software/Visual_Studio/PPC/Modules/Tango.PPC.BackupRestore/ViewModels/MainViewVM.cs b/Software/Visual_Studio/PPC/Modules/Tango.PPC.BackupRestore/ViewModels/MainViewVM.cs new file mode 100644 index 000000000..989f8a6ee --- /dev/null +++ b/Software/Visual_Studio/PPC/Modules/Tango.PPC.BackupRestore/ViewModels/MainViewVM.cs @@ -0,0 +1,34 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using Tango.Core.Commands; +using Tango.Core.DI; +using Tango.Explorer; +using Tango.PPC.BackupRestore.Views; +using Tango.PPC.Common; +using Tango.PPC.Common.BackupRestore; +using Tango.PPC.Storage; + +namespace Tango.PPC.BackupRestore.ViewModels +{ + public class MainViewVM : PPCViewModel + { + public override void OnNavigatedFrom() + { + base.OnNavigatedFrom(); + } + + public override void OnNavigatedTo() + { + base.OnNavigatedTo(); + NavigationManager.NavigateTo<BackupRestoreModule>(nameof(WelcomeView), false); + } + + public override void OnApplicationStarted() + { + + } + } +} diff --git a/Software/Visual_Studio/PPC/Modules/Tango.PPC.BackupRestore/ViewModels/RestoreCompletedViewVM.cs b/Software/Visual_Studio/PPC/Modules/Tango.PPC.BackupRestore/ViewModels/RestoreCompletedViewVM.cs new file mode 100644 index 000000000..d773aa5d4 --- /dev/null +++ b/Software/Visual_Studio/PPC/Modules/Tango.PPC.BackupRestore/ViewModels/RestoreCompletedViewVM.cs @@ -0,0 +1,51 @@ +using System; +using System.Collections.Generic; +using System.IO; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using Tango.Core.Commands; +using Tango.Core.Helpers; +using Tango.PPC.Common; +using Tango.PPC.Common.BackupRestore; +using Tango.PPC.Common.Navigation; + +namespace Tango.PPC.BackupRestore.ViewModels +{ + public class RestoreCompletedViewVM : PPCViewModel, INavigationObjectReceiver<RestoreResult> + { + private RestoreResult _restoreResult; + + public RelayCommand RestartCommand { get; set; } + + public RestoreCompletedViewVM() + { + RestartCommand = new RelayCommand(Restart); + } + + private void Restart() + { + if (_restoreResult.BackupFile.Settings.Mode == BackupMode.Jobs) + { + //Perform normal restart. + ApplicationManager.Restart(); + } + else + { + //Perform update restart using the result path. + String updater_exe = Path.Combine(_restoreResult.FolderPath, "Tango.PPC.Updater.exe"); + ApplicationManager.UpdateApplication(updater_exe, PathHelper.GetStartupPath()); + } + } + + public override void OnApplicationStarted() + { + + } + + public void OnNavigatedToWithObject(RestoreResult restoreResult) + { + _restoreResult = restoreResult; + } + } +} diff --git a/Software/Visual_Studio/PPC/Modules/Tango.PPC.BackupRestore/ViewModels/RestoreErrorViewVM.cs b/Software/Visual_Studio/PPC/Modules/Tango.PPC.BackupRestore/ViewModels/RestoreErrorViewVM.cs new file mode 100644 index 000000000..b6df53318 --- /dev/null +++ b/Software/Visual_Studio/PPC/Modules/Tango.PPC.BackupRestore/ViewModels/RestoreErrorViewVM.cs @@ -0,0 +1,38 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using Tango.PPC.BackupRestore.Views; +using Tango.PPC.Common; +using Tango.PPC.Common.BackupRestore; +using Tango.PPC.Common.Navigation; +using static Tango.PPC.BackupRestore.ViewModels.RestoreErrorViewVM; + +namespace Tango.PPC.BackupRestore.ViewModels +{ + public class RestoreErrorViewVM : PPCViewModel, INavigationObjectReceiver<RestoreErrorNavigationObject> + { + public class RestoreErrorNavigationObject + { + public String Error { get; set; } + } + + private String _error; + public String Error + { + get { return _error; } + set { _error = value; RaisePropertyChangedAuto(); } + } + + public override void OnApplicationStarted() + { + + } + + public void OnNavigatedToWithObject(RestoreErrorNavigationObject obj) + { + Error = obj.Error; + } + } +} diff --git a/Software/Visual_Studio/PPC/Modules/Tango.PPC.BackupRestore/ViewModels/RestoreViewVM.cs b/Software/Visual_Studio/PPC/Modules/Tango.PPC.BackupRestore/ViewModels/RestoreViewVM.cs new file mode 100644 index 000000000..d925ebad1 --- /dev/null +++ b/Software/Visual_Studio/PPC/Modules/Tango.PPC.BackupRestore/ViewModels/RestoreViewVM.cs @@ -0,0 +1,168 @@ +using System; +using System.Collections.Generic; +using System.IO; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using Tango.Core.Commands; +using Tango.Core.DI; +using Tango.Explorer; +using Tango.PPC.BackupRestore.Views; +using Tango.PPC.Common; +using Tango.PPC.Common.BackupRestore; +using Tango.PPC.Storage; +using static Tango.PPC.BackupRestore.ViewModels.RestoreErrorViewVM; + +namespace Tango.PPC.BackupRestore.ViewModels +{ + public class RestoreViewVM : PPCViewModel + { + private string _backupFileLocation; + private bool _isBrowsing; + + [TangoInject] + public IBackupManager BackupManager { get; set; } + + private String _backupFileName; + public String BackupFileName + { + get { return _backupFileName; } + set { _backupFileName = value; RaisePropertyChangedAuto(); InvalidateRelayCommands(); } + } + + private RestoreSettings _restoreSettings; + public RestoreSettings RestoreSettings + { + get { return _restoreSettings; } + set { _restoreSettings = value; RaisePropertyChangedAuto(); } + } + + private BackupFile _backupFile; + public BackupFile BackupFile + { + get { return _backupFile; } + set { _backupFile = value; RaisePropertyChangedAuto(); } + } + + private BackupRestoreProgressEventArgs _currentRestoreProgress; + public BackupRestoreProgressEventArgs CurrentRestoreProgress + { + get { return _currentRestoreProgress; } + set { _currentRestoreProgress = value; RaisePropertyChangedAuto(); } + } + + private long _backupSize; + public long BackupSize + { + get { return _backupSize; } + set { _backupSize = value; RaisePropertyChangedAuto(); } + } + + public RelayCommand BrowseForBackupCommand { get; set; } + + public RelayCommand RestoreCommand { get; set; } + + public RestoreViewVM() + { + RestoreSettings = new RestoreSettings(); + RestoreCommand = new RelayCommand(StartRestore, () => BackupFileName != null); + BrowseForBackupCommand = new RelayCommand(BrowseForBackup); + } + + private async void StartRestore() + { + await NavigationManager.NavigateTo<BackupRestoreModule>(nameof(RestoreProgressView), false); + + try + { + IsFree = false; + NavigationManager.IsBackEnabled = false; + var result = await BackupManager.Restore(_backupFileLocation, RestoreSettings); + await NavigationManager.NavigateWithObject<BackupRestoreModule, RestoreCompletedView, RestoreResult>(result, false); + } + catch (Exception ex) + { + LogManager.Log(ex, "The restore operation failed."); + + await NavigationManager.NavigateWithObject<BackupRestoreModule, RestoreErrorView, RestoreErrorNavigationObject>(new RestoreErrorNavigationObject() + { + Error = ex.FlattenMessage(), + }, false); + + NavigationManager.IsBackEnabled = true; + } + finally + { + IsFree = true; + } + } + + private async void BrowseForBackup() + { + _isBrowsing = true; + + var result = await NavigationManager. + NavigateForResult<StorageModule, + Storage.Views.MainView, ExplorerFileItem, + Storage.Models.StorageNavigationRequest>( + new Storage.Models.StorageNavigationRequest() + { + Intent = Storage.Models.StorageNavigationIntent.LoadFile, + Filter = ExplorerFileDefinition.Backup.Extension, + Title = "Select Backup File", + }); + + _isBrowsing = false; + + if (result != null) + { + _backupFileLocation = result.Path; + + try + { + BackupFile = await BackupManager.ExtractBackupConfiguration(_backupFileLocation); + BackupFileName = Path.GetFileName(result.Path); + BackupSize = new System.IO.FileInfo(_backupFileLocation).Length; + } + catch (Exception ex) + { + LogManager.Log(ex, $"Error extracting backup configuration from file '{_backupFileLocation}'."); + await NotificationProvider.ShowError($"Error occurred while trying to extract the backup file information\n{ex.FlattenMessage()}"); + } + } + } + + public override Task<bool> OnNavigateBackRequest() + { + return Task.FromResult(IsFree); + } + + public override void OnNavigatedFrom() + { + base.OnNavigatedFrom(); + + if (!_isBrowsing) + { + BackupFileName = null; + BackupFile = null; + _backupFileLocation = null; + } + } + + public override void OnApplicationReady() + { + base.OnApplicationReady(); + BackupManager.Progress += BackupManager_Progress; + } + + private void BackupManager_Progress(object sender, BackupRestoreProgressEventArgs e) + { + CurrentRestoreProgress = e; + } + + public override void OnApplicationStarted() + { + + } + } +} diff --git a/Software/Visual_Studio/PPC/Modules/Tango.PPC.BackupRestore/ViewModels/WelcomeViewVM.cs b/Software/Visual_Studio/PPC/Modules/Tango.PPC.BackupRestore/ViewModels/WelcomeViewVM.cs new file mode 100644 index 000000000..4fbac321e --- /dev/null +++ b/Software/Visual_Studio/PPC/Modules/Tango.PPC.BackupRestore/ViewModels/WelcomeViewVM.cs @@ -0,0 +1,48 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using Tango.Core.Commands; +using Tango.PPC.BackupRestore.Views; +using Tango.PPC.Common; + +namespace Tango.PPC.BackupRestore.ViewModels +{ + public class WelcomeViewVM : PPCViewModel + { + public RelayCommand NavigateToBackupCommand { get; set; } + + public RelayCommand NavigateToRestoreCommand { get; set; } + + public WelcomeViewVM() + { + NavigateToBackupCommand = new RelayCommand(() => + { + NavigationManager.NavigateTo<BackupRestoreModule>(nameof(BackupView)); + }); + + NavigateToRestoreCommand = new RelayCommand(() => + { + NavigationManager.NavigateTo<BackupRestoreModule>(nameof(RestoreView)); + }); + } + + public override void OnApplicationStarted() + { + + } + + public override void OnNavigatedTo() + { + base.OnNavigatedTo(); + NotificationProvider.NotificationsVisible = false; + } + + public override Task<bool> OnNavigateBackRequest() + { + NotificationProvider.NotificationsVisible = true; + return base.OnNavigateBackRequest(); + } + } +} diff --git a/Software/Visual_Studio/PPC/Modules/Tango.PPC.BackupRestore/Views/BackupCompletedView.xaml b/Software/Visual_Studio/PPC/Modules/Tango.PPC.BackupRestore/Views/BackupCompletedView.xaml new file mode 100644 index 000000000..470c16256 --- /dev/null +++ b/Software/Visual_Studio/PPC/Modules/Tango.PPC.BackupRestore/Views/BackupCompletedView.xaml @@ -0,0 +1,37 @@ +<UserControl x:Class="Tango.PPC.BackupRestore.Views.BackupCompletedView" + 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:touch="clr-namespace:Tango.Touch.Controls;assembly=Tango.Touch" + xmlns:vm="clr-namespace:Tango.PPC.BackupRestore.ViewModels" + xmlns:controls="clr-namespace:Tango.SharedUI.Controls;assembly=Tango.SharedUI" + xmlns:global="clr-namespace:Tango.PPC.BackupRestore" + xmlns:local="clr-namespace:Tango.PPC.BackupRestore.Views" + mc:Ignorable="d" + d:DesignHeight="700" d:DesignWidth="800" d:DataContext="{d:DesignInstance Type=vm:BackupCompletedViewVM, IsDesignTimeCreatable=False}" DataContext="{x:Static global:ViewModelLocator.BackupCompletedViewVM}"> + + <Grid Background="{StaticResource TangoPrimaryBackgroundBrush}"> + <DockPanel Margin="30 0 30 30"> + <Grid DockPanel.Dock="Top"> + <StackPanel> + <TextBlock TextWrapping="Wrap" FontSize="{StaticResource TangoDefaultFontSize}"> + <Run FontSize="{StaticResource TangoTitleFontSize}" Foreground="{StaticResource TangoSuccessBrush}">Backup completed</Run> + <LineBreak/> + <LineBreak/> + <Run>The backup operation was completed successfully.</Run> + </TextBlock> + </StackPanel> + </Grid> + + <Grid DockPanel.Dock="Bottom"> + + </Grid> + + <Grid> + + </Grid> + + </DockPanel> + </Grid> +</UserControl> diff --git a/Software/Visual_Studio/PPC/Modules/Tango.PPC.BackupRestore/Views/BackupCompletedView.xaml.cs b/Software/Visual_Studio/PPC/Modules/Tango.PPC.BackupRestore/Views/BackupCompletedView.xaml.cs new file mode 100644 index 000000000..2a9779ed1 --- /dev/null +++ b/Software/Visual_Studio/PPC/Modules/Tango.PPC.BackupRestore/Views/BackupCompletedView.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.PPC.BackupRestore.Views +{ + /// <summary> + /// Interaction logic for BackupView.xaml + /// </summary> + public partial class BackupCompletedView : UserControl + { + public BackupCompletedView() + { + InitializeComponent(); + } + } +} diff --git a/Software/Visual_Studio/PPC/Modules/Tango.PPC.BackupRestore/Views/BackupErrorView.xaml b/Software/Visual_Studio/PPC/Modules/Tango.PPC.BackupRestore/Views/BackupErrorView.xaml new file mode 100644 index 000000000..b54694a50 --- /dev/null +++ b/Software/Visual_Studio/PPC/Modules/Tango.PPC.BackupRestore/Views/BackupErrorView.xaml @@ -0,0 +1,39 @@ +<UserControl x:Class="Tango.PPC.BackupRestore.Views.BackupErrorView" + 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:touch="clr-namespace:Tango.Touch.Controls;assembly=Tango.Touch" + xmlns:vm="clr-namespace:Tango.PPC.BackupRestore.ViewModels" + xmlns:controls="clr-namespace:Tango.SharedUI.Controls;assembly=Tango.SharedUI" + xmlns:global="clr-namespace:Tango.PPC.BackupRestore" + xmlns:local="clr-namespace:Tango.PPC.BackupRestore.Views" + mc:Ignorable="d" + d:DesignHeight="700" d:DesignWidth="800" d:DataContext="{d:DesignInstance Type=vm:BackupErrorViewVM, IsDesignTimeCreatable=False}" DataContext="{x:Static global:ViewModelLocator.BackupErrorViewVM}"> + + <Grid Background="{StaticResource TangoPrimaryBackgroundBrush}"> + <DockPanel Margin="30 0 30 30"> + <Grid DockPanel.Dock="Top"> + <StackPanel> + <TextBlock TextWrapping="Wrap" FontSize="{StaticResource TangoDefaultFontSize}"> + <Run FontSize="{StaticResource TangoTitleFontSize}" Foreground="{StaticResource TangoErrorBrush}">Backup failed</Run> + <LineBreak/> + <LineBreak/> + <Run>The backup operation has failed due to the following reason.</Run> + </TextBlock> + </StackPanel> + </Grid> + + <Grid DockPanel.Dock="Bottom"> + + </Grid> + + <Grid> + <TextBlock Text="{Binding Error}" Margin="0 10 0 0" Height="Auto" TextWrapping="Wrap" Foreground="{StaticResource TangoGrayTextBrush}"> + + </TextBlock> + </Grid> + + </DockPanel> + </Grid> +</UserControl> diff --git a/Software/Visual_Studio/PPC/Modules/Tango.PPC.BackupRestore/Views/BackupErrorView.xaml.cs b/Software/Visual_Studio/PPC/Modules/Tango.PPC.BackupRestore/Views/BackupErrorView.xaml.cs new file mode 100644 index 000000000..cf050140d --- /dev/null +++ b/Software/Visual_Studio/PPC/Modules/Tango.PPC.BackupRestore/Views/BackupErrorView.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.PPC.BackupRestore.Views +{ + /// <summary> + /// Interaction logic for BackupView.xaml + /// </summary> + public partial class BackupErrorView : UserControl + { + public BackupErrorView() + { + InitializeComponent(); + } + } +} diff --git a/Software/Visual_Studio/PPC/Modules/Tango.PPC.BackupRestore/Views/BackupProgressView.xaml b/Software/Visual_Studio/PPC/Modules/Tango.PPC.BackupRestore/Views/BackupProgressView.xaml new file mode 100644 index 000000000..7785c1c0f --- /dev/null +++ b/Software/Visual_Studio/PPC/Modules/Tango.PPC.BackupRestore/Views/BackupProgressView.xaml @@ -0,0 +1,38 @@ +<UserControl x:Class="Tango.PPC.BackupRestore.Views.BackupProgressView" + 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:touch="clr-namespace:Tango.Touch.Controls;assembly=Tango.Touch" + xmlns:vm="clr-namespace:Tango.PPC.BackupRestore.ViewModels" + xmlns:controls="clr-namespace:Tango.SharedUI.Controls;assembly=Tango.SharedUI" + xmlns:global="clr-namespace:Tango.PPC.BackupRestore" + xmlns:local="clr-namespace:Tango.PPC.BackupRestore.Views" + mc:Ignorable="d" + d:DesignHeight="700" d:DesignWidth="800" d:DataContext="{d:DesignInstance Type=vm:BackupViewVM, IsDesignTimeCreatable=False}" DataContext="{x:Static global:ViewModelLocator.BackupViewVM}"> + + <Grid Background="{StaticResource TangoPrimaryBackgroundBrush}"> + <DockPanel Margin="30 0 30 30"> + <Grid DockPanel.Dock="Top"> + <StackPanel> + <TextBlock TextWrapping="Wrap" FontSize="{StaticResource TangoDefaultFontSize}"> + <Run FontSize="{StaticResource TangoTitleFontSize}">Backing up your system</Run> + <LineBreak/> + <LineBreak/> + <Run>This process may take several minutes, please wait.</Run> + </TextBlock> + + + </StackPanel> + </Grid> + + <Grid> + <StackPanel VerticalAlignment="Center"> + <TextBlock Text="{Binding CurrentBackupProgress.Stage,Converter={StaticResource EnumToDescriptionConverter},FallbackValue='Backing up data'}" HorizontalAlignment="Center" FontSize="{StaticResource TangoTitleFontSize}"></TextBlock> + <touch:TouchProgressBar Margin="0 20" Height="10" IsIndeterminate="{Binding CurrentBackupProgress.IsIntermediate}" Maximum="{Binding CurrentBackupProgress.MaxProgress}" Value="{Binding CurrentBackupProgress.Progress,Mode=OneWay}" /> + </StackPanel> + </Grid> + + </DockPanel> + </Grid> +</UserControl> diff --git a/Software/Visual_Studio/PPC/Modules/Tango.PPC.BackupRestore/Views/BackupProgressView.xaml.cs b/Software/Visual_Studio/PPC/Modules/Tango.PPC.BackupRestore/Views/BackupProgressView.xaml.cs new file mode 100644 index 000000000..dd650f750 --- /dev/null +++ b/Software/Visual_Studio/PPC/Modules/Tango.PPC.BackupRestore/Views/BackupProgressView.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.PPC.BackupRestore.Views +{ + /// <summary> + /// Interaction logic for BackupView.xaml + /// </summary> + public partial class BackupProgressView : UserControl + { + public BackupProgressView() + { + InitializeComponent(); + } + } +} diff --git a/Software/Visual_Studio/PPC/Modules/Tango.PPC.BackupRestore/Views/BackupView.xaml b/Software/Visual_Studio/PPC/Modules/Tango.PPC.BackupRestore/Views/BackupView.xaml new file mode 100644 index 000000000..2a72f9788 --- /dev/null +++ b/Software/Visual_Studio/PPC/Modules/Tango.PPC.BackupRestore/Views/BackupView.xaml @@ -0,0 +1,99 @@ +<UserControl x:Class="Tango.PPC.BackupRestore.Views.BackupView" + 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:touch="clr-namespace:Tango.Touch.Controls;assembly=Tango.Touch" + xmlns:vm="clr-namespace:Tango.PPC.BackupRestore.ViewModels" + xmlns:controls="clr-namespace:Tango.SharedUI.Controls;assembly=Tango.SharedUI" + xmlns:global="clr-namespace:Tango.PPC.BackupRestore" + xmlns:local="clr-namespace:Tango.PPC.BackupRestore.Views" + mc:Ignorable="d" + d:DesignHeight="700" d:DesignWidth="800" d:DataContext="{d:DesignInstance Type=vm:BackupViewVM, IsDesignTimeCreatable=False}" DataContext="{x:Static global:ViewModelLocator.BackupViewVM}"> + + <Grid Background="{StaticResource TangoPrimaryBackgroundBrush}"> + <DockPanel Margin="30 0 30 30"> + <Grid DockPanel.Dock="Bottom"> + <DockPanel> + <touch:TouchButton Command="{Binding BackupCommand}" HorizontalAlignment="Right" Height="80" Width="300" CornerRadius="40" Content="START"/> + </DockPanel> + </Grid> + <StackPanel IsEnabled="{Binding IsFree}"> + <TextBlock TextWrapping="Wrap" FontSize="{StaticResource TangoDefaultFontSize}"> + <Run FontSize="{StaticResource TangoTitleFontSize}">Backup your system</Run> + <LineBreak/> + <LineBreak/> + <Run>Please specify the location and settings of your backup and press 'START'.</Run> + </TextBlock> + + <touch:TouchDropShadowBorder Padding="10" Margin="0 50 0 0"> + <StackPanel> + <StackPanel Orientation="Horizontal" VerticalAlignment="Center"> + <TextBlock VerticalAlignment="Center" Foreground="{StaticResource TangoPrimaryAccentBrush}">Backup Mode</TextBlock> + </StackPanel> + + <StackPanel Margin="0 20 0 0" TextElement.Foreground="{StaticResource TangoDarkForegroundBrush}" TextElement.FontSize="{StaticResource TangoTitleFontSize}"> + <StackPanel.Resources> + <Style TargetType="touch:TouchCheckBox" BasedOn="{StaticResource {x:Type touch:TouchCheckBox}}"> + <Setter Property="Margin" Value="0 0 0 10"></Setter> + <Setter Property="Foreground" Value="{StaticResource TangoDarkForegroundBrush}"></Setter> + </Style> + + <Style x:Key="run" TargetType="Run"> + <Setter Property="Foreground" Value="{StaticResource TangoGrayTextBrush}"></Setter> + <Setter Property="FontSize" Value="{StaticResource TangoDefaultFontSize}"></Setter> + </Style> + </StackPanel.Resources> + <touch:TouchRadioButton IsChecked="{Binding IsBackupJobs,Mode=TwoWay}"> + <touch:TouchRadioButton.Content> + <TextBlock> + <Run>Jobs</Run> + <Run Style="{StaticResource run}">(create a backup of all your jobs)</Run> + </TextBlock> + </touch:TouchRadioButton.Content> + </touch:TouchRadioButton> + <touch:TouchRadioButton IsChecked="{Binding IsBackupFull,Mode=TwoWay}" Margin="0 5 0 0"> + <touch:TouchRadioButton.Content> + <TextBlock> + <Run>Full Backup</Run> + <Run Style="{StaticResource run}">(backup the entire state of the system)</Run> + </TextBlock> + </touch:TouchRadioButton.Content> + </touch:TouchRadioButton> + </StackPanel> + </StackPanel> + </touch:TouchDropShadowBorder> + + <touch:TouchDropShadowBorder Padding="10 10 10 20" Margin="0 10 0 0"> + <StackPanel> + <StackPanel Orientation="Horizontal" VerticalAlignment="Center"> + <TextBlock VerticalAlignment="Center" Foreground="{StaticResource TangoPrimaryAccentBrush}">Location</TextBlock> + </StackPanel> + + <StackPanel Margin="0 20 0 0"> + + <TextBlock>Please select the destination of your backup file</TextBlock> + <DockPanel Height="50" Margin="0 20 0 0"> + <touch:TouchButton Command="{Binding BrowseBackupLocationCommand}" Margin="20 0 0 0" Width="150" DockPanel.Dock="Right" Foreground="{StaticResource TangoDarkForegroundBrush}" BorderBrush="{StaticResource TangoDarkForegroundBrush}" Style="{StaticResource TangoHollowButton}">SELECT</touch:TouchButton> + <touch:TouchTextBox Text="{Binding BackupLocation}" IsReadOnly="True" /> + </DockPanel> + </StackPanel> + </StackPanel> + </touch:TouchDropShadowBorder> + + <touch:TouchDropShadowBorder Padding="10" Margin="0 10 0 0"> + <StackPanel> + <StackPanel Orientation="Horizontal" VerticalAlignment="Center"> + <TextBlock VerticalAlignment="Center" Foreground="{StaticResource TangoPrimaryAccentBrush}">Name</TextBlock> + </StackPanel> + + <StackPanel Margin="0 20 0 0"> + <TextBlock>Please enter the name of your backup</TextBlock> + <touch:TouchTextBox Margin="0 20 0 0" Text="{Binding BackupName}" KeyboardContainer="{Binding RelativeSource={RelativeSource AncestorType=touch:TouchKeyboardContainer}}" /> + </StackPanel> + </StackPanel> + </touch:TouchDropShadowBorder> + </StackPanel> + </DockPanel> + </Grid> +</UserControl> diff --git a/Software/Visual_Studio/PPC/Modules/Tango.PPC.BackupRestore/Views/BackupView.xaml.cs b/Software/Visual_Studio/PPC/Modules/Tango.PPC.BackupRestore/Views/BackupView.xaml.cs new file mode 100644 index 000000000..adc951f87 --- /dev/null +++ b/Software/Visual_Studio/PPC/Modules/Tango.PPC.BackupRestore/Views/BackupView.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.PPC.BackupRestore.Views +{ + /// <summary> + /// Interaction logic for BackupView.xaml + /// </summary> + public partial class BackupView : UserControl + { + public BackupView() + { + InitializeComponent(); + } + } +} diff --git a/Software/Visual_Studio/PPC/Modules/Tango.PPC.BackupRestore/Views/MainView.xaml b/Software/Visual_Studio/PPC/Modules/Tango.PPC.BackupRestore/Views/MainView.xaml new file mode 100644 index 000000000..0caabd0e1 --- /dev/null +++ b/Software/Visual_Studio/PPC/Modules/Tango.PPC.BackupRestore/Views/MainView.xaml @@ -0,0 +1,39 @@ +<UserControl x:Class="Tango.PPC.BackupRestore.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:touch="clr-namespace:Tango.Touch.Controls;assembly=Tango.Touch" + xmlns:vm="clr-namespace:Tango.PPC.BackupRestore.ViewModels" + xmlns:controls="clr-namespace:Tango.SharedUI.Controls;assembly=Tango.SharedUI" + xmlns:global="clr-namespace:Tango.PPC.BackupRestore" + xmlns:local="clr-namespace:Tango.PPC.BackupRestore.Views" + mc:Ignorable="d" + d:DesignHeight="1280" d:DesignWidth="800" d:DataContext="{d:DesignInstance Type=vm:MainViewVM, IsDesignTimeCreatable=False}" DataContext="{x:Static global:ViewModelLocator.MainViewVM}"> + + <touch:TouchKeyboardContainer Background="{StaticResource TangoPrimaryBackgroundBrush}"> + <DockPanel> + <Grid DockPanel.Dock="Top"> + <StackPanel DockPanel.Dock="Top" HorizontalAlignment="Center" Margin="0 20 0 0"> + <Image Source="/Images/backup-restore.png" Stretch="Fill" Width="700" /> + </StackPanel> + </Grid> + + <controls:NavigationControl x:Name="navigationControl" TransitionType="Slide" TransitionDuration="00:00:0.2" KeepElementsAttached="True" Margin="0 20 0 0" SelectedIndex="0"> + + <local:WelcomeView/> + <local:BackupView/> + <local:RestoreView/> + + <local:BackupProgressView/> + <local:RestoreProgressView/> + + <local:BackupErrorView/> + <local:RestoreErrorView/> + + <local:BackupCompletedView/> + <local:RestoreCompletedView/> + </controls:NavigationControl> + </DockPanel> + </touch:TouchKeyboardContainer> +</UserControl> diff --git a/Software/Visual_Studio/PPC/Modules/Tango.PPC.BackupRestore/Views/MainView.xaml.cs b/Software/Visual_Studio/PPC/Modules/Tango.PPC.BackupRestore/Views/MainView.xaml.cs new file mode 100644 index 000000000..e21bec0cb --- /dev/null +++ b/Software/Visual_Studio/PPC/Modules/Tango.PPC.BackupRestore/Views/MainView.xaml.cs @@ -0,0 +1,30 @@ +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; +using Tango.Core.DI; +using static Tango.PPC.BackupRestore.ViewModels.MainViewVM; + +namespace Tango.PPC.BackupRestore.Views +{ + /// <summary> + /// Interaction logic for MainView.xaml + /// </summary> + public partial class MainView : UserControl + { + public MainView() + { + InitializeComponent(); + } + } +} diff --git a/Software/Visual_Studio/PPC/Modules/Tango.PPC.BackupRestore/Views/RestoreCompletedView.xaml b/Software/Visual_Studio/PPC/Modules/Tango.PPC.BackupRestore/Views/RestoreCompletedView.xaml new file mode 100644 index 000000000..6352797e7 --- /dev/null +++ b/Software/Visual_Studio/PPC/Modules/Tango.PPC.BackupRestore/Views/RestoreCompletedView.xaml @@ -0,0 +1,37 @@ +<UserControl x:Class="Tango.PPC.BackupRestore.Views.RestoreCompletedView" + 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:touch="clr-namespace:Tango.Touch.Controls;assembly=Tango.Touch" + xmlns:vm="clr-namespace:Tango.PPC.BackupRestore.ViewModels" + xmlns:controls="clr-namespace:Tango.SharedUI.Controls;assembly=Tango.SharedUI" + xmlns:global="clr-namespace:Tango.PPC.BackupRestore" + xmlns:local="clr-namespace:Tango.PPC.BackupRestore.Views" + mc:Ignorable="d" + d:DesignHeight="700" d:DesignWidth="800" d:DataContext="{d:DesignInstance Type=vm:RestoreCompletedViewVM, IsDesignTimeCreatable=False}" DataContext="{x:Static global:ViewModelLocator.RestoreCompletedViewVM}"> + + <Grid Background="{StaticResource TangoPrimaryBackgroundBrush}"> + <DockPanel Margin="30 0 30 30"> + <Grid DockPanel.Dock="Top"> + <StackPanel> + <TextBlock TextWrapping="Wrap" FontSize="{StaticResource TangoDefaultFontSize}"> + <Run FontSize="{StaticResource TangoTitleFontSize}" Foreground="{StaticResource TangoSuccessBrush}">System restored</Run> + <LineBreak/> + <LineBreak/> + <Run>Your system was successfully restored. The system needs to restart in order apply the changes.</Run> + </TextBlock> + </StackPanel> + </Grid> + + <Grid DockPanel.Dock="Bottom"> + <touch:TouchButton Command="{Binding RestartCommand}" HorizontalAlignment="Right" Height="80" Width="300" CornerRadius="40" Content="RESTART"/> + </Grid> + + <Grid> + + </Grid> + + </DockPanel> + </Grid> +</UserControl> diff --git a/Software/Visual_Studio/PPC/Modules/Tango.PPC.BackupRestore/Views/RestoreCompletedView.xaml.cs b/Software/Visual_Studio/PPC/Modules/Tango.PPC.BackupRestore/Views/RestoreCompletedView.xaml.cs new file mode 100644 index 000000000..5c3fbeaec --- /dev/null +++ b/Software/Visual_Studio/PPC/Modules/Tango.PPC.BackupRestore/Views/RestoreCompletedView.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.PPC.BackupRestore.Views +{ + /// <summary> + /// Interaction logic for BackupView.xaml + /// </summary> + public partial class RestoreCompletedView : UserControl + { + public RestoreCompletedView() + { + InitializeComponent(); + } + } +} diff --git a/Software/Visual_Studio/PPC/Modules/Tango.PPC.BackupRestore/Views/RestoreErrorView.xaml b/Software/Visual_Studio/PPC/Modules/Tango.PPC.BackupRestore/Views/RestoreErrorView.xaml new file mode 100644 index 000000000..2d09326ea --- /dev/null +++ b/Software/Visual_Studio/PPC/Modules/Tango.PPC.BackupRestore/Views/RestoreErrorView.xaml @@ -0,0 +1,39 @@ +<UserControl x:Class="Tango.PPC.BackupRestore.Views.RestoreErrorView" + 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:touch="clr-namespace:Tango.Touch.Controls;assembly=Tango.Touch" + xmlns:vm="clr-namespace:Tango.PPC.BackupRestore.ViewModels" + xmlns:controls="clr-namespace:Tango.SharedUI.Controls;assembly=Tango.SharedUI" + xmlns:global="clr-namespace:Tango.PPC.BackupRestore" + xmlns:local="clr-namespace:Tango.PPC.BackupRestore.Views" + mc:Ignorable="d" + d:DesignHeight="700" d:DesignWidth="800" d:DataContext="{d:DesignInstance Type=vm:RestoreErrorViewVM, IsDesignTimeCreatable=False}" DataContext="{x:Static global:ViewModelLocator.RestoreErrorViewVM}"> + + <Grid Background="{StaticResource TangoPrimaryBackgroundBrush}"> + <DockPanel Margin="30 0 30 30"> + <Grid DockPanel.Dock="Top"> + <StackPanel> + <TextBlock TextWrapping="Wrap" FontSize="{StaticResource TangoDefaultFontSize}"> + <Run FontSize="{StaticResource TangoTitleFontSize}" Foreground="{StaticResource TangoErrorBrush}">Restore failed</Run> + <LineBreak/> + <LineBreak/> + <Run>The restore operation has failed due to the following reason.</Run> + </TextBlock> + </StackPanel> + </Grid> + + <Grid DockPanel.Dock="Bottom"> + + </Grid> + + <Grid> + <TextBlock Text="{Binding Error}" Margin="0 10 0 0" Height="Auto" TextWrapping="Wrap" Foreground="{StaticResource TangoGrayTextBrush}"> + + </TextBlock> + </Grid> + + </DockPanel> + </Grid> +</UserControl> diff --git a/Software/Visual_Studio/PPC/Modules/Tango.PPC.BackupRestore/Views/RestoreErrorView.xaml.cs b/Software/Visual_Studio/PPC/Modules/Tango.PPC.BackupRestore/Views/RestoreErrorView.xaml.cs new file mode 100644 index 000000000..c0268d020 --- /dev/null +++ b/Software/Visual_Studio/PPC/Modules/Tango.PPC.BackupRestore/Views/RestoreErrorView.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.PPC.BackupRestore.Views +{ + /// <summary> + /// Interaction logic for BackupView.xaml + /// </summary> + public partial class RestoreErrorView : UserControl + { + public RestoreErrorView() + { + InitializeComponent(); + } + } +} diff --git a/Software/Visual_Studio/PPC/Modules/Tango.PPC.BackupRestore/Views/RestoreProgressView.xaml b/Software/Visual_Studio/PPC/Modules/Tango.PPC.BackupRestore/Views/RestoreProgressView.xaml new file mode 100644 index 000000000..65c1678c5 --- /dev/null +++ b/Software/Visual_Studio/PPC/Modules/Tango.PPC.BackupRestore/Views/RestoreProgressView.xaml @@ -0,0 +1,38 @@ +<UserControl x:Class="Tango.PPC.BackupRestore.Views.RestoreProgressView" + 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:touch="clr-namespace:Tango.Touch.Controls;assembly=Tango.Touch" + xmlns:vm="clr-namespace:Tango.PPC.BackupRestore.ViewModels" + xmlns:controls="clr-namespace:Tango.SharedUI.Controls;assembly=Tango.SharedUI" + xmlns:global="clr-namespace:Tango.PPC.BackupRestore" + xmlns:local="clr-namespace:Tango.PPC.BackupRestore.Views" + mc:Ignorable="d" + d:DesignHeight="700" d:DesignWidth="800" d:DataContext="{d:DesignInstance Type=vm:RestoreViewVM, IsDesignTimeCreatable=False}" DataContext="{x:Static global:ViewModelLocator.RestoreViewVM}"> + + <Grid Background="{StaticResource TangoPrimaryBackgroundBrush}"> + <DockPanel Margin="30 0 30 30"> + <Grid DockPanel.Dock="Top"> + <StackPanel> + <TextBlock TextWrapping="Wrap" FontSize="{StaticResource TangoDefaultFontSize}"> + <Run FontSize="{StaticResource TangoTitleFontSize}">Restoring your system</Run> + <LineBreak/> + <LineBreak/> + <Run>This process may take several minutes, please wait.</Run> + </TextBlock> + + + </StackPanel> + </Grid> + + <Grid> + <StackPanel VerticalAlignment="Center"> + <TextBlock Text="{Binding CurrentRestoreProgress.Stage,Converter={StaticResource EnumToDescriptionConverter},FallbackValue='Restoring data'}" HorizontalAlignment="Center" FontSize="{StaticResource TangoTitleFontSize}"></TextBlock> + <touch:TouchProgressBar Margin="0 20" Height="10" IsIndeterminate="{Binding CurrentRestoreProgress.IsIntermediate}" Maximum="{Binding CurrentRestoreProgress.MaxProgress}" Value="{Binding CurrentRestoreProgress.Progress,Mode=OneWay}" /> + </StackPanel> + </Grid> + + </DockPanel> + </Grid> +</UserControl> diff --git a/Software/Visual_Studio/PPC/Modules/Tango.PPC.BackupRestore/Views/RestoreProgressView.xaml.cs b/Software/Visual_Studio/PPC/Modules/Tango.PPC.BackupRestore/Views/RestoreProgressView.xaml.cs new file mode 100644 index 000000000..3b8b19fa9 --- /dev/null +++ b/Software/Visual_Studio/PPC/Modules/Tango.PPC.BackupRestore/Views/RestoreProgressView.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.PPC.BackupRestore.Views +{ + /// <summary> + /// Interaction logic for BackupView.xaml + /// </summary> + public partial class RestoreProgressView : UserControl + { + public RestoreProgressView() + { + InitializeComponent(); + } + } +} diff --git a/Software/Visual_Studio/PPC/Modules/Tango.PPC.BackupRestore/Views/RestoreView.xaml b/Software/Visual_Studio/PPC/Modules/Tango.PPC.BackupRestore/Views/RestoreView.xaml new file mode 100644 index 000000000..fca7a668e --- /dev/null +++ b/Software/Visual_Studio/PPC/Modules/Tango.PPC.BackupRestore/Views/RestoreView.xaml @@ -0,0 +1,160 @@ +<UserControl x:Class="Tango.PPC.BackupRestore.Views.RestoreView" + 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:touch="clr-namespace:Tango.Touch.Controls;assembly=Tango.Touch" + xmlns:vm="clr-namespace:Tango.PPC.BackupRestore.ViewModels" + xmlns:controls="clr-namespace:Tango.SharedUI.Controls;assembly=Tango.SharedUI" + xmlns:global="clr-namespace:Tango.PPC.BackupRestore" + xmlns:local="clr-namespace:Tango.PPC.BackupRestore.Views" + mc:Ignorable="d" + d:DesignHeight="700" d:DesignWidth="800" d:DataContext="{d:DesignInstance Type=vm:RestoreViewVM, IsDesignTimeCreatable=False}" DataContext="{x:Static global:ViewModelLocator.RestoreViewVM}"> + + <Grid Background="{StaticResource TangoPrimaryBackgroundBrush}"> + <DockPanel Margin="30 0 30 30"> + <Grid DockPanel.Dock="Bottom"> + <DockPanel> + <touch:TouchButton Command="{Binding RestoreCommand}" HorizontalAlignment="Right" Height="80" Width="300" CornerRadius="40" Content="START"/> + </DockPanel> + </Grid> + <StackPanel IsEnabled="{Binding IsFree}"> + <TextBlock TextWrapping="Wrap" FontSize="{StaticResource TangoDefaultFontSize}"> + <Run FontSize="{StaticResource TangoTitleFontSize}">Restore your system</Run> + <LineBreak/> + <LineBreak/> + <Run>Please specify the location of your backup file and other options. Press 'START' when you are ready.</Run> + </TextBlock> + + <touch:TouchDropShadowBorder Padding="10 10 10 20" Margin="0 50 0 0"> + <StackPanel> + <StackPanel Orientation="Horizontal" VerticalAlignment="Center"> + <TextBlock VerticalAlignment="Center" Foreground="{StaticResource TangoPrimaryAccentBrush}">Location</TextBlock> + </StackPanel> + + <StackPanel Margin="0 20 0 0"> + + <TextBlock>Please insert a storage device and select your backup file</TextBlock> + <DockPanel Height="50" Margin="0 20 0 0"> + <touch:TouchButton Command="{Binding BrowseForBackupCommand}" Margin="20 0 0 0" Width="150" DockPanel.Dock="Right" Foreground="{StaticResource TangoDarkForegroundBrush}" BorderBrush="{StaticResource TangoDarkForegroundBrush}" Style="{StaticResource TangoHollowButton}">SELECT</touch:TouchButton> + <touch:TouchTextBox Text="{Binding BackupFileName}" IsReadOnly="True" /> + </DockPanel> + </StackPanel> + </StackPanel> + </touch:TouchDropShadowBorder> + + <touch:TouchDropShadowBorder Padding="10 10 10 0" Margin="0 10 0 0" Visibility="{Binding BackupFile,Converter={StaticResource IsNullToVisibilityConverter}}"> + <StackPanel> + <StackPanel Orientation="Horizontal" VerticalAlignment="Center"> + <TextBlock VerticalAlignment="Center" Foreground="{StaticResource TangoPrimaryAccentBrush}">Information</TextBlock> + </StackPanel> + + <StackPanel Margin="0 20 0 0"> + + <StackPanel> + <controls:TableGrid RowHeight="20"> + <TextBlock Text="Name:"></TextBlock> + <TextBlock Foreground="{StaticResource TangoGrayTextBrush}" Text="{Binding BackupFile.Name}"></TextBlock> + + <TextBlock Text="Date:"></TextBlock> + <TextBlock Foreground="{StaticResource TangoGrayTextBrush}" Text="{Binding BackupFile.Date}"></TextBlock> + + <TextBlock Text="Size:"></TextBlock> + <TextBlock Foreground="{StaticResource TangoGrayTextBrush}" Text="{Binding BackupSize,Converter={StaticResource ByteArrayToFileSizeConverter}}"></TextBlock> + + <TextBlock Text="Mode:"></TextBlock> + <TextBlock Foreground="{StaticResource TangoGrayTextBrush}" Text="{Binding BackupFile.Settings.Mode}"></TextBlock> + </controls:TableGrid> + </StackPanel> + + <StackPanel Margin="0 -20 0 0"> + <StackPanel.Style> + <Style TargetType="StackPanel"> + <Setter Property="Visibility" Value="Collapsed"></Setter> + <Style.Triggers> + <DataTrigger Binding="{Binding BackupFile.Settings.Mode}" Value="Jobs"> + <Setter Property="Visibility" Value="Visible"></Setter> + </DataTrigger> + </Style.Triggers> + </Style> + </StackPanel.Style> + <controls:TableGrid RowHeight="20"> + <TextBlock Text="Jobs:"></TextBlock> + <TextBlock Foreground="{StaticResource TangoGrayTextBrush}" Text="{Binding BackupFile.JobFiles.Count}"></TextBlock> + </controls:TableGrid> + </StackPanel> + + <StackPanel> + <StackPanel.Style> + <Style TargetType="StackPanel"> + <Setter Property="Visibility" Value="Collapsed"></Setter> + <Style.Triggers> + <DataTrigger Binding="{Binding BackupFile.Settings.Mode}" Value="Full"> + <Setter Property="Visibility" Value="Visible"></Setter> + </DataTrigger> + </Style.Triggers> + </Style> + </StackPanel.Style> + <controls:TableGrid RowHeight="20"> + <TextBlock Text="Application Version:"></TextBlock> + <TextBlock Foreground="{StaticResource TangoGrayTextBrush}" Text="{Binding BackupFile.ApplicationVersion}"></TextBlock> + + <TextBlock Text="Firmware Version:"></TextBlock> + <TextBlock Foreground="{StaticResource TangoGrayTextBrush}" Text="{Binding BackupFile.FirmwareVersion}"></TextBlock> + </controls:TableGrid> + </StackPanel> + </StackPanel> + </StackPanel> + </touch:TouchDropShadowBorder> + + <touch:TouchDropShadowBorder Padding="10" Margin="0 10 0 0"> + <touch:TouchDropShadowBorder.Style> + <Style TargetType="touch:TouchDropShadowBorder"> + <Setter Property="Visibility" Value="Collapsed"></Setter> + <Style.Triggers> + <DataTrigger Binding="{Binding BackupFile.Settings.Mode}" Value="Jobs"> + <Setter Property="Visibility" Value="Visible"></Setter> + </DataTrigger> + </Style.Triggers> + </Style> + </touch:TouchDropShadowBorder.Style> + <StackPanel> + <StackPanel Orientation="Horizontal" VerticalAlignment="Center"> + <TextBlock VerticalAlignment="Center" Foreground="{StaticResource TangoPrimaryAccentBrush}">Options</TextBlock> + </StackPanel> + + <StackPanel Margin="0 20 0 0" TextElement.Foreground="{StaticResource TangoDarkForegroundBrush}" TextElement.FontSize="{StaticResource TangoTitleFontSize}"> + <StackPanel.Resources> + <Style TargetType="touch:TouchCheckBox" BasedOn="{StaticResource {x:Type touch:TouchCheckBox}}"> + <Setter Property="Margin" Value="0 0 0 10"></Setter> + <Setter Property="Foreground" Value="{StaticResource TangoDarkForegroundBrush}"></Setter> + </Style> + + <Style x:Key="run" TargetType="Run"> + <Setter Property="Foreground" Value="{StaticResource TangoGrayTextBrush}"></Setter> + <Setter Property="FontSize" Value="{StaticResource TangoDefaultFontSize}"></Setter> + </Style> + </StackPanel.Resources> + <touch:TouchCheckBox IsChecked="{Binding RestoreSettings.OverwriteExistingJobs,Mode=TwoWay}"> + <touch:TouchCheckBox.Content> + <TextBlock> + <Run>Overwrite existing jobs</Run> + <Run Style="{StaticResource run}">(existing jobs will change if there are conflicts)</Run> + </TextBlock> + </touch:TouchCheckBox.Content> + </touch:TouchCheckBox> + <touch:TouchCheckBox IsChecked="{Binding RestoreSettings.AllowDeleteJobs,Converter={StaticResource BooleanInverseConverter},Mode=TwoWay}"> + <touch:TouchCheckBox.Content> + <TextBlock> + <Run>Do not remove existing jobs</Run> + <Run Style="{StaticResource run}">(existing jobs will not be deleted)</Run> + </TextBlock> + </touch:TouchCheckBox.Content> + </touch:TouchCheckBox> + </StackPanel> + </StackPanel> + </touch:TouchDropShadowBorder> + </StackPanel> + </DockPanel> + </Grid> +</UserControl> diff --git a/Software/Visual_Studio/PPC/Modules/Tango.PPC.BackupRestore/Views/RestoreView.xaml.cs b/Software/Visual_Studio/PPC/Modules/Tango.PPC.BackupRestore/Views/RestoreView.xaml.cs new file mode 100644 index 000000000..4df9146bb --- /dev/null +++ b/Software/Visual_Studio/PPC/Modules/Tango.PPC.BackupRestore/Views/RestoreView.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.PPC.BackupRestore.Views +{ + /// <summary> + /// Interaction logic for RestoreView.xaml + /// </summary> + public partial class RestoreView : UserControl + { + public RestoreView() + { + InitializeComponent(); + } + } +} diff --git a/Software/Visual_Studio/PPC/Modules/Tango.PPC.BackupRestore/Views/WelcomeView.xaml b/Software/Visual_Studio/PPC/Modules/Tango.PPC.BackupRestore/Views/WelcomeView.xaml new file mode 100644 index 000000000..cf64b5bea --- /dev/null +++ b/Software/Visual_Studio/PPC/Modules/Tango.PPC.BackupRestore/Views/WelcomeView.xaml @@ -0,0 +1,72 @@ +<UserControl x:Class="Tango.PPC.BackupRestore.Views.WelcomeView" + 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:touch="clr-namespace:Tango.Touch.Controls;assembly=Tango.Touch" + xmlns:vm="clr-namespace:Tango.PPC.BackupRestore.ViewModels" + xmlns:controls="clr-namespace:Tango.SharedUI.Controls;assembly=Tango.SharedUI" + xmlns:global="clr-namespace:Tango.PPC.BackupRestore" + xmlns:local="clr-namespace:Tango.PPC.BackupRestore.Views" + mc:Ignorable="d" + d:DesignHeight="1280" d:DesignWidth="800" d:DataContext="{d:DesignInstance Type=vm:WelcomeViewVM, IsDesignTimeCreatable=False}" DataContext="{x:Static global:ViewModelLocator.WelcomeViewVM}"> + + <UserControl.Resources> + <Style TargetType="touch:TouchButton" x:Key="ButtonMenu"> + <Setter Property="Padding" Value="10"></Setter> + <Setter Property="HorizontalContentAlignment" Value="Left"></Setter> + <Setter Property="Height" Value="140"></Setter> + <Setter Property="Background" Value="Transparent"></Setter> + <Setter Property="BorderBrush" Value="{StaticResource TangoDarkForegroundBrush}"></Setter> + <Setter Property="BorderThickness" Value="1"></Setter> + <Setter Property="Foreground" Value="{StaticResource TangoDarkForegroundBrush}"></Setter> + <Setter Property="EnableDropShadow" Value="False"></Setter> + <Setter Property="CornerRadius" Value="5"></Setter> + <Setter Property="Margin" Value="0 0 0 20"></Setter> + <Setter Property="RippleBrush" Value="#4BB8B8B8"></Setter> + </Style> + </UserControl.Resources> + + <Grid controls:NavigationControl.NavigationName="MainView"> + <StackPanel HorizontalAlignment="Left" Margin="50 20 50 0"> + <TextBlock TextWrapping="Wrap" FontSize="{StaticResource TangoDefaultFontSize}"> + <Run FontSize="{StaticResource TangoTitleFontSize}">Welcome to the backup/restore wizard</Run> + <LineBreak/> + <LineBreak/> + <Run>This wizard allows you to create a complete backup of your current machine state including software, firmware, data and user settings.</Run> + <LineBreak/> + <LineBreak/> + <LineBreak/> + <Run>For creating a complete backup of your system please press 'Backup'.</Run> + <LineBreak/> + <Run>In case you want to restore your system to a previous state, please press 'Restore'.</Run> + </TextBlock> + </StackPanel> + + <StackPanel VerticalAlignment="Center" Margin="50 150 50 0"> + <touch:TouchButton Style="{StaticResource ButtonMenu}" Command="{Binding NavigateToBackupCommand}"> + <StackPanel Orientation="Horizontal" HorizontalAlignment="Left"> + <Image Source="../Images/backup-big.png" Width="80" Height="80" /> + <StackPanel Margin="10 0 0 0"> + <TextBlock FontSize="{StaticResource TangoButtonFontSize}">Backup</TextBlock> + <TextBlock Foreground="{StaticResource TangoGrayTextBrush}" Width="470" TextWrapping="Wrap"> + Create a complete backup of your system state and save it to a storage device. + </TextBlock> + </StackPanel> + </StackPanel> + </touch:TouchButton> + + <touch:TouchButton Style="{StaticResource ButtonMenu}" Command="{Binding NavigateToRestoreCommand}" CommandParameter="RestoreView"> + <StackPanel Orientation="Horizontal" HorizontalAlignment="Left"> + <Image Source="../Images/restore.png" Width="80" Height="65" /> + <StackPanel Margin="10 0 0 0"> + <TextBlock FontSize="{StaticResource TangoButtonFontSize}">Restore</TextBlock> + <TextBlock Foreground="{StaticResource TangoGrayTextBrush}"> + Restore your system from a previously saved backup file. + </TextBlock> + </StackPanel> + </StackPanel> + </touch:TouchButton> + </StackPanel> + </Grid> +</UserControl> diff --git a/Software/Visual_Studio/PPC/Modules/Tango.PPC.BackupRestore/Views/WelcomeView.xaml.cs b/Software/Visual_Studio/PPC/Modules/Tango.PPC.BackupRestore/Views/WelcomeView.xaml.cs new file mode 100644 index 000000000..a7c347016 --- /dev/null +++ b/Software/Visual_Studio/PPC/Modules/Tango.PPC.BackupRestore/Views/WelcomeView.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.PPC.BackupRestore.Views +{ + /// <summary> + /// Interaction logic for WelcomeView.xaml + /// </summary> + public partial class WelcomeView : UserControl + { + public WelcomeView() + { + InitializeComponent(); + } + } +} diff --git a/Software/Visual_Studio/PPC/Modules/Tango.PPC.BackupRestore/app.config b/Software/Visual_Studio/PPC/Modules/Tango.PPC.BackupRestore/app.config new file mode 100644 index 000000000..1e22e6a88 --- /dev/null +++ b/Software/Visual_Studio/PPC/Modules/Tango.PPC.BackupRestore/app.config @@ -0,0 +1,61 @@ +<?xml version="1.0" encoding="utf-8"?> +<configuration> + <configSections> + <!-- For more information on Entity Framework configuration, visit http://go.microsoft.com/fwlink/?LinkID=237468 --> + <section name="entityFramework" type="System.Data.Entity.Internal.ConfigFile.EntityFrameworkSection, EntityFramework, Version=6.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" requirePermission="false"/> + </configSections> + <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> + <dependentAssembly> + <assemblyIdentity name="System.Collections.Immutable" publicKeyToken="b03f5f7f11d50a3a" culture="neutral"/> + <bindingRedirect oldVersion="0.0.0.0-1.2.2.0" newVersion="1.2.2.0"/> + </dependentAssembly> + <dependentAssembly> + <assemblyIdentity name="System.Reflection.Metadata" publicKeyToken="b03f5f7f11d50a3a" culture="neutral"/> + <bindingRedirect oldVersion="0.0.0.0-1.4.2.0" newVersion="1.4.2.0"/> + </dependentAssembly> + <dependentAssembly> + <assemblyIdentity name="System.IO.FileSystem" publicKeyToken="b03f5f7f11d50a3a" culture="neutral"/> + <bindingRedirect oldVersion="0.0.0.0-4.0.2.0" newVersion="4.0.2.0"/> + </dependentAssembly> + <dependentAssembly> + <assemblyIdentity name="System.ValueTuple" publicKeyToken="cc7b13ffcd2ddd51" culture="neutral"/> + <bindingRedirect oldVersion="0.0.0.0-4.0.2.0" newVersion="4.0.2.0"/> + </dependentAssembly> + <dependentAssembly> + <assemblyIdentity name="System.IO.Compression" publicKeyToken="b77a5c561934e089" culture="neutral"/> + <bindingRedirect oldVersion="0.0.0.0-4.1.2.0" newVersion="4.1.2.0"/> + </dependentAssembly> + <dependentAssembly> + <assemblyIdentity name="System.IO.FileSystem.Primitives" publicKeyToken="b03f5f7f11d50a3a" culture="neutral"/> + <bindingRedirect oldVersion="0.0.0.0-4.0.2.0" newVersion="4.0.2.0"/> + </dependentAssembly> + <dependentAssembly> + <assemblyIdentity name="System.Security.Cryptography.Primitives" publicKeyToken="b03f5f7f11d50a3a" culture="neutral"/> + <bindingRedirect oldVersion="0.0.0.0-4.0.1.0" newVersion="4.0.1.0"/> + </dependentAssembly> + <dependentAssembly> + <assemblyIdentity name="System.Xml.XPath.XDocument" publicKeyToken="b03f5f7f11d50a3a" culture="neutral"/> + <bindingRedirect oldVersion="0.0.0.0-4.0.2.0" newVersion="4.0.2.0"/> + </dependentAssembly> + <dependentAssembly> + <assemblyIdentity name="System.Console" publicKeyToken="b03f5f7f11d50a3a" culture="neutral"/> + <bindingRedirect oldVersion="0.0.0.0-4.0.1.0" newVersion="4.0.1.0"/> + </dependentAssembly> + <dependentAssembly> + <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> + </assemblyBinding> + </runtime> + <entityFramework> + <defaultConnectionFactory type="System.Data.Entity.Infrastructure.SqlConnectionFactory, EntityFramework"/> + <providers> + <provider invariantName="System.Data.SqlClient" type="System.Data.Entity.SqlServer.SqlProviderServices, EntityFramework.SqlServer"/> + </providers> + </entityFramework> +<startup><supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.6.1"/></startup></configuration> diff --git a/Software/Visual_Studio/PPC/Modules/Tango.PPC.BackupRestore/packages.config b/Software/Visual_Studio/PPC/Modules/Tango.PPC.BackupRestore/packages.config new file mode 100644 index 000000000..80367fdd2 --- /dev/null +++ b/Software/Visual_Studio/PPC/Modules/Tango.PPC.BackupRestore/packages.config @@ -0,0 +1,7 @@ +<?xml version="1.0" encoding="utf-8"?> +<packages> + <package id="EntityFramework" version="6.0.0" targetFramework="net46" /> + <package id="Expression.Blend.Sdk" version="1.0.2" targetFramework="net46" /> + <package id="FontAwesome.WPF" version="4.7.0.9" targetFramework="net46" /> + <package id="Google.Protobuf" version="3.4.1" targetFramework="net46" /> +</packages>
\ No newline at end of file diff --git a/Software/Visual_Studio/PPC/Modules/Tango.PPC.Browser/App.xaml b/Software/Visual_Studio/PPC/Modules/Tango.PPC.Browser/App.xaml new file mode 100644 index 000000000..576597134 --- /dev/null +++ b/Software/Visual_Studio/PPC/Modules/Tango.PPC.Browser/App.xaml @@ -0,0 +1,11 @@ +<Application x:Class="Tango.PPC.Browser.App" + xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" + xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"> + <Application.Resources> + <ResourceDictionary> + <ResourceDictionary.MergedDictionaries> + <ResourceDictionary Source="pack://application:,,,/Tango.PPC.Common;component/Resources/Merged.xaml" /> + </ResourceDictionary.MergedDictionaries> + </ResourceDictionary> + </Application.Resources> +</Application>
\ No newline at end of file diff --git a/Software/Visual_Studio/PPC/Modules/Tango.PPC.Browser/Attributes/BoundObjectAttribute.cs b/Software/Visual_Studio/PPC/Modules/Tango.PPC.Browser/Attributes/BoundObjectAttribute.cs new file mode 100644 index 000000000..b4e822f1e --- /dev/null +++ b/Software/Visual_Studio/PPC/Modules/Tango.PPC.Browser/Attributes/BoundObjectAttribute.cs @@ -0,0 +1,20 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace Tango.PPC.Browser.Attributes +{ + public class BoundObjectAttribute : Attribute + { + public String Name { get; set; } + public String ScriptFile { get; set; } + + public BoundObjectAttribute(String name,String scriptFile) + { + Name = name; + ScriptFile = scriptFile; + } + } +} diff --git a/Software/Visual_Studio/PPC/Modules/Tango.PPC.Browser/BoundsObjects/KeyboardHandler.cs b/Software/Visual_Studio/PPC/Modules/Tango.PPC.Browser/BoundsObjects/KeyboardHandler.cs new file mode 100644 index 000000000..3c608a518 --- /dev/null +++ b/Software/Visual_Studio/PPC/Modules/Tango.PPC.Browser/BoundsObjects/KeyboardHandler.cs @@ -0,0 +1,66 @@ +using System; +using System.Collections.Generic; +using System.Diagnostics; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using System.Windows; +using Tango.PPC.Browser.Attributes; +using Tango.PPC.Browser.Views; +using Tango.PPC.Common.Helpers; +using Tango.Touch.Keyboard; + +namespace Tango.PPC.Browser.BoundsObjects +{ + [BoundObject("keyboard", "keyboard.js")] + public class KeyboardHandler + { + private DateTime _lastTime; + + public KeyboardHandler() + { + _lastTime = DateTime.Now; + } + + public void openKeyboard(String inputType) + { + if (DateTime.Now > _lastTime.AddMilliseconds(1000)) + { + _lastTime = DateTime.Now; + + Application.Current.Dispatcher.BeginInvoke(new Action(async () => + { + switch (inputType) + { + case "search": + KeyboardHelper.OpenKeyboard(KeyboardActionKeyMode.Go); + break; + default: + KeyboardHelper.OpenKeyboard(KeyboardActionKeyMode.Next); + break; + } + + + await Task.Delay(50); + BrowserView.Instance.btnGo.Focus(); + await Task.Delay(50); + BrowserView.Instance.Browser.Focus(); + Debug.WriteLine("Focus"); + })); + } + } + + public void closeKeyboard() + { + if (DateTime.Now > _lastTime.AddMilliseconds(1000)) + { + _lastTime = DateTime.Now; + + Application.Current.Dispatcher.BeginInvoke(new Action(() => + { + KeyboardHelper.CloseKeyboard(); + })); + } + } + } +} diff --git a/Software/Visual_Studio/PPC/Modules/Tango.PPC.Browser/BrowserModule.cs b/Software/Visual_Studio/PPC/Modules/Tango.PPC.Browser/BrowserModule.cs new file mode 100644 index 000000000..dc7b294d5 --- /dev/null +++ b/Software/Visual_Studio/PPC/Modules/Tango.PPC.Browser/BrowserModule.cs @@ -0,0 +1,101 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using System.Windows.Media.Imaging; +using Tango.BL.Enumerations; +using Tango.PPC.Common; +using Tango.PPC.Browser.Views; +using Tango.SharedUI.Helpers; +using Tango.Core.DI; +using Tango.PPC.Common.Application; +using System.IO; +using Tango.Core.Helpers; + +namespace Tango.PPC.Browser +{ + /// <summary> + /// Represents a PPC <see cref="BrowserModule"/>. + /// </summary> + /// <seealso cref="Tango.PPC.Common.PPCModuleBase" /> + [PPCModule(10)] + public class BrowserModule : PPCModuleBase + { + /// <summary> + /// Initializes a new instance of the <see cref="BrowserModule"/> class. + /// </summary> + public BrowserModule() + { + IsVisibleInMenu = false; + } + + /// <summary> + /// Gets the module name. + /// </summary> + public override string Name + { + get + { + return "Browser"; + } + } + + /// <summary> + /// Gets the module description. + /// </summary> + public override string Description + { + get + { + return "Browser module"; + } + } + + /// <summary> + /// Gets the module cover image. + /// </summary> + public override BitmapSource Image + { + get + { + return ResourceHelper.GetImageFromResources("Images/browser.png"); + } + } + + /// <summary> + /// Gets the module entry point view type. + /// </summary> + public override Type MainViewType + { + get + { + return IsCefAvailable() ? typeof(BrowserView) : typeof(ErrorView); + } + } + + /// <summary> + /// Gets the permission required to see and load this module. + /// </summary> + public override Permissions Permission + { + get + { + return Permissions.RunPPC; + } + } + + private bool IsCefAvailable() + { + return File.Exists(Path.Combine(AssemblyHelper.GetCurrentAssemblyFolder(), "x86", "CefSharp.Core.dll")); + } + + /// <summary> + /// Performs application-defined tasks associated with freeing, releasing, or resetting unmanaged resources. + /// </summary> + public override void Dispose() + { + //Dispose module here... + } + } +} diff --git a/Software/Visual_Studio/PPC/Modules/Tango.PPC.Browser/CefSharpOutput.zip b/Software/Visual_Studio/PPC/Modules/Tango.PPC.Browser/CefSharpOutput.zip Binary files differnew file mode 100644 index 000000000..8c68cedb7 --- /dev/null +++ b/Software/Visual_Studio/PPC/Modules/Tango.PPC.Browser/CefSharpOutput.zip diff --git a/Software/Visual_Studio/PPC/Modules/Tango.PPC.Browser/Helpers/BoundObjectsHelper.cs b/Software/Visual_Studio/PPC/Modules/Tango.PPC.Browser/Helpers/BoundObjectsHelper.cs new file mode 100644 index 000000000..fe68ee848 --- /dev/null +++ b/Software/Visual_Studio/PPC/Modules/Tango.PPC.Browser/Helpers/BoundObjectsHelper.cs @@ -0,0 +1,72 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using System.Reflection; +using Tango.PPC.Browser.Attributes; +using CefSharp; +using CefSharp.Wpf; +using Tango.Core.Helpers; +using System.Windows.Threading; + +namespace Tango.PPC.Browser.Helpers +{ + public static class BoundObjectsHelper + { + private static DispatcherTimer _timer; + private static Dispatcher _dispatcher; + private static ChromiumWebBrowser _browser; + + private static List<String> _scripts = new List<string>(); + + public static void RegisterAllBoundObjects(ChromiumWebBrowser browser, Dispatcher dispatcher) + { + _dispatcher = dispatcher; + _browser = browser; + + _timer = new DispatcherTimer(DispatcherPriority.Background, dispatcher); + _timer.Tick += _timer_Tick; + _timer.Interval = TimeSpan.FromSeconds(2); + _timer.Stop(); + + foreach (var type in typeof(BoundObjectsHelper).Assembly.GetTypes().Where(x => x.GetCustomAttribute<BoundObjectAttribute>() != null)) + { + var att = type.GetCustomAttribute<BoundObjectAttribute>(); + + var script = EmbeddedResourceHelper.GetEmbeddedResourceText($"Tango.PPC.Browser.Scripts.{att.ScriptFile}"); + _scripts.Add(script); + + browser.JavascriptObjectRepository.Register(att.Name, Activator.CreateInstance(type), true); + + browser.FrameLoadEnd += Browser_FrameLoadEnd; + } + } + + private static void Browser_FrameLoadEnd(object sender, FrameLoadEndEventArgs e) + { + _timer.Stop(); + _timer.Start(); + } + + private static void _timer_Tick(object sender, EventArgs e) + { + try + { + _timer.Stop(); + + _dispatcher.BeginInvoke(new Action(() => + { + foreach (var script in _scripts) + { + _browser.GetMainFrame().ExecuteJavaScriptAsync(script); + } + })); + } + catch + { + _timer.Start(); + } + } + } +} diff --git a/Software/Visual_Studio/PPC/Modules/Tango.PPC.Browser/Images/browser.png b/Software/Visual_Studio/PPC/Modules/Tango.PPC.Browser/Images/browser.png Binary files differnew file mode 100644 index 000000000..ebb975b6f --- /dev/null +++ b/Software/Visual_Studio/PPC/Modules/Tango.PPC.Browser/Images/browser.png diff --git a/Software/Visual_Studio/PPC/Modules/Tango.PPC.Browser/Navigation/BrowserNavigationRequest.cs b/Software/Visual_Studio/PPC/Modules/Tango.PPC.Browser/Navigation/BrowserNavigationRequest.cs new file mode 100644 index 000000000..a8becf251 --- /dev/null +++ b/Software/Visual_Studio/PPC/Modules/Tango.PPC.Browser/Navigation/BrowserNavigationRequest.cs @@ -0,0 +1,19 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace Tango.PPC.Browser.Navigation +{ + public class BrowserNavigationRequest + { + public String Address { get; set; } + public bool DisplayAddressBar { get; set; } + + public BrowserNavigationRequest() + { + DisplayAddressBar = true; + } + } +} diff --git a/Software/Visual_Studio/PPC/Modules/Tango.PPC.Browser/Properties/AssemblyInfo.cs b/Software/Visual_Studio/PPC/Modules/Tango.PPC.Browser/Properties/AssemblyInfo.cs new file mode 100644 index 000000000..70edee491 --- /dev/null +++ b/Software/Visual_Studio/PPC/Modules/Tango.PPC.Browser/Properties/AssemblyInfo.cs @@ -0,0 +1,20 @@ +using System.Reflection; +using System.Resources; +using System.Runtime.CompilerServices; +using System.Runtime.InteropServices; +using System.Windows; + +// General Information about an assembly is controlled through the following +// set of attributes. Change these attribute values to modify the information +// associated with an assembly. +[assembly: AssemblyTitle("Tango Web Browser Module")] +[assembly: AssemblyVersion("2.0.1.1407")] + +[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/PPC/Modules/Tango.PPC.Browser/Properties/Resources.Designer.cs b/Software/Visual_Studio/PPC/Modules/Tango.PPC.Browser/Properties/Resources.Designer.cs new file mode 100644 index 000000000..01c0a8851 --- /dev/null +++ b/Software/Visual_Studio/PPC/Modules/Tango.PPC.Browser/Properties/Resources.Designer.cs @@ -0,0 +1,63 @@ +//------------------------------------------------------------------------------ +// <auto-generated> +// 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. +// </auto-generated> +//------------------------------------------------------------------------------ + +namespace Tango.PPC.Browser.Properties { + using System; + + + /// <summary> + /// A strongly-typed resource class, for looking up localized strings, etc. + /// </summary> + // 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", "15.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() { + } + + /// <summary> + /// Returns the cached ResourceManager instance used by this class. + /// </summary> + [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] + internal static global::System.Resources.ResourceManager ResourceManager { + get { + if (object.ReferenceEquals(resourceMan, null)) { + global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("Tango.PPC.Browser.Properties.Resources", typeof(Resources).Assembly); + resourceMan = temp; + } + return resourceMan; + } + } + + /// <summary> + /// Overrides the current thread's CurrentUICulture property for all + /// resource lookups using this strongly typed resource class. + /// </summary> + [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/PPC/Modules/Tango.PPC.Browser/Properties/Resources.resx b/Software/Visual_Studio/PPC/Modules/Tango.PPC.Browser/Properties/Resources.resx new file mode 100644 index 000000000..af7dbebba --- /dev/null +++ b/Software/Visual_Studio/PPC/Modules/Tango.PPC.Browser/Properties/Resources.resx @@ -0,0 +1,117 @@ +<?xml version="1.0" encoding="utf-8"?> +<root> + <!-- + Microsoft ResX Schema + + Version 2.0 + + The primary goals of this format is to allow a simple XML format + that is mostly human readable. The generation and parsing of the + various data types are done through the TypeConverter classes + associated with the data types. + + Example: + + ... ado.net/XML headers & schema ... + <resheader name="resmimetype">text/microsoft-resx</resheader> + <resheader name="version">2.0</resheader> + <resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader> + <resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader> + <data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data> + <data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data> + <data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64"> + <value>[base64 mime encoded serialized .NET Framework object]</value> + </data> + <data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64"> + <value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value> + <comment>This is a comment</comment> + </data> + + There are any number of "resheader" rows that contain simple + name/value pairs. + + Each data row contains a name, and value. The row also contains a + type or mimetype. Type corresponds to a .NET class that support + text/value conversion through the TypeConverter architecture. + Classes that don't support this are serialized and stored with the + mimetype set. + + The mimetype is used for serialized objects, and tells the + ResXResourceReader how to depersist the object. This is currently not + extensible. For a given mimetype the value must be set accordingly: + + Note - application/x-microsoft.net.object.binary.base64 is the format + that the ResXResourceWriter will generate, however the reader can + read any of the formats listed below. + + mimetype: application/x-microsoft.net.object.binary.base64 + value : The object must be serialized with + : System.Serialization.Formatters.Binary.BinaryFormatter + : and then encoded with base64 encoding. + + mimetype: application/x-microsoft.net.object.soap.base64 + value : The object must be serialized with + : System.Runtime.Serialization.Formatters.Soap.SoapFormatter + : and then encoded with base64 encoding. + + mimetype: application/x-microsoft.net.object.bytearray.base64 + value : The object must be serialized into a byte array + : using a System.ComponentModel.TypeConverter + : and then encoded with base64 encoding. + --> + <xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata"> + <xsd:element name="root" msdata:IsDataSet="true"> + <xsd:complexType> + <xsd:choice maxOccurs="unbounded"> + <xsd:element name="metadata"> + <xsd:complexType> + <xsd:sequence> + <xsd:element name="value" type="xsd:string" minOccurs="0" /> + </xsd:sequence> + <xsd:attribute name="name" type="xsd:string" /> + <xsd:attribute name="type" type="xsd:string" /> + <xsd:attribute name="mimetype" type="xsd:string" /> + </xsd:complexType> + </xsd:element> + <xsd:element name="assembly"> + <xsd:complexType> + <xsd:attribute name="alias" type="xsd:string" /> + <xsd:attribute name="name" type="xsd:string" /> + </xsd:complexType> + </xsd:element> + <xsd:element name="data"> + <xsd:complexType> + <xsd:sequence> + <xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" /> + <xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" /> + </xsd:sequence> + <xsd:attribute name="name" type="xsd:string" msdata:Ordinal="1" /> + <xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" /> + <xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" /> + </xsd:complexType> + </xsd:element> + <xsd:element name="resheader"> + <xsd:complexType> + <xsd:sequence> + <xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" /> + </xsd:sequence> + <xsd:attribute name="name" type="xsd:string" use="required" /> + </xsd:complexType> + </xsd:element> + </xsd:choice> + </xsd:complexType> + </xsd:element> + </xsd:schema> + <resheader name="resmimetype"> + <value>text/microsoft-resx</value> + </resheader> + <resheader name="version"> + <value>2.0</value> + </resheader> + <resheader name="reader"> + <value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value> + </resheader> + <resheader name="writer"> + <value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value> + </resheader> +</root>
\ No newline at end of file diff --git a/Software/Visual_Studio/PPC/Modules/Tango.PPC.Browser/Properties/Settings.Designer.cs b/Software/Visual_Studio/PPC/Modules/Tango.PPC.Browser/Properties/Settings.Designer.cs new file mode 100644 index 000000000..f464e258d --- /dev/null +++ b/Software/Visual_Studio/PPC/Modules/Tango.PPC.Browser/Properties/Settings.Designer.cs @@ -0,0 +1,26 @@ +//------------------------------------------------------------------------------ +// <auto-generated> +// 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. +// </auto-generated> +//------------------------------------------------------------------------------ + +namespace Tango.PPC.Browser.Properties { + + + [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "15.9.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/PPC/Modules/Tango.PPC.Browser/Properties/Settings.settings b/Software/Visual_Studio/PPC/Modules/Tango.PPC.Browser/Properties/Settings.settings new file mode 100644 index 000000000..033d7a5e9 --- /dev/null +++ b/Software/Visual_Studio/PPC/Modules/Tango.PPC.Browser/Properties/Settings.settings @@ -0,0 +1,7 @@ +<?xml version='1.0' encoding='utf-8'?> +<SettingsFile xmlns="uri:settings" CurrentProfile="(Default)"> + <Profiles> + <Profile Name="(Default)" /> + </Profiles> + <Settings /> +</SettingsFile>
\ No newline at end of file diff --git a/Software/Visual_Studio/PPC/Modules/Tango.PPC.Browser/RequestHandlers/ChromiumRequestHandler.cs b/Software/Visual_Studio/PPC/Modules/Tango.PPC.Browser/RequestHandlers/ChromiumRequestHandler.cs new file mode 100644 index 000000000..fc6cb119c --- /dev/null +++ b/Software/Visual_Studio/PPC/Modules/Tango.PPC.Browser/RequestHandlers/ChromiumRequestHandler.cs @@ -0,0 +1,114 @@ +using CefSharp; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace Tango.PPC.Browser.RequestHandlers +{ + public class ChromiumRequestHandler : IRequestHandler + { + public event EventHandler<String> AddressChanged; + + public bool GetAuthCredentials(IWebBrowser browserControl, IBrowser browser, IFrame frame, bool isProxy, string host, int port, string realm, string scheme, IAuthCallback callback) + { + return false; + } + + public bool OnBeforeBrowse(IWebBrowser browserControl, IBrowser browser, IFrame frame, IRequest request, bool isRedirect) + { + // You can check the Request object for the URL Here + return false; + } + + public CefReturnValue OnBeforeResourceLoad(IWebBrowser browserControl, IBrowser browser, IFrame frame, IRequest request, IRequestCallback callback) + { + // You can also check the URL here + callback.Dispose(); + return CefReturnValue.Continue; + } + + public bool OnCertificateError(IWebBrowser browserControl, IBrowser browser, CefErrorCode errorCode, string requestUrl, ISslInfo sslInfo, IRequestCallback callback) + { + callback.Dispose(); + return false; + } + + public bool OnOpenUrlFromTab(IWebBrowser browserControl, IBrowser browser, IFrame frame, string targetUrl, WindowOpenDisposition targetDisposition, bool userGesture) + { + return false; + } + + public void OnPluginCrashed(IWebBrowser browserControl, IBrowser browser, string pluginPath) + { + } + + public bool OnProtocolExecution(IWebBrowser browserControl, IBrowser browser, string url) + { + return false; + } + + public bool OnQuotaRequest(IWebBrowser browserControl, IBrowser browser, string originUrl, long newSize, IRequestCallback callback) + { + callback.Dispose(); + return false; + } + + public void OnRenderProcessTerminated(IWebBrowser browserControl, IBrowser browser, CefTerminationStatus status) + { + } + + public void OnRenderViewReady(IWebBrowser browserControl, IBrowser browser) + { + } + + public void OnResourceLoadComplete(IWebBrowser browserControl, IBrowser browser, IFrame frame, IRequest request, IResponse response, UrlRequestStatus status, long receivedContentLength) + { + // You can also check the request URL here + } + + public void OnResourceRedirect(IWebBrowser browserControl, IBrowser browser, IFrame frame, IRequest request, ref string newUrl) + { + } + + public bool OnResourceResponse(IWebBrowser browserControl, IBrowser browser, IFrame frame, IRequest request, IResponse response) + { + return false; + } + + + public IResponseFilter GetResourceResponseFilter(IWebBrowser browserControl, IBrowser browser, IFrame frame, IRequest request, IResponse response) + { + return null; + } + + + public void OnResourceRedirect(IWebBrowser browserControl, IBrowser browser, IFrame frame, IRequest request, IResponse response, ref string newUrl) + { + } + + public bool OnSelectClientCertificate(IWebBrowser browserControl, IBrowser browser, bool isProxy, string host, int port, System.Security.Cryptography.X509Certificates.X509Certificate2Collection certificates, ISelectClientCertificateCallback callback) + { + callback.Dispose(); + return false; + } + + public bool OnBeforeBrowse(IWebBrowser chromiumWebBrowser, IBrowser browser, IFrame frame, IRequest request, bool userGesture, bool isRedirect) + { + AddressChanged?.Invoke(this, request.Url); + return false; + } + + public IResourceRequestHandler GetResourceRequestHandler(IWebBrowser chromiumWebBrowser, IBrowser browser, IFrame frame, IRequest request, bool isNavigation, bool isDownload, string requestInitiator, ref bool disableDefaultHandling) + { + return null; + } + + public bool GetAuthCredentials(IWebBrowser chromiumWebBrowser, IBrowser browser, string originUrl, bool isProxy, string host, int port, string realm, string scheme, IAuthCallback callback) + { + callback.Dispose(); + return false; + } + } +} diff --git a/Software/Visual_Studio/PPC/Modules/Tango.PPC.Browser/Scripts/keyboard.js b/Software/Visual_Studio/PPC/Modules/Tango.PPC.Browser/Scripts/keyboard.js new file mode 100644 index 000000000..21771eb8e --- /dev/null +++ b/Software/Visual_Studio/PPC/Modules/Tango.PPC.Browser/Scripts/keyboard.js @@ -0,0 +1,21 @@ +(async function () { + await CefSharp.BindObjectAsync("keyboard", "bound"); + + var inputs = document.getElementsByTagName('input'); + var i = 0; + + do { + + var type = inputs[i].type; + + if (type == 'text' || type == 'email' || type == 'password' || type == 'search' || type == 'date' || type == 'url' || type == 'time' || type == 'tel' || type == 'number') { + inputs[i].onfocus = function () { + keyboard.openKeyboard(type); + } + inputs[i].onblur = function () { + keyboard.closeKeyboard(); + } + } + } + while (inputs[++i]) +})();
\ No newline at end of file diff --git a/Software/Visual_Studio/PPC/Modules/Tango.PPC.Browser/Tango.PPC.Browser.csproj b/Software/Visual_Studio/PPC/Modules/Tango.PPC.Browser/Tango.PPC.Browser.csproj new file mode 100644 index 000000000..b742d4d75 --- /dev/null +++ b/Software/Visual_Studio/PPC/Modules/Tango.PPC.Browser/Tango.PPC.Browser.csproj @@ -0,0 +1,199 @@ +<?xml version="1.0" encoding="utf-8"?> +<Project ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> + <Import Project="..\..\..\packages\CefSharp.Wpf.75.1.143\build\CefSharp.Wpf.props" Condition="Exists('..\..\..\packages\CefSharp.Wpf.75.1.143\build\CefSharp.Wpf.props')" /> + <Import Project="..\..\..\packages\CefSharp.Common.75.1.143\build\CefSharp.Common.props" Condition="Exists('..\..\..\packages\CefSharp.Common.75.1.143\build\CefSharp.Common.props')" /> + <Import Project="..\..\..\packages\cef.redist.x86.75.1.14\build\cef.redist.x86.props" Condition="Exists('..\..\..\packages\cef.redist.x86.75.1.14\build\cef.redist.x86.props')" /> + <Import Project="..\..\..\packages\cef.redist.x64.75.1.14\build\cef.redist.x64.props" Condition="Exists('..\..\..\packages\cef.redist.x64.75.1.14\build\cef.redist.x64.props')" /> + <Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" /> + <PropertyGroup> + <CefSharpAnyCpuSupport>true</CefSharpAnyCpuSupport> + <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration> + <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform> + <ProjectGuid>{F02EAA84-AD59-465B-99A2-4422C13BFB72}</ProjectGuid> + <OutputType>library</OutputType> + <RootNamespace>Tango.PPC.Browser</RootNamespace> + <AssemblyName>Tango.PPC.Browser</AssemblyName> + <TargetFrameworkVersion>v4.6.1</TargetFrameworkVersion> + <FileAlignment>512</FileAlignment> + <ProjectTypeGuids>{60dc8134-eba5-43b8-bcc9-bb4bc16c2548};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids> + <WarningLevel>4</WarningLevel> + <TargetFrameworkProfile /> + <NuGetPackageImportStamp> + </NuGetPackageImportStamp> + </PropertyGroup> + <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' "> + <DebugSymbols>true</DebugSymbols> + <DebugType>full</DebugType> + <Optimize>false</Optimize> + <OutputPath>..\..\..\Build\PPC\Debug\</OutputPath> + <DefineConstants>DEBUG;TRACE</DefineConstants> + <ErrorReport>prompt</ErrorReport> + <WarningLevel>4</WarningLevel> + </PropertyGroup> + <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' "> + <DebugType>pdbonly</DebugType> + <Optimize>true</Optimize> + <OutputPath>bin\Release\</OutputPath> + <DefineConstants>TRACE</DefineConstants> + <ErrorReport>prompt</ErrorReport> + <WarningLevel>4</WarningLevel> + </PropertyGroup> + <ItemGroup> + <Reference Include="EntityFramework, Version=6.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089, processorArchitecture=MSIL"> + <HintPath>..\..\..\packages\EntityFramework.6.0.0\lib\net45\EntityFramework.dll</HintPath> + <Private>True</Private> + </Reference> + <Reference Include="EntityFramework.SqlServer, Version=6.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089, processorArchitecture=MSIL"> + <HintPath>..\..\..\packages\EntityFramework.6.0.0\lib\net45\EntityFramework.SqlServer.dll</HintPath> + </Reference> + <Reference Include="FontAwesome.WPF, Version=4.7.0.37774, Culture=neutral, PublicKeyToken=0758b07a11a4f466, processorArchitecture=MSIL"> + <HintPath>..\..\..\packages\FontAwesome.WPF.4.7.0.9\lib\net40\FontAwesome.WPF.dll</HintPath> + </Reference> + <Reference Include="Google.Protobuf, Version=3.4.1.0, Culture=neutral, PublicKeyToken=a7d26565bac4d604, processorArchitecture=MSIL"> + <HintPath>..\..\..\packages\Google.Protobuf.3.4.1\lib\net45\Google.Protobuf.dll</HintPath> + </Reference> + <Reference Include="System" /> + <Reference Include="System.ComponentModel.DataAnnotations" /> + <Reference Include="System.Data" /> + <Reference Include="System.Windows.Interactivity, Version=4.5.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL"> + <HintPath>..\..\..\packages\Expression.Blend.Sdk.1.0.2\lib\net45\System.Windows.Interactivity.dll</HintPath> + </Reference> + <Reference Include="System.Xml" /> + <Reference Include="Microsoft.CSharp" /> + <Reference Include="System.Core" /> + <Reference Include="System.Xml.Linq" /> + <Reference Include="System.Data.DataSetExtensions" /> + <Reference Include="System.Net.Http" /> + <Reference Include="System.Xaml"> + <RequiredTargetFramework>4.0</RequiredTargetFramework> + </Reference> + <Reference Include="WindowsBase" /> + <Reference Include="PresentationCore" /> + <Reference Include="PresentationFramework" /> + </ItemGroup> + <ItemGroup> + <Page Include="App.xaml"> + <Generator>MSBuild:Compile</Generator> + <SubType>Designer</SubType> + </Page> + <Page Include="Views\BrowserView.xaml"> + <SubType>Designer</SubType> + <Generator>MSBuild:Compile</Generator> + </Page> + <Page Include="Views\ErrorView.xaml"> + <SubType>Designer</SubType> + <Generator>MSBuild:Compile</Generator> + </Page> + </ItemGroup> + <ItemGroup> + <Compile Include="..\..\..\Versioning\GlobalVersionInfo.cs"> + <Link>GlobalVersionInfo.cs</Link> + </Compile> + <Compile Include="Attributes\BoundObjectAttribute.cs" /> + <Compile Include="BoundsObjects\KeyboardHandler.cs" /> + <Compile Include="BrowserModule.cs" /> + <Compile Include="Helpers\BoundObjectsHelper.cs" /> + <Compile Include="Navigation\BrowserNavigationRequest.cs" /> + <Compile Include="Properties\AssemblyInfo.cs"> + <SubType>Code</SubType> + </Compile> + <Compile Include="Properties\Resources.Designer.cs"> + <AutoGen>True</AutoGen> + <DesignTime>True</DesignTime> + <DependentUpon>Resources.resx</DependentUpon> + </Compile> + <Compile Include="Properties\Settings.Designer.cs"> + <AutoGen>True</AutoGen> + <DependentUpon>Settings.settings</DependentUpon> + <DesignTimeSharedInput>True</DesignTimeSharedInput> + </Compile> + <Compile Include="RequestHandlers\ChromiumRequestHandler.cs" /> + <Compile Include="ViewContracts\IBrowserView.cs" /> + <Compile Include="ViewModelLocator.cs" /> + <Compile Include="ViewModels\BrowserViewVM.cs" /> + <Compile Include="Views\BrowserView.xaml.cs"> + <DependentUpon>BrowserView.xaml</DependentUpon> + </Compile> + <Compile Include="Views\ErrorView.xaml.cs"> + <DependentUpon>ErrorView.xaml</DependentUpon> + </Compile> + <EmbeddedResource Include="Properties\Resources.resx"> + <Generator>ResXFileCodeGenerator</Generator> + <LastGenOutput>Resources.Designer.cs</LastGenOutput> + </EmbeddedResource> + <None Include="app.config" /> + <None Include="CefSharpOutput.zip" /> + <None Include="packages.config" /> + <None Include="Properties\Settings.settings"> + <Generator>SettingsSingleFileGenerator</Generator> + <LastGenOutput>Settings.Designer.cs</LastGenOutput> + </None> + </ItemGroup> + <ItemGroup> + <ProjectReference Include="..\..\..\Tango.BL\Tango.BL.csproj"> + <Project>{f441feee-322a-4943-b566-110e12fd3b72}</Project> + <Name>Tango.BL</Name> + </ProjectReference> + <ProjectReference Include="..\..\..\Tango.Core\Tango.Core.csproj"> + <Project>{a34ee0f0-649d-41c8-8489-b6f1cc6924ee}</Project> + <Name>Tango.Core</Name> + </ProjectReference> + <ProjectReference Include="..\..\..\Tango.DragAndDrop\Tango.DragAndDrop.csproj"> + <Project>{b112d89a-a106-41ae-a0c1-4abc84c477f5}</Project> + <Name>Tango.DragAndDrop</Name> + </ProjectReference> + <ProjectReference Include="..\..\..\Tango.Logging\Tango.Logging.csproj"> + <Project>{bc932dbd-7cdb-488c-99e4-f02cf441f55e}</Project> + <Name>Tango.Logging</Name> + </ProjectReference> + <ProjectReference Include="..\..\..\Tango.PMR\Tango.PMR.csproj"> + <Project>{e4927038-348d-4295-aaf4-861c58cb3943}</Project> + <Name>Tango.PMR</Name> + </ProjectReference> + <ProjectReference Include="..\..\..\Tango.Settings\Tango.Settings.csproj"> + <Project>{d8f1ad85-526a-4f50-b6dc-d437af63d8d8}</Project> + <Name>Tango.Settings</Name> + </ProjectReference> + <ProjectReference Include="..\..\..\Tango.SharedUI\Tango.SharedUI.csproj"> + <Project>{8491d07b-c1f6-4b62-a412-41b9fd2d6538}</Project> + <Name>Tango.SharedUI</Name> + </ProjectReference> + <ProjectReference Include="..\..\..\Tango.Touch\Tango.Touch.csproj"> + <Project>{fd86424c-6e84-491b-8df9-3d0f5c236a2a}</Project> + <Name>Tango.Touch</Name> + </ProjectReference> + <ProjectReference Include="..\..\..\Tango.Transport\Tango.Transport.csproj"> + <Project>{74e700b0-1156-4126-be40-ee450d3c3026}</Project> + <Name>Tango.Transport</Name> + </ProjectReference> + <ProjectReference Include="..\..\Tango.PPC.Common\Tango.PPC.Common.csproj"> + <Project>{0be74eee-22cb-4dba-b896-793b9e1a3ac0}</Project> + <Name>Tango.PPC.Common</Name> + </ProjectReference> + </ItemGroup> + <ItemGroup> + <Resource Include="Images\browser.png" /> + </ItemGroup> + <ItemGroup> + <EmbeddedResource Include="Scripts\keyboard.js" /> + </ItemGroup> + <Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" /> + <ProjectExtensions> + <VisualStudio> + <UserProperties BuildVersion_StartDate="2000/1/1" BuildVersion_UseGlobalSettings="False" BuildVersion_BuildVersioningStyle="None.None.Increment.TimeStamp" BuildVersion_UpdateAssemblyVersion="True" BuildVersion_AssemblyInfoFilename="Properties\AssemblyInfo.cs" /> + </VisualStudio> + </ProjectExtensions> + <Target Name="EnsureNuGetPackageBuildImports" BeforeTargets="PrepareForBuild"> + <PropertyGroup> + <ErrorText>This project references NuGet package(s) that are missing on this computer. Use NuGet Package Restore to download them. For more information, see http://go.microsoft.com/fwlink/?LinkID=322105. The missing file is {0}.</ErrorText> + </PropertyGroup> + <Error Condition="!Exists('..\..\..\packages\cef.redist.x64.75.1.14\build\cef.redist.x64.props')" Text="$([System.String]::Format('$(ErrorText)', '..\..\..\packages\cef.redist.x64.75.1.14\build\cef.redist.x64.props'))" /> + <Error Condition="!Exists('..\..\..\packages\cef.redist.x86.75.1.14\build\cef.redist.x86.props')" Text="$([System.String]::Format('$(ErrorText)', '..\..\..\packages\cef.redist.x86.75.1.14\build\cef.redist.x86.props'))" /> + <Error Condition="!Exists('..\..\..\packages\CefSharp.Common.75.1.143\build\CefSharp.Common.props')" Text="$([System.String]::Format('$(ErrorText)', '..\..\..\packages\CefSharp.Common.75.1.143\build\CefSharp.Common.props'))" /> + <Error Condition="!Exists('..\..\..\packages\CefSharp.Common.75.1.143\build\CefSharp.Common.targets')" Text="$([System.String]::Format('$(ErrorText)', '..\..\..\packages\CefSharp.Common.75.1.143\build\CefSharp.Common.targets'))" /> + <Error Condition="!Exists('..\..\..\packages\CefSharp.Wpf.75.1.143\build\CefSharp.Wpf.props')" Text="$([System.String]::Format('$(ErrorText)', '..\..\..\packages\CefSharp.Wpf.75.1.143\build\CefSharp.Wpf.props'))" /> + <Error Condition="!Exists('..\..\..\packages\CefSharp.Wpf.75.1.143\build\CefSharp.Wpf.targets')" Text="$([System.String]::Format('$(ErrorText)', '..\..\..\packages\CefSharp.Wpf.75.1.143\build\CefSharp.Wpf.targets'))" /> + </Target> + <Import Project="..\..\..\packages\CefSharp.Common.75.1.143\build\CefSharp.Common.targets" Condition="Exists('..\..\..\packages\CefSharp.Common.75.1.143\build\CefSharp.Common.targets')" /> + <Import Project="..\..\..\packages\CefSharp.Wpf.75.1.143\build\CefSharp.Wpf.targets" Condition="Exists('..\..\..\packages\CefSharp.Wpf.75.1.143\build\CefSharp.Wpf.targets')" /> +</Project>
\ No newline at end of file diff --git a/Software/Visual_Studio/PPC/Modules/Tango.PPC.Browser/ViewContracts/IBrowserView.cs b/Software/Visual_Studio/PPC/Modules/Tango.PPC.Browser/ViewContracts/IBrowserView.cs new file mode 100644 index 000000000..8369209a3 --- /dev/null +++ b/Software/Visual_Studio/PPC/Modules/Tango.PPC.Browser/ViewContracts/IBrowserView.cs @@ -0,0 +1,18 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using Tango.PPC.Common; +using Tango.SharedUI; + +namespace Tango.PPC.Browser.ViewContracts +{ + public interface IBrowserView : IPPCView + { + event EventHandler<String> AddressChanged; + bool CanGoBack(); + void NavigateTo(String address); + void GoBack(); + } +} diff --git a/Software/Visual_Studio/PPC/Modules/Tango.PPC.Browser/ViewModelLocator.cs b/Software/Visual_Studio/PPC/Modules/Tango.PPC.Browser/ViewModelLocator.cs new file mode 100644 index 000000000..054310e99 --- /dev/null +++ b/Software/Visual_Studio/PPC/Modules/Tango.PPC.Browser/ViewModelLocator.cs @@ -0,0 +1,32 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using Tango.Core.DI; +using Tango.PPC.Browser.ViewModels; + +namespace Tango.PPC.Browser +{ + public static class ViewModelLocator + { + /// <summary> + /// Initializes a new instance of the ViewModelLocator class. + /// </summary> + static ViewModelLocator() + { + TangoIOC.Default.Register<BrowserViewVM>(); + } + + /// <summary> + /// Gets the main view VM. + /// </summary> + public static BrowserViewVM BrowserViewVM + { + get + { + return TangoIOC.Default.GetInstance<BrowserViewVM>(); + } + } + } +} diff --git a/Software/Visual_Studio/PPC/Modules/Tango.PPC.Browser/ViewModels/BrowserViewVM.cs b/Software/Visual_Studio/PPC/Modules/Tango.PPC.Browser/ViewModels/BrowserViewVM.cs new file mode 100644 index 000000000..0f5a49639 --- /dev/null +++ b/Software/Visual_Studio/PPC/Modules/Tango.PPC.Browser/ViewModels/BrowserViewVM.cs @@ -0,0 +1,134 @@ +using CefSharp; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using Tango.Core.Commands; +using Tango.PPC.Browser.Navigation; +using Tango.PPC.Browser.ViewContracts; +using Tango.PPC.Common; +using Tango.PPC.Common.Navigation; +using Tango.Touch.Keyboard; + +namespace Tango.PPC.Browser.ViewModels +{ + /// <summary> + /// Represents the main view VM and entry point for <see cref="Synchronization.MyModule"/>. + /// </summary> + /// <seealso cref="Tango.PPC.Common.PPCViewModel" /> + public class BrowserViewVM : PPCViewModel<IBrowserView>, INavigationObjectReceiver<BrowserNavigationRequest> + { + private bool _isFromObject; + + private String _address; + public String Address + { + get { return _address; } + set { _address = value; RaisePropertyChangedAuto(); } + } + + private bool _displayAddressBar; + public bool DisplayAddressBar + { + get { return _displayAddressBar; } + set { _displayAddressBar = value; RaisePropertyChangedAuto(); } + } + + public RelayCommand GoCommand { get; set; } + + public BrowserViewVM() + { + DisplayAddressBar = true; + + GoCommand = new RelayCommand(Go); + } + + public override void OnViewAttached() + { + base.OnViewAttached(); + View.AddressChanged += View_AddressChanged; + } + + private void View_AddressChanged(object sender, string address) + { + Address = address; + } + + public override void OnNavigatedTo() + { + base.OnNavigatedTo(); + + KeyboardView.Default.OutputMode = KeyboardOutputMode.Windows; + + if (!_isFromObject) + { + DisplayAddressBar = true; + } + + _isFromObject = false; + } + + public override void OnNavigatedFrom() + { + base.OnNavigatedFrom(); + KeyboardView.Default.OutputMode = KeyboardOutputMode.Wpf; + } + + public override Task<bool> OnNavigateBackRequest() + { + if (View != null && View.CanGoBack()) + { + View.GoBack(); + return Task.FromResult(false); + } + else + { + return Task.FromResult(true); + } + } + + /// <summary> + /// Called when the application has been started + /// </summary> + public override void OnApplicationStarted() + { + + } + + public override void OnApplicationShuttingDown() + { + base.OnApplicationShuttingDown(); + + try + { + Cef.Shutdown(); + } + catch (Exception ex) + { + LogManager.Log(ex, "Error shutting down cef."); + } + } + + private void Go() + { + if (View != null) + { + View.NavigateTo(Address); + } + } + + public void OnNavigatedToWithObject(BrowserNavigationRequest obj) + { + _isFromObject = true; + + DisplayAddressBar = obj.DisplayAddressBar; + + if (obj.Address != null) + { + Address = obj.Address; + Go(); + } + } + } +} diff --git a/Software/Visual_Studio/PPC/Modules/Tango.PPC.Browser/Views/BrowserView.xaml b/Software/Visual_Studio/PPC/Modules/Tango.PPC.Browser/Views/BrowserView.xaml new file mode 100644 index 000000000..ce28d660e --- /dev/null +++ b/Software/Visual_Studio/PPC/Modules/Tango.PPC.Browser/Views/BrowserView.xaml @@ -0,0 +1,77 @@ +<UserControl x:Class="Tango.PPC.Browser.Views.BrowserView" + 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:vm="clr-namespace:Tango.PPC.Browser.ViewModels" + xmlns:wpf="clr-namespace:CefSharp.Wpf;assembly=CefSharp.Wpf" + xmlns:experimental="clr-namespace:CefSharp.Wpf.Experimental;assembly=CefSharp.Wpf" + xmlns:global="clr-namespace:Tango.PPC.Browser" + xmlns:touch="clr-namespace:Tango.Touch.Controls;assembly=Tango.Touch" + xmlns:keyboard="clr-namespace:Tango.Touch.Keyboard;assembly=Tango.Touch" + xmlns:local="clr-namespace:Tango.PPC.Browser.Views" + mc:Ignorable="d" + d:DesignHeight="1280" d:DesignWidth="800" d:DataContext="{d:DesignInstance Type=vm:BrowserViewVM, IsDesignTimeCreatable=False}" DataContext="{x:Static global:ViewModelLocator.BrowserViewVM}" Background="{StaticResource TangoPrimaryBackgroundBrush}"> + <Grid> + <DockPanel> + <Border DockPanel.Dock="Top" Padding="10" BorderBrush="{StaticResource TangoGrayBrush}" BorderThickness="0 0 0 1" Visibility="{Binding DisplayAddressBar,Converter={StaticResource BooleanToVisibilityConverter}}"> + <DockPanel> + <touch:TouchButton x:Name="btnGo" Command="{Binding GoCommand}" DockPanel.Dock="Right" Padding="10" Width="150" CornerRadius="20" Margin="20 0 0 0"> + <touch:TouchIcon Icon="ArrowRightBold" Height="20" /> + </touch:TouchButton> + <Grid> + <Border Background="{StaticResource TangoMidBackgroundBrush}" Padding="2" BorderBrush="{StaticResource TangoLightBorderBrush}" BorderThickness="1" CornerRadius="20"> + <TextBox x:Name="txtAddress" PreviewMouseDoubleClick="TxtAddress_PreviewMouseDoubleClick" GotFocus="TxtAddress_GotFocus" PreviewMouseUp="TxtAddress_MouseUp" LostFocus="TxtAddress_LostFocus" KeyDown="TxtAddress_KeyDown" VerticalContentAlignment="Center" Text="{Binding Address,UpdateSourceTrigger=PropertyChanged}" BorderThickness="0" FontSize="{StaticResource TangoDefaultFontSize}" Padding="5" Background="Transparent"></TextBox> + </Border> + <Border CornerRadius="20" IsHitTestVisible="False" Visibility="{Binding ElementName=Browser,Path=IsLoading,Converter={StaticResource BooleanToVisibilityConverter}}"> + <Border.Background> + <LinearGradientBrush> + <GradientStop Offset="0" Color="Transparent" /> + <GradientStop Offset="0.5" Color="#7612D433" /> + <GradientStop Offset="1" Color="Transparent" /> + </LinearGradientBrush> + </Border.Background> + <Border.Style> + <Style TargetType="Border"> + <Style.Triggers> + <DataTrigger Binding="{Binding ElementName=Browser,Path=IsLoading}" Value="True"> + <DataTrigger.EnterActions> + <BeginStoryboard Name="loadingStory"> + <Storyboard> + <DoubleAnimation Storyboard.TargetProperty="Background.GradientStops[1].Offset" From="0" To="1" AutoReverse="True" RepeatBehavior="Forever" /> + </Storyboard> + </BeginStoryboard> + </DataTrigger.EnterActions> + <DataTrigger.ExitActions> + <RemoveStoryboard BeginStoryboardName="loadingStory" /> + </DataTrigger.ExitActions> + </DataTrigger> + </Style.Triggers> + </Style> + </Border.Style> + </Border> + </Grid> + </DockPanel> + </Border> + + <Grid> + <experimental:ChromiumWebBrowserWithTouchSupport x:Name="Browser" /> + <Grid Background="White" IsHitTestVisible="False" Visibility="Hidden" x:Name="gridError"> + <StackPanel HorizontalAlignment="Center" VerticalAlignment="Center"> + <touch:TouchIcon Icon="Alert" Foreground="{StaticResource TangoGrayTextBrush}" Width="100" Height="100" /> + <TextBlock HorizontalAlignment="Center" Foreground="{StaticResource TangoGrayTextBrush}" FontSize="40" Margin="0 20 0 0">Page Not Found</TextBlock> + <TextBlock Margin="0 10 0 0" Foreground="{StaticResource TangoGrayTextBrush}" HorizontalAlignment="Center" Width="600" TextAlignment="Center" TextWrapping="Wrap"> + <Run>The page at '</Run><Run Text="{Binding ElementName=txtAddress,Path=Text,Mode=OneWay}"></Run><Run>'</Run> + <Run>could not be reached.</Run> + <LineBreak/> + <Run>Please check your internet connection.</Run> + <LineBreak/> + <LineBreak/> + <Run x:Name="runError" Text="Unspecified"></Run> + </TextBlock> + </StackPanel> + </Grid> + </Grid> + </DockPanel> + </Grid> +</UserControl> diff --git a/Software/Visual_Studio/PPC/Modules/Tango.PPC.Browser/Views/BrowserView.xaml.cs b/Software/Visual_Studio/PPC/Modules/Tango.PPC.Browser/Views/BrowserView.xaml.cs new file mode 100644 index 000000000..e7fe1ca27 --- /dev/null +++ b/Software/Visual_Studio/PPC/Modules/Tango.PPC.Browser/Views/BrowserView.xaml.cs @@ -0,0 +1,211 @@ +using System; +using System.Collections.Generic; +using System.Diagnostics; +using System.Linq; +using System.Text; +using System.Text.RegularExpressions; +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; +using System.Windows.Threading; +using CefSharp; +using CefSharp.Wpf; +using Tango.Core.DI; +using Tango.Core.Helpers; +using Tango.Logging; +using Tango.PPC.Browser.BoundsObjects; +using Tango.PPC.Browser.ViewContracts; +using Tango.PPC.Common.Helpers; +using Tango.Touch.Keyboard; + +namespace Tango.PPC.Browser.Views +{ + /// <summary> + /// Interaction logic for MainView.xaml + /// </summary> + public partial class BrowserView : UserControl, IBrowserView + { + public event EventHandler<string> AddressChanged; + + public static BrowserView Instance { get; set; } + + public BrowserView() + { + try + { + var settings = new CefSettings(); + settings.BrowserSubprocessPath = @"x86\CefSharp.BrowserSubprocess.exe"; + settings.UserAgent = "Mozilla/5.0 (iPad; CPU OS 12_2 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Mobile/15E148"; + + Cef.Initialize(settings, performDependencyCheck: false, browserProcessHandler: null); + } + catch (Exception ex) + { + LogManager.Default.Log(ex, "Error loading cef."); + } + + InitializeComponent(); + + Instance = this; + + TangoIOC.Default.Register<IBrowserView>(this); + + Helpers.BoundObjectsHelper.RegisterAllBoundObjects(Browser, Dispatcher); + + KeyboardView.Default.KeyboardOpened += Default_KeyboardOpened; + KeyboardView.Default.KeyboardClosed += Default_KeyboardClosed; + + var handler = new RequestHandlers.ChromiumRequestHandler(); + handler.AddressChanged += Handler_AddressChanged; + Browser.RequestHandler = handler; + Browser.LoadError += Browser_LoadError; + Browser.LoadingStateChanged += Browser_LoadingStateChanged; + } + + private void Browser_LoadError(object sender, LoadErrorEventArgs e) + { + //if (e.ErrorCode == CefErrorCode.ConnectionTimedOut || e.ErrorCode == CefErrorCode.NameNotResolved) + //{ + InvokeUI(() => + { + runError.Text = e.ErrorText; + gridError.Visibility = Visibility.Visible; + }); + //} + } + + private void Browser_LoadingStateChanged(object sender, LoadingStateChangedEventArgs e) + { + if (!e.IsLoading) + { + InvokeUI(() => + { + KeyboardHelper.CloseKeyboard(); + }); + } + else + { + InvokeUI(() => + { + gridError.Visibility = Visibility.Hidden; + }); + } + } + + private void Handler_AddressChanged(object sender, string address) + { + InvokeUI(() => + { + AddressChanged?.Invoke(this, address); + }); + } + + private void Default_KeyboardClosed(object sender, EventArgs e) + { + Browser.VerticalAlignment = VerticalAlignment.Stretch; + Browser.Height = double.NaN; + } + + private void Default_KeyboardOpened(object sender, EventArgs e) + { + Browser.VerticalAlignment = VerticalAlignment.Top; + Browser.Height = 780; + } + + public bool CanGoBack() + { + return Browser.CanGoBack; + } + + public void NavigateTo(string address) + { + if (Browser.Address != address) + { + String uri; + + if (ValidHttpURL(address, out uri)) + { + Browser.Address = uri; + } + else + { + Browser.Address = $"google.com/search?q={address.Replace(" ", "+")}"; + } + } + else + { + Browser.Reload(); + } + } + + public static bool ValidHttpURL(string s, out string result) + { + if (Uri.IsWellFormedUriString(s, UriKind.Absolute)) + { + result = s; + return true; + } + else if (s.StartsWith("www.")) + { + result = "http://" + s; + return true; + } + + result = s; + return false; + } + + public void GoBack() + { + if (Browser.CanGoBack) + { + Browser.Back(); + } + } + + private async void TxtAddress_GotFocus(object sender, RoutedEventArgs e) + { + KeyboardHelper.OpenKeyboard(KeyboardActionKeyMode.Go); + await Task.Delay(100); + txtAddress.SelectAll(); + } + + private void TxtAddress_LostFocus(object sender, RoutedEventArgs e) + { + KeyboardHelper.CloseKeyboard(); + } + + private void TxtAddress_KeyDown(object sender, KeyEventArgs e) + { + if (e.Key == Key.Return) + { + KeyboardHelper.CloseKeyboard(); + NavigateTo(txtAddress.Text); + } + } + + private void TxtAddress_MouseUp(object sender, MouseButtonEventArgs e) + { + KeyboardHelper.OpenKeyboard(KeyboardActionKeyMode.Go); + } + + private async void TxtAddress_PreviewMouseDoubleClick(object sender, MouseButtonEventArgs e) + { + KeyboardHelper.OpenKeyboard(KeyboardActionKeyMode.Go); + await Task.Delay(100); + txtAddress.SelectAll(); + } + + private void InvokeUI(Action action) + { + Dispatcher.BeginInvoke(action); + } + } +} diff --git a/Software/Visual_Studio/PPC/Modules/Tango.PPC.Browser/Views/ErrorView.xaml b/Software/Visual_Studio/PPC/Modules/Tango.PPC.Browser/Views/ErrorView.xaml new file mode 100644 index 000000000..25e3381ba --- /dev/null +++ b/Software/Visual_Studio/PPC/Modules/Tango.PPC.Browser/Views/ErrorView.xaml @@ -0,0 +1,23 @@ +<UserControl x:Class="Tango.PPC.Browser.Views.ErrorView" + xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" + xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" + xmlns:vm="clr-namespace:Tango.PPC.Browser.ViewModels" + xmlns:global="clr-namespace:Tango.PPC.Browser" + xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" + xmlns:touch="clr-namespace:Tango.Touch.Controls;assembly=Tango.Touch" + xmlns:d="http://schemas.microsoft.com/expression/blend/2008" + xmlns:local="clr-namespace:Tango.PPC.Browser.Views" + mc:Ignorable="d" + d:DesignHeight="1280" d:DesignWidth="800" d:DataContext="{d:DesignInstance Type=vm:BrowserViewVM, IsDesignTimeCreatable=False}" DataContext="{x:Static global:ViewModelLocator.BrowserViewVM}" Background="{StaticResource TangoPrimaryBackgroundBrush}"> + <Grid> + <Grid Background="White" IsHitTestVisible="False"> + <StackPanel HorizontalAlignment="Center" VerticalAlignment="Center"> + <touch:TouchIcon Icon="Alert" Foreground="{StaticResource TangoGrayTextBrush}" Width="100" Height="100" /> + <TextBlock HorizontalAlignment="Center" Foreground="{StaticResource TangoGrayTextBrush}" FontSize="40" Margin="0 20 0 0">Browser Not Loaded</TextBlock> + <TextBlock Margin="0 10 0 0" Foreground="{StaticResource TangoGrayTextBrush}" HorizontalAlignment="Center" Width="600" TextAlignment="Center" TextWrapping="Wrap"> + The browser module was not loaded properly or has caused some error. + </TextBlock> + </StackPanel> + </Grid> + </Grid> +</UserControl> diff --git a/Software/Visual_Studio/PPC/Modules/Tango.PPC.Browser/Views/ErrorView.xaml.cs b/Software/Visual_Studio/PPC/Modules/Tango.PPC.Browser/Views/ErrorView.xaml.cs new file mode 100644 index 000000000..0d59b80f0 --- /dev/null +++ b/Software/Visual_Studio/PPC/Modules/Tango.PPC.Browser/Views/ErrorView.xaml.cs @@ -0,0 +1,29 @@ +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; +using Tango.PPC.Browser.ViewContracts; + +namespace Tango.PPC.Browser.Views +{ + /// <summary> + /// Interaction logic for ErrorView.xaml + /// </summary> + public partial class ErrorView : UserControl + { + public ErrorView() + { + InitializeComponent(); + } + } +} diff --git a/Software/Visual_Studio/PPC/Modules/Tango.PPC.Browser/app.config b/Software/Visual_Studio/PPC/Modules/Tango.PPC.Browser/app.config new file mode 100644 index 000000000..cf33970a7 --- /dev/null +++ b/Software/Visual_Studio/PPC/Modules/Tango.PPC.Browser/app.config @@ -0,0 +1,90 @@ +<?xml version="1.0" encoding="utf-8"?> +<configuration> + <configSections> + <!-- For more information on Entity Framework configuration, visit http://go.microsoft.com/fwlink/?LinkID=237468 --> + <section name="entityFramework" type="System.Data.Entity.Internal.ConfigFile.EntityFrameworkSection, EntityFramework, Version=6.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" requirePermission="false" /> + </configSections> + <runtime> + <assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1"> + <!--Required for cefCharp--> + <probing privatePath="x86"/> + <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> + <dependentAssembly> + <assemblyIdentity name="System.Collections.Immutable" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" /> + <bindingRedirect oldVersion="0.0.0.0-1.2.2.0" newVersion="1.2.2.0" /> + </dependentAssembly> + <dependentAssembly> + <assemblyIdentity name="System.Reflection.Metadata" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" /> + <bindingRedirect oldVersion="0.0.0.0-1.4.2.0" newVersion="1.4.2.0" /> + </dependentAssembly> + <dependentAssembly> + <assemblyIdentity name="System.IO.FileSystem" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" /> + <bindingRedirect oldVersion="0.0.0.0-4.0.2.0" newVersion="4.0.2.0" /> + </dependentAssembly> + <dependentAssembly> + <assemblyIdentity name="System.ValueTuple" publicKeyToken="cc7b13ffcd2ddd51" culture="neutral" /> + <bindingRedirect oldVersion="0.0.0.0-4.0.2.0" newVersion="4.0.2.0" /> + </dependentAssembly> + <dependentAssembly> + <assemblyIdentity name="System.IO.Compression" publicKeyToken="b77a5c561934e089" culture="neutral" /> + <bindingRedirect oldVersion="0.0.0.0-4.1.2.0" newVersion="4.1.2.0" /> + </dependentAssembly> + <dependentAssembly> + <assemblyIdentity name="System.IO.FileSystem.Primitives" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" /> + <bindingRedirect oldVersion="0.0.0.0-4.0.2.0" newVersion="4.0.2.0" /> + </dependentAssembly> + <dependentAssembly> + <assemblyIdentity name="System.Security.Cryptography.Primitives" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" /> + <bindingRedirect oldVersion="0.0.0.0-4.0.1.0" newVersion="4.0.1.0" /> + </dependentAssembly> + <dependentAssembly> + <assemblyIdentity name="System.Xml.XPath.XDocument" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" /> + <bindingRedirect oldVersion="0.0.0.0-4.0.2.0" newVersion="4.0.2.0" /> + </dependentAssembly> + <dependentAssembly> + <assemblyIdentity name="System.Console" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" /> + <bindingRedirect oldVersion="0.0.0.0-4.0.1.0" newVersion="4.0.1.0" /> + </dependentAssembly> + <dependentAssembly> + <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="Microsoft.IdentityModel.Clients.ActiveDirectory" publicKeyToken="31bf3856ad364e35" culture="neutral" /> + <bindingRedirect oldVersion="0.0.0.0-5.0.5.0" newVersion="5.0.5.0" /> + </dependentAssembly> + <dependentAssembly> + <assemblyIdentity name="Microsoft.Data.Edm" publicKeyToken="31bf3856ad364e35" culture="neutral" /> + <bindingRedirect oldVersion="0.0.0.0-5.6.4.0" newVersion="5.6.4.0" /> + </dependentAssembly> + <dependentAssembly> + <assemblyIdentity name="Microsoft.Data.Services.Client" publicKeyToken="31bf3856ad364e35" culture="neutral" /> + <bindingRedirect oldVersion="0.0.0.0-5.6.4.0" newVersion="5.6.4.0" /> + </dependentAssembly> + <dependentAssembly> + <assemblyIdentity name="Microsoft.Data.OData" publicKeyToken="31bf3856ad364e35" culture="neutral" /> + <bindingRedirect oldVersion="0.0.0.0-5.6.4.0" newVersion="5.6.4.0" /> + </dependentAssembly> + <dependentAssembly> + <assemblyIdentity name="Newtonsoft.Json" publicKeyToken="30ad4fe6b2a6aeed" culture="neutral" /> + <bindingRedirect oldVersion="0.0.0.0-9.0.0.0" newVersion="9.0.0.0" /> + </dependentAssembly> + <dependentAssembly> + <assemblyIdentity name="WebGrease" publicKeyToken="31bf3856ad364e35" culture="neutral" /> + <bindingRedirect oldVersion="0.0.0.0-1.5.2.14234" newVersion="1.5.2.14234" /> + </dependentAssembly> + </assemblyBinding> + </runtime> + <entityFramework> + <defaultConnectionFactory type="System.Data.Entity.Infrastructure.SqlConnectionFactory, EntityFramework" /> + <providers> + <provider invariantName="System.Data.SqlClient" type="System.Data.Entity.SqlServer.SqlProviderServices, EntityFramework.SqlServer" /> + </providers> + </entityFramework> + <startup> + <supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.6.1" /> + </startup> +</configuration> diff --git a/Software/Visual_Studio/PPC/Modules/Tango.PPC.Browser/packages.config b/Software/Visual_Studio/PPC/Modules/Tango.PPC.Browser/packages.config new file mode 100644 index 000000000..f7fe1b9a2 --- /dev/null +++ b/Software/Visual_Studio/PPC/Modules/Tango.PPC.Browser/packages.config @@ -0,0 +1,11 @@ +<?xml version="1.0" encoding="utf-8"?> +<packages> + <package id="cef.redist.x64" version="75.1.14" targetFramework="net461" /> + <package id="cef.redist.x86" version="75.1.14" targetFramework="net461" /> + <package id="CefSharp.Common" version="75.1.143" targetFramework="net461" /> + <package id="CefSharp.Wpf" version="75.1.143" targetFramework="net461" /> + <package id="EntityFramework" version="6.0.0" targetFramework="net46" /> + <package id="Expression.Blend.Sdk" version="1.0.2" targetFramework="net46" /> + <package id="FontAwesome.WPF" version="4.7.0.9" targetFramework="net46" /> + <package id="Google.Protobuf" version="3.4.1" targetFramework="net46" /> +</packages>
\ No newline at end of file diff --git a/Software/Visual_Studio/PPC/Modules/Tango.PPC.BugReporting/BugReportingModule.cs b/Software/Visual_Studio/PPC/Modules/Tango.PPC.BugReporting/BugReportingModule.cs index e65b44698..659ffe732 100644 --- a/Software/Visual_Studio/PPC/Modules/Tango.PPC.BugReporting/BugReportingModule.cs +++ b/Software/Visual_Studio/PPC/Modules/Tango.PPC.BugReporting/BugReportingModule.cs @@ -17,7 +17,7 @@ namespace Tango.PPC.BugReporting /// Represents a PPC <see cref="BugReportingModule"/>. /// </summary> /// <seealso cref="Tango.PPC.Common.PPCModuleBase" /> - [PPCModule(5)] + [PPCModule(6)] public class BugReportingModule : PPCModuleBase { /// <summary> diff --git a/Software/Visual_Studio/PPC/Modules/Tango.PPC.BugReporting/TFS/TeamFoundationServicePPCClient.cs b/Software/Visual_Studio/PPC/Modules/Tango.PPC.BugReporting/TFS/TeamFoundationServicePPCClient.cs index 26d6425bf..b84d11c37 100644 --- a/Software/Visual_Studio/PPC/Modules/Tango.PPC.BugReporting/TFS/TeamFoundationServicePPCClient.cs +++ b/Software/Visual_Studio/PPC/Modules/Tango.PPC.BugReporting/TFS/TeamFoundationServicePPCClient.cs @@ -13,6 +13,8 @@ using Tango.PPC.Common.Connection; using Tango.TFS; using Tango.Core.ExtensionMethods; using Tango.Core.Helpers; +using Tango.Settings; +using Tango.PPC.Common; namespace Tango.PPC.BugReporting.TFS { @@ -53,6 +55,21 @@ namespace Tango.PPC.BugReporting.TFS } } + private string[] GetLogFiles(FileLogger logger) + { + string[] fileEntries = new string[1]; + fileEntries[0] = logger.LogFile; + string fileName = Path.GetFileNameWithoutExtension(logger.LogFile); + int indexPos = fileName.IndexOf(FileLogger.FILE_SET_EXTENSION); + if (indexPos > 0) + { + string extension = Path.GetExtension(logger.LogFile); + fileName = fileName.Substring(0, indexPos); + fileEntries = Directory.GetFiles(logger.Folder, $"{fileName}*{extension}").Where(x => Path.GetFileName(x).StartsWith(logger.Tag)).OrderBy(x => x.Length).ThenBy(x => x).ToArray(); + } + return fileEntries; + } + public async Task SubmitBug(String title, String steps, TeamMember createdBy, TeamMember assignedTo, Severity severity) { LogManager.Log("Submitting bug report..."); @@ -80,6 +97,7 @@ namespace Tango.PPC.BugReporting.TFS item.Severity = severity; item.State = State.New; item.Type = WorkItemType.Bug; + item.Environment = SettingsManager.Default.GetOrCreate<PPCSettings>().DeploymentSlot.ToDescription(); FileLogger appFileLogger = LogManager.Default.RegisteredLoggers.FirstOrDefault(x => x.GetType() == typeof(FileLogger)) as FileLogger; FileLogger embeddedFileLogger = MachineOperator.EmbeddedLogManager.RegisteredLoggers.FirstOrDefault(x => x.GetType() == typeof(FileLogger)) as FileLogger; @@ -87,31 +105,54 @@ namespace Tango.PPC.BugReporting.TFS if (appFileLogger != null) { LogManager.Log($"Attaching application log file ${appFileLogger.LogFile}"); - - var appLogFile = tempFolder.CreateImaginaryFile(); - File.Copy(appFileLogger.LogFile, appLogFile.Path); - - item.Attachments.Add(new Attachment() + string[] logFiles = GetLogFiles(appFileLogger); + foreach (string file in logFiles) { - Description = "Application Log File", - FilePath = appLogFile.Path, - Name = Path.GetFileName(appFileLogger.LogFile), - }); + var appLogFile = tempFolder.CreateImaginaryFile(); + File.Copy(file, appLogFile.Path); + item.Attachments.Add(new Attachment() + { + Description = "Application Log File", + FilePath = appLogFile.Path, + Name = Path.GetFileName(file), + }); + } } if (embeddedFileLogger != null && File.Exists(embeddedFileLogger.LogFile)) { LogManager.Log($"Attaching embedded log file ${embeddedFileLogger.LogFile}"); - var embeddedLogFile = tempFolder.CreateImaginaryFile(); - File.Copy(embeddedFileLogger.LogFile, embeddedLogFile.Path); + string[] logFiles = GetLogFiles(embeddedFileLogger); + foreach (string file in logFiles) + { + var embeddedLogFile = tempFolder.CreateImaginaryFile(); + File.Copy(file, embeddedLogFile.Path); + item.Attachments.Add(new Attachment() + { + Description = "Embedded Log File", + FilePath = embeddedLogFile.Path, + Name = Path.GetFileName(file), + }); + } + } - item.Attachments.Add(new Attachment() + //Add session log file.. + if (MachineOperator.EnableSessionLogFile) + { + var file = MachineOperator.SessionLogger.LogFile; + + if (file != null && File.Exists(file)) { - Description = "Embedded Log File", - FilePath = embeddedLogFile.Path, - Name = Path.GetFileName(embeddedFileLogger.LogFile), - }); + var sessionLogFile = tempFolder.CreateImaginaryFile(); + File.Copy(file, sessionLogFile.Path); + item.Attachments.Add(new Attachment() + { + Description = "Session Log File", + FilePath = sessionLogFile.Path, + Name = Path.GetFileName(file), + }); + } } SystemInformationModel sysModel = new SystemInformationModel(); diff --git a/Software/Visual_Studio/PPC/Modules/Tango.PPC.BugReporting/Tango.PPC.BugReporting_txujxqrg_wpftmp.csproj b/Software/Visual_Studio/PPC/Modules/Tango.PPC.BugReporting/Tango.PPC.BugReporting_txujxqrg_wpftmp.csproj new file mode 100644 index 000000000..3b897aa71 --- /dev/null +++ b/Software/Visual_Studio/PPC/Modules/Tango.PPC.BugReporting/Tango.PPC.BugReporting_txujxqrg_wpftmp.csproj @@ -0,0 +1,235 @@ +<?xml version="1.0" encoding="utf-8"?> +<Project ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> + <Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" /> + <PropertyGroup> + <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration> + <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform> + <ProjectGuid>{8146FA0A-0725-4A1A-82E6-696C58F33A2B}</ProjectGuid> + <OutputType>library</OutputType> + <RootNamespace>Tango.PPC.BugReporting</RootNamespace> + <AssemblyName>Tango.PPC.BugReporting</AssemblyName> + <TargetFrameworkVersion>v4.6.1</TargetFrameworkVersion> + <FileAlignment>512</FileAlignment> + <ProjectTypeGuids>{60dc8134-eba5-43b8-bcc9-bb4bc16c2548};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids> + <WarningLevel>4</WarningLevel> + <TargetFrameworkProfile /> + </PropertyGroup> + <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' "> + <DebugSymbols>true</DebugSymbols> + <DebugType>full</DebugType> + <Optimize>false</Optimize> + <OutputPath>..\..\..\Build\PPC\Debug\</OutputPath> + <DefineConstants>DEBUG;TRACE</DefineConstants> + <ErrorReport>prompt</ErrorReport> + <WarningLevel>4</WarningLevel> + </PropertyGroup> + <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' "> + <DebugType>pdbonly</DebugType> + <Optimize>true</Optimize> + <OutputPath>..\..\..\Build\PPC\Release\</OutputPath> + <DefineConstants>TRACE</DefineConstants> + <ErrorReport>prompt</ErrorReport> + <WarningLevel>4</WarningLevel> + </PropertyGroup> + <ItemGroup> + </ItemGroup> + <ItemGroup> + </ItemGroup> + <ItemGroup> + <Compile Include="..\..\..\Versioning\GlobalVersionInfo.cs"> + <Link>GlobalVersionInfo.cs</Link> + </Compile> + <Compile Include="BugReportingModule.cs" /> + <Compile Include="BugReportingSettings.cs" /> + <Compile Include="Properties\AssemblyInfo.cs"> + <SubType>Code</SubType> + </Compile> + <Compile Include="Properties\Resources.Designer.cs"> + <AutoGen>True</AutoGen> + <DesignTime>True</DesignTime> + <DependentUpon>Resources.resx</DependentUpon> + </Compile> + <Compile Include="Properties\Settings.Designer.cs"> + <AutoGen>True</AutoGen> + <DependentUpon>Settings.settings</DependentUpon> + <DesignTimeSharedInput>True</DesignTimeSharedInput> + </Compile> + <Compile Include="TFS\SystemInformationModel.cs" /> + <Compile Include="TFS\TeamFoundationServicePPCClient.cs" /> + <Compile Include="ViewModelLocator.cs" /> + <Compile Include="ViewModels\MainViewVM.cs" /> + <Compile Include="Views\MainView.xaml.cs"> + <DependentUpon>MainView.xaml</DependentUpon> + </Compile> + <EmbeddedResource Include="Properties\Resources.resx"> + <Generator>ResXFileCodeGenerator</Generator> + <LastGenOutput>Resources.Designer.cs</LastGenOutput> + </EmbeddedResource> + <None Include="app.config" /> + <None Include="packages.config" /> + <None Include="Properties\Settings.settings"> + <Generator>SettingsSingleFileGenerator</Generator> + <LastGenOutput>Settings.Designer.cs</LastGenOutput> + </None> + <EmbeddedResource Include="TFS\SystemInformationTemplate.cshtml" /> + </ItemGroup> + <ItemGroup> + <ProjectReference Include="..\..\..\Tango.BL\Tango.BL.csproj"> + <Project>{f441feee-322a-4943-b566-110e12fd3b72}</Project> + <Name>Tango.BL</Name> + </ProjectReference> + <ProjectReference Include="..\..\..\Tango.CodeGeneration\Tango.CodeGeneration.csproj"> + <Project>{caedae94-11ed-473c-888a-268a6d38cd20}</Project> + <Name>Tango.CodeGeneration</Name> + </ProjectReference> + <ProjectReference Include="..\..\..\Tango.Core\Tango.Core.csproj"> + <Project>{a34ee0f0-649d-41c8-8489-b6f1cc6924ee}</Project> + <Name>Tango.Core</Name> + </ProjectReference> + <ProjectReference Include="..\..\..\Tango.DragAndDrop\Tango.DragAndDrop.csproj"> + <Project>{b112d89a-a106-41ae-a0c1-4abc84c477f5}</Project> + <Name>Tango.DragAndDrop</Name> + </ProjectReference> + <ProjectReference Include="..\..\..\Tango.Integration\Tango.Integration.csproj"> + <Project>{4206ac58-3b57-4699-8835-90bf6db01a61}</Project> + <Name>Tango.Integration</Name> + </ProjectReference> + <ProjectReference Include="..\..\..\Tango.Logging\Tango.Logging.csproj"> + <Project>{bc932dbd-7cdb-488c-99e4-f02cf441f55e}</Project> + <Name>Tango.Logging</Name> + </ProjectReference> + <ProjectReference Include="..\..\..\Tango.PMR\Tango.PMR.csproj"> + <Project>{e4927038-348d-4295-aaf4-861c58cb3943}</Project> + <Name>Tango.PMR</Name> + </ProjectReference> + <ProjectReference Include="..\..\..\Tango.Settings\Tango.Settings.csproj"> + <Project>{d8f1ad85-526a-4f50-b6dc-d437af63d8d8}</Project> + <Name>Tango.Settings</Name> + </ProjectReference> + <ProjectReference Include="..\..\..\Tango.SharedUI\Tango.SharedUI.csproj"> + <Project>{8491d07b-c1f6-4b62-a412-41b9fd2d6538}</Project> + <Name>Tango.SharedUI</Name> + </ProjectReference> + <ProjectReference Include="..\..\..\Tango.TFS\Tango.TFS.csproj"> + <Project>{998f8471-dc1b-41b6-9d96-354e1b4e7a32}</Project> + <Name>Tango.TFS</Name> + </ProjectReference> + <ProjectReference Include="..\..\..\Tango.Touch\Tango.Touch.csproj"> + <Project>{fd86424c-6e84-491b-8df9-3d0f5c236a2a}</Project> + <Name>Tango.Touch</Name> + </ProjectReference> + <ProjectReference Include="..\..\..\Tango.Transport\Tango.Transport.csproj"> + <Project>{74e700b0-1156-4126-be40-ee450d3c3026}</Project> + <Name>Tango.Transport</Name> + </ProjectReference> + <ProjectReference Include="..\..\..\Tango.Web\Tango.Web.csproj"> + <Project>{5001990f-977b-48ff-b217-0236a5022ad8}</Project> + <Name>Tango.Web</Name> + </ProjectReference> + <ProjectReference Include="..\..\Tango.PPC.Common\Tango.PPC.Common.csproj"> + <Project>{0be74eee-22cb-4dba-b896-793b9e1a3ac0}</Project> + <Name>Tango.PPC.Common</Name> + </ProjectReference> + </ItemGroup> + <ItemGroup> + </ItemGroup> + <ItemGroup /> + <Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" /> + <ProjectExtensions> + <VisualStudio> + <UserProperties BuildVersion_AssemblyInfoFilename="Properties\AssemblyInfo.cs" BuildVersion_UpdateAssemblyVersion="True" BuildVersion_BuildVersioningStyle="None.None.Increment.TimeStamp" BuildVersion_UseGlobalSettings="False" BuildVersion_StartDate="2000/1/1" /> + </VisualStudio> + </ProjectExtensions> + <ItemGroup> + <ReferencePath Include="C:\DATA\Development\Tango\Software\Visual_Studio\packages\EntityFramework.6.0.0\lib\net45\EntityFramework.dll" /> + <ReferencePath Include="C:\DATA\Development\Tango\Software\Visual_Studio\packages\EntityFramework.6.0.0\lib\net45\EntityFramework.SqlServer.dll" /> + <ReferencePath Include="C:\DATA\Development\Tango\Software\Visual_Studio\packages\FontAwesome.WPF.4.7.0.9\lib\net40\FontAwesome.WPF.dll" /> + <ReferencePath Include="C:\DATA\Development\Tango\Software\Visual_Studio\packages\Google.Protobuf.3.4.1\lib\net45\Google.Protobuf.dll" /> + <ReferencePath Include="C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.6.1\Microsoft.CSharp.dll" /> + <ReferencePath Include="C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.6.1\mscorlib.dll" /> + <ReferencePath Include="C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.6.1\PresentationCore.dll" /> + <ReferencePath Include="C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.6.1\PresentationFramework.dll" /> + <ReferencePath Include="C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.6.1\System.ComponentModel.DataAnnotations.dll" /> + <ReferencePath Include="C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.6.1\System.Core.dll" /> + <ReferencePath Include="C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.6.1\System.Data.DataSetExtensions.dll" /> + <ReferencePath Include="C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.6.1\System.Data.dll" /> + <ReferencePath Include="C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.6.1\System.dll" /> + <ReferencePath Include="C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.6.1\System.Net.Http.dll" /> + <ReferencePath Include="C:\DATA\Development\Tango\Software\Visual_Studio\packages\Expression.Blend.Sdk.1.0.2\lib\net45\System.Windows.Interactivity.dll" /> + <ReferencePath Include="C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.6.1\System.Xaml.dll" /> + <ReferencePath Include="C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.6.1\System.Xml.dll" /> + <ReferencePath Include="C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.6.1\System.Xml.Linq.dll" /> + <ReferencePath Include="C:\DATA\Development\Tango\Software\Visual_Studio\Build\Core\Debug\Tango.BL.dll" /> + <ReferencePath Include="C:\DATA\Development\Tango\Software\Visual_Studio\Build\Core\Debug\Tango.CodeGeneration.dll" /> + <ReferencePath Include="C:\DATA\Development\Tango\Software\Visual_Studio\Build\Core\Debug\Tango.Core.dll" /> + <ReferencePath Include="C:\DATA\Development\Tango\Software\Visual_Studio\Build\Core\Debug\Tango.DragAndDrop.dll" /> + <ReferencePath Include="C:\DATA\Development\Tango\Software\Visual_Studio\Build\Core\Debug\Tango.Integration.dll" /> + <ReferencePath Include="C:\DATA\Development\Tango\Software\Visual_Studio\Build\Core\Debug\Tango.Logging.dll" /> + <ReferencePath Include="C:\DATA\Development\Tango\Software\Visual_Studio\Build\Core\Debug\Tango.PMR.dll" /> + <ReferencePath Include="C:\DATA\Development\Tango\Software\Visual_Studio\Build\PPC\Debug\Tango.PPC.Common.dll" /> + <ReferencePath Include="C:\DATA\Development\Tango\Software\Visual_Studio\Build\Core\Debug\Tango.Settings.dll" /> + <ReferencePath Include="C:\DATA\Development\Tango\Software\Visual_Studio\Build\Core\Debug\Tango.SharedUI.dll" /> + <ReferencePath Include="C:\DATA\Development\Tango\Software\Visual_Studio\Build\Core\Debug\Tango.TFS.dll" /> + <ReferencePath Include="C:\DATA\Development\Tango\Software\Visual_Studio\Build\Core\Debug\Tango.Touch.dll" /> + <ReferencePath Include="C:\DATA\Development\Tango\Software\Visual_Studio\Build\Core\Debug\Tango.Transport.dll" /> + <ReferencePath Include="C:\DATA\Development\Tango\Software\Visual_Studio\Build\Core\Debug\Tango.Web.dll" /> + <ReferencePath Include="C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.6.1\WindowsBase.dll" /> + <ReferencePath Include="C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.6.1\Facades\System.Collections.Concurrent.dll" /> + <ReferencePath Include="C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.6.1\Facades\System.Collections.dll" /> + <ReferencePath Include="C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.6.1\Facades\System.ComponentModel.Annotations.dll" /> + <ReferencePath Include="C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.6.1\Facades\System.ComponentModel.dll" /> + <ReferencePath Include="C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.6.1\Facades\System.ComponentModel.EventBasedAsync.dll" /> + <ReferencePath Include="C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.6.1\Facades\System.Diagnostics.Contracts.dll" /> + <ReferencePath Include="C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.6.1\Facades\System.Diagnostics.Debug.dll" /> + <ReferencePath Include="C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.6.1\Facades\System.Diagnostics.Tools.dll" /> + <ReferencePath Include="C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.6.1\Facades\System.Diagnostics.Tracing.dll" /> + <ReferencePath Include="C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.6.1\Facades\System.Dynamic.Runtime.dll" /> + <ReferencePath Include="C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.6.1\Facades\System.Globalization.dll" /> + <ReferencePath Include="C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.6.1\Facades\System.IO.dll" /> + <ReferencePath Include="C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.6.1\Facades\System.Linq.dll" /> + <ReferencePath Include="C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.6.1\Facades\System.Linq.Expressions.dll" /> + <ReferencePath Include="C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.6.1\Facades\System.Linq.Parallel.dll" /> + <ReferencePath Include="C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.6.1\Facades\System.Linq.Queryable.dll" /> + <ReferencePath Include="C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.6.1\Facades\System.Net.NetworkInformation.dll" /> + <ReferencePath Include="C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.6.1\Facades\System.Net.Primitives.dll" /> + <ReferencePath Include="C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.6.1\Facades\System.Net.Requests.dll" /> + <ReferencePath Include="C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.6.1\Facades\System.Net.WebHeaderCollection.dll" /> + <ReferencePath Include="C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.6.1\Facades\System.ObjectModel.dll" /> + <ReferencePath Include="C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.6.1\Facades\System.Reflection.dll" /> + <ReferencePath Include="C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.6.1\Facades\System.Reflection.Emit.dll" /> + <ReferencePath Include="C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.6.1\Facades\System.Reflection.Emit.ILGeneration.dll" /> + <ReferencePath Include="C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.6.1\Facades\System.Reflection.Emit.Lightweight.dll" /> + <ReferencePath Include="C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.6.1\Facades\System.Reflection.Extensions.dll" /> + <ReferencePath Include="C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.6.1\Facades\System.Reflection.Primitives.dll" /> + <ReferencePath Include="C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.6.1\Facades\System.Resources.ResourceManager.dll" /> + <ReferencePath Include="C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.6.1\Facades\System.Runtime.dll" /> + <ReferencePath Include="C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.6.1\Facades\System.Runtime.Extensions.dll" /> + <ReferencePath Include="C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.6.1\Facades\System.Runtime.Handles.dll" /> + <ReferencePath Include="C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.6.1\Facades\System.Runtime.InteropServices.dll" /> + <ReferencePath Include="C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.6.1\Facades\System.Runtime.InteropServices.WindowsRuntime.dll" /> + <ReferencePath Include="C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.6.1\Facades\System.Runtime.Numerics.dll" /> + <ReferencePath Include="C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.6.1\Facades\System.Runtime.Serialization.Json.dll" /> + <ReferencePath Include="C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.6.1\Facades\System.Runtime.Serialization.Primitives.dll" /> + <ReferencePath Include="C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.6.1\Facades\System.Runtime.Serialization.Xml.dll" /> + <ReferencePath Include="C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.6.1\Facades\System.Security.Principal.dll" /> + <ReferencePath Include="C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.6.1\Facades\System.ServiceModel.Duplex.dll" /> + <ReferencePath Include="C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.6.1\Facades\System.ServiceModel.Http.dll" /> + <ReferencePath Include="C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.6.1\Facades\System.ServiceModel.NetTcp.dll" /> + <ReferencePath Include="C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.6.1\Facades\System.ServiceModel.Primitives.dll" /> + <ReferencePath Include="C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.6.1\Facades\System.ServiceModel.Security.dll" /> + <ReferencePath Include="C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.6.1\Facades\System.Text.Encoding.dll" /> + <ReferencePath Include="C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.6.1\Facades\System.Text.Encoding.Extensions.dll" /> + <ReferencePath Include="C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.6.1\Facades\System.Text.RegularExpressions.dll" /> + <ReferencePath Include="C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.6.1\Facades\System.Threading.dll" /> + <ReferencePath Include="C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.6.1\Facades\System.Threading.Tasks.dll" /> + <ReferencePath Include="C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.6.1\Facades\System.Threading.Tasks.Parallel.dll" /> + <ReferencePath Include="C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.6.1\Facades\System.Threading.Timer.dll" /> + <ReferencePath Include="C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.6.1\Facades\System.Xml.ReaderWriter.dll" /> + <ReferencePath Include="C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.6.1\Facades\System.Xml.XDocument.dll" /> + <ReferencePath Include="C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.6.1\Facades\System.Xml.XmlSerializer.dll" /> + </ItemGroup> + <ItemGroup> + <Compile Include="C:\DATA\Development\Tango\Software\Visual_Studio\PPC\Modules\Tango.PPC.BugReporting\obj\Debug\App.g.cs" /> + <Compile Include="C:\DATA\Development\Tango\Software\Visual_Studio\PPC\Modules\Tango.PPC.BugReporting\obj\Debug\Views\MainView.g.cs" /> + </ItemGroup> +</Project>
\ No newline at end of file diff --git a/Software/Visual_Studio/PPC/Modules/Tango.PPC.BugReporting/ViewModelLocator.cs b/Software/Visual_Studio/PPC/Modules/Tango.PPC.BugReporting/ViewModelLocator.cs index 1f71ca2c1..24b222370 100644 --- a/Software/Visual_Studio/PPC/Modules/Tango.PPC.BugReporting/ViewModelLocator.cs +++ b/Software/Visual_Studio/PPC/Modules/Tango.PPC.BugReporting/ViewModelLocator.cs @@ -16,7 +16,7 @@ namespace Tango.PPC.BugReporting /// </summary> static ViewModelLocator() { - TangoIOC.Default.Register<TeamFoundationServicePPCClient>(new TeamFoundationServicePPCClient("https://twinetfs.visualstudio.com", String.Empty, "szzfokrceo4rhd4eqi5qpmxn3pa5iwl3q7tlqd36l2m7smz2ynoa")); + TangoIOC.Default.Register<TeamFoundationServicePPCClient>(new TeamFoundationServicePPCClient("https://twinetfs.visualstudio.com", String.Empty, "pyulwgs7m3v7pizz3oxusypdkdfw43txggo5mjwu2ouyv2qwprhq")); TangoIOC.Default.Register<MainViewVM>(); } diff --git a/Software/Visual_Studio/PPC/Modules/Tango.PPC.Events/Converters/MachineEventToViewConverter.cs b/Software/Visual_Studio/PPC/Modules/Tango.PPC.Events/Converters/MachineEventToViewConverter.cs index 47c9e0ddf..56d7149d3 100644 --- a/Software/Visual_Studio/PPC/Modules/Tango.PPC.Events/Converters/MachineEventToViewConverter.cs +++ b/Software/Visual_Studio/PPC/Modules/Tango.PPC.Events/Converters/MachineEventToViewConverter.cs @@ -18,10 +18,17 @@ namespace Tango.PPC.Events.Converters static MachineEventToViewConverter() { + //Jobs _eventViews.Add(EventTypes.JOB_STARTED, typeof(JobEventView)); _eventViews.Add(EventTypes.JOB_ABORTED, typeof(JobEventView)); _eventViews.Add(EventTypes.JOB_COMPLETED, typeof(JobEventView)); _eventViews.Add(EventTypes.JOB_FAILED, typeof(JobEventView)); + + //Thread Break + _eventViews.Add(EventTypes.THREAD_BREAK, typeof(ThreadBreakView)); + _eventViews.Add(EventTypes.THREAD_TENSION_CONTROL_FAILURE_FEEDER_DANCER, typeof(ThreadBreakView)); + _eventViews.Add(EventTypes.THREAD_TENSION_CONTROL_FAILURE_PULLER_DANCER, typeof(ThreadBreakView)); + _eventViews.Add(EventTypes.THREAD_TENSION_CONTROL_FAILURE_WINDER_DANCER, typeof(ThreadBreakView)); } public object Convert(object value, Type targetType, object parameter, CultureInfo culture) diff --git a/Software/Visual_Studio/PPC/Modules/Tango.PPC.Events/EventsViews/ThreadBreakView.xaml b/Software/Visual_Studio/PPC/Modules/Tango.PPC.Events/EventsViews/ThreadBreakView.xaml new file mode 100644 index 000000000..71c4ced07 --- /dev/null +++ b/Software/Visual_Studio/PPC/Modules/Tango.PPC.Events/EventsViews/ThreadBreakView.xaml @@ -0,0 +1,26 @@ +<UserControl x:Class="Tango.PPC.Events.EventsViews.ThreadBreakView" + 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:touch="clr-namespace:Tango.Touch.Controls;assembly=Tango.Touch" + xmlns:entities="clr-namespace:Tango.BL.Entities;assembly=Tango.BL" + xmlns:local="clr-namespace:Tango.PPC.Events.EventsViews" + mc:Ignorable="d" + d:DesignHeight="220" d:DesignWidth="750" d:DataContext="{d:DesignInstance Type=entities:MachinesEvent, IsDesignTimeCreatable=False}"> + <Grid Background="{StaticResource TangoPrimaryBackgroundBrush}"> + <DockPanel> + <Image Stretch="None" Margin="20" DockPanel.Dock="Right" Source="../Images/machine_small.png" RenderOptions.BitmapScalingMode="Fant" /> + <DockPanel Margin="35 20 20 20"> + <TextBlock FontSize="{StaticResource TangoTitleFontSize}" FontWeight="SemiBold" DockPanel.Dock="Top" Text="{Binding EventType.Title,FallbackValue='Unknown Event'}"></TextBlock> + + <StackPanel Margin="0 30 0 0"> + <TextBlock TextWrapping="Wrap" FontWeight="SemiBold" Text="{Binding EventType.Description,FallbackValue='No Description'}"></TextBlock> + <Rectangle Margin="0 5 0 10" StrokeThickness="2" Stroke="{StaticResource TangoDividerBrush}" /> + + <touch:TouchButton x:Name="btnLoadThreadBreakWizard" Margin="0 10 0 0" Height="55" Style="{StaticResource TangoHollowButton}" Width="280" HorizontalAlignment="Left">LOAD THREAD BREAK WIZARD</touch:TouchButton> + </StackPanel> + </DockPanel> + </DockPanel> + </Grid> +</UserControl> diff --git a/Software/Visual_Studio/PPC/Modules/Tango.PPC.Events/EventsViews/ThreadBreakView.xaml.cs b/Software/Visual_Studio/PPC/Modules/Tango.PPC.Events/EventsViews/ThreadBreakView.xaml.cs new file mode 100644 index 000000000..7e8337514 --- /dev/null +++ b/Software/Visual_Studio/PPC/Modules/Tango.PPC.Events/EventsViews/ThreadBreakView.xaml.cs @@ -0,0 +1,49 @@ +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; +using Tango.Core.DI; +using Tango.PPC.Common.ThreadLoading; + +namespace Tango.PPC.Events.EventsViews +{ + /// <summary> + /// Interaction logic for ThreadBreakView.xaml + /// </summary> + public partial class ThreadBreakView : UserControl + { + public ThreadBreakView() + { + InitializeComponent(); + + btnLoadThreadBreakWizard.Click += BtnLoadThreadBreakWizard_Click; + } + + private void BtnLoadThreadBreakWizard_Click(object sender, RoutedEventArgs e) + { + try + { + var threadLoadingService = TangoIOC.Default.GetInstance<IThreadLoadingService>(); + + if (threadLoadingService != null) + { + threadLoadingService.StartThreadBreakWizard(); + } + } + catch (Exception ex) + { + Logging.LogManager.Default.Log(ex, "Error loading the thread break wizard."); + } + } + } +} diff --git a/Software/Visual_Studio/PPC/Modules/Tango.PPC.Events/Resources/Styles.xaml b/Software/Visual_Studio/PPC/Modules/Tango.PPC.Events/Resources/Styles.xaml index 53102d8ec..eaf621571 100644 --- a/Software/Visual_Studio/PPC/Modules/Tango.PPC.Events/Resources/Styles.xaml +++ b/Software/Visual_Studio/PPC/Modules/Tango.PPC.Events/Resources/Styles.xaml @@ -18,11 +18,11 @@ <Setter Property="Height" Value="68"></Setter> <Setter Property="Margin" Value="5 0 5 5"></Setter> <Setter Property="CornerRadius" Value="5"></Setter> - <Setter Property="Effect"> + <!--<Setter Property="Effect"> <Setter.Value> <DropShadowEffect BlurRadius="5" ShadowDepth="1" Color="Silver" /> </Setter.Value> - </Setter> + </Setter>--> </Style> <Style TargetType="{x:Type touch:LightTouchDataGridRow}"> diff --git a/Software/Visual_Studio/PPC/Modules/Tango.PPC.Events/Tango.PPC.Events.csproj b/Software/Visual_Studio/PPC/Modules/Tango.PPC.Events/Tango.PPC.Events.csproj index e2133e585..e8d4683ee 100644 --- a/Software/Visual_Studio/PPC/Modules/Tango.PPC.Events/Tango.PPC.Events.csproj +++ b/Software/Visual_Studio/PPC/Modules/Tango.PPC.Events/Tango.PPC.Events.csproj @@ -76,6 +76,10 @@ <SubType>Designer</SubType> <Generator>MSBuild:Compile</Generator> </Page> + <Page Include="EventsViews\ThreadBreakView.xaml"> + <SubType>Designer</SubType> + <Generator>MSBuild:Compile</Generator> + </Page> <Page Include="Resources\Styles.xaml"> <Generator>MSBuild:Compile</Generator> <SubType>Designer</SubType> @@ -98,6 +102,9 @@ <Compile Include="EventsViews\JobEventView.xaml.cs"> <DependentUpon>JobEventView.xaml</DependentUpon> </Compile> + <Compile Include="EventsViews\ThreadBreakView.xaml.cs"> + <DependentUpon>ThreadBreakView.xaml</DependentUpon> + </Compile> <Compile Include="Properties\AssemblyInfo.cs"> <SubType>Code</SubType> </Compile> @@ -180,7 +187,7 @@ <Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" /> <ProjectExtensions> <VisualStudio> - <UserProperties BuildVersion_AssemblyInfoFilename="Properties\AssemblyInfo.cs" BuildVersion_UpdateAssemblyVersion="True" BuildVersion_BuildVersioningStyle="None.None.Increment.TimeStamp" BuildVersion_UseGlobalSettings="False" BuildVersion_StartDate="2000/1/1" /> + <UserProperties BuildVersion_StartDate="2000/1/1" BuildVersion_UseGlobalSettings="False" BuildVersion_BuildVersioningStyle="None.None.Increment.TimeStamp" BuildVersion_UpdateAssemblyVersion="True" BuildVersion_AssemblyInfoFilename="Properties\AssemblyInfo.cs" /> </VisualStudio> </ProjectExtensions> </Project>
\ No newline at end of file diff --git a/Software/Visual_Studio/PPC/Modules/Tango.PPC.Events/ViewModels/MainViewVM.cs b/Software/Visual_Studio/PPC/Modules/Tango.PPC.Events/ViewModels/MainViewVM.cs index d2a730cd7..a6e6b7a4e 100644 --- a/Software/Visual_Studio/PPC/Modules/Tango.PPC.Events/ViewModels/MainViewVM.cs +++ b/Software/Visual_Studio/PPC/Modules/Tango.PPC.Events/ViewModels/MainViewVM.cs @@ -127,15 +127,31 @@ namespace Tango.PPC.Events.ViewModels { if (ev.NotificationTime != EventTypeNotificationTimes.None) { - CurrentEvents.Insert(0, ev); + if (!ev.EventType.Persistent) + { + CurrentEvents.Insert(0, ev); + } + else + { + HistoryEvents.Insert(0, ev); + } var notificationItem = new MessageNotificationItem(); - notificationItem.CanClose = false; + notificationItem.CanClose = ev.EventType.Persistent; notificationItem.Message = ev.EventType.Title; notificationItem.ExpandedMessage = ev.EventType.Description; notificationItem.Pressed += async (_, __) => { - SelectedEventsSource = EventsSource.CURRENT; + if (!ev.EventType.Persistent) + { + SelectedEventsSource = EventsSource.CURRENT; + } + else + { + SelectedEventsSource = EventsSource.HISTORY; + notificationItem.Dispose(); + } + SelectedEvent = ev; await NavigationManager.NavigateTo<EventsModule>(); }; @@ -144,15 +160,23 @@ namespace Tango.PPC.Events.ViewModels { case EventTypeCategories.Info: notificationItem.MessageType = MessageNotificationItem.MessageNotificationItemTypes.Info; + notificationItem.Priority = NotificationItem.NotificationPriority.Normal; break; case EventTypeCategories.Warning: notificationItem.MessageType = MessageNotificationItem.MessageNotificationItemTypes.Warning; + notificationItem.Priority = NotificationItem.NotificationPriority.High; break; case EventTypeCategories.Error: notificationItem.MessageType = MessageNotificationItem.MessageNotificationItemTypes.Error; + notificationItem.Priority = NotificationItem.NotificationPriority.VeryHigh; break; case EventTypeCategories.Critical: notificationItem.MessageType = MessageNotificationItem.MessageNotificationItemTypes.Critical; + notificationItem.Priority = NotificationItem.NotificationPriority.Critical; + break; + case EventTypeCategories.Success: + notificationItem.MessageType = MessageNotificationItem.MessageNotificationItemTypes.Success; + notificationItem.Priority = NotificationItem.NotificationPriority.VeryHigh; break; } @@ -171,7 +195,7 @@ namespace Tango.PPC.Events.ViewModels { InvokeUI(() => { - if (ev.NotificationTime != EventTypeNotificationTimes.None) + if (ev.NotificationTime != EventTypeNotificationTimes.None && !ev.EventType.Persistent) { CurrentEvents.Remove(ev); HistoryEvents.Insert(0, ev); diff --git a/Software/Visual_Studio/PPC/Modules/Tango.PPC.Events/Views/MainView.xaml b/Software/Visual_Studio/PPC/Modules/Tango.PPC.Events/Views/MainView.xaml index af42a5576..f0ae4b128 100644 --- a/Software/Visual_Studio/PPC/Modules/Tango.PPC.Events/Views/MainView.xaml +++ b/Software/Visual_Studio/PPC/Modules/Tango.PPC.Events/Views/MainView.xaml @@ -143,8 +143,8 @@ <touch:TouchIcon Width="32" Height="32" IsHitTestVisible="False"> <touch:TouchIcon.Style> <Style TargetType="touch:TouchIcon"> - <Setter Property="Icon" Value="CheckCircleOutline"/> - <Setter Property="Foreground" Value="{StaticResource TangoSuccessBrush}"/> + <Setter Property="Icon" Value="Information"/> + <Setter Property="Foreground" Value="{StaticResource TangoDarkForegroundBrush}"/> <Style.Triggers> <DataTrigger Binding="{Binding Category,Mode=OneWay}" Value="Warning"> <Setter Property="Icon" Value="AlertCircleOutline"/> @@ -158,6 +158,10 @@ <Setter Property="Icon" Value="Alert"/> <Setter Property="Foreground" Value="{StaticResource TangoErrorBrush}"/> </DataTrigger> + <DataTrigger Binding="{Binding Category,Mode=OneWay}" Value="Success"> + <Setter Property="Icon" Value="CheckCircleOutline"/> + <Setter Property="Foreground" Value="{StaticResource TangoSuccessBrush}"/> + </DataTrigger> </Style.Triggers> </Style> </touch:TouchIcon.Style> diff --git a/Software/Visual_Studio/PPC/Modules/Tango.PPC.Jobs/AppBarItems/JobProgressAppBarItemView.xaml b/Software/Visual_Studio/PPC/Modules/Tango.PPC.Jobs/AppBarItems/JobProgressAppBarItemView.xaml index cdc28335d..16c6a42be 100644 --- a/Software/Visual_Studio/PPC/Modules/Tango.PPC.Jobs/AppBarItems/JobProgressAppBarItemView.xaml +++ b/Software/Visual_Studio/PPC/Modules/Tango.PPC.Jobs/AppBarItems/JobProgressAppBarItemView.xaml @@ -5,11 +5,12 @@ xmlns:d="http://schemas.microsoft.com/expression/blend/2008" xmlns:touch="clr-namespace:Tango.Touch.Controls;assembly=Tango.Touch" xmlns:local="clr-namespace:Tango.PPC.Jobs.AppBarItems" - mc:Ignorable="d" d:DesignWidth="800" d:DataContext="{d:DesignInstance Type=local:JobProgressAppBarItem, IsDesignTimeCreatable=False}"> + mc:Ignorable="d" + d:DesignWidth="800" d:DataContext="{d:DesignInstance Type=local:JobProgressAppBarItem, IsDesignTimeCreatable=False}"> <Grid> <touch:TouchButton Style="{StaticResource TangoFlatButton}" Command="{Binding PressedCommand}" Padding="0"> <StackPanel VerticalAlignment="Center"> - <TextBlock Text="{Binding MachineProvider.MachineOperator.RunningJob.Name,FallbackValue='Job Name'}" FontSize="{StaticResource TangoTitleFontSize}"></TextBlock> + <TextBlock Text="{Binding MachineProvider.MachineOperator.RunningJob.Name,FallbackValue='Job Name'}" FontSize="{StaticResource TangoTitleFontSize}" TextTrimming="CharacterEllipsis"></TextBlock> <ProgressBar Maximum="{Binding MachineProvider.MachineOperator.RunningJobStatus.TotalProgressMinusSettingUp}" Value="{Binding MachineProvider.MachineOperator.RunningJobStatus.ProgressMinusSettingUp}" Margin="0 10 0 5" Background="{StaticResource TangoGrayBrush}" Height="5" Foreground="{StaticResource TangoPrimaryAccentBrush}" BorderThickness="0" /> <DockPanel LastChildFill="False"> <TextBlock DockPanel.Dock="Left"> diff --git a/Software/Visual_Studio/PPC/Modules/Tango.PPC.Jobs/AppButtons/StartPrintingButton.cs b/Software/Visual_Studio/PPC/Modules/Tango.PPC.Jobs/AppButtons/StartPrintingButton.cs index 001888c92..4d6050639 100644 --- a/Software/Visual_Studio/PPC/Modules/Tango.PPC.Jobs/AppButtons/StartPrintingButton.cs +++ b/Software/Visual_Studio/PPC/Modules/Tango.PPC.Jobs/AppButtons/StartPrintingButton.cs @@ -15,12 +15,12 @@ namespace Tango.PPC.Jobs.AppButtons { op.StatusChanged += Op_StatusChanged; - Op_StatusChanged(this, op.Status); + Op_StatusChanged(op, op.Status); } private void Op_StatusChanged(object sender, MachineStatuses status) { - IsEnabled = status == MachineStatuses.ReadyToDye; + IsEnabled = (sender as IMachineOperator).CanPrint; } } } diff --git a/Software/Visual_Studio/PPC/Modules/Tango.PPC.Jobs/Controls/JobOutlineControl.cs b/Software/Visual_Studio/PPC/Modules/Tango.PPC.Jobs/Controls/JobOutlineControl.cs new file mode 100644 index 000000000..78f8c90a1 --- /dev/null +++ b/Software/Visual_Studio/PPC/Modules/Tango.PPC.Jobs/Controls/JobOutlineControl.cs @@ -0,0 +1,319 @@ +using System; +using System.Collections; +using System.Collections.Generic; +using System.IO; +using System.Linq; +using System.Reflection; +using System.Text; +using System.Threading.Tasks; +using System.Windows; +using System.Windows.Controls; +using System.Windows.Media; +using System.Windows.Shapes; +using Tango.PMR.Printing; +using Tango.Touch.Controls; + +namespace Tango.PPC.Jobs +{ + public class JobOutlineControl : Control + { + #region Members + + private Size _sizeControl = new Size(0, 0); + ScrollViewer _parentScrollViewer = null; + public struct LevelOffset + { + public const double level_0 = 0.0; + public const double level_1 = 10.0; + public const double level_2 = 20.0; + public const double level_3 = 37.0; + public const double level_4 = 50.0; + public const double level_5 = 60.0; + public const double level_6 = 77.0; + public const double level_7 = 90.0; + public const double level_8 = 100.0; + } + private double _verticalOffset = 0; + private double _viewportHeight = 0; + private const double HEADER_FONT_HEIGHT = 35; + private const double TITLE_FONT_HEIGHT = 22; + private const double SUB_TITLE_FONT_HEIGHT = 19; + private const double NORMAL_FONT_HEIGHT = 17; + private const double WIDTH = 330; + + #endregion members + + public JobOutlineControl() : base() + { + Unloaded += JobOutlineControl_Unloaded; + DataContextChanged += JobOutlineControl_DataContextChanged; + Width = WIDTH; + } + + private void JobOutlineControl_DataContextChanged(object sender, DependencyPropertyChangedEventArgs e) + { + if (DataContext == null) + { + return; + } + + if (_parentScrollViewer != null) + { + _parentScrollViewer.ScrollToTop(); + } + + InvalidateVisual(); + } + + #region events + private void JobOutlineControl_Unloaded(object sender, RoutedEventArgs e) + { + if (_parentScrollViewer != null) + { + _parentScrollViewer.ScrollChanged -= ScrollViewer_ScrollChanged; + } + } + + private void ScrollViewer_ScrollChanged(object sender, ScrollChangedEventArgs e) + { + if (e.VerticalChange == 0.0) + return; + + _verticalOffset = _parentScrollViewer.VerticalOffset; + _viewportHeight = _parentScrollViewer.ViewportHeight; + InvalidateVisual(); + } + #endregion events + + #region render + protected override void OnRender(DrawingContext drawingContext) + { + base.OnRender(drawingContext); + + if (!(DataContext is JobTicket job)) return; + if (_parentScrollViewer == null) + { + _parentScrollViewer = this.FindAncestor<ScrollViewer>(); + _parentScrollViewer.ScrollChanged += ScrollViewer_ScrollChanged; + } + else if (_viewportHeight == 0) + { + _viewportHeight = _parentScrollViewer.ActualHeight; + } + _sizeControl = new Size(); + _sizeControl.Height += 10; + DrawHeaderText(drawingContext, "JOB OUTLINE", 30, LevelOffset.level_0); + _sizeControl.Height += HEADER_FONT_HEIGHT; + + _sizeControl.Height += 20; + DrawHeaderText(drawingContext, "BASIC", 17, LevelOffset.level_0); + _sizeControl.Height += TITLE_FONT_HEIGHT; + _sizeControl.Height += 5.0; + var basicProps = GetNameValueList(job); + foreach (var prop in basicProps) + { + DrawNameValueText(drawingContext, prop, LevelOffset.level_1, TouchIconKind.Pencil); + _sizeControl.Height += NORMAL_FONT_HEIGHT; + } + //JobTicket.Spool + if (job.Spool != null) + { + _sizeControl.Height += 20; + DrawHeaderText(drawingContext, "SPOOL", 17, LevelOffset.level_0); + _sizeControl.Height += TITLE_FONT_HEIGHT; + _sizeControl.Height += 5.0; + basicProps = GetNameValueList(job.Spool); + foreach (var prop in basicProps) + { + DrawNameValueText(drawingContext, prop, LevelOffset.level_1, TouchIconKind.Pencil); + _sizeControl.Height += NORMAL_FONT_HEIGHT; + } + } + //JobTicket.ProcessParameters + if (job.ProcessParameters != null) + { + _sizeControl.Height += 20; + DrawHeaderText(drawingContext, "PROCESS PARAMETERS", 17, LevelOffset.level_0); + _sizeControl.Height += TITLE_FONT_HEIGHT; + _sizeControl.Height += 5.0; + basicProps = GetNameValueList(job.ProcessParameters); + foreach (var prop in basicProps) + { + DrawNameValueText(drawingContext, prop, LevelOffset.level_1, TouchIconKind.Settings); + _sizeControl.Height += NORMAL_FONT_HEIGHT; + } + } + //JobTicket.ThreadParameters + if (job.ThreadParameters != null) + { + _sizeControl.Height += 20; + DrawHeaderText(drawingContext, "THREAD PARAMETERS", 17, LevelOffset.level_0); + _sizeControl.Height += TITLE_FONT_HEIGHT; + _sizeControl.Height += 5.0; + basicProps = GetNameValueList(job.ThreadParameters); + foreach (var prop in basicProps) + { + DrawNameValueText(drawingContext, prop, LevelOffset.level_1, TouchIconKind.Settings); + _sizeControl.Height += NORMAL_FONT_HEIGHT; + } + } + //JobTicket.HeadCleaningParameters + if (job.HeadCleaningParameters != null) + { + _sizeControl.Height += 20; + DrawHeaderText(drawingContext, "HEAD CLEANING PARAMETERS", 17, LevelOffset.level_0); + _sizeControl.Height += TITLE_FONT_HEIGHT; + _sizeControl.Height += 5.0; + basicProps = GetNameValueList(job.HeadCleaningParameters); + foreach (var prop in basicProps) + { + DrawNameValueText(drawingContext, prop, LevelOffset.level_1, TouchIconKind.Settings); + _sizeControl.Height += NORMAL_FONT_HEIGHT; + } + } + //JobTicket.Segments + if (job.Segments != null) + { + _sizeControl.Height += 20; + DrawHeaderText(drawingContext, "SEGMENTS", 17, LevelOffset.level_0); + _sizeControl.Height += TITLE_FONT_HEIGHT; + _sizeControl.Height += 10.0; + int index = 0; + foreach (JobSegment seg in job.Segments) + { + DrawHeaderText(drawingContext, string.Format("#{0} SEGMENT", ++index), 14, LevelOffset.level_1); + _sizeControl.Height += SUB_TITLE_FONT_HEIGHT; + basicProps = GetNameValueList(seg); + foreach (var prop in basicProps) + { + DrawNameValueText(drawingContext, prop, LevelOffset.level_2, TouchIconKind.Pencil); + _sizeControl.Height += NORMAL_FONT_HEIGHT; + } + //BrushStops + DrawHeaderText(drawingContext, "BRUSH STOPS", 12, LevelOffset.level_3); + _sizeControl.Height += NORMAL_FONT_HEIGHT; + int indexBrush = 0; + foreach (JobBrushStop brushstop in seg.BrushStops) + { + _sizeControl.Height += 5.0; + DrawHeaderText(drawingContext, string.Format("#{0} STOP", ++indexBrush), 11, LevelOffset.level_4); + _sizeControl.Height += NORMAL_FONT_HEIGHT; + var brushStops = GetNameValueList(brushstop); + foreach (var brushstopprop in brushStops) + { + DrawNameValueText(drawingContext, brushstopprop, LevelOffset.level_5, TouchIconKind.Pencil); + _sizeControl.Height += NORMAL_FONT_HEIGHT; + } + DrawHeaderText(drawingContext, "DISPENSERS", 12, LevelOffset.level_6); + _sizeControl.Height += NORMAL_FONT_HEIGHT; + _sizeControl.Height += 5.0; + int indexDispenser = 0; + foreach (JobDispenser disp in brushstop.Dispensers) + { + DrawHeaderText(drawingContext, string.Format("#{0} DISPENSER", ++indexDispenser), 11, LevelOffset.level_6); + _sizeControl.Height += NORMAL_FONT_HEIGHT; + var dispProperties = GetNameValueList(disp); + foreach (var dispprop in dispProperties) + { + DrawNameValueText(drawingContext, dispprop, LevelOffset.level_7, TouchIconKind.ArrowRightBoldCircle); + _sizeControl.Height += NORMAL_FONT_HEIGHT; + } + } + } + } + } + + if (Height != _sizeControl.Height) + { + Height = _sizeControl.Height; + } + } + public IEnumerable<Tuple<String, String>> GetNameValueList(object value) + { + if (value != null) + { + var properties = value.GetType().GetProperties(BindingFlags.Public | BindingFlags.Instance).Where(x => (!x.PropertyType.IsClass && !typeof(IEnumerable).IsAssignableFrom(x.PropertyType)) || x.PropertyType == typeof(String)).ToList(); + return properties.Select(x => new Tuple<string, string>(x.Name, x.GetValue(value).ToString())); + } + else + { + return null; + } + } + #endregion render + + #region drawing + protected void DrawNameValueText(DrawingContext drawingContext, Tuple<string, string> text, double levelOfOffset, TouchIconKind? icon) + { + if (IsInViewPort()) + { + FormattedText formattedName = new FormattedText(text.Item1 + ": ", System.Globalization.CultureInfo.InvariantCulture, System.Windows.FlowDirection.LeftToRight, new Typeface(this.FontFamily, FontStyles.Normal, FontWeights.Normal, FontStretches.Normal), + 12, Foreground); + DrawIconTextIfVisible(drawingContext, levelOfOffset, formattedName, icon); + double widthOfNameText = formattedName.WidthIncludingTrailingWhitespace + 17 + levelOfOffset;//17 pix for draw icon before text + + FormattedText formattedValue = new FormattedText(text.Item2, System.Globalization.CultureInfo.InvariantCulture, System.Windows.FlowDirection.LeftToRight, new Typeface(this.FontFamily, FontStyles.Normal, FontWeights.SemiBold, FontStretches.Normal), + 12, Foreground); + DrawIconTextIfVisible(drawingContext, widthOfNameText, formattedValue); + _sizeControl.Width = Math.Max(_sizeControl.Width, (widthOfNameText + formattedValue.WidthIncludingTrailingWhitespace)); + } + } + + private bool IsInViewPort() + { + return (_sizeControl.Height >= _verticalOffset && _sizeControl.Height <= (_verticalOffset + _viewportHeight + 5)); + } + + protected void DrawHeaderText(DrawingContext drawingContext, string text, int fontSize, double levelOfOffset) + { + if (IsInViewPort()) + { + FormattedText formattedtext = new FormattedText(text, System.Globalization.CultureInfo.InvariantCulture, System.Windows.FlowDirection.LeftToRight, new Typeface(this.FontFamily, FontStyles.Normal, FontWeights.SemiBold, FontStretches.Normal), + fontSize, Foreground); + DrawIconTextIfVisible(drawingContext, levelOfOffset, formattedtext); + _sizeControl.Width = Math.Max(_sizeControl.Width, (formattedtext.Width + levelOfOffset)); + } + } + + private void DrawIconTextIfVisible(DrawingContext drawingContext, double levelOfOffset, FormattedText formattedText, TouchIconKind? icon = null) + { + if (icon is TouchIconKind) + { + DrawIcon(drawingContext, (TouchIconKind)icon, new Point(levelOfOffset, _sizeControl.Height)); + levelOfOffset += 17; + } + drawingContext.DrawText(formattedText, new Point(levelOfOffset, _sizeControl.Height)); + } + private void DrawIcon(DrawingContext drawingContext, TouchIconKind kind, Point point) + { + GeometryGroup group = GetGeometryByIcon(kind); + SetGeometryPosition(group, point); + drawingContext.DrawGeometry(Foreground, new Pen(Brushes.White, 1), group); + + } + private GeometryGroup GetGeometryByIcon(TouchIconKind kind) + { + Geometry geometry = Geometry.Parse(TouchIcon.Icons[kind]); + GeometryGroup group = new GeometryGroup(); + group.Children.Add(geometry); + + TransformGroup tg = new TransformGroup(); + tg.Children.Add(new ScaleTransform() + { + ScaleX = 10d / geometry.Bounds.Width, + ScaleY = 10d / geometry.Bounds.Height, + }); + tg.Children.Add(new TranslateTransform() { }); + + group.Transform = tg; + return group; + } + private void SetGeometryPosition(GeometryGroup group, Point point) + { + TransformGroup tg = group.Transform as TransformGroup; + (tg.Children[1] as TranslateTransform).X = point.X; + (tg.Children[1] as TranslateTransform).Y = point.Y + 1; + } + #endregion drawing + } +} diff --git a/Software/Visual_Studio/PPC/Modules/Tango.PPC.Jobs/Controls/JobSummeryViewer.xaml b/Software/Visual_Studio/PPC/Modules/Tango.PPC.Jobs/Controls/JobSummeryViewer.xaml index ba6c13e91..afe331145 100644 --- a/Software/Visual_Studio/PPC/Modules/Tango.PPC.Jobs/Controls/JobSummeryViewer.xaml +++ b/Software/Visual_Studio/PPC/Modules/Tango.PPC.Jobs/Controls/JobSummeryViewer.xaml @@ -66,6 +66,9 @@ </RectangleGeometry.Rect> </RectangleGeometry> </Border.Clip> + <Border.Background> + <ImageBrush ImageSource="../Images/JobView/transparent_small.jpg" Stretch="None" TileMode="Tile" AlignmentX="Left" ViewportUnits="Absolute" Viewport="0,0,94,30" /> + </Border.Background> <Grid> <ItemsControl ClipToBounds="False" ItemsSource="{Binding EffectiveSegments,IsAsync=True}"> <ItemsControl.ItemsPanel> diff --git a/Software/Visual_Studio/PPC/Modules/Tango.PPC.Jobs/Controls/RunningJobViewer.xaml b/Software/Visual_Studio/PPC/Modules/Tango.PPC.Jobs/Controls/RunningJobViewer.xaml index 97aedcf89..5d3f3f1fc 100644 --- a/Software/Visual_Studio/PPC/Modules/Tango.PPC.Jobs/Controls/RunningJobViewer.xaml +++ b/Software/Visual_Studio/PPC/Modules/Tango.PPC.Jobs/Controls/RunningJobViewer.xaml @@ -57,6 +57,9 @@ </ItemsControl> <Border Grid.Row="1" x:Name="brush_border" ClipToBounds="False" CornerRadius="10" Margin="0 5 0 0"> + <Border.Background> + <ImageBrush ImageSource="../Images/JobView/transparent_small.jpg" Stretch="None" TileMode="Tile" AlignmentX="Left" ViewportUnits="Absolute" Viewport="0,0,94,30" /> + </Border.Background> <Border.Clip> <RectangleGeometry RadiusX="10" RadiusY="10"> <RectangleGeometry.Rect> diff --git a/Software/Visual_Studio/PPC/Modules/Tango.PPC.Jobs/Converters/ColorSpaceToVisibilityConverter.cs b/Software/Visual_Studio/PPC/Modules/Tango.PPC.Jobs/Converters/ColorSpaceToVisibilityConverter.cs index a8ba66eda..b1be93793 100644 --- a/Software/Visual_Studio/PPC/Modules/Tango.PPC.Jobs/Converters/ColorSpaceToVisibilityConverter.cs +++ b/Software/Visual_Studio/PPC/Modules/Tango.PPC.Jobs/Converters/ColorSpaceToVisibilityConverter.cs @@ -18,9 +18,17 @@ namespace Tango.PPC.Jobs.Converters if (colorSpace != null) { - if (colorSpace.Space == BL.Enumerations.ColorSpaces.Catalog) + if (String.IsNullOrWhiteSpace(parameter.ToStringSafe())) { - return Visibility.Collapsed; + if (colorSpace.Space == BL.Enumerations.ColorSpaces.Catalog) + { + return Visibility.Collapsed; + } + } + else + { + String[] spaces = parameter.ToString().Split(','); + return spaces.Contains(colorSpace.Space.ToString()) ? Visibility.Visible : Visibility.Collapsed; } } diff --git a/Software/Visual_Studio/PPC/Modules/Tango.PPC.Jobs/Dialogs/AdvancedColorCorrectionView.xaml b/Software/Visual_Studio/PPC/Modules/Tango.PPC.Jobs/Dialogs/AdvancedColorCorrectionView.xaml index 69eb1fd72..da6989ff6 100644 --- a/Software/Visual_Studio/PPC/Modules/Tango.PPC.Jobs/Dialogs/AdvancedColorCorrectionView.xaml +++ b/Software/Visual_Studio/PPC/Modules/Tango.PPC.Jobs/Dialogs/AdvancedColorCorrectionView.xaml @@ -19,23 +19,85 @@ </Grid.RowDefinitions> <Grid> - <TextBlock VerticalAlignment="Center" FontSize="{StaticResource TangoMessageBoxTitleFontSize}" Foreground="{StaticResource TangoErrorBrush}">Color is out of range</TextBlock> + <TextBlock VerticalAlignment="Center" FontSize="{StaticResource TangoMessageBoxTitleFontSize}"> + <TextBlock.Style> + <Style TargetType="TextBlock"> + <Setter Property="Text" Value="Color is out of range"></Setter> + <Setter Property="Foreground" Value="{StaticResource TangoErrorBrush}"></Setter> + <Style.Triggers> + <DataTrigger Binding="{Binding IsOutOfGamut}" Value="False"> + <Setter Property="Text" Value="Closest Alternatives"></Setter> + <Setter Property="Foreground" Value="{StaticResource TangoDarkForegroundBrush}"></Setter> + <Setter Property="Margin" Value="20 0 0 0"></Setter> + </DataTrigger> + </Style.Triggers> + </Style> + </TextBlock.Style> + </TextBlock> <touch:TouchIconButton Command="{Binding CloseCommand}" HorizontalAlignment="Right" Icon="Close" CornerRadius="50" RippleBrush="{StaticResource TangoRippleDarkBrush}" Foreground="{StaticResource TangoDarkForegroundBrush}" Padding="22" /> </Grid> <StackPanel Orientation="Horizontal" Grid.Row="1" VerticalAlignment="Center"> - <Image Source="../Images/JobView/error.png" Stretch="None" /> + <Image Source="../Images/JobView/error.png" Stretch="None" Visibility="{Binding IsOutOfGamut,Converter={StaticResource BooleanToVisibilityConverter}}" /> <Ellipse Width="60" Height="60" Margin="20 0 0 0" Fill="{Binding InvalidBrushStop.Brush}" /> <TextBlock VerticalAlignment="Center" Foreground="{StaticResource TangoGrayTextBrush}" Margin="20 0 0 0"> + <TextBlock.Style> + <Style TargetType="TextBlock"> + <Setter Property="Visibility" Value="Collapsed"></Setter> + <Style.Triggers> + <DataTrigger Binding="{Binding InvalidBrushStop.BrushColorSpace}" Value="RGB"> + <Setter Property="Visibility" Value="Visible"></Setter> + </DataTrigger> + </Style.Triggers> + </Style> + </TextBlock.Style> <Run Text="{Binding InvalidBrushStop.Red}"></Run><Run>,</Run> <Run Text="{Binding InvalidBrushStop.Green}"></Run><Run>,</Run> <Run Text="{Binding InvalidBrushStop.Blue}"></Run> </TextBlock> + <TextBlock VerticalAlignment="Center" Foreground="{StaticResource TangoGrayTextBrush}" Margin="20 0 0 0"> + <TextBlock.Style> + <Style TargetType="TextBlock"> + <Setter Property="Visibility" Value="Collapsed"></Setter> + <Style.Triggers> + <DataTrigger Binding="{Binding InvalidBrushStop.BrushColorSpace}" Value="LAB"> + <Setter Property="Visibility" Value="Visible"></Setter> + </DataTrigger> + </Style.Triggers> + </Style> + </TextBlock.Style> + <Run Text="{Binding InvalidBrushStop.L,StringFormat=0.00}"></Run><Run>,</Run> + <Run Text="{Binding InvalidBrushStop.A,StringFormat=0.00}"></Run><Run>,</Run> + <Run Text="{Binding InvalidBrushStop.B,StringFormat=0.00}"></Run> + </TextBlock> + <TextBlock VerticalAlignment="Center" Foreground="{StaticResource TangoGrayTextBrush}" Margin="20 0 0 0" Text="{Binding InvalidBrushStop.LiquidVolumesOrderedPigmentedString,Mode=OneWay}"> + <TextBlock.Style> + <Style TargetType="TextBlock"> + <Setter Property="Visibility" Value="Collapsed"></Setter> + <Style.Triggers> + <DataTrigger Binding="{Binding InvalidBrushStop.BrushColorSpace}" Value="Volume"> + <Setter Property="Visibility" Value="Visible"></Setter> + </DataTrigger> + </Style.Triggers> + </Style> + </TextBlock.Style> + </TextBlock> </StackPanel> <DockPanel Grid.Row="2" Margin="0 0 0 0"> - <TextBlock DockPanel.Dock="Top" Margin="40 0 0 0">Please select the best alternative</TextBlock> + <TextBlock DockPanel.Dock="Top" Margin="40 0 0 0"> + <TextBlock.Style> + <Style TargetType="TextBlock"> + <Setter Property="Text" Value="Please select the best alternative"></Setter> + <Style.Triggers> + <DataTrigger Binding="{Binding IsOutOfGamut}" Value="False"> + <Setter Property="Text" Value="Please select an alternative"></Setter> + </DataTrigger> + </Style.Triggers> + </Style> + </TextBlock.Style> + </TextBlock> <hive:HexList Width="330" Height="460" Margin="0 20 0 0" RowCount="6" ColumnCount="5" ItemsSource="{Binding Suggestions}" SelectedItem="{Binding SelectedSuggestion,Mode=TwoWay}"> <hive:HexList.ItemContainerStyle> diff --git a/Software/Visual_Studio/PPC/Modules/Tango.PPC.Jobs/Dialogs/AdvancedColorCorrectionViewVM.cs b/Software/Visual_Studio/PPC/Modules/Tango.PPC.Jobs/Dialogs/AdvancedColorCorrectionViewVM.cs index 887e62dd7..db8573322 100644 --- a/Software/Visual_Studio/PPC/Modules/Tango.PPC.Jobs/Dialogs/AdvancedColorCorrectionViewVM.cs +++ b/Software/Visual_Studio/PPC/Modules/Tango.PPC.Jobs/Dialogs/AdvancedColorCorrectionViewVM.cs @@ -14,6 +14,6 @@ namespace Tango.PPC.Jobs.Dialogs /// <seealso cref="Tango.PPC.Jobs.Dialogs.BasicColorCorrectionViewVM" /> public class AdvancedColorCorrectionViewVM : BasicColorCorrectionViewVM { - + public bool IsOutOfGamut { get; set; } } } diff --git a/Software/Visual_Studio/PPC/Modules/Tango.PPC.Jobs/Dialogs/BasicColorCorrectionView.xaml b/Software/Visual_Studio/PPC/Modules/Tango.PPC.Jobs/Dialogs/BasicColorCorrectionView.xaml index 4c100c2fc..bd31b88ce 100644 --- a/Software/Visual_Studio/PPC/Modules/Tango.PPC.Jobs/Dialogs/BasicColorCorrectionView.xaml +++ b/Software/Visual_Studio/PPC/Modules/Tango.PPC.Jobs/Dialogs/BasicColorCorrectionView.xaml @@ -59,7 +59,7 @@ </StackPanel> <DockPanel Grid.Row="2" Margin="0 0 0 0"> - <TextBlock DockPanel.Dock="Top" Margin="40 0 0 0">Please select an alternative</TextBlock> + <TextBlock DockPanel.Dock="Top" Margin="40 0 0 0">Please use the closest alternative</TextBlock> <touch:TouchListBox SelectionMode="Single" Style="{StaticResource TangoNoRippleListBox}" ItemsSource="{Binding Suggestions}" SelectedItem="{Binding SelectedSuggestion,Mode=TwoWay}" Margin="0 20 0 0"> <touch:TouchListBox.ItemContainerStyle> @@ -81,7 +81,7 @@ </Setter> <Setter Property="Effect"> <Setter.Value> - <DropShadowEffect Color="{StaticResource TangoDarkForegroundColor}" ShadowDepth="0" BlurRadius="10" Opacity="0" /> + <DropShadowEffect Color="{StaticResource TangoGrayColor}" ShadowDepth="0" BlurRadius="10" Opacity="0" /> </Setter.Value> </Setter> <Style.Triggers> @@ -147,7 +147,10 @@ <DockPanel Grid.Row="3" Margin="40 10 20 0" LastChildFill="False"> <touch:TouchButton Command="{Binding MoreOptionsCommand}" VerticalAlignment="Top" Style="{StaticResource TangoLinkButton}" DockPanel.Dock="Left" Foreground="{StaticResource TangoPrimaryAccentBrush}"> - More Options + <StackPanel Orientation="Horizontal"> + <Image Source="../Images/color-picker.png" Stretch="None" VerticalAlignment="Center" /> + <TextBlock Margin="5 0 0 0" VerticalAlignment="Center">More Options</TextBlock> + </StackPanel> </touch:TouchButton> <touch:TouchButton Command="{Binding OKCommand}" CornerRadius="25" Style="{StaticResource TangoHollowButton}" DockPanel.Dock="Right" Width="170" Height="50" VerticalAlignment="Bottom"> diff --git a/Software/Visual_Studio/PPC/Modules/Tango.PPC.Jobs/Dialogs/CatalogSelectionView.xaml b/Software/Visual_Studio/PPC/Modules/Tango.PPC.Jobs/Dialogs/CatalogSelectionView.xaml index ded395e08..128a93548 100644 --- a/Software/Visual_Studio/PPC/Modules/Tango.PPC.Jobs/Dialogs/CatalogSelectionView.xaml +++ b/Software/Visual_Studio/PPC/Modules/Tango.PPC.Jobs/Dialogs/CatalogSelectionView.xaml @@ -56,7 +56,7 @@ <DataTemplate> <StackPanel Orientation="Vertical" HorizontalAlignment="Center"> <Image Stretch="Fill" Width="32" Height="32" RenderOptions.BitmapScalingMode="Fant" Source="../Images/NewJob/twine.png"></Image> - <TextBlock HorizontalAlignment="Center" Margin="0 10 0 0" Text="{Binding Name}"></TextBlock> + <TextBlock HorizontalAlignment="Center" Margin="0 10 0 0" TextAlignment="Center" Text="{Binding Name}" TextWrapping="Wrap" TextTrimming="CharacterEllipsis"></TextBlock> </StackPanel> </DataTemplate> </touch:TouchStaticListBox.ItemTemplate> diff --git a/Software/Visual_Studio/PPC/Modules/Tango.PPC.Jobs/Dialogs/ImportJobView.xaml b/Software/Visual_Studio/PPC/Modules/Tango.PPC.Jobs/Dialogs/ImportJobView.xaml index ac27cc00d..da51bba27 100644 --- a/Software/Visual_Studio/PPC/Modules/Tango.PPC.Jobs/Dialogs/ImportJobView.xaml +++ b/Software/Visual_Studio/PPC/Modules/Tango.PPC.Jobs/Dialogs/ImportJobView.xaml @@ -18,7 +18,7 @@ <TextBlock HorizontalAlignment="Center" Margin="0 20 0 0" FontSize="{StaticResource TangoHeaderFontSize}">IMPORT JOB</TextBlock> <TextBlock Margin="20 10" HorizontalAlignment="Center" TextWrapping="Wrap" TextAlignment="Center">A job file has been selected from the storage device. press 'IMPORT' to add the job to your job list.</TextBlock> - <touch:TouchCheckBox IsChecked="{Binding ImportAndEdit}" Margin="40 50 0 0">Edit this job after import</touch:TouchCheckBox> + <touch:TouchCheckBox IsChecked="{Binding ImportAndEdit}" Margin="40 50 0 0" Visibility="Collapsed">Edit this job after import</touch:TouchCheckBox> </StackPanel> </DockPanel> </Grid> diff --git a/Software/Visual_Studio/PPC/Modules/Tango.PPC.Jobs/Images/JobView/transparent.jpg b/Software/Visual_Studio/PPC/Modules/Tango.PPC.Jobs/Images/JobView/transparent.jpg Binary files differnew file mode 100644 index 000000000..cf1d94d12 --- /dev/null +++ b/Software/Visual_Studio/PPC/Modules/Tango.PPC.Jobs/Images/JobView/transparent.jpg diff --git a/Software/Visual_Studio/PPC/Modules/Tango.PPC.Jobs/Images/JobView/transparent_small.jpg b/Software/Visual_Studio/PPC/Modules/Tango.PPC.Jobs/Images/JobView/transparent_small.jpg Binary files differnew file mode 100644 index 000000000..c682a4c7e --- /dev/null +++ b/Software/Visual_Studio/PPC/Modules/Tango.PPC.Jobs/Images/JobView/transparent_small.jpg diff --git a/Software/Visual_Studio/PPC/Modules/Tango.PPC.Jobs/Images/color-picker.png b/Software/Visual_Studio/PPC/Modules/Tango.PPC.Jobs/Images/color-picker.png Binary files differnew file mode 100644 index 000000000..d8d6f8470 --- /dev/null +++ b/Software/Visual_Studio/PPC/Modules/Tango.PPC.Jobs/Images/color-picker.png diff --git a/Software/Visual_Studio/PPC/Modules/Tango.PPC.Jobs/Images/sync.png b/Software/Visual_Studio/PPC/Modules/Tango.PPC.Jobs/Images/sync.png Binary files differnew file mode 100644 index 000000000..46059c5c0 --- /dev/null +++ b/Software/Visual_Studio/PPC/Modules/Tango.PPC.Jobs/Images/sync.png diff --git a/Software/Visual_Studio/PPC/Modules/Tango.PPC.Jobs/Images/sync_job.png b/Software/Visual_Studio/PPC/Modules/Tango.PPC.Jobs/Images/sync_job.png Binary files differnew file mode 100644 index 000000000..4e46ee447 --- /dev/null +++ b/Software/Visual_Studio/PPC/Modules/Tango.PPC.Jobs/Images/sync_job.png diff --git a/Software/Visual_Studio/PPC/Modules/Tango.PPC.Jobs/NotificationItems/NewSynchronizardJobsNotificationItem.cs b/Software/Visual_Studio/PPC/Modules/Tango.PPC.Jobs/NotificationItems/NewSynchronizardJobsNotificationItem.cs new file mode 100644 index 000000000..4e3137e1c --- /dev/null +++ b/Software/Visual_Studio/PPC/Modules/Tango.PPC.Jobs/NotificationItems/NewSynchronizardJobsNotificationItem.cs @@ -0,0 +1,32 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using Tango.PPC.Common.Notifications; + +namespace Tango.PPC.Jobs.NotificationItems +{ + /// <summary> + /// Represents a simple text message notification item which can be inserted into the application notifications panel. + /// </summary> + /// <seealso cref="Tango.PPC.Common.Notifications.NotificationItem" /> + public class NewSynchronizardJobsNotificationItem : NotificationItem + { + /// <summary> + /// Initializes a new instance of the <see cref="UpdateAvailableNotificationItem"/> class. + /// </summary> + public NewSynchronizardJobsNotificationItem() + { + CanClose = true; + } + + /// <summary> + /// Gets or sets the view type. + /// </summary> + public override Type ViewType + { + get { return typeof(NewSynchronizardJobsNotificationItemView); } + } + } +} diff --git a/Software/Visual_Studio/PPC/Modules/Tango.PPC.Jobs/NotificationItems/NewSynchronizardJobsNotificationItemView.xaml b/Software/Visual_Studio/PPC/Modules/Tango.PPC.Jobs/NotificationItems/NewSynchronizardJobsNotificationItemView.xaml new file mode 100644 index 000000000..5a57e3db7 --- /dev/null +++ b/Software/Visual_Studio/PPC/Modules/Tango.PPC.Jobs/NotificationItems/NewSynchronizardJobsNotificationItemView.xaml @@ -0,0 +1,30 @@ +<UserControl x:Class="Tango.PPC.Jobs.NotificationItems.NewSynchronizardJobsNotificationItemView" + 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:touch="clr-namespace:Tango.Touch.Controls;assembly=Tango.Touch" + xmlns:local="clr-namespace:Tango.PPC.Jobs.NotificationItems" + xmlns:common="clr-namespace:Tango.PPC.Common.Converters" + mc:Ignorable="d" + x:Name="MessageNotificationItemControl" + d:DesignHeight="60" d:DesignWidth="800" d:DataContext="{d:DesignInstance Type=local:NewSynchronizardJobsNotificationItem, IsDesignTimeCreatable=False}" MinHeight="90" Height="90" MaxHeight="150" Background="White"> + + <UserControl.Resources> + <BitmapImage x:Key="icon" UriSource="../Images/sync_job.png" /> + </UserControl.Resources> + + <Grid> + <Border BorderThickness="0 0 0 2" BorderBrush="{StaticResource TangoPrimaryAccentBrush}" Padding="15"> + <DockPanel> + <Image Source="{StaticResource icon}" MaxHeight="50" /> + + <Grid> + <TextBlock Margin="20 0 0 0" VerticalAlignment="Center"> + New job definitions were synchronized with your machine. Tap to refresh your job list. + </TextBlock> + </Grid> + </DockPanel> + </Border> + </Grid> +</UserControl> diff --git a/Software/Visual_Studio/PPC/Modules/Tango.PPC.Jobs/NotificationItems/NewSynchronizardJobsNotificationItemView.xaml.cs b/Software/Visual_Studio/PPC/Modules/Tango.PPC.Jobs/NotificationItems/NewSynchronizardJobsNotificationItemView.xaml.cs new file mode 100644 index 000000000..33db09386 --- /dev/null +++ b/Software/Visual_Studio/PPC/Modules/Tango.PPC.Jobs/NotificationItems/NewSynchronizardJobsNotificationItemView.xaml.cs @@ -0,0 +1,30 @@ +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.PPC.Jobs.NotificationItems +{ + /// <summary> + /// Represents the <see cref="UpdateAvailableNotificationItemView"/> view. + /// </summary> + /// <seealso cref="System.Windows.Controls.UserControl" /> + /// <seealso cref="System.Windows.Markup.IComponentConnector" /> + public partial class NewSynchronizardJobsNotificationItemView : UserControl + { + public NewSynchronizardJobsNotificationItemView() + { + InitializeComponent(); + } + } +} diff --git a/Software/Visual_Studio/PPC/Modules/Tango.PPC.Jobs/Tango.PPC.Jobs.csproj b/Software/Visual_Studio/PPC/Modules/Tango.PPC.Jobs/Tango.PPC.Jobs.csproj index aedf09ce7..33b9de808 100644 --- a/Software/Visual_Studio/PPC/Modules/Tango.PPC.Jobs/Tango.PPC.Jobs.csproj +++ b/Software/Visual_Studio/PPC/Modules/Tango.PPC.Jobs/Tango.PPC.Jobs.csproj @@ -124,6 +124,10 @@ <SubType>Designer</SubType> <Generator>MSBuild:Compile</Generator> </Page> + <Page Include="NotificationItems\NewSynchronizardJobsNotificationItemView.xaml"> + <Generator>MSBuild:Compile</Generator> + <SubType>Designer</SubType> + </Page> <Page Include="Resources\Styles.xaml"> <SubType>Designer</SubType> <Generator>MSBuild:Compile</Generator> @@ -163,6 +167,7 @@ </Compile> <Compile Include="AppButtons\StartPrintingButton.cs" /> <Compile Include="AppButtons\StopPrintingButton.cs" /> + <Compile Include="Controls\JobOutlineControl.cs" /> <Compile Include="Controls\RunningJobViewer.xaml.cs"> <DependentUpon>RunningJobViewer.xaml</DependentUpon> </Compile> @@ -227,6 +232,10 @@ <Compile Include="NavigationObjects\JobNavigationObject.cs" /> <Compile Include="NavigationObjects\JobSummeryNavigationObject.cs" /> <Compile Include="NavigationObjects\TwineCatalogNavigationObject.cs" /> + <Compile Include="NotificationItems\NewSynchronizardJobsNotificationItem.cs" /> + <Compile Include="NotificationItems\NewSynchronizardJobsNotificationItemView.xaml.cs"> + <DependentUpon>NewSynchronizardJobsNotificationItemView.xaml</DependentUpon> + </Compile> <Compile Include="Properties\AssemblyInfo.cs"> <SubType>Code</SubType> </Compile> @@ -482,10 +491,25 @@ <Resource Include="Images\small-cards-view - blue.png" /> <Resource Include="Images\small-cards-view.png" /> </ItemGroup> + <ItemGroup> + <Resource Include="Images\color-picker.png" /> + </ItemGroup> + <ItemGroup> + <Resource Include="Images\sync.png" /> + </ItemGroup> + <ItemGroup> + <Resource Include="Images\JobView\transparent.jpg" /> + </ItemGroup> + <ItemGroup> + <Resource Include="Images\JobView\transparent_small.jpg" /> + </ItemGroup> + <ItemGroup> + <Resource Include="Images\sync_job.png" /> + </ItemGroup> <Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" /> <ProjectExtensions> <VisualStudio> - <UserProperties BuildVersion_AssemblyInfoFilename="Properties\AssemblyInfo.cs" BuildVersion_UpdateAssemblyVersion="True" BuildVersion_BuildVersioningStyle="None.None.Increment.TimeStamp" BuildVersion_UseGlobalSettings="False" BuildVersion_StartDate="2000/1/1" /> + <UserProperties BuildVersion_StartDate="2000/1/1" BuildVersion_UseGlobalSettings="False" BuildVersion_BuildVersioningStyle="None.None.Increment.TimeStamp" BuildVersion_UpdateAssemblyVersion="True" BuildVersion_AssemblyInfoFilename="Properties\AssemblyInfo.cs" /> </VisualStudio> </ProjectExtensions> </Project>
\ No newline at end of file diff --git a/Software/Visual_Studio/PPC/Modules/Tango.PPC.Jobs/ViewModels/JobProgressViewVM.cs b/Software/Visual_Studio/PPC/Modules/Tango.PPC.Jobs/ViewModels/JobProgressViewVM.cs index 103a10b28..8d5bd284d 100644 --- a/Software/Visual_Studio/PPC/Modules/Tango.PPC.Jobs/ViewModels/JobProgressViewVM.cs +++ b/Software/Visual_Studio/PPC/Modules/Tango.PPC.Jobs/ViewModels/JobProgressViewVM.cs @@ -6,8 +6,10 @@ using System.Threading.Tasks; using Tango.BL.Entities; using Tango.Core.Commands; using Tango.Integration.Operation; +using Tango.PMR.Printing; using Tango.PPC.Common; using Tango.PPC.Common.Navigation; +using Tango.PPC.Common.Notifications; using Tango.PPC.Jobs.AppBarItems; using Tango.PPC.Jobs.AppButtons; using Tango.PPC.Jobs.Dialogs; @@ -47,6 +49,26 @@ namespace Tango.PPC.Jobs.ViewModels set { _runningJobStatus = value; RaisePropertyChangedAuto(); } } + private bool _isDisplayJobOutline; + /// <summary> + /// Gets or sets a value indicating whether to display the job outline. + /// </summary> + public bool IsDisplayJobOutline + { + get { return _isDisplayJobOutline; } + set { _isDisplayJobOutline = value; RaisePropertyChangedAuto(); } + } + + private JobTicket _jobOutlineTicket; + /// <summary> + /// Gets or sets the job outline ticket. + /// </summary> + public JobTicket JobOutlineTicket + { + get { return _jobOutlineTicket; } + set { _jobOutlineTicket = value; RaisePropertyChangedAuto(); } + } + #endregion #region Commands @@ -59,6 +81,16 @@ namespace Tango.PPC.Jobs.ViewModels /// </value> public RelayCommand GoToJobCommand { get; set; } + /// <summary> + /// Gets or sets the display job outline command. + /// </summary> + public RelayCommand DisplayJobOutlineCommand { get; set; } + + /// <summary> + /// Gets or sets the hide job outline command. + /// </summary> + public RelayCommand HideJobOutlineCommand { get; set; } + #endregion public JobProgressViewVM() @@ -67,14 +99,21 @@ namespace Tango.PPC.Jobs.ViewModels _stop_job_btn.Pressed += _stop_job_btn_Pressed; GoToJobCommand = new RelayCommand(GoToJob); + DisplayJobOutlineCommand = new RelayCommand(DisplayJobOutline); + HideJobOutlineCommand = new RelayCommand(HideJobOutline); } - private void _stop_job_btn_Pressed() + #region Private Methods + + private void HideJobOutline() { - if (_handler != null) - { - _handler.Cancel(); - } + IsDisplayJobOutline = false; + } + + private void DisplayJobOutline() + { + JobOutlineTicket = _handler.JobTicket; + IsDisplayJobOutline = true; } private void GoToJob() @@ -83,6 +122,8 @@ namespace Tango.PPC.Jobs.ViewModels NavigationManager.ClearHistoryExcept<JobsView>(); } + #endregion + #region Override Methods /// <summary> @@ -94,41 +135,32 @@ namespace Tango.PPC.Jobs.ViewModels } /// <summary> - /// Called when the navigation system has navigated from this VM view. - /// </summary> - public override void OnNavigatedFrom() - { - base.OnNavigatedFrom(); - - if (MachineProvider.MachineOperator.IsPrinting && _handler != null && !_handler.IsCanceled) - { - NotificationProvider.PushAppBarItem<JobProgressAppBarItem>().Pressed += (_, __) => - { - NotificationProvider.CurrentAppBarItem.Close(); - NavigationManager.NavigateTo<JobsModule>(nameof(JobProgressView)); - }; - } - } - - /// <summary> /// Called when the navigation system has navigated to this VM view. /// </summary> public override void OnNavigatedTo() { base.OnNavigatedTo(); - if (NotificationProvider.HasAppBarItem && NotificationProvider.CurrentAppBarItem is JobProgressAppBarItem) + IsDisplayJobOutline = false; + + if (_handler != null && !_handler.Status.IsFailed) { - NotificationProvider.CurrentAppBarItem.Close(); + _stop_job_btn.Push(); } - - _stop_job_btn.Push(); } #endregion #region Event Handlers + private void _stop_job_btn_Pressed() + { + if (_handler != null) + { + _handler.Cancel(); + } + } + /// <summary> /// Handles the PrintingStarted event of the MachineOperator. /// </summary> @@ -141,8 +173,10 @@ namespace Tango.PPC.Jobs.ViewModels e.JobHandler.StatusChanged += JobHandler_StatusChanged; e.JobHandler.SpoolChangeRequired += JobHandler_SpoolChangeRequired; e.JobHandler.Stopped += JobHandler_Stopped; + e.JobHandler.CanCancelChanged += JobHandler_CanCancelChanged; _stop_job_btn.Push(); + _stop_job_btn.IsEnabled = true; } /// <summary> @@ -172,12 +206,18 @@ namespace Tango.PPC.Jobs.ViewModels /// <param name="e">The <see cref="EventArgs"/> instance containing the event data.</param> private void JobHandler_Stopped(object sender, EventArgs e) { - if (NotificationProvider.HasAppBarItem && NotificationProvider.CurrentAppBarItem is JobProgressAppBarItem) + if (_stop_job_btn != null) { - NotificationProvider.CurrentAppBarItem.Close(); + _stop_job_btn.Pop(); } - _stop_job_btn.Pop(); + if (_handler != null) + { + _handler.StatusChanged -= JobHandler_StatusChanged; + _handler.SpoolChangeRequired -= JobHandler_SpoolChangeRequired; + _handler.Stopped -= JobHandler_Stopped; + _handler.CanCancelChanged -= JobHandler_CanCancelChanged; + } } /// <summary> @@ -193,6 +233,16 @@ namespace Tango.PPC.Jobs.ViewModels }); } + /// <summary> + /// Handles the CanCancelChanged event of the JobHandler control. + /// </summary> + /// <param name="sender">The source of the event.</param> + /// <param name="e">The <see cref="EventArgs"/> instance containing the event data.</param> + private void JobHandler_CanCancelChanged(object sender, EventArgs e) + { + _stop_job_btn.IsEnabled = _handler.CanCancel; + } + #endregion } } diff --git a/Software/Visual_Studio/PPC/Modules/Tango.PPC.Jobs/ViewModels/JobSummeryViewVM.cs b/Software/Visual_Studio/PPC/Modules/Tango.PPC.Jobs/ViewModels/JobSummeryViewVM.cs index bff6beff5..a2acf5893 100644 --- a/Software/Visual_Studio/PPC/Modules/Tango.PPC.Jobs/ViewModels/JobSummeryViewVM.cs +++ b/Software/Visual_Studio/PPC/Modules/Tango.PPC.Jobs/ViewModels/JobSummeryViewVM.cs @@ -26,6 +26,7 @@ namespace Tango.PPC.Jobs.ViewModels { private ObservablesContext _context; private bool _canStartJob; + private bool _startingJob; private bool _isPreparingJob; /// <summary> @@ -59,7 +60,6 @@ namespace Tango.PPC.Jobs.ViewModels set { _estimatedDuration = value; RaisePropertyChangedAuto(); } } - /// <summary> /// Gets or sets the dye command. /// </summary> @@ -96,12 +96,20 @@ namespace Tango.PPC.Jobs.ViewModels /// </summary> private async void StartJob() { + if (_startingJob) return; + + _startingJob = true; + _canStartJob = false; + InvalidateRelayCommands(); + NavigationManager.IsBackEnabled = false; + try { LogManager.Log("Start job command pressed. Starting job and navigating to job progress view..."); await PrintingManager.Print(Job, _context); await NavigationManager.NavigateTo<JobsModule>(false, nameof(JobProgressView)); + _startingJob = false; } catch (InsufficientLiquidQuantityException) { @@ -112,6 +120,13 @@ namespace Tango.PPC.Jobs.ViewModels LogManager.Log(ex, "Could not start the current job."); await NotificationProvider.ShowError($"{ex.Message}"); } + finally + { + _startingJob = false; + _canStartJob = true; + NavigationManager.IsBackEnabled = true; + InvalidateRelayCommands(); + } } /// <summary> @@ -130,16 +145,6 @@ namespace Tango.PPC.Jobs.ViewModels _context = obj.Context; Job = obj.Job; - if (Job.ColorSpace.Space == BL.Enumerations.ColorSpaces.Catalog) - { - if (_context.ColorCatalogs.SingleOrDefault(x => x.Guid == Job.ColorCatalogGuid) == null) - { - await NotificationProvider.ShowError("The selected color catalog for this job could not be found.\nCannot load job."); - await NavigationManager.NavigateBack(); - return; - } - } - IsPreparingJob = true; Job = await new JobBuilder(_context).Set(Job.Guid) @@ -150,7 +155,15 @@ namespace Tango.PPC.Jobs.ViewModels .WithBrushStops() .BuildAsync(); - await Task.Delay(2000); + if (Job.ColorSpace.Space == BL.Enumerations.ColorSpaces.Catalog) + { + if (_context.ColorCatalogs.SingleOrDefault(x => x.Guid == Job.ColorCatalogGuid) == null) + { + await NotificationProvider.ShowError("The selected color catalog for this job could not be found.\nCannot load job."); + await NavigationManager.NavigateBack(); + return; + } + } await Task.Factory.StartNew(() => { diff --git a/Software/Visual_Studio/PPC/Modules/Tango.PPC.Jobs/ViewModels/JobViewVM.cs b/Software/Visual_Studio/PPC/Modules/Tango.PPC.Jobs/ViewModels/JobViewVM.cs index 4e1e58dba..5e90d3b5b 100644 --- a/Software/Visual_Studio/PPC/Modules/Tango.PPC.Jobs/ViewModels/JobViewVM.cs +++ b/Software/Visual_Studio/PPC/Modules/Tango.PPC.Jobs/ViewModels/JobViewVM.cs @@ -56,6 +56,7 @@ namespace Tango.PPC.Jobs.ViewModels private ActionTimer _volumeConversionTimer; private IColorConverter _converter; private string _current_job_string; + private bool startingJob = false; #region Properties @@ -412,7 +413,7 @@ namespace Tango.PPC.Jobs.ViewModels RepeatSampleDyeCommand = new RelayCommand(RepeatSampleDye); AnotherSampleCommand = new RelayCommand(DyeAnotherSample); InvokeFineTuningPaletteCommand = new RelayCommand<FineTuneItem>(InvokeFineTuningPalette); - ResetFineTuningCommand = new RelayCommand(ResetFineTuning); + ResetFineTuningCommand = new RelayCommand(() => ResetFineTuning(true)); StartFineTuningCommand = new RelayCommand(StartFineTuning, () => FineTuneItems.Any(x => x.IsSelected) && CanStartJob()); RepeatFineTuningCommand = new RelayCommand(RepeatFineTuning); ApproveFineTuningCommand = new RelayCommand(ApproveFineTuning); @@ -468,7 +469,7 @@ namespace Tango.PPC.Jobs.ViewModels Job.ValidateOnPropertyChanged = true; LogManager.Log("Loading RMLS..."); - Rmls = (await new RmlsCollectionBuilder(_db).SetAll().WithActiveParametersGroup().WithCAT(Job.MachineGuid).WithCCT().WithLiquidFactors().BuildAsync()).ToList(); + Rmls = (await new RmlsCollectionBuilder(_db).SetAll().WithActiveParametersGroup().WithCAT(Job.MachineGuid).WithCCT().WithLiquidFactors().WithSpools().ForHeadType(MachineProvider.Machine.MachineHeadType).ForSite(MachineProvider.Machine.SiteGuid).BuildAsync()).ToList(); LogManager.Log("Loading Color Spaces..."); ColorSpaces = await _db.ColorSpaces.ToListAsync(); LogManager.Log("Loading Spool Types..."); @@ -478,7 +479,7 @@ namespace Tango.PPC.Jobs.ViewModels if (Job.ColorSpace.Space == BL.Enumerations.ColorSpaces.Catalog) { - SelectedCatalog = await new ColorCatalogBuilder(_db).Set(Job.ColorCatalogGuid).WithGroups().WithItems().BuildAsync(); + SelectedCatalog = await new CatalogBuilder(_db).Set(Job.ColorCatalogGuid).WithGroups().WithItems().BuildAsync(); if (SelectedCatalog != null) { @@ -545,18 +546,15 @@ namespace Tango.PPC.Jobs.ViewModels } catch (Exception ex) { - LogManager.Log(ex, $"Error loading job '{_job_to_load.Name}'"); + IsFree = true; + LogManager.Log(ex, $"Error loading job '{(_job_to_load != null ? _job_to_load.Name : "null")}'"); await NotificationProvider.ShowError("An error occurred while trying to load the selected job."); _can_navigate_back = true; await NavigationManager.NavigateBack(); } finally { - InvokeUI(() => - { - IsFree = true; - //NotificationProvider.ReleaseGlobalBusyMessage(); - }); + IsFree = true; } } @@ -593,7 +591,9 @@ namespace Tango.PPC.Jobs.ViewModels } Job.LastUpdated = DateTime.UtcNow; + Job.IsSynchronized = false; Job.JobStatus = BL.Enumerations.JobStatuses.Draft; + Job.MarkModified(_db); await _db.SaveChangesAsync(); _current_job_string = Job.ToJobFileWhenLoaded().ToString(); @@ -645,11 +645,16 @@ namespace Tango.PPC.Jobs.ViewModels /// </summary> private async void StartJob() { + if (startingJob) return; + try { + Debug.WriteLine("Job Starting..."); + startingJob = true; LogManager.Log("Start job command pressed. Starting job and navigating to job progress view..."); - await PrintingManager.Print(Job, _db); + var handler = await PrintingManager.Print(Job, _db); await NavigationManager.NavigateTo<JobsModule>(nameof(JobProgressView)); + startingJob = false; } catch (InsufficientLiquidQuantityException) { @@ -660,6 +665,10 @@ namespace Tango.PPC.Jobs.ViewModels LogManager.Log(ex, "Could not start the current job."); await NotificationProvider.ShowError($"{ex.Message}."); } + finally + { + startingJob = false; + } } /// <summary> @@ -668,8 +677,7 @@ namespace Tango.PPC.Jobs.ViewModels private bool CanStartJob() { return - Job != null && Job.Validate(_db) && - !Job.Segments.SelectMany(x => x.BrushStops).ToList().Exists(x => x.IsOutOfGamut); + Job != null && Job.Validate(_db) && !Job.Segments.SelectMany(x => x.BrushStops).Where(x => !x.IsTransparent && !x.IsWhite).ToList().Exists(x => x.IsOutOfGamut || x.IsLiquidVolumesOutOfRange); } #endregion @@ -709,7 +717,7 @@ namespace Tango.PPC.Jobs.ViewModels try { LogManager.Log("Adding new solid segment..."); - var s = Job.AddSolidSegment(MachineProvider.Machine.DefaultSegmentLength > 0 ? MachineProvider.Machine.DefaultSegmentLength : 10); + var s = Job.AddSolidSegment(Settings.DefaultSegmentLength > 0 ? Settings.DefaultSegmentLength : 10); SetSegmentLiquidVolumesIfVolume(s); return s; } @@ -729,7 +737,7 @@ namespace Tango.PPC.Jobs.ViewModels try { LogManager.Log("Adding new gradient segment..."); - var s = Job.AddGradientSegment(MachineProvider.Machine.DefaultSegmentLength > 0 ? MachineProvider.Machine.DefaultSegmentLength : 10); + var s = Job.AddGradientSegment(Settings.DefaultSegmentLength > 0 ? Settings.DefaultSegmentLength : 10); SetSegmentLiquidVolumesIfVolume(s); return s; } @@ -759,14 +767,7 @@ namespace Tango.PPC.Jobs.ViewModels draggedSegment.SegmentIndex = droppedSegment.SegmentIndex + 1; } - int index = 1; - - foreach (var segment in Job.Segments.OrderBy(x => x.SegmentIndex)) - { - segment.SegmentIndex = index++; - } - - SegmentsCollectionView.Refresh(); + ArrangeSegmentsIndices(); } /// <summary> @@ -829,10 +830,14 @@ namespace Tango.PPC.Jobs.ViewModels private void ArrangeSegmentsIndices() { - for (int i = 0; i < Job.Segments.Count; i++) + int index = 1; + + foreach (var segment in Job.Segments.OrderBy(x => x.SegmentIndex)) { - Job.Segments[i].SegmentIndex = i + 1; + segment.SegmentIndex = index++; } + + SegmentsCollectionView.Refresh(); } #endregion @@ -880,23 +885,55 @@ namespace Tango.PPC.Jobs.ViewModels LogManager.Log($"Invoking triplet color adjustment dialog for brush stop {brushStop.StopIndex} at segment {brushStop.Segment.SegmentIndex}."); LogManager.Log("Retrieving color conversion suggestions for brush stop..."); - var conversionOutput = _converter.Convert(brushStop, true); + PMR.ColorLab.ConversionOutput conversionOutput = null; + + if (brushStop.IsOutOfGamut) + { + conversionOutput = _converter.Convert(brushStop, false); + } BasicColorCorrectionViewVM vm = null; + List<ColorConversionSuggestion> suggestions = null; - vm = await NotificationProvider.ShowDialog<BasicColorCorrectionViewVM>(new BasicColorCorrectionViewVM() + if (brushStop.IsOutOfGamut) { - InvalidBrushStop = brushStop, - Suggestions = conversionOutput.CreateTrippletSuggestions(), - }); + vm = await NotificationProvider.ShowDialog<BasicColorCorrectionViewVM>(new BasicColorCorrectionViewVM() + { + InvalidBrushStop = brushStop, + Suggestions = new List<ColorConversionSuggestion>() { new ColorConversionSuggestion(conversionOutput.SingleCoordinates, 0, 0) }, + }); + } - if (vm.Result == BasicColorCorrectionViewVM.ColorCorrectionDialogResult.MoreOptions) + if (vm == null || vm.Result == BasicColorCorrectionViewVM.ColorCorrectionDialogResult.MoreOptions) { + NotificationProvider.SetGlobalBusyMessage("Generating color hive..."); + + await Task.Factory.StartNew(() => + { + conversionOutput = _converter.Convert(brushStop, true); + + suggestions = conversionOutput.CreateHiveSuggestions(); + + if (vm == null) + { + var center = suggestions.GetCenterSuggestion(); + center.Coordinates.Red = brushStop.Red; + center.Coordinates.Green = brushStop.Green; + center.Coordinates.Blue = brushStop.Blue; + + center.Coordinates.L = brushStop.L; + center.Coordinates.A = brushStop.A; + center.Coordinates.B = brushStop.B; + } + }); + + NotificationProvider.ReleaseGlobalBusyMessage(); LogManager.Log("Invoking hive color conversion dialog..."); vm = await NotificationProvider.ShowDialog<AdvancedColorCorrectionViewVM>(new AdvancedColorCorrectionViewVM() { InvalidBrushStop = brushStop, - Suggestions = conversionOutput.CreateHiveSuggestions(), + Suggestions = suggestions, + IsOutOfGamut = brushStop.IsOutOfGamut, }); } @@ -916,6 +953,13 @@ namespace Tango.PPC.Jobs.ViewModels brushStop.A = vm.SelectedSuggestion.Coordinates.A; brushStop.B = vm.SelectedSuggestion.Coordinates.B; } + else if (brushStop.BrushColorSpace == BL.Enumerations.ColorSpaces.Volume) + { + if (vm.SelectedSuggestion != suggestions.GetCenterSuggestion()) + { + vm.SelectedSuggestion.ApplyOnBrushStop(brushStop); + } + } brushStop.Corrected = true; brushStop.IsOutOfGamut = false; @@ -927,6 +971,11 @@ namespace Tango.PPC.Jobs.ViewModels LogManager.Log(ex, "Error while invoking color adjustment dialog."); await NotificationProvider.ShowError("An error occurred while trying to convert the selected color."); } + finally + { + NotificationProvider.ReleaseGlobalBusyMessage(); + DyeCommand.RaiseCanExecuteChanged(); + } } /// <summary> @@ -936,7 +985,7 @@ namespace Tango.PPC.Jobs.ViewModels [HandleProcessCorruptedStateExceptions] public void OnBrushStopFieldValueChanged(BrushStop stop) { - if (stop != null) + if (stop != null && stop.ColorSpace != null) { stop.Corrected = false; stop.OutOfGamutChecked = false; @@ -954,6 +1003,11 @@ namespace Tango.PPC.Jobs.ViewModels stop.Blue = output.SingleCoordinates.Blue; stop.Corrected = true; stop.IsOutOfGamut = false; + + InvokeUI(() => + { + DyeCommand.RaiseCanExecuteChanged(); + }); } catch (Exception ex) { @@ -1074,7 +1128,7 @@ namespace Tango.PPC.Jobs.ViewModels /// <summary> /// Synchronizes the fine tune items to brush stops. /// </summary> - private void SyncFineTuneItemsToBrushStops() + private async void SyncFineTuneItemsToBrushStops(bool displayBusy = false) { try { @@ -1086,18 +1140,27 @@ namespace Tango.PPC.Jobs.ViewModels } else { + if (displayBusy) + { + NotificationProvider.SetGlobalBusyMessage("Generating suggestions..."); + } + FineTuneItems.Clear(); - foreach (var stop in Job.Segments.SelectMany(x => x.BrushStops).Where(x => x.ColorSpace.Space == BL.Enumerations.ColorSpaces.RGB || x.ColorSpace.Space == BL.Enumerations.ColorSpaces.LAB).DistinctBy(x => x.Color)) + foreach (var stop in Job.Segments.SelectMany(x => x.BrushStops).Where(x => !x.IsTransparent).Where(x => x.ColorSpace.Space == BL.Enumerations.ColorSpaces.RGB || x.ColorSpace.Space == BL.Enumerations.ColorSpaces.LAB).DistinctBy(x => x.Color)) { - FineTuneItem item = new FineTuneItem(_converter.Convert(stop, true)); + var conversionoutput = await _converter.ConvertAsync(stop, true); + FineTuneItem item = new FineTuneItem(conversionoutput); + item.BrushStop = stop; item.BrushStops = Job.Segments.SelectMany(x => x.BrushStops).Where(x => x.Color == stop.Color).ToList(); - item.SelectedSuggestion = item.Suggestions[item.Suggestions.Count / 2]; + item.SelectedSuggestion = item.Suggestions.GetCenterSuggestion(); item.SelectedChanged += () => StartFineTuningCommand.RaiseCanExecuteChanged(); FineTuneItems.Add(item); } _jobs_fine_tune_items[Job.Guid] = FineTuneItems.ToList(); + + NotificationProvider.ReleaseGlobalBusyMessage(); } ApprovalFineTuneItems = FineTuneItems.Where(x => x.IsSelected).ToObservableCollection(); @@ -1109,6 +1172,10 @@ namespace Tango.PPC.Jobs.ViewModels { LogManager.Log(ex, "Error while trying to synchronize fine tuning items with brush stops."); } + finally + { + NotificationProvider.ReleaseGlobalBusyMessage(); + } } /// <summary> @@ -1135,19 +1202,23 @@ namespace Tango.PPC.Jobs.ViewModels LogManager.Log(ex, "Error invoking the fine tunning palette"); await NotificationProvider.ShowError("An error occurred while trying to display the fine tunning palette."); } + finally + { + NotificationProvider.ReleaseGlobalBusyMessage(); + } } /// <summary> /// Resets the fine tuning. /// </summary> - private void ResetFineTuning() + private void ResetFineTuning(bool displayBusy = false) { if (Job != null && _jobs_fine_tune_items.ContainsKey(Job.Guid)) { _jobs_fine_tune_items.Remove(Job.Guid); } - SyncFineTuneItemsToBrushStops(); + SyncFineTuneItemsToBrushStops(displayBusy); } /// <summary> @@ -1357,6 +1428,8 @@ namespace Tango.PPC.Jobs.ViewModels { bool result = true; + if (!IsFree) return false; + if (!_can_navigate_back) { bool jobChainged = false; diff --git a/Software/Visual_Studio/PPC/Modules/Tango.PPC.Jobs/ViewModels/JobsViewVM.cs b/Software/Visual_Studio/PPC/Modules/Tango.PPC.Jobs/ViewModels/JobsViewVM.cs index a7b06f6eb..64931cbe3 100644 --- a/Software/Visual_Studio/PPC/Modules/Tango.PPC.Jobs/ViewModels/JobsViewVM.cs +++ b/Software/Visual_Studio/PPC/Modules/Tango.PPC.Jobs/ViewModels/JobsViewVM.cs @@ -36,6 +36,9 @@ using System.Windows.Media.Imaging; using Tango.Touch.Components; using Tango.PPC.Jobs.ViewContracts; using Tango.Core.ExtensionMethods; +using Tango.PPC.Common.Synchronization; +using Tango.PPC.Jobs.NotificationItems; +using Tango.PPC.Storage.Models; namespace Tango.PPC.Jobs.ViewModels { @@ -46,7 +49,10 @@ namespace Tango.PPC.Jobs.ViewModels public class JobsViewVM : PPCViewModel<IJobsView> { private ObservablesContext _db; //Holds the db context for the job list. - private ObservableCollection<ColorCatalog> _catalogs; //Holds the available color catalogs. + private ObservableCollection<ColorCatalog> _catalogs; //Holds the available color catalogs for the site. + private ObservableCollection<Rml> _rmls; //Holds the available RML for the site. + private List<ColorSpace> _colorSpaces; //Holds the available color spaces. + private bool _isJobsSynchronizationNotificationActive; public enum JobsCategory { @@ -318,7 +324,7 @@ namespace Tango.PPC.Jobs.ViewModels RaiseMessage(new JobSelectedMessage() { Job = job, Context = _db }); - if (!directlyToEdit && MachineProvider.MachineOperator.Status == Integration.Operation.MachineStatuses.ReadyToDye) + if (!directlyToEdit && MachineProvider.MachineOperator.CanPrint) { await NavigationManager.NavigateWithObject<JobsModule, JobSummeryView, JobSummeryNavigationObject>(new JobSummeryNavigationObject() { @@ -349,6 +355,8 @@ namespace Tango.PPC.Jobs.ViewModels _db = ObservablesContext.CreateDefault(); + _colorSpaces = _db.ColorSpaces.ToList(); + var jobs = new JobsCollectionBuilder(_db).Set(x => x.MachineGuid == MachineProvider.Machine.Guid).WithSegments().WithBrushStops().WithCustomer().WithColorSpace().Build(); InvokeUI(() => @@ -407,10 +415,15 @@ namespace Tango.PPC.Jobs.ViewModels var machine = MachineProvider.Machine; JobCreationViewVM vm = new JobCreationViewVM( - machine.SupportedJobTypes.Count > 0 ? machine.SupportedJobTypes : Enum.GetValues(typeof(JobTypes)).Cast<JobTypes>().ToList(), - machine.SupportedColorSpaces.Count > 0 ? machine.SupportedColorSpaces : Enum.GetValues(typeof(ColorSpaces)).Cast<ColorSpaces>().Where(x => x.IsUserSpace() || (ApplicationManager.IsInTechnicianMode && x == ColorSpaces.Volume)).ToList() + Settings.SupportedJobTypes.Count > 0 ? Settings.SupportedJobTypes : Enum.GetValues(typeof(JobTypes)).Cast<JobTypes>().ToList(), + Settings.SupportedColorSpaces.Count > 0 ? Settings.SupportedColorSpaces : Enum.GetValues(typeof(ColorSpaces)).Cast<ColorSpaces>().Where(x => x.IsUserSpace() || (ApplicationManager.IsInTechnicianMode && x == ColorSpaces.Volume)).ToList() ); + if (_catalogs.Count == 0) + { + vm.SupportedColorSpaces.Remove(ColorSpaces.Catalog); + } + CatalogSelectionViewVM catalogVM = new CatalogSelectionViewVM(_catalogs.ToList(), _catalogs.ToList().SingleOrDefault(x => x.Guid == settings.LastSelectedCatalogGuid)); if (settings.LastJobType != null) @@ -419,7 +432,7 @@ namespace Tango.PPC.Jobs.ViewModels } else { - vm.SelectedJobType = machine.SupportedJobTypes.FirstOrDefault(); + vm.SelectedJobType = Settings.SupportedJobTypes.FirstOrDefault(); } if (settings.LastJobColorSpace != null) @@ -428,7 +441,7 @@ namespace Tango.PPC.Jobs.ViewModels } else { - var space = machine.SupportedColorSpaces.FirstOrDefault(); + var space = Settings.SupportedColorSpaces.FirstOrDefault(); vm.SelectedColorSpace = space.IsUserSpace() ? space : ColorSpaces.Catalog; } @@ -446,7 +459,7 @@ namespace Tango.PPC.Jobs.ViewModels if (twnFile == null) { - if (machine.SupportedJobTypes.Count != 1 || machine.SupportedColorSpaces.Count != 1) + if (Settings.SupportedJobTypes.Count != 1 || Settings.SupportedColorSpaces.Count != 1) { vm = await NotificationProvider.ShowDialog<JobCreationViewVM>(vm); if (!vm.DialogResult) return; @@ -476,14 +489,14 @@ namespace Tango.PPC.Jobs.ViewModels } else { - vm.SelectedJobType = machine.SupportedJobTypes.First(); - vm.SelectedColorSpace = machine.SupportedColorSpaces.First(); + vm.SelectedJobType = Settings.SupportedJobTypes.First(); + vm.SelectedColorSpace = Settings.SupportedColorSpaces.First(); } } settings.LastJobType = vm.SelectedJobType; settings.LastJobColorSpace = vm.SelectedColorSpace; - + if (vm.SelectedColorSpace == ColorSpaces.Catalog) { settings.LastSelectedCatalogGuid = catalogVM.SelectedCatalog.Guid; @@ -492,6 +505,8 @@ namespace Tango.PPC.Jobs.ViewModels settings.Save(); Job job = new Job(); + job.LastUpdated = DateTime.UtcNow; + job.JobSource = JobSource.Local; job.Name = "untitled"; job.NumberOfHeads = 1; job.NumberOfUnits = 1; @@ -501,11 +516,12 @@ namespace Tango.PPC.Jobs.ViewModels job.JobType = vm.SelectedJobType; job.EnableLubrication = true; job.ColorSpaceGuid = Adapter.ColorSpaces.FirstOrDefault(x => x.Code == vm.SelectedColorSpace.ToInt32()).Guid; + job.ColorSpace = _colorSpaces.SingleOrDefault(x => x.Guid == job.ColorSpaceGuid); job.MachineGuid = MachineProvider.Machine.Guid; - job.UserGuid = AuthenticationProvider.CurrentUser.Guid; - job.RmlGuid = machine.DefaultRml != null ? machine.DefaultRmlGuid : Adapter.Rmls.FirstOrDefault().Guid; + job.UserGuid = null; + job.RmlGuid = (Settings.DefaultRmlGuid != null && _rmls.Select(x => x.Guid).Contains(Settings.DefaultRmlGuid)) ? Settings.DefaultRmlGuid : _rmls.FirstOrDefault().Guid; job.WindingMethodGuid = Adapter.WindingMethods.FirstOrDefault().Guid; - job.SpoolTypeGuid = machine.DefaultSpoolType != null ? machine.DefaultSpoolTypeGuid : Adapter.SpoolTypes.FirstOrDefault().Guid; + job.SpoolTypeGuid = Settings.DefaultSpoolTypeGuid != null ? Settings.DefaultSpoolTypeGuid : Adapter.SpoolTypes.FirstOrDefault().Guid; if (vm.SelectedColorSpace == ColorSpaces.Catalog) { @@ -519,11 +535,11 @@ namespace Tango.PPC.Jobs.ViewModels if (colorProfile == null) { - job.AddSolidSegment(machine.DefaultSegmentLength > 0 ? machine.DefaultSegmentLength : 100); + job.AddSolidSegment(Settings.DefaultSegmentLength > 0 ? Settings.DefaultSegmentLength : 100); } else { - job.AddSolidSegment(colorProfile.Value, machine.DefaultSegmentLength > 0 ? machine.DefaultSegmentLength : 100); + job.AddSolidSegment(colorProfile.Value, Settings.DefaultSegmentLength > 0 ? Settings.DefaultSegmentLength : 100); job.Name = $"SnapMatch {colorProfile.Value.R}, {colorProfile.Value.G}, {colorProfile.Value.B}"; } @@ -724,10 +740,13 @@ namespace Tango.PPC.Jobs.ViewModels StorageProvider.RegisterFileHandler(ExplorerFileDefinition.Pulse.Extension, HandlePulseFileLoaded); //Load catalogs. - using (ObservablesContext c = ObservablesContext.CreateDefault()) + using (ObservablesContext db = ObservablesContext.CreateDefault()) { - _catalogs = (await c.ColorCatalogs.ToListAsync()).ToObservableCollection(); + _catalogs = await new CatalogsCollectionBuilder(db).SetAll().ForSite(MachineProvider.Machine.SiteGuid).BuildAsync(); + _rmls = await new RmlsCollectionBuilder(db).SetAll().ForHeadType(MachineProvider.Machine.MachineHeadType).ForSite(MachineProvider.Machine.SiteGuid).BuildAsync(); } + + MachineDataSynchronizer.SynchronizationEnded += MachineDataSynchronizer_SynchronizationEnded; } public override void OnNavigatedTo() @@ -745,37 +764,64 @@ namespace Tango.PPC.Jobs.ViewModels var selected_job = SelectedJobs.FirstOrDefault(); if (selected_job == null) return; + var selectedJobs = SelectedJobs.ToList(); + ClearSelection(); var result = await NavigationManager. NavigateForResult<StorageModule, Storage.Views.MainView, ExplorerFileItem, - Storage.Models.StorageNavigationRequest>( - new Storage.Models.StorageNavigationRequest() + StorageNavigationRequest>( + new StorageNavigationRequest() { - Intent = Storage.Models.StorageNavigationIntent.SaveFile, + Intent = selectedJobs.Count == 1 ? StorageNavigationIntent.SaveFile : StorageNavigationIntent.SaveFiles, DefaultFileName = selected_job.Name, Filter = ExplorerFileDefinition.Job.Extension, - Title = "Save Job File", + Title = selectedJobs.Count == 1 ? "Save Job File" : "Save Job Files", }); if (result != null) { - try + if (selectedJobs.Count == 1) { - var jobFile = await selected_job.ToJobFile(); + try + { + var jobFile = await selected_job.ToJobFile(); - using (FileStream fs = new FileStream(result.Path + ExplorerFileDefinition.Job.Extension, FileMode.Create)) + using (FileStream fs = new FileStream(result.Path + ExplorerFileDefinition.Job.Extension, FileMode.Create)) + { + jobFile.WriteTo(fs); + } + + await NotificationProvider.ShowSuccess("Job saved successfully."); + } + catch (Exception ex) { - jobFile.WriteTo(fs); + LogManager.Log(ex, $"Error saving job {selected_job.Name} to file."); + await NotificationProvider.ShowError($"An error occurred while trying to save the job.\n{ex.Message}"); } - - await NotificationProvider.ShowSuccess("Job saved successfully."); } - catch (Exception ex) + else { - LogManager.Log(ex, $"Error saving job {selected_job.Name} to file."); - await NotificationProvider.ShowError($"An error occurred while trying to save the job.\n{ex.Message}"); + foreach (var job in selectedJobs) + { + try + { + var jobFile = await job.ToJobFile(); + + using (FileStream fs = new FileStream(Path.Combine(result.Path, jobFile.Name.ToValidFileName()) + ExplorerFileDefinition.Job.Extension, FileMode.Create)) + { + jobFile.WriteTo(fs); + } + } + catch (Exception ex) + { + LogManager.Log(ex, $"Error saving job {job.Name} to file."); + await NotificationProvider.ShowError($"An error occurred while trying to save the job.\n{ex.Message}"); + } + } + + await NotificationProvider.ShowSuccess("Jobs saved successfully."); } } } @@ -784,7 +830,7 @@ namespace Tango.PPC.Jobs.ViewModels #region Handle Job File Loading From Storage - private async void HandleJobFileLoaded(ExplorerFileItem jobFile) + private async void HandleJobFileLoaded(List<ExplorerFileItem> jobFiles) { var vm = await NotificationProvider.ShowDialog<ImportJobViewVM>(); @@ -792,29 +838,35 @@ namespace Tango.PPC.Jobs.ViewModels { using (ObservablesContext jobContext = ObservablesContext.CreateDefault()) { - try + foreach (var jobFile in jobFiles) { - JobFile jFile = JobFile.Parser.ParseFrom(File.ReadAllBytes(jobFile.Path)); - var job = await Job.FromJobFile(jFile, MachineProvider.Machine.Guid, AuthenticationProvider.CurrentUser.Guid); - jobContext.Jobs.Add(job); - await jobContext.SaveChangesAsync(); - LoadJobs(() => + try { - if (vm.ImportAndEdit) - { - var postJob = Jobs.SingleOrDefault(x => x.Guid == job.Guid); - if (postJob != null) - { - SelectJob(postJob, true); - } - } - }); + JobFile jFile = JobFile.Parser.ParseFrom(File.ReadAllBytes(jobFile.Path)); + var job = await Job.FromJobFile(jFile, MachineProvider.Machine.Guid, null); + job.JobSource = JobSource.Local; + jobContext.Jobs.Add(job); + await jobContext.SaveChangesAsync(); + } + catch (Exception ex) + { + LogManager.Log(ex, $"Error occurred while trying to import job from file {jobFile.Path}."); + await NotificationProvider.ShowError($"An error occurred while trying to import the selected job file.\n{ex.Message}"); + } } - catch (Exception ex) + + LoadJobs(() => { - LogManager.Log(ex, $"Error occurred while trying to import job from file {jobFile.Path}."); - await NotificationProvider.ShowError($"An error occurred while trying to import the selected job file.\n{ex.Message}"); - } + //Editing of a job is currently deprecated due to enabling multiple job imports. + //if (vm.ImportAndEdit) + //{ + // var postJob = Jobs.SingleOrDefault(x => x.Guid == job.Guid); + // if (postJob != null) + // { + // SelectJob(postJob, true); + // } + //} + }); } } } @@ -823,8 +875,10 @@ namespace Tango.PPC.Jobs.ViewModels #region Handle TCC File Loading From Storage - private async void HandleColorProfileFileLoaded(ExplorerFileItem tccFile) + private async void HandleColorProfileFileLoaded(List<ExplorerFileItem> tccFiles) { + var tccFile = tccFiles.FirstOrDefault(); + try { DetectionColorFile tcc = DetectionColorFile.Parser.ParseFrom(File.ReadAllBytes(tccFile.Path)); @@ -853,8 +907,10 @@ namespace Tango.PPC.Jobs.ViewModels #region Handle Pulse TWN Loading From Storage - private async void HandlePulseFileLoaded(ExplorerFileItem twnFile) + private async void HandlePulseFileLoaded(List<ExplorerFileItem> twnFiles) { + var twnFile = twnFiles.FirstOrDefault(); + TwnFile twn = TwnFile.FromFile(twnFile.Path); BitmapSource preview = twn.Thumbnail.ToBitmapSource(); @@ -871,6 +927,32 @@ namespace Tango.PPC.Jobs.ViewModels #endregion + #region Handle New Synchronized Jobs + + private void MachineDataSynchronizer_SynchronizationEnded(object sender, SynchronizationEndedEventArgs e) + { + if (e.NewChangedJobs > 0 && !_isJobsSynchronizationNotificationActive) + { + _isJobsSynchronizationNotificationActive = true; + + var item = NotificationProvider.PushNotification<NewSynchronizardJobsNotificationItem>(); + item.Pressed += (_, __) => + { + _isJobsSynchronizationNotificationActive = false; + LoadJobs(() => + { + NotificationProvider.ShowSuccess("Your job list is now synchronized."); + }); + }; + item.Closed += (_, __) => + { + _isJobsSynchronizationNotificationActive = false; + }; + } + } + + #endregion + #region Color Profile Request private void ExternalBridgeService_ColorProfileRequest(object sender, ColorProfileRequestEventArgs e) diff --git a/Software/Visual_Studio/PPC/Modules/Tango.PPC.Jobs/ViewModels/MainViewVM.cs b/Software/Visual_Studio/PPC/Modules/Tango.PPC.Jobs/ViewModels/MainViewVM.cs index ed1e28f55..579e1e2f7 100644 --- a/Software/Visual_Studio/PPC/Modules/Tango.PPC.Jobs/ViewModels/MainViewVM.cs +++ b/Software/Visual_Studio/PPC/Modules/Tango.PPC.Jobs/ViewModels/MainViewVM.cs @@ -11,6 +11,7 @@ using Tango.Integration.Operation; using Tango.PPC.Common; using Tango.PPC.Common.Notifications; using Tango.PPC.Common.Notifications.NotificationItems; +using Tango.PPC.Jobs.AppBarItems; using Tango.PPC.Jobs.Messages; using Tango.PPC.Jobs.NavigationObjects; using Tango.PPC.Jobs.Views; @@ -24,6 +25,9 @@ namespace Tango.PPC.Jobs.ViewModels public class MainViewVM : PPCViewModel { private NotificationItem _last_failed_job_notification; + private JobHandler _handler; + private bool resuming; + private JobProgressAppBarItem _appBarItem; /// <summary> /// Called when the application has been started. @@ -33,23 +37,42 @@ namespace Tango.PPC.Jobs.ViewModels MachineProvider.MachineOperator.PrintingCompleted += MachineOperator_PrintingCompleted; MachineProvider.MachineOperator.PrintingFailed += MachineOperator_PrintingFailed; MachineProvider.MachineOperator.ResumingJob += MachineOperator_ResumingJob; + MachineProvider.MachineOperator.PrintingStarted += MachineOperator_PrintingStarted; + MachineProvider.MachineOperator.PrintingEnded += MachineOperator_PrintingEnded; + NavigationManager.CurrentVMChanged += NavigationManager_CurrentVMChanged; } - private async void MachineOperator_ResumingJob(object sender, ResumingJobEventArgs e) + private void MachineOperator_PrintingEnded(object sender, PrintingEventArgs e) { - LogManager.Log($"Trying to resume job '{e.JobGuid}'..."); + _appBarItem?.Close(); + _appBarItem = null; + } - try + private void NavigationManager_CurrentVMChanged(object sender, PPCViewModel vm) + { + if (vm.GetType() == typeof(JobProgressViewVM)) { - var job = await new JobBuilder(ObservablesContext.CreateDefault()).Set(e.JobGuid) - .WithConfiguration() - .WithRML() - .WithUser() - .WithSegments() - .WithBrushStops() - .BuildAsync(); + _appBarItem?.Close(); + _appBarItem = null; + } + else if (vm.GetType() != typeof(JobSummeryViewVM) && _appBarItem == null && MachineProvider.MachineOperator.IsPrinting && _handler != null && !_handler.IsCanceled) + { + _appBarItem = NotificationProvider.PushAppBarItem<JobProgressAppBarItem>(); + _appBarItem.Pressed += (_, __) => + { + _appBarItem?.Close(); + NavigationManager.NavigateTo<JobsModule>(nameof(JobProgressView)); + }; + } + } - e.Approve(job); + private void MachineOperator_PrintingStarted(object sender, PrintingEventArgs e) + { + _handler = e.JobHandler; + + if (resuming) + { + resuming = false; InvokeUI(() => { @@ -62,6 +85,17 @@ namespace Tango.PPC.Jobs.ViewModels } }); } + } + + private void MachineOperator_ResumingJob(object sender, ResumingJobEventArgs e) + { + LogManager.Log($"Job resume request '{e.JobGuid}' approving..."); + + try + { + e.Approve(); + resuming = true; + } catch (Exception ex) { LogManager.Log(ex, "An error occurred while trying to resume the job."); @@ -79,13 +113,15 @@ namespace Tango.PPC.Jobs.ViewModels /// <param name="e">The <see cref="Integration.Operation.PrintingFailedEventArgs"/> instance containing the event data.</param> private void MachineOperator_PrintingFailed(object sender, PrintingFailedEventArgs e) { + String message = $"{e.Exception.FlattenMessage()}"; + _last_failed_job_notification = NotificationProvider.PushNotification(new MessageNotificationItem( - String.Format("'{0}' failed.", e.Job.Name), - String.Format("The job '{1}' has failed due to unexpected error.{0}{2}{0}{0}Tap to view this job details.", Environment.NewLine, e.Job.Name, e.Exception), MessageNotificationItem.MessageNotificationItemTypes.Error, () => + $"'{e.Job.Name}' failed at position {e.JobHandler.Status.ProgressMinusSettingUp.ToString("0.0")} out of {e.JobHandler.Status.TotalProgressMinusSettingUp.ToString("0.0")} meters.", + message, MessageNotificationItem.MessageNotificationItemTypes.Error, () => { NavigationManager.NavigateWithObject<JobsModule, JobView, Job>(e.Job); NavigationManager.ClearHistoryExcept<JobsView>(); - })); + }, NotificationItem.NotificationPriority.VeryHigh)); } /// <summary> @@ -119,7 +155,7 @@ namespace Tango.PPC.Jobs.ViewModels { NavigationManager.NavigateWithObject<JobsModule, JobView, JobNavigationObject>(new JobNavigationObject() { Job = e.Job }); NavigationManager.ClearHistoryExcept<JobsView>(); - })); + }, NotificationItem.NotificationPriority.VeryHigh)); } } diff --git a/Software/Visual_Studio/PPC/Modules/Tango.PPC.Jobs/Views/JobProgressView.xaml b/Software/Visual_Studio/PPC/Modules/Tango.PPC.Jobs/Views/JobProgressView.xaml index 3b92581bc..40cfc40f9 100644 --- a/Software/Visual_Studio/PPC/Modules/Tango.PPC.Jobs/Views/JobProgressView.xaml +++ b/Software/Visual_Studio/PPC/Modules/Tango.PPC.Jobs/Views/JobProgressView.xaml @@ -19,7 +19,7 @@ <Grid> <StackPanel HorizontalAlignment="Center" VerticalAlignment="Top" Margin="0 100 0 0"> <StackPanel Orientation="Horizontal" HorizontalAlignment="Center"> - <TextBlock FontSize="{StaticResource TangoHeaderFontSize}" Text="{Binding Job.Name,FallbackValue='Job Name'}"></TextBlock> + <TextBlock FontSize="{StaticResource TangoHeaderFontSize}" Text="{Binding Job.Name,FallbackValue='Job Name'}" TextWrapping="Wrap" MaxWidth="700"></TextBlock> <TextBlock FontSize="{StaticResource TangoTitleFontSize}" Foreground="{StaticResource TangoGrayTextBrush}" VerticalAlignment="Center" Margin="10 0 0 0" Visibility="{Binding Job.Designation,Converter={StaticResource EnumToVisibilityConverter},ConverterParameter='SampleDye'}">(Sample)</TextBlock> <TextBlock FontSize="{StaticResource TangoTitleFontSize}" Foreground="{StaticResource TangoGrayTextBrush}" VerticalAlignment="Center" Margin="10 0 0 0" Visibility="{Binding Job.Designation,Converter={StaticResource EnumToVisibilityConverter},ConverterParameter='FineTuning'}">(Fine Tuning)</TextBlock> </StackPanel> @@ -38,6 +38,8 @@ <Setter Property="Visibility" Value="Visible"></Setter> </DataTrigger> <DataTrigger Binding="{Binding RunningJobStatus.IsCompleted}" Value="True"> + <Setter Property="Maximum" Value="100"></Setter> + <Setter Property="Value" Value="99.9999999"></Setter> <Setter Property="Foreground" Value="{StaticResource TangoSuccessBrush}"></Setter> </DataTrigger> <DataTrigger Binding="{Binding RunningJobStatus.IsCanceled}" Value="True"> @@ -98,7 +100,7 @@ <StackPanel Height="90" Visibility="{Binding RunningJobStatus.IsSettingUp,Converter={StaticResource BooleanToVisibilityConverter}}"> <StackPanel Orientation="Horizontal" HorizontalAlignment="Center"> <Image Source="../Images/JobProgressView/drop.png" Stretch="None" /> - <TextBlock Margin="5 0 0 0" VerticalAlignment="Center" FontSize="{StaticResource TangoTitleFontSize}">Getting ready...</TextBlock> + <TextBlock Margin="5 0 0 0" VerticalAlignment="Center" FontSize="{StaticResource TangoTitleFontSize}">Getting Ready...</TextBlock> </StackPanel> </StackPanel> @@ -117,8 +119,8 @@ </Grid> <Grid Margin="0 150 0 0"> - <StackPanel> - <Canvas Height="80" Margin="5 0"> + <StackPanel MaxWidth="600"> + <Canvas Height="80" Margin="0"> <StackPanel> <StackPanel.Style> <Style TargetType="StackPanel"> @@ -138,64 +140,58 @@ </Style.Triggers> </Style> </StackPanel.Style> - <StackPanel Margin="-50 0 0 0"> - <ContentControl> - <ContentControl.Style> - <Style TargetType="ContentControl"> - <Setter Property="Content"> - <Setter.Value> - <StackPanel> - <TextBlock HorizontalAlignment="Center" FontSize="{StaticResource TangoTitleFontSize}"> - <TextBlock.Style> - <Style TargetType="TextBlock"> - <Setter Property="Text" Value="now dyeing"></Setter> - <Style.Triggers> - <DataTrigger Binding="{Binding RunningJobStatus.IsSettingUp}" Value="True"> - <Setter Property="Text" Value="getting ready"></Setter> - </DataTrigger> - </Style.Triggers> - </Style> - </TextBlock.Style> - </TextBlock> - <touch:TouchIcon Margin="0 8 0 0" HorizontalAlignment="Center" Icon="Water" Angle="180" Foreground="{StaticResource TangoPrimaryAccentBrush}" Width="40" Height="40" /> - </StackPanel> - </Setter.Value> - </Setter> - <Style.Triggers> - <DataTrigger Binding="{Binding RunningJobStatus.IsCanceled}" Value="True"> - <Setter Property="Content"> - <Setter.Value> - <StackPanel> - <TextBlock HorizontalAlignment="Center" FontSize="{StaticResource TangoTitleFontSize}">job canceled</TextBlock> - <touch:TouchIcon Margin="0 8 0 0" HorizontalAlignment="Center" Icon="Alert" Foreground="{StaticResource TangoWarningBrush}" Width="40" Height="40" /> - </StackPanel> - </Setter.Value> - </Setter> - </DataTrigger> - <DataTrigger Binding="{Binding RunningJobStatus.IsFailed}" Value="True"> - <Setter Property="Content"> - <Setter.Value> - <StackPanel> - <TextBlock HorizontalAlignment="Center" FontSize="{StaticResource TangoTitleFontSize}">job failed</TextBlock> - <touch:TouchIcon Margin="0 8 0 0" HorizontalAlignment="Center" Icon="AlertOctagon" Foreground="{StaticResource TangoErrorBrush}" Width="40" Height="40" /> - </StackPanel> - </Setter.Value> - </Setter> - </DataTrigger> - <DataTrigger Binding="{Binding RunningJobStatus.IsCompleted}" Value="True"> - <Setter Property="Content"> - <Setter.Value> - <StackPanel> - <TextBlock HorizontalAlignment="Center" FontSize="{StaticResource TangoTitleFontSize}">job completed</TextBlock> - <touch:TouchIcon Margin="0 8 0 0" HorizontalAlignment="Center" Icon="Check" Foreground="{StaticResource TangoSuccessBrush}" Width="40" Height="40" /> - </StackPanel> - </Setter.Value> - </Setter> - </DataTrigger> - </Style.Triggers> - </Style> - </ContentControl.Style> - </ContentControl> + <StackPanel Margin="-20 20 0 0"> + <StackPanel> + <Canvas HorizontalAlignment="Center"> + <TextBlock Margin="0 -25 0 0" Canvas.Left="{Binding RelativeSource={RelativeSource Mode=Self},Path=ActualWidth,Converter={StaticResource MathOperatorConverter},ConverterParameter='*-0.5'}" HorizontalAlignment="Center" FontSize="{StaticResource TangoTitleFontSize}"> + <TextBlock.Style> + <Style TargetType="TextBlock"> + <Setter Property="Text" Value="Now Dyeing"></Setter> + <Style.Triggers> + <DataTrigger Binding="{Binding RunningJobStatus.IsSettingUp}" Value="True"> + <Setter Property="Text" Value="Getting Ready"></Setter> + </DataTrigger> + <DataTrigger Binding="{Binding RunningJobStatus.IsCanceled}" Value="True"> + <Setter Property="Text" Value="Job Canceled"></Setter> + </DataTrigger> + <DataTrigger Binding="{Binding RunningJobStatus.IsFailed}" Value="True"> + <Setter Property="Text" Value="Job Failed"></Setter> + </DataTrigger> + <DataTrigger Binding="{Binding RunningJobStatus.IsCompleted}" Value="True"> + <Setter Property="Text" Value="Job Completed"></Setter> + </DataTrigger> + </Style.Triggers> + </Style> + </TextBlock.Style> + </TextBlock> + </Canvas> + <touch:TouchIcon Margin="0 8 0 0" HorizontalAlignment="Center" Width="40" Height="40"> + <touch:TouchIcon.Style> + <Style TargetType="touch:TouchIcon" BasedOn="{StaticResource {x:Type touch:TouchIcon}}"> + <Setter Property="Angle" Value="180"></Setter> + <Setter Property="Icon" Value="Water"></Setter> + <Setter Property="Foreground" Value="{StaticResource TangoPrimaryAccentBrush}"></Setter> + <Style.Triggers> + <DataTrigger Binding="{Binding RunningJobStatus.IsCanceled}" Value="True"> + <Setter Property="Angle" Value="0"></Setter> + <Setter Property="Icon" Value="Alert"></Setter> + <Setter Property="Foreground" Value="{StaticResource TangoWarningBrush}"></Setter> + </DataTrigger> + <DataTrigger Binding="{Binding RunningJobStatus.IsFailed}" Value="True"> + <Setter Property="Angle" Value="0"></Setter> + <Setter Property="Icon" Value="AlertOctagon"></Setter> + <Setter Property="Foreground" Value="{StaticResource TangoErrorBrush}"></Setter> + </DataTrigger> + <DataTrigger Binding="{Binding RunningJobStatus.IsCompleted}" Value="True"> + <Setter Property="Angle" Value="0"></Setter> + <Setter Property="Icon" Value="Check"></Setter> + <Setter Property="Foreground" Value="{StaticResource TangoSuccessBrush}"></Setter> + </DataTrigger> + </Style.Triggers> + </Style> + </touch:TouchIcon.Style> + </touch:TouchIcon> + </StackPanel> </StackPanel> </StackPanel> </Canvas> @@ -214,5 +210,23 @@ Go to job </touch:TouchButton> </StackPanel> + + <touch:TouchButton Visibility="{Binding ApplicationManager.IsInTechnicianMode,Converter={StaticResource BooleanToVisibilityConverter}}" VerticalAlignment="Bottom" Margin="0 100 0 0" Command="{Binding DisplayJobOutlineCommand}" Style="{StaticResource TangoLinkButton}" Height="60" FontSize="{StaticResource TangoTitleFontSize}"> + Display Job Outline + </touch:TouchButton> + + <Grid Visibility="{Binding IsDisplayJobOutline,Converter={StaticResource BooleanToVisibilityConverter}}" Background="{StaticResource TangoPrimaryBackgroundBrush}" Opacity="0.8"/> + + <Grid Margin="0 -10 0 0" Visibility="{Binding IsDisplayJobOutline,Converter={StaticResource BooleanToVisibilityConverter}}"> + <Grid> + <touch:TouchScrollViewer BorderThickness="0" Padding="10" Margin="0 0 0 100"> + <global:JobOutlineControl BorderThickness="0" Margin="20" DataContext="{Binding JobOutlineTicket}" HorizontalAlignment="Left" /> + </touch:TouchScrollViewer> + </Grid> + + <touch:TouchButton Background="{StaticResource TangoPrimaryBackgroundBrush}" VerticalAlignment="Bottom" Margin="0 100 0 0" Command="{Binding HideJobOutlineCommand}" Style="{StaticResource TangoLinkButton}" Height="60" FontSize="{StaticResource TangoTitleFontSize}"> + Hide Job Outline + </touch:TouchButton> + </Grid> </Grid> </UserControl> diff --git a/Software/Visual_Studio/PPC/Modules/Tango.PPC.Jobs/Views/JobSummeryView.xaml b/Software/Visual_Studio/PPC/Modules/Tango.PPC.Jobs/Views/JobSummeryView.xaml index 80a427714..4785805a6 100644 --- a/Software/Visual_Studio/PPC/Modules/Tango.PPC.Jobs/Views/JobSummeryView.xaml +++ b/Software/Visual_Studio/PPC/Modules/Tango.PPC.Jobs/Views/JobSummeryView.xaml @@ -54,7 +54,7 @@ <RowDefinition Height="300*"/> </Grid.RowDefinitions> - <TextBlock FontSize="{StaticResource TangoHeaderFontSize}" Text="{Binding Job.Name}" HorizontalAlignment="Center" VerticalAlignment="Center"></TextBlock> + <TextBlock FontSize="{StaticResource TangoHeaderFontSize}" Text="{Binding Job.Name}" HorizontalAlignment="Center" VerticalAlignment="Center" TextWrapping="Wrap"></TextBlock> <Grid Grid.Row="1" Width="360" Height="360"> <touch:TouchBusyIndicator Opacity="0.6" IsIndeterminate="False" Foreground="{StaticResource TangoGrayBrush}" StrokeThickness="10" Minimum="0" Maximum="100" Value="99.999" Width="Auto" Height="Auto"> diff --git a/Software/Visual_Studio/PPC/Modules/Tango.PPC.Jobs/Views/JobView.xaml b/Software/Visual_Studio/PPC/Modules/Tango.PPC.Jobs/Views/JobView.xaml index 57101569a..6a94034db 100644 --- a/Software/Visual_Studio/PPC/Modules/Tango.PPC.Jobs/Views/JobView.xaml +++ b/Software/Visual_Studio/PPC/Modules/Tango.PPC.Jobs/Views/JobView.xaml @@ -26,6 +26,8 @@ <BitmapImage x:Key="Image_Out_Of_Gamut" UriSource="../Images/JobView/error.png" /> <BitmapImage x:Key="Image_Replace_Color" UriSource="../Images/JobView/replace-color.png" /> <BitmapImage x:Key="Image_Color_Picker" UriSource="../Images/JobView/color-picker.png" /> + <BitmapImage x:Key="Image_Transparent" UriSource="../Images/JobView/transparent.jpg" /> + <BitmapImage x:Key="Image_TransparentSmall" UriSource="../Images/JobView/transparent_small.jpg" /> <Style TargetType="FrameworkElement" x:Key="Level1Container"> @@ -111,9 +113,24 @@ <StackPanel> <StackPanel Orientation="Horizontal"> <Border Width="48" Height="48" CornerRadius="5" BorderThickness="1" BorderBrush="{StaticResource TangoGrayBrush}"> - <Border.Background> - <SolidColorBrush Color="{Binding Color,IsAsync=True}"></SolidColorBrush> - </Border.Background> + <Border.Style> + <Style TargetType="Border"> + <Setter Property="Background"> + <Setter.Value> + <SolidColorBrush Color="{Binding Color,IsAsync=True}" /> + </Setter.Value> + </Setter> + <Style.Triggers> + <DataTrigger Binding="{Binding IsTransparent,IsAsync=True}" Value="True" > + <Setter Property="Background"> + <Setter.Value> + <ImageBrush ImageSource="{StaticResource Image_TransparentSmall}" Stretch="None" /> + </Setter.Value> + </Setter> + </DataTrigger> + </Style.Triggers> + </Style> + </Border.Style> </Border> <TextBlock Margin="30 0 0 0" FontSize="{StaticResource TangoTitleFontSize}"> @@ -147,6 +164,17 @@ <DataTrigger Binding="{Binding ElementName=view,Path=DataContext.Job.ColorSpace.Name,IsAsync=True}" Value="Volume"> <Setter Property="ContentTemplate" Value="{StaticResource Volume_Template}" /> </DataTrigger> + <DataTrigger Binding="{Binding IsTransparent,IsAsync=True}" Value="True"> + <Setter Property="ContentTemplate"> + <Setter.Value> + <DataTemplate> + <Grid Height="40"> + <TextBlock VerticalAlignment="Bottom" Foreground="{StaticResource TangoGrayBrush}">Transparent</TextBlock> + </Grid> + </DataTemplate> + </Setter.Value> + </Setter> + </DataTrigger> </Style.Triggers> </Style> </ContentControl.Style> @@ -172,7 +200,10 @@ </StackPanel> <StackPanel Orientation="Horizontal" Margin="0 0 -130 0" HorizontalAlignment="Right" VerticalAlignment="Top"> - <touch:TouchImageButton Command="{Binding ElementName=view,Path=DataContext.ReplaceBrushStopCommand,IsAsync=True}" CommandParameter="{Binding}" Visibility="{Binding IsOutOfGamut,Converter={StaticResource BooleanToVisibilityConverter},IsAsync=True}" Width="50" Height="50" Padding="10" Image="{StaticResource Image_Replace_Color}" CornerRadius="30"></touch:TouchImageButton> + <StackPanel Orientation="Horizontal" Visibility="{Binding ElementName=toggleEdit,Path=IsChecked,IsAsync=True,Converter={StaticResource BooleanToVisibilityInverseConverter}}"> + <!--<touch:TouchToggleIconButton Padding="15" Width="60" Height="60" CornerRadius="30" Icon="EyeOutline" CheckedIcon="EyeOffOutline" Foreground="{StaticResource TangoGrayBrush}" CheckedForeground="{StaticResource TangoGrayBrush}" IsChecked="{Binding IsTransparent,IsAsync=True}"></touch:TouchToggleIconButton>--> + <touch:TouchImageButton Command="{Binding ElementName=view,Path=DataContext.ReplaceBrushStopCommand,IsAsync=True}" CommandParameter="{Binding}" Visibility="{Binding ColorSpace,Converter={StaticResource ColorSpaceToVisibilityConverter},IsAsync=True}" Width="50" Height="50" Padding="10" Image="{StaticResource Image_Replace_Color}" CornerRadius="30"></touch:TouchImageButton> + </StackPanel> <touch:TouchIconButton Margin="0 0 50 0" Visibility="{Binding ElementName=toggleEdit,Path=IsChecked,Converter={StaticResource BooleanToVisibilityConverter}}" Command="{Binding ElementName=view,Path=DataContext.RemoveBrushStopCommand,IsAsync=True}" CommandParameter="{Binding}" EnableDropShadow="False" Icon="TrashAltRegular" Padding="12" Foreground="{StaticResource TangoPrimaryAccentBrush}" Width="50" Height="50" RippleBrush="{StaticResource TangoRippleDarkBrush}" CornerRadius="30" /> </StackPanel> </Grid> @@ -214,7 +245,11 @@ </Style.Triggers> </Style> </DockPanel.Style> - <Border DockPanel.Dock="Left" Background="{Binding SegmentBrush}" BorderThickness="0 0 1 0" BorderBrush="{StaticResource TangoLightBorderBrush}"> + + <Border DockPanel.Dock="Left" BorderThickness="0 0 1 0" BorderBrush="{StaticResource TangoLightBorderBrush}"> + <Border.Background> + <ImageBrush ImageSource="{StaticResource Image_Transparent}" Stretch="None" /> + </Border.Background> <Border.Style> <Style TargetType="Border"> <Setter Property="CornerRadius" Value="8 0 0 8"></Setter> @@ -233,6 +268,26 @@ </Style.Triggers> </Style> </Border.Style> + <Border Background="{Binding SegmentBrush}"> + <Border.Style> + <Style TargetType="Border"> + <Setter Property="CornerRadius" Value="8 0 0 8"></Setter> + <Setter Property="Width" Value="{Binding RelativeSource={RelativeSource Self},Path=ActualHeight,IsAsync=True}"></Setter> + <Style.Triggers> + <DataTrigger Binding="{Binding ElementName=toggle_small_list,Path=IsChecked,IsAsync=True}" Value="True"> + <Setter Property="Width" Value="{Binding RelativeSource={RelativeSource Self},Path=ActualHeight,Converter={StaticResource MathOperatorConverter},ConverterParameter='*2',IsAsync=True}"></Setter> + </DataTrigger> + <MultiDataTrigger> + <MultiDataTrigger.Conditions> + <Condition Binding="{Binding Converter={StaticResource IsSegmentGradientConverter},IsAsync=True}" Value="True"></Condition> + <Condition Binding="{Binding ElementName=toggle_large_list,Path=IsChecked,IsAsync=True}" Value="True"></Condition> + </MultiDataTrigger.Conditions> + <Setter Property="CornerRadius" Value="8 0 0 0"></Setter> + </MultiDataTrigger> + </Style.Triggers> + </Style> + </Border.Style> + </Border> </Border> <Grid> @@ -247,77 +302,90 @@ </TextBlock> </StackPanel> - <StackPanel Margin="0 30 0 0" VerticalAlignment="Bottom" HorizontalAlignment="Left" Width="300" Visibility="{Binding ElementName=toggle_large_list,Path=IsChecked,Converter={StaticResource BooleanToVisibilityConverter},IsAsync=True}"> - <DockPanel LastChildFill="False"> - <DockPanel.Style> - <Style TargetType="DockPanel"> - <Setter Property="Visibility" Value="Visible"></Setter> - <Style.Triggers> - <DataTrigger Binding="{Binding Converter={StaticResource IsSegmentGradientConverter},IsAsync=True}" Value="True"> - <Setter Property="Visibility" Value="Collapsed"></Setter> - </DataTrigger> - </Style.Triggers> - </Style> - </DockPanel.Style> - <TextBlock VerticalAlignment="Bottom" DockPanel.Dock="Left" Text="Color code:"></TextBlock> + <Grid> + <StackPanel Margin="0 30 0 0" VerticalAlignment="Bottom" HorizontalAlignment="Left" Width="300" Visibility="{Binding ElementName=toggle_large_list,Path=IsChecked,Converter={StaticResource BooleanToVisibilityConverter},IsAsync=True}"> + <DockPanel LastChildFill="False"> + <DockPanel.Style> + <Style TargetType="DockPanel"> + <Setter Property="Visibility" Value="Visible"></Setter> + <Style.Triggers> + <DataTrigger Binding="{Binding Converter={StaticResource IsSegmentGradientConverter},IsAsync=True}" Value="True"> + <Setter Property="Visibility" Value="Collapsed"></Setter> + </DataTrigger> + </Style.Triggers> + </Style> + </DockPanel.Style> + <TextBlock VerticalAlignment="Bottom" DockPanel.Dock="Left" Text="Color code:"></TextBlock> - <Grid DockPanel.Dock="Right" DataContext="{Binding BrushStops[0],IsAsync=True}"> - <StackPanel> - <ContentControl Focusable="False" FocusVisualStyle="{x:Null}" d:DataContext="{d:DesignInstance Type=entities:BrushStop, IsDesignTimeCreatable=False}" Content="{Binding}" Width="180"> - <ContentControl.Style> - <Style TargetType="ContentControl"> - <Setter Property="ContentTemplate"> - <Setter.Value> - <DataTemplate> + <Grid DockPanel.Dock="Right" DataContext="{Binding BrushStops[0],IsAsync=True}"> + <StackPanel> + <ContentControl Focusable="False" FocusVisualStyle="{x:Null}" d:DataContext="{d:DesignInstance Type=entities:BrushStop, IsDesignTimeCreatable=False}" Content="{Binding}" Width="180"> + <ContentControl.Style> + <Style TargetType="ContentControl"> + <Setter Property="ContentTemplate"> + <Setter.Value> + <DataTemplate> - </DataTemplate> - </Setter.Value> - </Setter> - <Style.Triggers> - <DataTrigger Binding="{Binding ElementName=view,Path=DataContext.Job.ColorSpace.Name,IsAsync=True}" Value="RGB"> - <Setter Property="ContentTemplate" Value="{StaticResource RGB_Template}" /> - </DataTrigger> - <DataTrigger Binding="{Binding ElementName=view,Path=DataContext.Job.ColorSpace.Name,IsAsync=True}" Value="CMYK"> - <Setter Property="ContentTemplate" Value="{StaticResource CMYK_Template}" /> - </DataTrigger> - <DataTrigger Binding="{Binding ElementName=view,Path=DataContext.Job.ColorSpace.Name,IsAsync=True}" Value="LAB"> - <Setter Property="ContentTemplate" Value="{StaticResource LAB_Template}" /> - </DataTrigger> - <DataTrigger Binding="{Binding ElementName=view,Path=DataContext.Job.ColorSpace.Name,IsAsync=True}" Value="Catalog"> - <Setter Property="ContentTemplate" Value="{StaticResource CATALOG_Template}" /> - </DataTrigger> - <DataTrigger Binding="{Binding ElementName=view,Path=DataContext.Job.ColorSpace.Name,IsAsync=True}" Value="Volume"> - <Setter Property="ContentTemplate" Value="{StaticResource Volume_Template}" /> - </DataTrigger> - </Style.Triggers> - </Style> - </ContentControl.Style> - </ContentControl> - </StackPanel> - </Grid> - </DockPanel> - <Canvas> - <Canvas.Style> - <Style TargetType="Canvas"> - <Setter Property="Visibility" Value="Collapsed"></Setter> - <Style.Triggers> - <MultiDataTrigger> - <MultiDataTrigger.Conditions> - <Condition Binding="{Binding Converter={StaticResource IsSegmentGradientConverter},IsAsync=True}" Value="False" /> - <Condition Binding="{Binding BrushStops[0].IsOutOfGamut,IsAsync=True}" Value="True" /> - </MultiDataTrigger.Conditions> - <Setter Property="Visibility" Value="Visible"></Setter> - </MultiDataTrigger> - </Style.Triggers> - </Style> - </Canvas.Style> - <TextBlock Canvas.Top="2" Foreground="{StaticResource TangoErrorBrush}" FontSize="{StaticResource TangoSmallFontSize}" Text="Color is out of gamut. Modify color or select an alternative."></TextBlock> - </Canvas> - <DockPanel LastChildFill="False" Margin="0 20 0 0"> - <TextBlock VerticalAlignment="Bottom" DockPanel.Dock="Left" Text="Length (m):"></TextBlock> - <touch:TouchNumericTextBox Width="180" DockPanel.Dock="Right" Value="{Binding Length}" StringFormat="0.0" AutoCalculateJogStep="False" HasDecimalPoint="True" Minimum="1" Maximum="100000" KeyboardContainer="{Binding ElementName=Container}" /> - </DockPanel> - </StackPanel> + </DataTemplate> + </Setter.Value> + </Setter> + <Style.Triggers> + <DataTrigger Binding="{Binding ElementName=view,Path=DataContext.Job.ColorSpace.Name,IsAsync=True}" Value="RGB"> + <Setter Property="ContentTemplate" Value="{StaticResource RGB_Template}" /> + </DataTrigger> + <DataTrigger Binding="{Binding ElementName=view,Path=DataContext.Job.ColorSpace.Name,IsAsync=True}" Value="CMYK"> + <Setter Property="ContentTemplate" Value="{StaticResource CMYK_Template}" /> + </DataTrigger> + <DataTrigger Binding="{Binding ElementName=view,Path=DataContext.Job.ColorSpace.Name,IsAsync=True}" Value="LAB"> + <Setter Property="ContentTemplate" Value="{StaticResource LAB_Template}" /> + </DataTrigger> + <DataTrigger Binding="{Binding ElementName=view,Path=DataContext.Job.ColorSpace.Name,IsAsync=True}" Value="Catalog"> + <Setter Property="ContentTemplate" Value="{StaticResource CATALOG_Template}" /> + </DataTrigger> + <DataTrigger Binding="{Binding ElementName=view,Path=DataContext.Job.ColorSpace.Name,IsAsync=True}" Value="Volume"> + <Setter Property="ContentTemplate" Value="{StaticResource Volume_Template}" /> + </DataTrigger> + <DataTrigger Binding="{Binding IsTransparent,IsAsync=True}" Value="True"> + <Setter Property="ContentTemplate"> + <Setter.Value> + <DataTemplate> + <Grid Height="40"> + <TextBlock VerticalAlignment="Bottom" Foreground="{StaticResource TangoGrayBrush}">Transparent</TextBlock> + </Grid> + </DataTemplate> + </Setter.Value> + </Setter> + </DataTrigger> + </Style.Triggers> + </Style> + </ContentControl.Style> + </ContentControl> + </StackPanel> + </Grid> + </DockPanel> + <Canvas> + <Canvas.Style> + <Style TargetType="Canvas"> + <Setter Property="Visibility" Value="Collapsed"></Setter> + <Style.Triggers> + <MultiDataTrigger> + <MultiDataTrigger.Conditions> + <Condition Binding="{Binding Converter={StaticResource IsSegmentGradientConverter},IsAsync=True}" Value="False" /> + <Condition Binding="{Binding BrushStops[0].IsOutOfGamut,IsAsync=True}" Value="True" /> + </MultiDataTrigger.Conditions> + <Setter Property="Visibility" Value="Visible"></Setter> + </MultiDataTrigger> + </Style.Triggers> + </Style> + </Canvas.Style> + <TextBlock Canvas.Top="2" Foreground="{StaticResource TangoErrorBrush}" FontSize="{StaticResource TangoSmallFontSize}" Text="Color is out of gamut. Modify color or select an alternative."></TextBlock> + </Canvas> + <DockPanel LastChildFill="False" Margin="0 20 0 0"> + <TextBlock VerticalAlignment="Bottom" DockPanel.Dock="Left" Text="Length (m):"></TextBlock> + <touch:TouchNumericTextBox Width="180" DockPanel.Dock="Right" Value="{Binding Length}" StringFormat="0.0" AutoCalculateJogStep="False" HasDecimalPoint="True" Minimum="1" Maximum="100000" KeyboardContainer="{Binding ElementName=Container}" /> + </DockPanel> + </StackPanel> + </Grid> </DockPanel> <StackPanel Orientation="Horizontal" HorizontalAlignment="Right" VerticalAlignment="Top" Margin="0 10 10 0"> @@ -334,23 +402,27 @@ </TextBlock.Style> </TextBlock> - <touch:TouchImageButton Command="{Binding ElementName=view,Path=DataContext.ReplaceBrushStopCommand}" CommandParameter="{Binding BrushStops[0]}" Width="50" Height="50" Padding="10" Image="{StaticResource Image_Replace_Color}" CornerRadius="30"> - <touch:TouchImageButton.Style> - <Style TargetType="{x:Type touch:TouchImageButton}" BasedOn="{StaticResource {x:Type touch:TouchImageButton}}"> + <StackPanel Orientation="Horizontal"> + <StackPanel.Style> + <Style TargetType="StackPanel"> <Setter Property="Visibility" Value="Collapsed"></Setter> <Style.Triggers> <MultiDataTrigger> <MultiDataTrigger.Conditions> + <Condition Binding="{Binding ElementName=toggleEdit,Path=IsChecked,IsAsync=True}" Value="False" /> <Condition Binding="{Binding ElementName=toggle_large_list,Path=IsChecked,IsAsync=True}" Value="True" /> <Condition Binding="{Binding Converter={StaticResource IsSegmentGradientConverter},IsAsync=True}" Value="False" /> - <Condition Binding="{Binding BrushStops[0].IsOutOfGamut,IsAsync=True}" Value="True" /> </MultiDataTrigger.Conditions> <Setter Property="Visibility" Value="Visible"></Setter> </MultiDataTrigger> </Style.Triggers> </Style> - </touch:TouchImageButton.Style> - </touch:TouchImageButton> + </StackPanel.Style> + + <!--<touch:TouchToggleIconButton Padding="15" Width="60" Height="60" CornerRadius="30" Icon="EyeOutline" CheckedIcon="EyeOffOutline" Foreground="{StaticResource TangoGrayBrush}" CheckedForeground="{StaticResource TangoGrayBrush}" IsChecked="{Binding BrushStops[0].IsTransparent,IsAsync=True}"></touch:TouchToggleIconButton>--> + + <touch:TouchImageButton Visibility="{Binding BrushStops[0].ColorSpace,Converter={StaticResource ColorSpaceToVisibilityConverter},IsAsync=True}" Command="{Binding ElementName=view,Path=DataContext.ReplaceBrushStopCommand}" CommandParameter="{Binding BrushStops[0]}" Width="50" Height="50" Padding="10" Image="{StaticResource Image_Replace_Color}" CornerRadius="30"></touch:TouchImageButton> + </StackPanel> <StackPanel Visibility="{Binding ElementName=toggleEdit,Path=IsChecked,Converter={StaticResource BooleanToVisibilityConverter},IsAsync=True}" Orientation="Horizontal"> @@ -454,9 +526,9 @@ <touch:TouchComboBox ItemsSource="{Binding Rmls}" SelectedItem="{Binding Job.Rml}" DisplayMemberPath="Name" Title="Select Thread" /> <TextBlock>Comment:</TextBlock> - <TextBox Margin="20 0 0 -42" Text="{Binding Job.Description}" FocusVisualStyle="{x:Null}" BorderBrush="{StaticResource TangoDividerBrush}" Foreground="{StaticResource TangoDarkForegroundBrush}" AcceptsReturn="True" TextWrapping="Wrap" Height="60" Padding="5" keyboard:KeyboardView.Container="{Binding ElementName=Container}" keyboard:KeyboardView.Mode="AlphaNumeric"> + <touch:TouchMultiLineTextBox Margin="20 0 0 -42" Text="{Binding Job.Description}" Height="60" keyboard:KeyboardView.Container="{Binding ElementName=Container}"> - </TextBox> + </touch:TouchMultiLineTextBox> </controls:TableGrid> <Grid HorizontalAlignment="Center" Margin="0 20 0 0" TextElement.Foreground="{StaticResource TangoGrayTextBrush}"> @@ -559,7 +631,6 @@ <touch:TouchToggleImageButton x:Name="toggleEdit" UncheckedImage="../Images/pencil-gray.png" CheckedImage="../Images/pencil-blue.png" DockPanel.Dock="Right" - IsChecked="{Binding IsSelected}" Padding="8" CornerRadius="30" Width="40" Height="40"> </touch:TouchToggleImageButton> <!--<touch:TouchToggleIconButton x:Name="toggleEdit" DockPanel.Dock="Right" Icon="Pencil" CheckedIcon="Pencil" Padding="8" CornerRadius="20" />--> @@ -647,63 +718,61 @@ </touch:TouchDropShadowBorder> </touch:TouchVirtualizedContentControl> - <touch:TouchVirtualizedContentControl Margin="0 20 0 0" > - <touch:TouchDropShadowBorder Padding="0 0 0 50"> - <StackPanel> - <StackPanel Orientation="Horizontal" VerticalAlignment="Center" Style="{StaticResource Level1Container}"> - <Image Source="../Images/JobView/job-summary.png" Width="39" /> - <TextBlock FontWeight="Medium" Margin="20 0 0 0" VerticalAlignment="Center" FontSize="{StaticResource TangoExpanderHeaderFontSize}">Job Summary</TextBlock> - </StackPanel> + <touch:TouchDropShadowBorder Padding="0 20 0 50" Margin="0 0 0 15"> + <StackPanel> + <StackPanel Orientation="Horizontal" VerticalAlignment="Center" Style="{StaticResource Level1Container}"> + <Image Source="../Images/JobView/job-summary.png" Width="39" /> + <TextBlock FontWeight="Medium" Margin="20 0 0 0" VerticalAlignment="Center" FontSize="{StaticResource TangoExpanderHeaderFontSize}">Job Summary</TextBlock> + </StackPanel> - <StackPanel Style="{StaticResource Level2ContainerExtraMargin}"> - <Grid> - <localControls:JobSummeryViewer DataContext="{Binding Job,IsAsync=True}" Height="40"/> - </Grid> + <StackPanel Style="{StaticResource Level2ContainerExtraMargin}"> + <Grid> + <localControls:JobSummeryViewer DataContext="{Binding Job,IsAsync=True}" Height="40"/> + </Grid> - <DockPanel Margin="0 30 0 0" LastChildFill="False"> + <DockPanel Margin="0 30 0 0" LastChildFill="False"> - <StackPanel Orientation="Horizontal" DockPanel.Dock="Left" VerticalAlignment="Center"> - <TextBlock> + <StackPanel Orientation="Horizontal" DockPanel.Dock="Left" VerticalAlignment="Center"> + <TextBlock> <Run Text="Job length (m):"></Run> <Run Text="{Binding Job.Length,Mode=OneWay}"></Run> - </TextBlock> - <TextBlock Foreground="{StaticResource TangoGrayTextBrush}"> - <TextBlock.Style> - <Style TargetType="TextBlock"> - <Setter Property="Visibility" Value="Collapsed"></Setter> - <Style.Triggers> - <DataTrigger Binding="{Binding Job.LengthPercentageFactor,Converter={StaticResource GreaterThanToBooleanConverter},ConverterParameter=0}" Value="True"> - <Setter Property="Visibility" Value="Visible"></Setter> - </DataTrigger> - </Style.Triggers> - </Style> - </TextBlock.Style> + </TextBlock> + <TextBlock Foreground="{StaticResource TangoGrayTextBrush}"> + <TextBlock.Style> + <Style TargetType="TextBlock"> + <Setter Property="Visibility" Value="Collapsed"></Setter> + <Style.Triggers> + <DataTrigger Binding="{Binding Job.LengthPercentageFactor,Converter={StaticResource GreaterThanToBooleanConverter},ConverterParameter=0}" Value="True"> + <Setter Property="Visibility" Value="Visible"></Setter> + </DataTrigger> + </Style.Triggers> + </Style> + </TextBlock.Style> <Run>(</Run><Run Text="{Binding Job.Length,Mode=OneWay}"></Run><Run>+</Run><Run Text="{Binding Job.LengthPercentageFactor,Mode=OneWay}"></Run><Run>%</Run><Run>)</Run> - </TextBlock> - </StackPanel> + </TextBlock> + </StackPanel> - <StackPanel DockPanel.Dock="Right" Orientation="Horizontal" HorizontalAlignment="Right" VerticalAlignment="Center" Margin="0 -20 5 0"> - <TextBlock Margin="0 3 0 0" Foreground="{StaticResource TangoGrayTextBrush}" VerticalAlignment="Bottom"> + <StackPanel DockPanel.Dock="Right" Orientation="Horizontal" HorizontalAlignment="Right" VerticalAlignment="Center" Margin="0 -20 5 0"> + <TextBlock Margin="0 3 0 0" Foreground="{StaticResource TangoGrayTextBrush}" VerticalAlignment="Bottom"> <Run Text="Factor: +"></Run> - </TextBlock> + </TextBlock> - <touch:TouchNumericTextBox Foreground="{StaticResource TangoGrayTextBrush}" Margin="5 0 0 0" Width="50" HorizontalContentAlignment="Center" Maximum="100" Minimum="0" Value="{Binding Job.LengthPercentageFactor}" KeyboardContainer="{Binding ElementName=Container}" StringFormat="0" FocusSelectionMode="SelectAll" /> + <touch:TouchNumericTextBox Foreground="{StaticResource TangoGrayTextBrush}" Margin="5 0 0 0" Width="50" HorizontalContentAlignment="Center" Maximum="100" Minimum="0" Value="{Binding Job.LengthPercentageFactor}" KeyboardContainer="{Binding ElementName=Container}" StringFormat="0" FocusSelectionMode="SelectAll" /> - <TextBlock VerticalAlignment="Bottom" Foreground="{StaticResource TangoGrayTextBrush}">%</TextBlock> + <TextBlock VerticalAlignment="Bottom" Foreground="{StaticResource TangoGrayTextBrush}">%</TextBlock> - <Image Margin="10 0 0 0" Source="../Images/JobView/settings.png" VerticalAlignment="Bottom" /> - </StackPanel> - </DockPanel> - </StackPanel> + <Image Margin="10 0 0 0" Source="../Images/JobView/settings.png" VerticalAlignment="Bottom" /> + </StackPanel> + </DockPanel> </StackPanel> - </touch:TouchDropShadowBorder> - </touch:TouchVirtualizedContentControl> + </StackPanel> + </touch:TouchDropShadowBorder> - <StackPanel HorizontalAlignment="Center" Margin="20 40 0 40" Orientation="Horizontal" VerticalAlignment="Center" Style="{StaticResource Level1Container}"> + <StackPanel Visibility="Collapsed" HorizontalAlignment="Center" Margin="20 40 0 40" Orientation="Horizontal" VerticalAlignment="Center" Style="{StaticResource Level1Container}"> <TextBlock FontWeight="Medium" Margin="20 0 0 0" VerticalAlignment="Center" FontSize="{StaticResource TangoTitleFontSize}">Additional Tools</TextBlock> </StackPanel> - <touch:TouchVirtualizedContentControl> + <!--<touch:TouchVirtualizedContentControl> <touch:TouchExpander x:Name="expander_sample_dye" Margin="0 0 0 0" Padding="20 15"> <touch:TouchExpander.Header> <StackPanel Orientation="Horizontal" VerticalAlignment="Center" Margin="0 0 20 0"> @@ -871,7 +940,7 @@ </touch:TouchVirtualizedContentControl> <touch:TouchVirtualizedContentControl> - <touch:TouchExpander x:Name="expander_fine_tuning" Margin="0 20 0 120" Padding="20 15" IsExpanded="{Binding IsFineTuneExpanded,Mode=TwoWay}" Visibility="{Binding Job.ColorSpace,Converter={StaticResource ColorSpaceToVisibilityConverter}}"> + <touch:TouchExpander x:Name="expander_fine_tuning" Margin="0 20 0 120" Padding="20 15" IsExpanded="{Binding IsFineTuneExpanded,Mode=TwoWay}" Visibility="{Binding Job.ColorSpace,Converter={StaticResource ColorSpaceToVisibilityConverter},ConverterParameter='RGB,LAB'}"> <touch:TouchExpander.Header> <StackPanel Orientation="Horizontal" VerticalAlignment="Center" Margin="0 0 20 0"> <Image Source="../Images/JobView/color-fine-tuning.png" Width="39" /> @@ -1102,7 +1171,7 @@ </ContentControl> </StackPanel> </touch:TouchExpander> - </touch:TouchVirtualizedContentControl> + </touch:TouchVirtualizedContentControl>--> </StackPanel> </StackPanel> </touch:LightTouchScrollViewer> diff --git a/Software/Visual_Studio/PPC/Modules/Tango.PPC.Jobs/Views/JobView.xaml.cs b/Software/Visual_Studio/PPC/Modules/Tango.PPC.Jobs/Views/JobView.xaml.cs index 880aa8a3a..86a8d2a37 100644 --- a/Software/Visual_Studio/PPC/Modules/Tango.PPC.Jobs/Views/JobView.xaml.cs +++ b/Software/Visual_Studio/PPC/Modules/Tango.PPC.Jobs/Views/JobView.xaml.cs @@ -54,16 +54,16 @@ namespace Tango.PPC.Jobs.Views public async void DisplaySampleDye() { - expander_sample_dye.IsExpanded = true; - await Task.Delay(500); - scrollViewer.ScrollToElement(expander_sample_dye); + //expander_sample_dye.IsExpanded = true; + //await Task.Delay(500); + //scrollViewer.ScrollToElement(expander_sample_dye); } public async void DisplayFineTuning() { - expander_fine_tuning.IsExpanded = true; - await Task.Delay(500); - scrollViewer.ScrollToElement(expander_fine_tuning); + //expander_fine_tuning.IsExpanded = true; + //await Task.Delay(500); + //scrollViewer.ScrollToElement(expander_fine_tuning); } public void OnNavigatedFrom() @@ -94,6 +94,10 @@ namespace Tango.PPC.Jobs.Views borderEditDock.Visibility = Visibility.Collapsed; } } + else if (_is_edit_docked) + { + FloatEditing(); + } } private void DockEditing() diff --git a/Software/Visual_Studio/PPC/Modules/Tango.PPC.Jobs/Views/JobsView.xaml b/Software/Visual_Studio/PPC/Modules/Tango.PPC.Jobs/Views/JobsView.xaml index c615583bc..94abe6b83 100644 --- a/Software/Visual_Studio/PPC/Modules/Tango.PPC.Jobs/Views/JobsView.xaml +++ b/Software/Visual_Studio/PPC/Modules/Tango.PPC.Jobs/Views/JobsView.xaml @@ -214,14 +214,14 @@ <touch:LightTouchDataGridColumn Width="1*" Header="Name" SortMember="Name" HorizontalContentAlignment="Left"> <touch:LightTouchDataGridColumn.CellTemplate> <DataTemplate> - <controls:FastTextBlock IsHitTestVisible="False" Text="{Binding Name,IsAsync=True}"></controls:FastTextBlock> + <TextBlock IsHitTestVisible="False" Text="{Binding Name,Converter={StaticResource StringEllipsisConverter},ConverterParameter='40'}"></TextBlock> </DataTemplate> </touch:LightTouchDataGridColumn.CellTemplate> </touch:LightTouchDataGridColumn> <touch:LightTouchDataGridColumn Width="117" Header="Length (m)" SortMember="Length"> <touch:LightTouchDataGridColumn.CellTemplate> <DataTemplate> - <controls:FastTextBlock IsHitTestVisible="False" Text="{Binding Length,StringFormat=0.0,IsAsync=True}"></controls:FastTextBlock> + <TextBlock IsHitTestVisible="False" Text="{Binding Length,StringFormat=0.0}"></TextBlock> </DataTemplate> </touch:LightTouchDataGridColumn.CellTemplate> </touch:LightTouchDataGridColumn> @@ -235,7 +235,7 @@ <touch:LightTouchDataGridColumn Width="100" Header="Updated" SortMember="LastUpdated"> <touch:LightTouchDataGridColumn.CellTemplate> <DataTemplate> - <controls:FastTextBlock IsHitTestVisible="False" Text="{Binding LastUpdated,Converter={StaticResource DateTimeUTCToShortDateConverter},IsAsync=True}"></controls:FastTextBlock> + <TextBlock IsHitTestVisible="False" Text="{Binding LastUpdated,Converter={StaticResource DateTimeUTCToShortDateConverter}}"></TextBlock> </DataTemplate> </touch:LightTouchDataGridColumn.CellTemplate> </touch:LightTouchDataGridColumn> @@ -314,21 +314,21 @@ <touch:LightTouchDataGridColumn Width="100" Header="Status" SortMember="JobStatus" HorizontalContentAlignment="Left"> <touch:LightTouchDataGridColumn.CellTemplate> <DataTemplate> - <controls:FastTextBlock IsHitTestVisible="False" Text="{Binding JobStatus,Converter={StaticResource EnumToDescriptionConverter},IsAsync=True}" HorizontalAlignment="Left" VerticalAlignment="Center"></controls:FastTextBlock> + <TextBlock IsHitTestVisible="False" Text="{Binding JobStatus,Converter={StaticResource EnumToDescriptionConverter}}" HorizontalAlignment="Left" VerticalAlignment="Center"></TextBlock> </DataTemplate> </touch:LightTouchDataGridColumn.CellTemplate> </touch:LightTouchDataGridColumn> <touch:LightTouchDataGridColumn Width="1*" Header="Name" SortMember="Name" HorizontalContentAlignment="Left"> <touch:LightTouchDataGridColumn.CellTemplate> <DataTemplate> - <controls:FastTextBlock IsHitTestVisible="False" Text="{Binding Name,IsAsync=True}" HorizontalAlignment="Left" VerticalAlignment="Center"></controls:FastTextBlock> + <TextBlock IsHitTestVisible="False" Text="{Binding Name,Converter={StaticResource StringEllipsisConverter},ConverterParameter='40'}" HorizontalAlignment="Left" VerticalAlignment="Center"></TextBlock> </DataTemplate> </touch:LightTouchDataGridColumn.CellTemplate> </touch:LightTouchDataGridColumn> <touch:LightTouchDataGridColumn Width="117" Header="Length (m)" SortMember="Length"> <touch:LightTouchDataGridColumn.CellTemplate> <DataTemplate> - <controls:FastTextBlock IsHitTestVisible="False" Text="{Binding Length,StringFormat=0.0,IsAsync=True}"></controls:FastTextBlock> + <TextBlock IsHitTestVisible="False" Text="{Binding Length,StringFormat=0.0}"></TextBlock> </DataTemplate> </touch:LightTouchDataGridColumn.CellTemplate> </touch:LightTouchDataGridColumn> @@ -342,7 +342,7 @@ <touch:LightTouchDataGridColumn Width="100" Header="Updated" SortMember="LastUpdated"> <touch:LightTouchDataGridColumn.CellTemplate> <DataTemplate> - <controls:FastTextBlock IsHitTestVisible="False" Text="{Binding LastUpdated,Converter={StaticResource DateTimeUTCToShortDateConverter},IsAsync=True}"></controls:FastTextBlock> + <TextBlock IsHitTestVisible="False" Text="{Binding LastUpdated,Converter={StaticResource DateTimeUTCToShortDateConverter}}"></TextBlock> </DataTemplate> </touch:LightTouchDataGridColumn.CellTemplate> </touch:LightTouchDataGridColumn> diff --git a/Software/Visual_Studio/PPC/Modules/Tango.PPC.MachineSettings/MachineSettingsModule.cs b/Software/Visual_Studio/PPC/Modules/Tango.PPC.MachineSettings/MachineSettingsModule.cs index 477340357..807a70b10 100644 --- a/Software/Visual_Studio/PPC/Modules/Tango.PPC.MachineSettings/MachineSettingsModule.cs +++ b/Software/Visual_Studio/PPC/Modules/Tango.PPC.MachineSettings/MachineSettingsModule.cs @@ -15,7 +15,7 @@ namespace Tango.PPC.MachineSettings /// Represents a PPC <see cref="MachineSettingsModule"/>. /// </summary> /// <seealso cref="Tango.PPC.Common.PPCModuleBase" /> - [PPCModule(2)] + [PPCModule(4)] public class MachineSettingsModule : PPCModuleBase { /// <summary> diff --git a/Software/Visual_Studio/PPC/Modules/Tango.PPC.MachineSettings/ViewModels/MainViewVM.cs b/Software/Visual_Studio/PPC/Modules/Tango.PPC.MachineSettings/ViewModels/MainViewVM.cs index 8ed512670..20cfd6bf4 100644 --- a/Software/Visual_Studio/PPC/Modules/Tango.PPC.MachineSettings/ViewModels/MainViewVM.cs +++ b/Software/Visual_Studio/PPC/Modules/Tango.PPC.MachineSettings/ViewModels/MainViewVM.cs @@ -9,6 +9,7 @@ using System.Text; using System.Threading.Tasks; using System.Windows.Data; using Tango.BL; +using Tango.BL.Builders; using Tango.BL.Entities; using Tango.BL.Enumerations; using Tango.Core.Commands; @@ -18,6 +19,8 @@ using Tango.PPC.Common; using Tango.PPC.Common.Connection; using Tango.PPC.Common.ExternalBridge; using Tango.PPC.Common.Messages; +using Tango.PPC.Common.OS; +using Tango.PPC.Common.UWF; using Tango.SharedUI.Components; using Tango.WiFi; @@ -29,8 +32,17 @@ namespace Tango.PPC.MachineSettings.ViewModels /// <seealso cref="Tango.PPC.Common.PPCViewModel" /> public class MainViewVM : PPCViewModel { + private TimeZoneInfo _previousTimeZone; + private bool _previousEnableUWF; + #region Properties + [TangoInject] + private IOperationSystemManager OperationSystemManager { get; set; } + + [TangoInject] + private IUnifiedWriteFilterManager UnifiedWriteFilterManager { get; set; } + private Machine _machine; public Machine Machine { @@ -52,6 +64,13 @@ namespace Tango.PPC.MachineSettings.ViewModels set { _selectedColorSpaces = value; RaisePropertyChangedAuto(); } } + private ObservableCollection<Rml> _rmls; + public ObservableCollection<Rml> Rmls + { + get { return _rmls; } + set { _rmls = value; RaisePropertyChangedAuto(); } + } + private bool _enableHotSpot; public bool EnableHotSpot { @@ -108,6 +127,69 @@ namespace Tango.PPC.MachineSettings.ViewModels set { _lockScreenPassword = value; RaisePropertyChangedAuto(); } } + private Rml _defaultRML; + public Rml DefaultRML + { + get { return _defaultRML; } + set { _defaultRML = value; RaisePropertyChangedAuto(); } + } + + private SpoolType _defaultSpoolType; + public SpoolType DefaultSpoolType + { + get { return _defaultSpoolType; } + set { _defaultSpoolType = value; RaisePropertyChangedAuto(); } + } + + private bool _synchronizeJobs; + public bool SynchronizeJobs + { + get { return _synchronizeJobs; } + set { _synchronizeJobs = value; RaisePropertyChangedAuto(); InvalidateRelayCommands(); } + } + + private bool _synchronizeDiagnostics; + public bool SynchronizeDiagnostics + { + get { return _synchronizeDiagnostics; } + set { _synchronizeDiagnostics = value; RaisePropertyChangedAuto(); InvalidateRelayCommands(); } + } + + private bool _autoCheckForUpdates; + public bool AutoCheckForUpdates + { + get { return _autoCheckForUpdates; } + set { _autoCheckForUpdates = value; RaisePropertyChangedAuto(); } + } + + private List<TimeZoneInfo> _timeZones; + /// <summary> + /// Gets or sets the available time zones. + /// </summary> + public List<TimeZoneInfo> TimeZones + { + get { return _timeZones; } + set { _timeZones = value; RaisePropertyChangedAuto(); } + } + + private TimeZoneInfo _selectedTimeZone; + /// <summary> + /// Gets or sets the selected time zone. + /// </summary> + public TimeZoneInfo SelectedTimeZone + { + get { return _selectedTimeZone; } + set { _selectedTimeZone = value; RaisePropertyChangedAuto(); } + } + + private bool _enableUWF; + public bool EnableUWF + { + get { return _enableUWF; } + set { _enableUWF = value; RaisePropertyChangedAuto(); } + } + + #endregion #region Commands @@ -122,12 +204,18 @@ namespace Tango.PPC.MachineSettings.ViewModels /// </summary> public RelayCommand DiscardCommand { get; set; } + /// <summary> + /// Gets or sets the synchronize command. + /// </summary> + public RelayCommand SynchronizeCommand { get; set; } + #endregion public MainViewVM() { SaveCommand = new RelayCommand(Save); DiscardCommand = new RelayCommand(Discard); + SynchronizeCommand = new RelayCommand(Synchronize, () => !MachineDataSynchronizer.IsSynchronizing && IsFree); } private void Discard() @@ -139,9 +227,9 @@ namespace Tango.PPC.MachineSettings.ViewModels { if (Validate()) { - Machine.SupportedJobTypes = SelectedJobTypes.SynchedSource.ToList(); - Machine.SupportedColorSpaces = SelectedColorSpaces.SynchedSource.ToList(); - Machine.MapPrimitivesWithStrings(MachineProvider.Machine); + Settings.SupportedJobTypes = SelectedJobTypes.SynchedSource.ToList(); + Settings.SupportedColorSpaces = SelectedColorSpaces.SynchedSource.ToList(); + Machine.MapPropertiesTo(MachineProvider.Machine, MappingFlags.NoReferenceTypes); Settings.EnableHotSpot = EnableHotSpot; Settings.HotSpotPassword = HotSpotPassword; @@ -150,10 +238,73 @@ namespace Tango.PPC.MachineSettings.ViewModels Settings.EnableLockScreen = EnableLockScreen; Settings.LockScreenTimeout = TimeSpan.FromMinutes(LockScreenTimeoutMinutes); Settings.LockScreenPassword = LockScreenPassword; + Settings.DefaultRmlGuid = DefaultRML?.Guid; + Settings.DefaultSpoolTypeGuid = DefaultSpoolType?.Guid; + Settings.SynchronizeJobs = SynchronizeJobs; + Settings.SynchronizeDiagnostics = SynchronizeDiagnostics; + Settings.AutoCheckForUpdates = AutoCheckForUpdates; + + MachineDataSynchronizer.IsEnabled = SynchronizeJobs || SynchronizeDiagnostics; + Settings.Save(); await MachineProvider.SaveMachine(); - await NavigationManager.NavigateBack(); + + bool isRestarting = false; + + if (_previousTimeZone.ToStringSafe() != SelectedTimeZone.ToStringSafe()) + { + if (await NotificationProvider.ShowQuestion("Changing the time zone requires the application to restart. Do you wish to restart the application?")) + { + try + { + LogManager.Log($"Setting new time zone to '{SelectedTimeZone.ToString()}'."); + NotificationProvider.SetGlobalBusyMessage("Setting new time zone..."); + await OperationSystemManager.ChangeTimeZone(SelectedTimeZone); + NotificationProvider.ReleaseGlobalBusyMessage(); + isRestarting = true; + ApplicationManager.Restart(); + } + catch (Exception ex) + { + LogManager.Log(ex, "Error changing the time zone."); + NotificationProvider.ReleaseGlobalBusyMessage(); + await NotificationProvider.ShowError($"Error setting timezone.\n{ex.FlattenMessage()}"); + } + } + } + + if (_previousEnableUWF != EnableUWF) + { + await NotificationProvider.ShowWarning("Changes to disk protection (UWF) will take effect only after a full system restart."); + + try + { + LogManager.Log($"Changing UWF mode to '{EnableUWF}'."); + if (EnableUWF) + { + NotificationProvider.SetGlobalBusyMessage("Enabling disk protection (UWF)..."); + await UnifiedWriteFilterManager.Enable(); + } + else + { + NotificationProvider.SetGlobalBusyMessage("Disabling disk protection (UWF)..."); + await UnifiedWriteFilterManager.Disable(); + } + NotificationProvider.ReleaseGlobalBusyMessage(); + } + catch (Exception ex) + { + NotificationProvider.ReleaseGlobalBusyMessage(); + LogManager.Log(ex, "Error setting UWF mode."); + await NotificationProvider.ShowError($"Could not change the disk protection mode\n{ex.FlattenMessage()}"); + } + } + + if (!isRestarting) + { + await NavigationManager.NavigateBack(); + } } } @@ -167,10 +318,29 @@ namespace Tango.PPC.MachineSettings.ViewModels /// </summary> public override void OnApplicationStarted() { + try + { + TimeZones = OperationSystemManager.GetAvailableTimeZones().ToList(); + } + catch (Exception ex) + { + LogManager.Log(ex, "Error retrieving available time zones."); + } + } + + public async override void OnApplicationReady() + { + base.OnApplicationReady(); + MachineDataSynchronizer.SynchronizationStarted += (_, __) => InvalidateRelayCommands(); + MachineDataSynchronizer.SynchronizationEnded += (_, __) => InvalidateRelayCommands(); + using (ObservablesContext db = ObservablesContext.CreateDefault()) + { + Rmls = await new RmlsCollectionBuilder(db).SetAll().ForHeadType(MachineProvider.Machine.MachineHeadType).ForSite(MachineProvider.Machine.SiteGuid).BuildAsync(); + } } - public override void OnNavigatedTo() + public async override void OnNavigatedTo() { base.OnNavigatedTo(); @@ -195,8 +365,29 @@ namespace Tango.PPC.MachineSettings.ViewModels LockScreenTimeoutMinutes = (int)Settings.LockScreenTimeout.TotalMinutes; LockScreenPassword = Settings.LockScreenPassword; - SelectedJobTypes = new SelectedObjectCollection<JobTypes>(Enum.GetValues(typeof(JobTypes)).Cast<JobTypes>().ToObservableCollection(), Machine.SupportedJobTypes.ToObservableCollection()); - SelectedColorSpaces = new SelectedObjectCollection<ColorSpaces>(Enum.GetValues(typeof(ColorSpaces)).Cast<ColorSpaces>().Where(x => x.IsUserSpace()).ToObservableCollection(), Machine.SupportedColorSpaces.ToObservableCollection()); + SelectedJobTypes = new SelectedObjectCollection<JobTypes>(Enum.GetValues(typeof(JobTypes)).Cast<JobTypes>().ToObservableCollection(), Settings.SupportedJobTypes.ToObservableCollection()); + SelectedColorSpaces = new SelectedObjectCollection<ColorSpaces>(Enum.GetValues(typeof(ColorSpaces)).Cast<ColorSpaces>().Where(x => x.IsUserSpace()).ToObservableCollection(), Settings.SupportedColorSpaces.ToObservableCollection()); + + DefaultRML = Adapter.Rmls.SingleOrDefault(x => x.Guid == Settings.DefaultRmlGuid); + DefaultSpoolType = Adapter.SpoolTypes.SingleOrDefault(x => x.Guid == Settings.DefaultSpoolTypeGuid); + + SynchronizeJobs = Settings.SynchronizeJobs; + SynchronizeDiagnostics = Settings.SynchronizeDiagnostics; + + AutoCheckForUpdates = Settings.AutoCheckForUpdates; + + SelectedTimeZone = TimeZones.SingleOrDefault(x => x.StandardName == TimeZone.CurrentTimeZone.StandardName); + _previousTimeZone = SelectedTimeZone; + + try + { + EnableUWF = await UnifiedWriteFilterManager.IsEnabled(); + _previousEnableUWF = EnableUWF; + } + catch (Exception ex) + { + LogManager.Log(ex, "Error getting UWF status."); + } } private async void OnEnableRemoteAssistanceChanged() @@ -271,5 +462,29 @@ namespace Tango.PPC.MachineSettings.ViewModels { ExternalBridgeService.Enabled = EnableExternalBridge; } + + private async void Synchronize() + { + try + { + IsFree = false; + NotificationProvider.SetGlobalBusyMessage("Synchronizing..."); + + await MachineDataSynchronizer.Synchronize(); + + NotificationProvider.ReleaseGlobalBusyMessage(); + await NotificationProvider.ShowSuccess("Synchronization completed successfully."); + } + catch (Exception ex) + { + NotificationProvider.ReleaseGlobalBusyMessage(); + await NotificationProvider.ShowError($"Error occurred while trying to synchronize.\n{ex.FlattenMessage()}"); + } + finally + { + NotificationProvider.ReleaseGlobalBusyMessage(); + IsFree = true; + } + } } } diff --git a/Software/Visual_Studio/PPC/Modules/Tango.PPC.MachineSettings/Views/MainView.xaml b/Software/Visual_Studio/PPC/Modules/Tango.PPC.MachineSettings/Views/MainView.xaml index dd5f89bb2..ba3516be4 100644 --- a/Software/Visual_Studio/PPC/Modules/Tango.PPC.MachineSettings/Views/MainView.xaml +++ b/Software/Visual_Studio/PPC/Modules/Tango.PPC.MachineSettings/Views/MainView.xaml @@ -5,15 +5,19 @@ xmlns:d="http://schemas.microsoft.com/expression/blend/2008" xmlns:enumerations="clr-namespace:Tango.BL.Enumerations;assembly=Tango.BL" xmlns:touch="clr-namespace:Tango.Touch.Controls;assembly=Tango.Touch" + xmlns:keyboard="clr-namespace:Tango.Touch.Keyboard;assembly=Tango.Touch" + xmlns:sys="clr-namespace:System.Collections;assembly=mscorlib" xmlns:controls="clr-namespace:Tango.SharedUI.Controls;assembly=Tango.SharedUI" xmlns:vm="clr-namespace:Tango.PPC.MachineSettings.ViewModels" xmlns:connectivity="clr-namespace:Tango.PPC.Common.Connectivity;assembly=Tango.PPC.Common" + xmlns:adapters="clr-namespace:Tango.Transport.Adapters;assembly=Tango.Transport" xmlns:global="clr-namespace:Tango.PPC.MachineSettings" + xmlns:integrationPMR="clr-namespace:Tango.PMR.Integration;assembly=Tango.PMR" xmlns:local="clr-namespace:Tango.PPC.MachineSettings.Views" mc:Ignorable="d" - d:DesignHeight="2500" d:DesignWidth="800" d:DataContext="{d:DesignInstance Type=vm:MainViewVM, IsDesignTimeCreatable=False}" DataContext="{x:Static global:ViewModelLocator.MainViewVM}"> + d:DesignHeight="4500" d:DesignWidth="800" d:DataContext="{d:DesignInstance Type=vm:MainViewVM, IsDesignTimeCreatable=False}" DataContext="{x:Static global:ViewModelLocator.MainViewVM}"> - <Grid Background="{StaticResource TangoMidBackgroundBrush}"> + <Grid Background="{StaticResource TangoMidBackgroundBrush}" IsEnabled="{Binding IsFree}"> <Grid.RowDefinitions> <RowDefinition Height="Auto"/> <RowDefinition Height="1*"/> @@ -83,7 +87,7 @@ </touch:TouchExpander> <!--JOBS--> - <touch:TouchExpander Margin="0 20 0 0" Header="JOBS" IsExpanded="True" FontSize="{StaticResource TangoExpanderHeaderFontSize}"> + <touch:TouchExpander Margin="0 20 0 0" Header="Jobs" IsExpanded="True" FontSize="{StaticResource TangoExpanderHeaderFontSize}"> <StackPanel> <controls:TableGrid Margin="10" RowHeight="70" MakeFirstColumnVerticalAlignmentBottom="False" TextElement.FontSize="{StaticResource TangoDefaultFontSize}"> <TextBlock VerticalAlignment="Center">Supported Job Types</TextBlock> @@ -136,14 +140,14 @@ </ItemsControl.ItemTemplate> </ItemsControl> - <TextBlock VerticalAlignment="Bottom">Default Thread Type</TextBlock> - <touch:TouchComboBox HorizontalAlignment="Right" VerticalAlignment="Bottom" Width="200" ItemsSource="{Binding Adapter.Rmls}" SelectedItem="{Binding Machine.DefaultRml}" DisplayMemberPath="Name" ValuePath="Guid"></touch:TouchComboBox> + <TextBlock VerticalAlignment="Bottom">Default Thread</TextBlock> + <touch:TouchComboBox HorizontalAlignment="Right" VerticalAlignment="Bottom" Width="200" ItemsSource="{Binding Rmls}" SelectedItem="{Binding DefaultRML}" DisplayMemberPath="Name"></touch:TouchComboBox> - <!--<TextBlock VerticalAlignment="Bottom">Default Spool</TextBlock> - <touch:TouchComboBox HorizontalAlignment="Right" VerticalAlignment="Bottom" Width="200" ItemsSource="{Binding Adapter.SpoolTypes}" SelectedItem="{Binding Machine.DefaultSpoolType}" DisplayMemberPath="Name"></touch:TouchComboBox>--> + <TextBlock VerticalAlignment="Bottom">Default Spool</TextBlock> + <touch:TouchComboBox HorizontalAlignment="Right" VerticalAlignment="Bottom" Width="200" ItemsSource="{Binding Adapter.SpoolTypes}" SelectedItem="{Binding DefaultSpoolType}" DisplayMemberPath="Name"></touch:TouchComboBox> <TextBlock VerticalAlignment="Bottom">Default Segment Length</TextBlock> - <touch:TouchNumericTextBox HorizontalAlignment="Right" VerticalAlignment="Bottom" Width="200" Minimum="1" Maximum="1000" Value="{Binding Machine.DefaultSegmentLength}" HasDecimalPoint="True" KeyboardContainer="{Binding ElementName=Container}"></touch:TouchNumericTextBox> + <touch:TouchNumericTextBox HorizontalAlignment="Right" VerticalAlignment="Bottom" Width="200" Minimum="1" Maximum="1000" Value="{Binding Settings.DefaultSegmentLength}" HasDecimalPoint="True" KeyboardContainer="{Binding ElementName=Container}"></touch:TouchNumericTextBox> </controls:TableGrid> @@ -195,6 +199,172 @@ </DockPanel> </StackPanel> </touch:TouchExpander> + + <!--SYNCHRONIZATION--> + <touch:TouchExpander Margin="0 20 0 0" Header="Cloud Synchronization" IsExpanded="True" FontSize="{StaticResource TangoExpanderHeaderFontSize}"> + <StackPanel Margin="10 30 10 10"> + + <DockPanel TextElement.FontSize="{StaticResource TangoDefaultFontSize}"> + <StackPanel> + <TextBlock VerticalAlignment="Center">Auto Update Check</TextBlock> + <DockPanel Margin="0 5 0 0"> + <touch:TouchIcon VerticalAlignment="Top" Icon="InformationOutline" Foreground="{StaticResource TangoGrayTextBrush}"></touch:TouchIcon> + <TextBlock Margin="10 0 0 0" VerticalAlignment="Top" TextWrapping="Wrap" FontSize="{StaticResource TangoSmallFontSize}" Foreground="{StaticResource TangoGrayTextBrush}"> + Automatically check for software and database updates. + </TextBlock> + </DockPanel> + </StackPanel> + <touch:TouchToggleSlider Margin="0 0 100 0" DockPanel.Dock="Right" Style="{StaticResource TangoToggleButtonGrayAccent}" HorizontalAlignment="Right" Width="90" IsChecked="{Binding AutoCheckForUpdates}"></touch:TouchToggleSlider> + </DockPanel> + + <DockPanel Margin="0 40 0 0" TextElement.FontSize="{StaticResource TangoDefaultFontSize}"> + <StackPanel> + <TextBlock VerticalAlignment="Center">Synchronize Jobs</TextBlock> + <DockPanel Margin="0 5 0 0"> + <touch:TouchIcon VerticalAlignment="Top" Icon="InformationOutline" Foreground="{StaticResource TangoGrayTextBrush}"></touch:TouchIcon> + <TextBlock Margin="10 0 0 0" VerticalAlignment="Top" TextWrapping="Wrap" FontSize="{StaticResource TangoSmallFontSize}" Foreground="{StaticResource TangoGrayTextBrush}"> + Synchronize your jobs with twine's cloud services. + </TextBlock> + </DockPanel> + </StackPanel> + <touch:TouchToggleSlider Margin="0 0 100 0" DockPanel.Dock="Right" Style="{StaticResource TangoToggleButtonGrayAccent}" HorizontalAlignment="Right" Width="90" IsChecked="{Binding SynchronizeJobs}"></touch:TouchToggleSlider> + </DockPanel> + + <DockPanel Margin="0 40 0 0" TextElement.FontSize="{StaticResource TangoDefaultFontSize}"> + <StackPanel> + <TextBlock VerticalAlignment="Center">Synchronize Diagnostics Data</TextBlock> + <DockPanel Margin="0 5 0 0"> + <touch:TouchIcon VerticalAlignment="Top" Icon="InformationOutline" Foreground="{StaticResource TangoGrayTextBrush}"></touch:TouchIcon> + <TextBlock Margin="10 0 0 0" VerticalAlignment="Top" TextWrapping="Wrap" FontSize="{StaticResource TangoSmallFontSize}" Foreground="{StaticResource TangoGrayTextBrush}"> + Help us improve your experience using this system. + </TextBlock> + </DockPanel> + </StackPanel> + <touch:TouchToggleSlider Margin="0 0 100 0" DockPanel.Dock="Right" Style="{StaticResource TangoToggleButtonGrayAccent}" HorizontalAlignment="Right" Width="90" IsChecked="{Binding SynchronizeDiagnostics}"></touch:TouchToggleSlider> + </DockPanel> + + <DockPanel Margin="0 40 0 0"> + <touch:TouchIcon VerticalAlignment="Top" Icon="InformationOutline" Foreground="{StaticResource TangoGrayTextBrush}"></touch:TouchIcon> + <TextBlock Margin="10 0 0 0" VerticalAlignment="Top" TextWrapping="Wrap" FontSize="{StaticResource TangoSmallFontSize}" Foreground="{StaticResource TangoGrayTextBrush}"> + Once enabled, synchronization occurs automatically in the background. you can choose to synchronize right now. + </TextBlock> + </DockPanel> + <touch:TouchButton Command="{Binding SynchronizeCommand}" IsEnabled="{Binding MachineDataSynchronizer.IsEnabled}" HorizontalAlignment="Left" Margin="25 10 0 0" Style="{StaticResource TangoHollowButton}" FontSize="{StaticResource TangoDefaultFontSize}" Padding="15 10" CornerRadius="22">Synchronize Now</touch:TouchButton> + </StackPanel> + </touch:TouchExpander> + + <!--DATE & TIME--> + <touch:TouchExpander Margin="0 20 0 0" Header="Date & Time" IsExpanded="True" FontSize="{StaticResource TangoExpanderHeaderFontSize}" Visibility="{Binding ApplicationManager.IsInTechnicianMode,Converter={StaticResource BooleanToVisibilityConverter}}"> + <StackPanel Margin="10 30 10 10"> + + <DockPanel TextElement.FontSize="{StaticResource TangoDefaultFontSize}"> + <StackPanel> + <TextBlock VerticalAlignment="Center">Time Zone</TextBlock> + <touch:TouchComboBox Margin="0 10 0 0" ItemsSource="{Binding TimeZones}" SelectedItem="{Binding SelectedTimeZone,Mode=TwoWay}"> + + </touch:TouchComboBox> + </StackPanel> + </DockPanel> + </StackPanel> + </touch:TouchExpander> + + <!--TECHNICIAN--> + <touch:TouchExpander Visibility="{Binding ApplicationManager.IsInTechnicianMode,Converter={StaticResource BooleanToVisibilityConverter}}" Margin="0 20 0 0" Header="Advanced" IsExpanded="True" FontSize="{StaticResource TangoExpanderHeaderFontSize}"> + <StackPanel Margin="10 30 10 10"> + + <DockPanel TextElement.FontSize="{StaticResource TangoDefaultFontSize}"> + <TextBlock VerticalAlignment="Center">Embedded COM Port</TextBlock> + <touch:TouchTextBox KeyboardContainer="{Binding ElementName=Container}" Text="{Binding Settings.EmbeddedComPort}" Margin="0 0 100 0" DockPanel.Dock="Right" HorizontalAlignment="Right" Width="90"></touch:TouchTextBox> + </DockPanel> + + <DockPanel Margin="0 20 0 0" TextElement.FontSize="{StaticResource TangoDefaultFontSize}"> + <TextBlock VerticalAlignment="Center">Emergency COM Port</TextBlock> + <touch:TouchTextBox KeyboardContainer="{Binding ElementName=Container}" Text="{Binding Settings.EmergencyComPort}" Margin="0 0 100 0" DockPanel.Dock="Right" HorizontalAlignment="Right" Width="90"></touch:TouchTextBox> + </DockPanel> + + <DockPanel Margin="0 20 0 0" TextElement.FontSize="{StaticResource TangoDefaultFontSize}"> + <TextBlock VerticalAlignment="Center">Enable Emergency Screen</TextBlock> + <touch:TouchToggleSlider IsChecked="{Binding Settings.EnableEmergencyNotifications}" Margin="0 0 100 0" DockPanel.Dock="Right" Style="{StaticResource TangoToggleButtonGrayAccent}" HorizontalAlignment="Right" Width="90"></touch:TouchToggleSlider> + </DockPanel> + + <DockPanel Margin="0 20 0 0" TextElement.FontSize="{StaticResource TangoDefaultFontSize}"> + <TextBlock VerticalAlignment="Center">Enable Embedded Debug Logs</TextBlock> + <touch:TouchToggleSlider IsChecked="{Binding Settings.EnableEmbeddedDebugLogs}" Margin="0 0 100 0" DockPanel.Dock="Right" Style="{StaticResource TangoToggleButtonGrayAccent}" HorizontalAlignment="Right" Width="90"></touch:TouchToggleSlider> + </DockPanel> + + <DockPanel Margin="0 20 0 0" TextElement.FontSize="{StaticResource TangoDefaultFontSize}"> + <TextBlock VerticalAlignment="Center">Enable Automatic Thread Loading Support</TextBlock> + <touch:TouchToggleSlider IsChecked="{Binding Settings.EnableAutomaticThreadLoading}" Margin="0 0 100 0" DockPanel.Dock="Right" Style="{StaticResource TangoToggleButtonGrayAccent}" HorizontalAlignment="Right" Width="90"></touch:TouchToggleSlider> + </DockPanel> + + <DockPanel Margin="0 20 0 0" TextElement.FontSize="{StaticResource TangoDefaultFontSize}"> + <TextBlock VerticalAlignment="Center">Display PowerUp Screen</TextBlock> + <touch:TouchToggleSlider IsChecked="{Binding Settings.DisplayPowerUpScreen}" Margin="0 0 100 0" DockPanel.Dock="Right" Style="{StaticResource TangoToggleButtonGrayAccent}" HorizontalAlignment="Right" Width="90"></touch:TouchToggleSlider> + </DockPanel> + + <DockPanel Margin="0 20 0 0" TextElement.FontSize="{StaticResource TangoDefaultFontSize}"> + <TextBlock VerticalAlignment="Center">Enable Job Liquid Quantity Validation</TextBlock> + <touch:TouchToggleSlider IsChecked="{Binding Settings.EnableJobLiquidQuantityValidation}" Margin="0 0 100 0" DockPanel.Dock="Right" Style="{StaticResource TangoToggleButtonGrayAccent}" HorizontalAlignment="Right" Width="90"></touch:TouchToggleSlider> + </DockPanel> + + <DockPanel Margin="0 20 0 0" TextElement.FontSize="{StaticResource TangoDefaultFontSize}"> + <TextBlock VerticalAlignment="Center">Always Start in Technician Mode</TextBlock> + <touch:TouchToggleSlider IsChecked="{Binding Settings.EnableTechnicianModeByDefault}" Margin="0 0 100 0" DockPanel.Dock="Right" Style="{StaticResource TangoToggleButtonGrayAccent}" HorizontalAlignment="Right" Width="90"></touch:TouchToggleSlider> + </DockPanel> + + <DockPanel Margin="0 20 0 0" TextElement.FontSize="{StaticResource TangoDefaultFontSize}"> + <TextBlock VerticalAlignment="Center">Enable External Bridge SignalR</TextBlock> + <touch:TouchToggleSlider IsChecked="{Binding Settings.EnableExternalBridgeSignalR}" Margin="0 0 100 0" DockPanel.Dock="Right" Style="{StaticResource TangoToggleButtonGrayAccent}" HorizontalAlignment="Right" Width="90"></touch:TouchToggleSlider> + </DockPanel> + + <DockPanel Margin="0 20 0 0" TextElement.FontSize="{StaticResource TangoDefaultFontSize}"> + <TextBlock VerticalAlignment="Center">Auto Update Check Interval Minutes</TextBlock> + <touch:TouchNumericTextBox Minimum="1" Maximum="120" KeyboardContainer="{Binding ElementName=Container}" Value="{Binding Settings.AutoUpdateCheckInterval,Converter={StaticResource TimeSpanToMinutesConverter}}" Margin="0 0 100 0" DockPanel.Dock="Right" HorizontalAlignment="Right" Width="90"></touch:TouchNumericTextBox> + </DockPanel> + + <DockPanel Margin="0 20 0 0" TextElement.FontSize="{StaticResource TangoDefaultFontSize}"> + <TextBlock VerticalAlignment="Center">Bypass Internet Connectivity Checks</TextBlock> + <touch:TouchToggleSlider IsChecked="{Binding Settings.BypassInternetConnectivityCheck}" Margin="0 0 100 0" DockPanel.Dock="Right" Style="{StaticResource TangoToggleButtonGrayAccent}" HorizontalAlignment="Right" Width="90"></touch:TouchToggleSlider> + </DockPanel> + + <DockPanel Margin="0 20 0 0" TextElement.FontSize="{StaticResource TangoDefaultFontSize}"> + <TextBlock VerticalAlignment="Center">Gradient Resolution CM</TextBlock> + <touch:TouchNumericTextBox Minimum="10" Maximum="500" KeyboardContainer="{Binding ElementName=Container}" Value="{Binding Settings.GradientGenerationResolution}" Margin="0 0 100 0" DockPanel.Dock="Right" HorizontalAlignment="Right" Width="90"></touch:TouchNumericTextBox> + </DockPanel> + + <DockPanel Margin="0 20 0 0" TextElement.FontSize="{StaticResource TangoDefaultFontSize}"> + <TextBlock VerticalAlignment="Center">Enable Insights</TextBlock> + <touch:TouchToggleSlider IsChecked="{Binding Settings.InsightsEnabled}" Margin="0 0 100 0" DockPanel.Dock="Right" Style="{StaticResource TangoToggleButtonGrayAccent}" HorizontalAlignment="Right" Width="90"></touch:TouchToggleSlider> + </DockPanel> + + <DockPanel Margin="0 20 0 0" TextElement.FontSize="{StaticResource TangoDefaultFontSize}"> + <TextBlock VerticalAlignment="Center">Insights Sampling Interval (sec)</TextBlock> + <touch:TouchNumericTextBox Minimum="1" Maximum="300" KeyboardContainer="{Binding ElementName=Container}" Value="{Binding Settings.InsightsSamplingInterval,Converter={StaticResource TimeSpanToSecondsConverter}}" Margin="0 0 100 0" DockPanel.Dock="Right" HorizontalAlignment="Right" Width="90"></touch:TouchNumericTextBox> + </DockPanel> + + <DockPanel Margin="0 20 0 0" TextElement.FontSize="{StaticResource TangoDefaultFontSize}"> + <TextBlock VerticalAlignment="Center">Insights Storage Cleanup Interval (min)</TextBlock> + <touch:TouchNumericTextBox Minimum="1" Maximum="120" KeyboardContainer="{Binding ElementName=Container}" Value="{Binding Settings.InsightsStorageCleanupInterval,Converter={StaticResource TimeSpanToMinutesConverter}}" Margin="0 0 100 0" DockPanel.Dock="Right" HorizontalAlignment="Right" Width="90"></touch:TouchNumericTextBox> + </DockPanel> + + <DockPanel Margin="0 20 0 0" TextElement.FontSize="{StaticResource TangoDefaultFontSize}"> + <TextBlock VerticalAlignment="Center">Insights Max Storage Duration (days)</TextBlock> + <touch:TouchNumericTextBox Minimum="1" Maximum="120" KeyboardContainer="{Binding ElementName=Container}" Value="{Binding Settings.InsightsMaxStorageDuration,Converter={StaticResource TimeSpanToDaysConverter}}" Margin="0 0 100 0" DockPanel.Dock="Right" HorizontalAlignment="Right" Width="90"></touch:TouchNumericTextBox> + </DockPanel> + + <DockPanel Margin="0 20 0 0" TextElement.FontSize="{StaticResource TangoDefaultFontSize}"> + <TextBlock VerticalAlignment="Center">Enable UWF (Disk Protection)</TextBlock> + <touch:TouchToggleSlider IsChecked="{Binding EnableUWF}" Margin="0 0 100 0" DockPanel.Dock="Right" Style="{StaticResource TangoToggleButtonGrayAccent}" HorizontalAlignment="Right" Width="90"></touch:TouchToggleSlider> + </DockPanel> + + <DockPanel Margin="0 20 0 0"> + <touch:TouchIcon VerticalAlignment="Top" Icon="InformationOutline" Foreground="{StaticResource TangoGrayTextBrush}"></touch:TouchIcon> + <TextBlock Margin="10 0 0 0" VerticalAlignment="Top" TextWrapping="Wrap" FontSize="{StaticResource TangoSmallFontSize}" Foreground="{StaticResource TangoGrayTextBrush}"> + Please restart the application for advanced settings to take effect. + </TextBlock> + </DockPanel> + </StackPanel> + </touch:TouchExpander> </StackPanel> </touch:LightTouchScrollViewer> </Grid> diff --git a/Software/Visual_Studio/PPC/Modules/Tango.PPC.Maintenance/App.xaml b/Software/Visual_Studio/PPC/Modules/Tango.PPC.Maintenance/App.xaml new file mode 100644 index 000000000..cb7592abd --- /dev/null +++ b/Software/Visual_Studio/PPC/Modules/Tango.PPC.Maintenance/App.xaml @@ -0,0 +1,11 @@ +<Application x:Class="Tango.PPC.Maintenance.App" + xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" + xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"> + <Application.Resources> + <ResourceDictionary> + <ResourceDictionary.MergedDictionaries> + <ResourceDictionary Source="pack://application:,,,/Tango.PPC.Common;component/Resources/Merged.xaml" /> + </ResourceDictionary.MergedDictionaries> + </ResourceDictionary> + </Application.Resources> +</Application>
\ No newline at end of file diff --git a/Software/Visual_Studio/PPC/Modules/Tango.PPC.Maintenance/Commands/HomingMotorCommand.cs b/Software/Visual_Studio/PPC/Modules/Tango.PPC.Maintenance/Commands/HomingMotorCommand.cs new file mode 100644 index 000000000..d3f44fe7e --- /dev/null +++ b/Software/Visual_Studio/PPC/Modules/Tango.PPC.Maintenance/Commands/HomingMotorCommand.cs @@ -0,0 +1,80 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using Tango.PMR.Diagnostics; +using Tango.PMR.Hardware; + +namespace Tango.PPC.Maintenance.Commands +{ + public abstract class HomingMotorCommand : MaintenanceCommand<object> + { + public HardwareMotorType Motor { get; set; } + + public MotorDirection Direction { get; set; } + + public double Speed { get; set; } + + public String HomingMessage { get; set; } + + public String ErrorMessage { get; set; } + + public String SuccessMessage { get; set; } + + public HomingMotorCommand(HardwareMotorType motor, + MotorDirection direction, + double speed, + string homingMessage, + string errorMessage, + string successMessage) + { + Motor = motor; + Direction = direction; + Speed = speed; + HomingMessage = homingMessage; + ErrorMessage = errorMessage; + SuccessMessage = successMessage; + } + + protected override void OnExecute() + { + IsEnabled = false; + + try + { + NotificationProvider.SetGlobalBusyMessage(HomingMessage); + + MachineProvider.MachineOperator.StartMotorHoming(new PMR.Diagnostics.MotorHomingRequest() + { + Direction = Direction, + MotorType = Motor, + Speed = Speed, + }).Subscribe((response) => + { + //Next + }, (ex) => + { + //Error + IsEnabled = true; + NotificationProvider.ReleaseGlobalBusyMessage(); + LogManager.Log(ex, ErrorMessage); + NotificationProvider.ShowError(ex.FlattenMessage()); + }, () => + { + //Complete + IsEnabled = true; + NotificationProvider.ReleaseGlobalBusyMessage(); + NotificationProvider.ShowSuccess(SuccessMessage); + }); + } + catch (Exception ex) + { + LogManager.Log(ex, ErrorMessage); + NotificationProvider.ReleaseGlobalBusyMessage(); + NotificationProvider.ShowError(ex.FlattenMessage()); + IsEnabled = true; + } + } + } +} diff --git a/Software/Visual_Studio/PPC/Modules/Tango.PPC.Maintenance/Commands/OpenCloseDyeingHeadCommand.cs b/Software/Visual_Studio/PPC/Modules/Tango.PPC.Maintenance/Commands/OpenCloseDyeingHeadCommand.cs new file mode 100644 index 000000000..5c482e04c --- /dev/null +++ b/Software/Visual_Studio/PPC/Modules/Tango.PPC.Maintenance/Commands/OpenCloseDyeingHeadCommand.cs @@ -0,0 +1,31 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using Tango.Integration.Operation; +using Tango.PMR.Diagnostics; +using Tango.PMR.Hardware; + +namespace Tango.PPC.Maintenance.Commands +{ + public class OpenCloseDyeingHeadCommand : OpenCloseMotorCommand + { + public OpenCloseDyeingHeadCommand() : base( + HardwareMotorType.MotoDhLid, + MotorDirection.Backward, + 400, + 400, + MotorState.Closed, + "Opening dyeing head lid...", + "Closing dyeing head lid...", + "Error opening dyeing head lid.", + "Error closing dyeing head lid.", + "The dyeing head lid is now opened.", + "The dyeing head lid is now closed." + ) + { + + } + } +} diff --git a/Software/Visual_Studio/PPC/Modules/Tango.PPC.Maintenance/Commands/OpenCloseLeftLeadingWheelsCommand.cs b/Software/Visual_Studio/PPC/Modules/Tango.PPC.Maintenance/Commands/OpenCloseLeftLeadingWheelsCommand.cs new file mode 100644 index 000000000..b0d8c1dc5 --- /dev/null +++ b/Software/Visual_Studio/PPC/Modules/Tango.PPC.Maintenance/Commands/OpenCloseLeftLeadingWheelsCommand.cs @@ -0,0 +1,30 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using Tango.PMR.Diagnostics; +using Tango.PMR.Hardware; + +namespace Tango.PPC.Maintenance.Commands +{ + public class OpenCloseLeftLeadingWheelsCommand : OpenCloseMotorCommand + { + public OpenCloseLeftLeadingWheelsCommand() : base( + HardwareMotorType.MotoLloading, + MotorDirection.Backward, + 250, + 250, + MotorState.Closed, + "Opening left leading wheels...", + "Closing left leading wheels...", + "Error opening left leading wheels.", + "Error closing left leading wheels.", + "The left leading wheels are now opened.", + "The left leading wheels are now closed." + ) + { + + } + } +} diff --git a/Software/Visual_Studio/PPC/Modules/Tango.PPC.Maintenance/Commands/OpenCloseMotorCommand.cs b/Software/Visual_Studio/PPC/Modules/Tango.PPC.Maintenance/Commands/OpenCloseMotorCommand.cs new file mode 100644 index 000000000..149c3675d --- /dev/null +++ b/Software/Visual_Studio/PPC/Modules/Tango.PPC.Maintenance/Commands/OpenCloseMotorCommand.cs @@ -0,0 +1,158 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using Tango.PMR.Diagnostics; +using Tango.PMR.Hardware; + +namespace Tango.PPC.Maintenance.Commands +{ + public abstract class OpenCloseMotorCommand : MaintenanceCommand<OpenCloseMotorCommand.MotorState> + { + public enum MotorState + { + Closed, + Opened, + } + + public HardwareMotorType Motor { get; set; } + + public MotorDirection OpenDirection { get; set; } + + public MotorDirection CloseDirection + { + get + { + return OpenDirection == MotorDirection.Forward ? MotorDirection.Backward : MotorDirection.Forward; + } + } + + public double OpeningSpeed { get; set; } + + public double ClosingSpeed { get; set; } + + public String OpeningMessage { get; set; } + + public String ClosingMessage { get; set; } + + public String OpeningErrorMessage { get; set; } + + public String ClosingErrorMessage { get; set; } + + public String OpeningSuccessMessage { get; set; } + + public String ClosingSuccessMessage { get; set; } + + public OpenCloseMotorCommand( + HardwareMotorType motor, + MotorDirection openDirection, + double openingSpeed, + double closingSpeed, + MotorState defaultState, + String openingMessage, + String closingMessage, + String openingErrorMessage, + String closingErrorMessage, + String openingSuccessMessage, + String closingSuccessMessage) + { + + Motor = motor; + OpenDirection = openDirection; + OpeningSpeed = openingSpeed; + ClosingSpeed = closingSpeed; + State = defaultState; + OpeningMessage = openingMessage; + ClosingMessage = closingMessage; + OpeningErrorMessage = openingErrorMessage; + ClosingErrorMessage = closingErrorMessage; + OpeningSuccessMessage = openingSuccessMessage; + ClosingSuccessMessage = closingSuccessMessage; + } + + protected override void OnExecute() + { + if (State == MotorState.Closed) + { + IsEnabled = false; + + try + { + NotificationProvider.SetGlobalBusyMessage(OpeningMessage); + + MachineProvider.MachineOperator.StartMotorHoming(new PMR.Diagnostics.MotorHomingRequest() + { + Direction = OpenDirection, + MotorType = Motor, + Speed = OpeningSpeed, + }).Subscribe((response) => + { + //Next + }, (ex) => + { + //Error + IsEnabled = true; + NotificationProvider.ReleaseGlobalBusyMessage(); + LogManager.Log(ex, OpeningErrorMessage); + NotificationProvider.ShowError(ex.FlattenMessage()); + }, () => + { + //Complete + IsEnabled = true; + State = MotorState.Opened; + NotificationProvider.ReleaseGlobalBusyMessage(); + NotificationProvider.ShowSuccess(OpeningSuccessMessage); + }); + } + catch (Exception ex) + { + LogManager.Log(ex, OpeningErrorMessage); + NotificationProvider.ReleaseGlobalBusyMessage(); + NotificationProvider.ShowError(ex.FlattenMessage()); + IsEnabled = true; + } + } + else + { + IsEnabled = false; + + try + { + NotificationProvider.SetGlobalBusyMessage(ClosingMessage); + + MachineProvider.MachineOperator.StartMotorHoming(new PMR.Diagnostics.MotorHomingRequest() + { + Direction = CloseDirection, + MotorType = Motor, + Speed = ClosingSpeed, + }).Subscribe((response) => + { + //Next + }, (ex) => + { + //Error + IsEnabled = true; + NotificationProvider.ReleaseGlobalBusyMessage(); + LogManager.Log(ex, ClosingErrorMessage); + NotificationProvider.ShowError(ex.FlattenMessage()); + }, () => + { + //Complete + IsEnabled = true; + State = MotorState.Closed; + NotificationProvider.ReleaseGlobalBusyMessage(); + NotificationProvider.ShowSuccess(ClosingSuccessMessage); + }); + } + catch (Exception ex) + { + LogManager.Log(ex, ClosingErrorMessage); + NotificationProvider.ReleaseGlobalBusyMessage(); + NotificationProvider.ShowError(ex.FlattenMessage()); + IsEnabled = true; + } + } + } + } +} diff --git a/Software/Visual_Studio/PPC/Modules/Tango.PPC.Maintenance/Commands/OpenCloseRightLeadingWheelsCommand.cs b/Software/Visual_Studio/PPC/Modules/Tango.PPC.Maintenance/Commands/OpenCloseRightLeadingWheelsCommand.cs new file mode 100644 index 000000000..ced9eea60 --- /dev/null +++ b/Software/Visual_Studio/PPC/Modules/Tango.PPC.Maintenance/Commands/OpenCloseRightLeadingWheelsCommand.cs @@ -0,0 +1,30 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using Tango.PMR.Diagnostics; +using Tango.PMR.Hardware; + +namespace Tango.PPC.Maintenance.Commands +{ + public class OpenCloseRightLeadingWheelsCommand : OpenCloseMotorCommand + { + public OpenCloseRightLeadingWheelsCommand() : base( + HardwareMotorType.MotoRloading, + MotorDirection.Backward, + 250, + 250, + MotorState.Closed, + "Opening right leading wheels...", + "Closing right leading wheels...", + "Error opening right leading wheels.", + "Error closing right leading wheels.", + "The right leading wheels are now opened.", + "The right leading wheels are now closed." + ) + { + + } + } +} diff --git a/Software/Visual_Studio/PPC/Modules/Tango.PPC.Maintenance/Commands/ResetThreadLoadingCommand.cs b/Software/Visual_Studio/PPC/Modules/Tango.PPC.Maintenance/Commands/ResetThreadLoadingCommand.cs new file mode 100644 index 000000000..0078cd546 --- /dev/null +++ b/Software/Visual_Studio/PPC/Modules/Tango.PPC.Maintenance/Commands/ResetThreadLoadingCommand.cs @@ -0,0 +1,24 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using Tango.PMR.Diagnostics; +using Tango.PMR.Hardware; + +namespace Tango.PPC.Maintenance.Commands +{ + public class ResetThreadLoadingCommand : HomingMotorCommand + { + public ResetThreadLoadingCommand() : base( + HardwareMotorType.MotoDryerLoadarm, + MotorDirection.Backward, + 200, + "Resetting thread loading arm...", + "Error resetting thread loading arm.", + "Thread loading arm in now in place.") + { + + } + } +} diff --git a/Software/Visual_Studio/PPC/Modules/Tango.PPC.Maintenance/Controls/StateTouchButton.cs b/Software/Visual_Studio/PPC/Modules/Tango.PPC.Maintenance/Controls/StateTouchButton.cs new file mode 100644 index 000000000..9a259482b --- /dev/null +++ b/Software/Visual_Studio/PPC/Modules/Tango.PPC.Maintenance/Controls/StateTouchButton.cs @@ -0,0 +1,109 @@ +using System; +using System.Collections; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Collections.Specialized; +using System.ComponentModel; +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.Markup; +using System.Windows.Media; +using System.Windows.Media.Imaging; +using System.Windows.Navigation; +using System.Windows.Shapes; +using Tango.Touch.Controls; + +namespace Tango.PPC.Maintenance.Controls +{ + public class ButtonState : DependencyObject + { + public Object Value + { + get { return (Object)GetValue(ValueProperty); } + set { SetValue(ValueProperty, value); } + } + public static readonly DependencyProperty ValueProperty = + DependencyProperty.Register("Value", typeof(Object), typeof(ButtonState), new PropertyMetadata(null)); + + public Object Content + { + get { return (Object)GetValue(ContentProperty); } + set { SetValue(ContentProperty, value); } + } + public static readonly DependencyProperty ContentProperty = + DependencyProperty.Register("Content", typeof(Object), typeof(ButtonState), new PropertyMetadata(null)); + } + + [ContentProperty(nameof(States))] + public class StateTouchButton : TouchButton + { + public ObservableCollection<Object> States + { + get { return (ObservableCollection<Object>)GetValue(StatesProperty); } + set { SetValue(StatesProperty, value); } + } + public static readonly DependencyProperty StatesProperty = + DependencyProperty.Register("States", typeof(ObservableCollection<Object>), typeof(StateTouchButton), new PropertyMetadata(null, (d, e) => (d as StateTouchButton).OnStatesChanged())); + + public Object SelectedState + { + get { return (Object)GetValue(SelectedStateProperty); } + set { SetValue(SelectedStateProperty, value); } + } + public static readonly DependencyProperty SelectedStateProperty = + DependencyProperty.Register("SelectedState", typeof(Object), typeof(StateTouchButton), new PropertyMetadata(null, (d, e) => (d as StateTouchButton).OnSelectedStateChanged())); + + public StateTouchButton() + { + States = new ObservableCollection<object>(); + } + + private void OnStatesChanged() + { + if (States != null) + { + States.CollectionChanged -= States_CollectionChanged; + States.CollectionChanged += States_CollectionChanged; + OnSelectedStateChanged(); + } + } + + private void OnSelectedStateChanged() + { + if (SelectedState == null) + { + Content = null; + return; + } + + if (States != null) + { + var converter = TypeDescriptor.GetConverter(SelectedState.GetType()); + var matchingState = States.OfType<ButtonState>().ToList().FirstOrDefault(x => x.Value != null && converter.ConvertFrom(x.Value).Equals(SelectedState)); + if (matchingState != null) + { + Content = matchingState.Content; + } + else + { + Content = null; + } + } + else + { + Content = null; + } + } + + private void States_CollectionChanged(object sender, NotifyCollectionChangedEventArgs e) + { + OnSelectedStateChanged(); + } + } +} diff --git a/Software/Visual_Studio/PPC/Modules/Tango.PPC.Maintenance/Converters/LiquidTypeToBrushConverter.cs b/Software/Visual_Studio/PPC/Modules/Tango.PPC.Maintenance/Converters/LiquidTypeToBrushConverter.cs new file mode 100644 index 000000000..c33efdca6 --- /dev/null +++ b/Software/Visual_Studio/PPC/Modules/Tango.PPC.Maintenance/Converters/LiquidTypeToBrushConverter.cs @@ -0,0 +1,74 @@ +using System; +using System.Collections.Generic; +using System.Globalization; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using System.Windows; +using System.Windows.Data; +using System.Windows.Media; +using System.Windows.Media.Imaging; +using Tango.BL.Entities; +using Tango.SharedUI.Helpers; + +namespace Tango.PPC.Maintenance.Converters +{ + public class LiquidTypeToBrushConverter : IValueConverter + { + public object Convert(object value, Type targetType, object parameter, CultureInfo culture) + { + if (value is LiquidType) + { + LiquidType type = value as LiquidType; + switch (type.Type) + { + case BL.Enumerations.LiquidTypes.Lubricant: + { + + ImageBrush lubricantBrush = new ImageBrush() { Stretch = Stretch.None, TileMode = TileMode.Tile, ViewportUnits = BrushMappingMode.Absolute }; + + BitmapSource bit_source = ResourceHelper.GetImageFromResources(@"Images/lubricant2.png"); + var targetBitmap = new WriteableBitmap(new TransformedBitmap(bit_source, new ScaleTransform(0.2, 0.2))); + lubricantBrush.ImageSource = targetBitmap; + lubricantBrush.Viewport = new System.Windows.Rect(2, 2, targetBitmap.Width, targetBitmap.Height); + return lubricantBrush; + } + case BL.Enumerations.LiquidTypes.Cleaner: + { + ImageBrush cleanerBrush = new ImageBrush() { Stretch = Stretch.None, TileMode = TileMode.Tile, ViewportUnits = BrushMappingMode.Absolute }; + BitmapSource bit_source = ResourceHelper.GetImageFromResources(@"Images/cl-full.png"); + var targetBitmap = new WriteableBitmap(new TransformedBitmap(bit_source, new ScaleTransform(0.3, 0.3))); + + cleanerBrush.ImageSource = targetBitmap; + cleanerBrush.Viewport = new System.Windows.Rect(0, 0, targetBitmap.Width, targetBitmap.Height); + return cleanerBrush; + } + case BL.Enumerations.LiquidTypes.Yellow: + { + return new SolidColorBrush(Color.FromRgb(232, 225, 12)); + } + case BL.Enumerations.LiquidTypes.Cyan: + { + return new SolidColorBrush(Color.FromRgb(22, 98, 235)); + } + case BL.Enumerations.LiquidTypes.Magenta: + { + return new SolidColorBrush(Color.FromRgb(237, 0, 140)); + } + } + + + return new SolidColorBrush(type.LiquidTypeColor); + } + return null; + + } + + public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture) + { + throw new NotImplementedException(); + } + + } +} + diff --git a/Software/Visual_Studio/PPC/Modules/Tango.PPC.Maintenance/Converters/LiquidTypeToShortNameConverter.cs b/Software/Visual_Studio/PPC/Modules/Tango.PPC.Maintenance/Converters/LiquidTypeToShortNameConverter.cs new file mode 100644 index 000000000..15041bf17 --- /dev/null +++ b/Software/Visual_Studio/PPC/Modules/Tango.PPC.Maintenance/Converters/LiquidTypeToShortNameConverter.cs @@ -0,0 +1,41 @@ +using System; +using System.Collections.Generic; +using System.Globalization; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using System.Windows.Data; +using Tango.BL.Entities; + +namespace Tango.PPC.Maintenance.Converters +{ + class LiquidTypeToShortNameConverter : IValueConverter + { + public object Convert(object value, Type targetType, object parameter, CultureInfo culture) + { + if (value is LiquidType) + { + LiquidType type = value as LiquidType; + switch (type.Type) + { + case BL.Enumerations.LiquidTypes.Cleaner: + return "CL"; + case BL.Enumerations.LiquidTypes.TransparentInk: + return "TI"; + case BL.Enumerations.LiquidTypes.Black: + return "K"; + } + return type.Name.First().ToString(); + } + else + { + return value; + } + } + + public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture) + { + throw new NotImplementedException(); + } + } +} diff --git a/Software/Visual_Studio/PPC/Modules/Tango.PPC.Maintenance/Converters/MidTankLevelToElementHeightConverter.cs b/Software/Visual_Studio/PPC/Modules/Tango.PPC.Maintenance/Converters/MidTankLevelToElementHeightConverter.cs new file mode 100644 index 000000000..94d1ed8b8 --- /dev/null +++ b/Software/Visual_Studio/PPC/Modules/Tango.PPC.Maintenance/Converters/MidTankLevelToElementHeightConverter.cs @@ -0,0 +1,34 @@ +using System; +using System.Collections.Generic; +using System.Globalization; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using System.Windows.Data; +using Tango.Integration.Operation; + +namespace Tango.PPC.Maintenance.Converters +{ + public class MidTankLevelToElementHeightConverter : IMultiValueConverter + { + public object Convert(object[] values, Type targetType, object parameter, CultureInfo culture) + { + try + { + double parentActualHeight = (double)values[0]; + double midTankLevel = Math.Min((double)values[1], MachineOperator.MAX_MIDTANK_LITERS); + //var test = (parentActualHeight - (midTankLevel / MachineOperator.MAX_MIDTANK_LITERS) * parentActualHeight); + return (parentActualHeight - (midTankLevel / MachineOperator.MAX_MIDTANK_LITERS) * parentActualHeight); + } + catch + { + return 0d; + } + } + + public object[] ConvertBack(object value, Type[] targetTypes, object parameter, CultureInfo culture) + { + throw new NotImplementedException(); + } + } +} diff --git a/Software/Visual_Studio/PPC/Modules/Tango.PPC.Maintenance/Converters/StringToFirstLetterConverter.cs b/Software/Visual_Studio/PPC/Modules/Tango.PPC.Maintenance/Converters/StringToFirstLetterConverter.cs new file mode 100644 index 000000000..0922af78d --- /dev/null +++ b/Software/Visual_Studio/PPC/Modules/Tango.PPC.Maintenance/Converters/StringToFirstLetterConverter.cs @@ -0,0 +1,30 @@ +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.PPC.Maintenance.Converters +{ + public class StringToFirstLetterConverter : IValueConverter + { + public object Convert(object value, Type targetType, object parameter, CultureInfo culture) + { + if (value != null && value.ToString().Length > 1) + { + return value.ToString().First().ToString(); + } + else + { + return value; + } + } + + public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture) + { + throw new NotImplementedException(); + } + } +} diff --git a/Software/Visual_Studio/PPC/Modules/Tango.PPC.Maintenance/Dialogs/CleanerDispensingView.xaml b/Software/Visual_Studio/PPC/Modules/Tango.PPC.Maintenance/Dialogs/CleanerDispensingView.xaml new file mode 100644 index 000000000..98be45608 --- /dev/null +++ b/Software/Visual_Studio/PPC/Modules/Tango.PPC.Maintenance/Dialogs/CleanerDispensingView.xaml @@ -0,0 +1,66 @@ +<UserControl x:Class="Tango.PPC.Maintenance.Dialogs.CleanerDispensingView" + 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:touch="clr-namespace:Tango.Touch.Controls;assembly=Tango.Touch" + xmlns:local="clr-namespace:Tango.PPC.Maintenance.Dialogs" + mc:Ignorable="d" + Background="{StaticResource TangoPrimaryBackgroundBrush}" d:DesignHeight="555" d:DesignWidth="560" Width="600" Height="950" d:DataContext="{d:DesignInstance Type=local:CleanerDispensingViewVM, IsDesignTimeCreatable=False}"> + <Grid> + <StackPanel Margin="0 50 0 0" HorizontalAlignment="Center"> + <Image Source="../Images/head_cleaning.png" RenderOptions.BitmapScalingMode="Fant" Stretch="Uniform" Height="120"></Image> + <TextBlock HorizontalAlignment="Center" FontSize="{StaticResource TangoTitleFontSize}" Margin="0 30 0 0">Dispense Cleaning Liquid</TextBlock> + + + <DockPanel Margin="20 40" HorizontalAlignment="Center"> + <touch:TouchIcon Icon="Alert" Foreground="{StaticResource TangoErrorBrush}" /> + <TextBlock Margin="5 0 0 0" VerticalAlignment="Center" Foreground="{StaticResource TangoErrorBrush}">Please put on safety glasses</TextBlock> + </DockPanel> + + <Label Margin="20 10" HorizontalAlignment="Center"> + <Label.Style> + <Style TargetType="Label"> + <Setter Property="Content"> + <Setter.Value> + <TextBlock LineHeight="30" TextWrapping="Wrap"> + <Run>1. Pull the thread aside and clean with Q tip when the liquid is dispensed.</Run> + <LineBreak/> + <Run>2. Dispense again if the liquid isn't enough for cleaning.</Run> + <LineBreak/> + <Run>3. When cleaning is completed, return the thread back to the V-Groove and press the 'Close Dyeing Head Lid' button to close the head lid</Run> + </TextBlock> + </Setter.Value> + </Setter> + <Style.Triggers> + <DataTrigger Binding="{Binding MachineProvider.Machine.MachineHeadType}" Value="Arc"> + <Setter Property="Content"> + <Setter.Value> + <TextBlock LineHeight="30" TextWrapping="Wrap"> + <Run>1. Open the dyeing head lid, pull the thread aside and clean with Q tip when the liquid is dispensed.</Run> + <LineBreak/> + <Run>2. Dispense again if the liquid isn't enough for cleaning.</Run> + <LineBreak/> + <Run>3. When cleaning is completed, return the thread back to the V-Groove and install the head lid back.</Run> + </TextBlock> + </Setter.Value> + </Setter> + </DataTrigger> + </Style.Triggers> + </Style> + </Label.Style> + </Label> + + <Grid> + <touch:TouchButton Command="{Binding StartCommand}" Margin="0 100 0 0" Style="{StaticResource TangoHollowButton}" HorizontalAlignment="Center" Padding="80 15" CornerRadius="25">START</touch:TouchButton> + </Grid> + + <StackPanel Margin="40 150 40 40"> + <TextBlock HorizontalAlignment="Left" TextWrapping="Wrap" Text="{Binding Status}"></TextBlock> + <touch:TouchProgressBar Margin="0 5 0 0" VerticalAlignment="Bottom" Height="10" Minimum="0" Maximum="100" Value="0" IsIndeterminate="{Binding IsStarted}"> + + </touch:TouchProgressBar> + </StackPanel> + </StackPanel> + </Grid> +</UserControl> diff --git a/Software/Visual_Studio/PPC/Modules/Tango.PPC.Maintenance/Dialogs/CleanerDispensingView.xaml.cs b/Software/Visual_Studio/PPC/Modules/Tango.PPC.Maintenance/Dialogs/CleanerDispensingView.xaml.cs new file mode 100644 index 000000000..6f1ebb4ed --- /dev/null +++ b/Software/Visual_Studio/PPC/Modules/Tango.PPC.Maintenance/Dialogs/CleanerDispensingView.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.PPC.Maintenance.Dialogs +{ + /// <summary> + /// Interaction logic for PowerUpView.xaml + /// </summary> + public partial class CleanerDispensingView : UserControl + { + public CleanerDispensingView() + { + InitializeComponent(); + } + } +} diff --git a/Software/Visual_Studio/PPC/Modules/Tango.PPC.Maintenance/Dialogs/CleanerDispensingViewVM.cs b/Software/Visual_Studio/PPC/Modules/Tango.PPC.Maintenance/Dialogs/CleanerDispensingViewVM.cs new file mode 100644 index 000000000..e37be417f --- /dev/null +++ b/Software/Visual_Studio/PPC/Modules/Tango.PPC.Maintenance/Dialogs/CleanerDispensingViewVM.cs @@ -0,0 +1,128 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using System.Timers; +using Tango.BL.Entities; +using Tango.Core.Commands; +using Tango.Core.DI; +using Tango.Integration.Operation; +using Tango.PMR.Printing; +using Tango.PPC.Common; +using Tango.PPC.Common.Connection; +using Tango.PPC.Common.Notifications; +using Tango.Settings; +using Tango.SharedUI; + +namespace Tango.PPC.Maintenance.Dialogs +{ + public class CleanerDispensingViewVM : DialogViewVM + { + private const int JOGGING_TIME_SEC = 10; + private const int JOGGING_SPEED = 400; + + [TangoInject] + public IMachineProvider MachineProvider { get; set; } + + [TangoInject] + private INotificationProvider NotificationProvider { get; set; } + + private bool _isStarted; + public bool IsStarted + { + get { return _isStarted; } + set { _isStarted = value; RaisePropertyChangedAuto(); } + } + + private bool _isCompleted; + public bool IsCompleted + { + get { return _isCompleted; } + set { _isCompleted = value; RaisePropertyChangedAuto(); } + } + + private bool _isFailed; + public bool IsFailed + { + get { return _isFailed; } + set { _isFailed = value; RaisePropertyChangedAuto(); } + } + + private String _status; + public String Status + { + get { return _status; } + set { _status = value; RaisePropertyChangedAuto(); } + } + + public RelayCommand StartCommand { get; set; } + + public CleanerDispensingViewVM() + { + Status = "Ready..."; + CanClose = true; + TangoIOC.Default.Inject(this); + StartCommand = new RelayCommand(Start, () => !IsStarted); + } + + private async void Start() + { + try + { + CanClose = false; + IsStarted = true; + IsCompleted = false; + IsFailed = false; + InvalidateRelayCommands(); + + Status = "Dispensing cleaner liquid..."; + + var cleanerPack = MachineProvider.Machine.Configuration.NoneEmptyIdsPacks.FirstOrDefault(x => x.LiquidType.Type == BL.Enumerations.LiquidTypes.Cleaner); + + if (cleanerPack == null) + { + throw new InvalidOperationException("'Cleaner' liquid type was not found on the machine configuration."); + } + + var cleanerIndex = cleanerPack.PackIndex; + + await MachineProvider.MachineOperator.StartDispenserJogging(new PMR.Diagnostics.DispenserJoggingRequest() + { + Direction = PMR.Diagnostics.MotorDirection.Forward, + Speed = JOGGING_SPEED, + Index = cleanerIndex + }); + + await Task.Delay(TimeSpan.FromSeconds(JOGGING_TIME_SEC)); + + await MachineProvider.MachineOperator.StopDispenserJogging(new PMR.Diagnostics.DispenserAbortJoggingRequest() + { + Index = cleanerIndex + }); + + IsCompleted = true; + Status = "Cleaner liquid dispensing completed."; + } + catch (Exception ex) + { + Status = "Cleaner liquid dispensing failed."; + IsFailed = true; + await NotificationProvider.ShowError($"Error occurred while trying to perform the cleaner liquid dispensing.\n{ex.FlattenMessage()}"); + } + finally + { + CanClose = true; + IsStarted = false; + } + } + + protected override void Cancel() + { + if (CanClose) + { + base.Cancel(); + } + } + } +} diff --git a/Software/Visual_Studio/PPC/Modules/Tango.PPC.Maintenance/Dialogs/HeadCleaningView.xaml b/Software/Visual_Studio/PPC/Modules/Tango.PPC.Maintenance/Dialogs/HeadCleaningView.xaml new file mode 100644 index 000000000..f640d5cec --- /dev/null +++ b/Software/Visual_Studio/PPC/Modules/Tango.PPC.Maintenance/Dialogs/HeadCleaningView.xaml @@ -0,0 +1,56 @@ +<UserControl x:Class="Tango.PPC.Maintenance.Dialogs.HeadCleaningView" + 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:touch="clr-namespace:Tango.Touch.Controls;assembly=Tango.Touch" + xmlns:local="clr-namespace:Tango.PPC.Maintenance.Dialogs" + mc:Ignorable="d" + Background="{StaticResource TangoPrimaryBackgroundBrush}" d:DesignHeight="555" d:DesignWidth="560" Width="600" Height="800" d:DataContext="{d:DesignInstance Type=local:HeadCleaningViewVM, IsDesignTimeCreatable=False}"> + <Grid> + <StackPanel Margin="0 50 0 0" HorizontalAlignment="Center"> + <Image Source="../Images/head_cleaning.png" RenderOptions.BitmapScalingMode="Fant" Stretch="Uniform" Height="120"></Image> + <TextBlock HorizontalAlignment="Center" FontSize="{StaticResource TangoTitleFontSize}" Margin="0 30 0 0">Head Cleaning</TextBlock> + + <TextBlock Margin="20 10" HorizontalAlignment="Center" TextWrapping="Wrap" TextAlignment="Center"> + <TextBlock.Style> + <Style TargetType="TextBlock"> + <Setter Property="Text" Value="Press 'START' to start the head cleaning sequence"></Setter> + <Style.Triggers> + <DataTrigger Binding="{Binding IsStarted}" Value="True"> + <Setter Property="Text" Value="Head cleaning in progress"></Setter> + </DataTrigger> + <DataTrigger Binding="{Binding IsAborting}" Value="True"> + <Setter Property="Text" Value="Aborting head cleaning"></Setter> + </DataTrigger> + <DataTrigger Binding="{Binding IsCompleted}" Value="True"> + <Setter Property="Text" Value="Head cleaning completed"></Setter> + </DataTrigger> + </Style.Triggers> + </Style> + </TextBlock.Style> + </TextBlock> + + <Grid> + <touch:TouchButton Visibility="{Binding IsStarted,Converter={StaticResource BooleanToVisibilityInverseConverter}}" Command="{Binding StartCommand}" Margin="0 100 0 0" Style="{StaticResource TangoHollowButton}" HorizontalAlignment="Center" Padding="80 15" CornerRadius="25">START</touch:TouchButton> + <touch:TouchButton Visibility="{Binding IsStarted,Converter={StaticResource BooleanToVisibilityConverter}}" IsEnabled="{Binding IsAborting,Converter={StaticResource BooleanInverseConverter}}" Command="{Binding AbortCommand}" Margin="0 100 0 0" Style="{StaticResource TangoHollowButton}" HorizontalAlignment="Center" Padding="80 15" CornerRadius="25">ABORT</touch:TouchButton> + </Grid> + + <StackPanel Margin="40"> + <TextBlock HorizontalAlignment="Left" TextWrapping="Wrap" Text="{Binding Status.Status}"></TextBlock> + <touch:TouchProgressBar Margin="0 20 0 0" VerticalAlignment="Bottom" Width="500" Height="10" Minimum="0" Maximum="{Binding Status.Total}" Value="{Binding Status.Progress}"> + <touch:TouchProgressBar.Style> + <Style TargetType="touch:TouchProgressBar" BasedOn="{StaticResource {x:Type touch:TouchProgressBar}}"> + <Setter Property="IsIndeterminate" Value="False"></Setter> + <Style.Triggers> + <DataTrigger Binding="{Binding Status.Progress}" Value="0"> + <Setter Property="IsIndeterminate" Value="True"></Setter> + </DataTrigger> + </Style.Triggers> + </Style> + </touch:TouchProgressBar.Style> + </touch:TouchProgressBar> + </StackPanel> + </StackPanel> + </Grid> +</UserControl> diff --git a/Software/Visual_Studio/PPC/Modules/Tango.PPC.Maintenance/Dialogs/HeadCleaningView.xaml.cs b/Software/Visual_Studio/PPC/Modules/Tango.PPC.Maintenance/Dialogs/HeadCleaningView.xaml.cs new file mode 100644 index 000000000..c715bf5cf --- /dev/null +++ b/Software/Visual_Studio/PPC/Modules/Tango.PPC.Maintenance/Dialogs/HeadCleaningView.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.PPC.Maintenance.Dialogs +{ + /// <summary> + /// Interaction logic for PowerUpView.xaml + /// </summary> + public partial class HeadCleaningView : UserControl + { + public HeadCleaningView() + { + InitializeComponent(); + } + } +} diff --git a/Software/Visual_Studio/PPC/Modules/Tango.PPC.Maintenance/Dialogs/HeadCleaningViewVM.cs b/Software/Visual_Studio/PPC/Modules/Tango.PPC.Maintenance/Dialogs/HeadCleaningViewVM.cs new file mode 100644 index 000000000..59d119f21 --- /dev/null +++ b/Software/Visual_Studio/PPC/Modules/Tango.PPC.Maintenance/Dialogs/HeadCleaningViewVM.cs @@ -0,0 +1,150 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using System.Timers; +using Tango.BL.Entities; +using Tango.Core.Commands; +using Tango.Core.DI; +using Tango.Integration.Operation; +using Tango.PMR.Printing; +using Tango.PPC.Common; +using Tango.PPC.Common.Connection; +using Tango.PPC.Common.Notifications; +using Tango.Settings; +using Tango.SharedUI; + +namespace Tango.PPC.Maintenance.Dialogs +{ + public class HeadCleaningViewVM : DialogViewVM + { + private HeadCleaningHandler _handler; + + [TangoInject] + private IMachineProvider MachineProvider { get; set; } + + [TangoInject] + private INotificationProvider NotificationProvider { get; set; } + + private bool _isStarted; + public bool IsStarted + { + get { return _isStarted; } + set { _isStarted = value; RaisePropertyChangedAuto(); } + } + + private bool _isCompleted; + public bool IsCompleted + { + get { return _isCompleted; } + set { _isCompleted = value; RaisePropertyChangedAuto(); } + } + + private bool _isAborting; + public bool IsAborting + { + get { return _isAborting; } + set { _isAborting = value; RaisePropertyChangedAuto(); } + } + + private bool _isFailed; + public bool IsFailed + { + get { return _isFailed; } + set { _isFailed = value; RaisePropertyChangedAuto(); } + } + + private StartHeadCleaningResponse _status; + public StartHeadCleaningResponse Status + { + get { return _status; } + set { _status = value; RaisePropertyChangedAuto(); } + } + + public RelayCommand StartCommand { get; set; } + public RelayCommand AbortCommand { get; set; } + + public HeadCleaningViewVM() + { + CanClose = true; + TangoIOC.Default.Inject(this); + StartCommand = new RelayCommand(Start); + AbortCommand = new RelayCommand(Abort); + } + + private async void Start() + { + try + { + CanClose = false; + IsStarted = true; + _handler = await MachineProvider.MachineOperator.PerformHeadCleaning(); + _handler.Completed += _handler_Completed; + _handler.Failed += _handler_Failed; + _handler.StatusChanged += _handler_StatusChanged; + } + catch (Exception ex) + { + _handler_Failed(this, ex); + } + } + + private void _handler_StatusChanged(object sender, HeadCleaningStatusChangedEventArgs e) + { + Status = e.Status; + } + + private void _handler_Failed(object sender, Exception e) + { + IsStarted = false; + IsFailed = true; + InvokeUI(() => + { + CanClose = true; + Cancel(); + NotificationProvider.ShowError($"Error occurred while trying to perform the head cleaning.\n{e.FlattenMessage()}"); + }); + } + + private void _handler_Completed(object sender, EventArgs e) + { + IsStarted = false; + IsCompleted = true; + InvokeUI(() => + { + Accept(); + NotificationProvider.ShowSuccess("Head cleaning completed successfully."); + }); + } + + protected override void Cancel() + { + if (CanClose) + { + base.Cancel(); + } + } + + private async void Abort() + { + IsAborting = true; + try + { + await _handler.Abort(); + CanClose = true; + Cancel(); + await NotificationProvider.ShowInfo("Head cleaning aborted."); + } + catch (Exception ex) + { + if (!IsCompleted) + { + CanClose = true; + IsAborting = false; + await NotificationProvider.ShowError($"Error occurred while trying to abort the head cleaning.\n{ex.FlattenMessage()}"); + } + } + } + } +} diff --git a/Software/Visual_Studio/PPC/Modules/Tango.PPC.Maintenance/GuideBase.cs b/Software/Visual_Studio/PPC/Modules/Tango.PPC.Maintenance/GuideBase.cs new file mode 100644 index 000000000..438375c72 --- /dev/null +++ b/Software/Visual_Studio/PPC/Modules/Tango.PPC.Maintenance/GuideBase.cs @@ -0,0 +1,35 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using System.Windows; +using System.Windows.Media.Imaging; + +namespace Tango.PPC.Maintenance +{ + public abstract class GuideBase + { + public abstract String Name { get; } + public abstract BitmapSource Icon { get; } + public abstract String Image { get; } + public abstract List<GuideStep> Steps { get; } + + protected virtual List<GuideStep> GetStepsFromResource(String key) + { + List<GuideStep> list = new List<GuideStep>(); + + var arr = (Application.Current.Resources[key] as Array); + + foreach (var item in arr) + { + list.Add(new GuideStep() + { + Text = item + }); + } + + return list; + } + } +} diff --git a/Software/Visual_Studio/PPC/Modules/Tango.PPC.Maintenance/GuideStep.cs b/Software/Visual_Studio/PPC/Modules/Tango.PPC.Maintenance/GuideStep.cs new file mode 100644 index 000000000..71a70d9db --- /dev/null +++ b/Software/Visual_Studio/PPC/Modules/Tango.PPC.Maintenance/GuideStep.cs @@ -0,0 +1,21 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using Tango.Core; + +namespace Tango.PPC.Maintenance +{ + public class GuideStep : ExtendedObject + { + public Object Text { get; set; } + + private bool _isChecked; + public bool IsChecked + { + get { return _isChecked; } + set { _isChecked = value; RaisePropertyChangedAuto(); } + } + } +} diff --git a/Software/Visual_Studio/PPC/Modules/Tango.PPC.Maintenance/Guides/HandleWasteCartridgeGuide.cs b/Software/Visual_Studio/PPC/Modules/Tango.PPC.Maintenance/Guides/HandleWasteCartridgeGuide.cs new file mode 100644 index 000000000..a4820e349 --- /dev/null +++ b/Software/Visual_Studio/PPC/Modules/Tango.PPC.Maintenance/Guides/HandleWasteCartridgeGuide.cs @@ -0,0 +1,43 @@ +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.SharedUI.Helpers; + +namespace Tango.PPC.Maintenance.Guides +{ + public class HandleWasteCartridgeGuide : GuideBase + { + public override string Name => "Handling the Waste Cartridges"; + public override String Image => "../Images/Guides/Residue-Cartridges-A.gif"; + + private BitmapSource _icon; + public override BitmapSource Icon + { + get + { + if (_icon == null) + { + _icon = ResourceHelper.GetImageFromResources("Images/Guides/handling-the-waste-cartridges.png"); + } + return _icon; + } + } + + private List<GuideStep> _steps; + public override List<GuideStep> Steps + { + get + { + if (_steps == null) + { + _steps = GetStepsFromResource("HandleWasteCartridge"); + } + return _steps; + } + } + } +} diff --git a/Software/Visual_Studio/PPC/Modules/Tango.PPC.Maintenance/Guides/LoadInkCartridgeGuide.cs b/Software/Visual_Studio/PPC/Modules/Tango.PPC.Maintenance/Guides/LoadInkCartridgeGuide.cs new file mode 100644 index 000000000..1a6ed8321 --- /dev/null +++ b/Software/Visual_Studio/PPC/Modules/Tango.PPC.Maintenance/Guides/LoadInkCartridgeGuide.cs @@ -0,0 +1,43 @@ +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.SharedUI.Helpers; + +namespace Tango.PPC.Maintenance.Guides +{ + public class LoadInkCartridgeGuide : GuideBase + { + public override string Name => "Loading an Ink Cartridge"; + public override String Image => "../Images/Guides/Loading-an-Ink-Cartridge.gif"; + + private BitmapSource _icon; + public override BitmapSource Icon + { + get + { + if (_icon == null) + { + _icon = ResourceHelper.GetImageFromResources("Images/Guides/loading-an-ink-cartridge.png"); + } + return _icon; + } + } + + private List<GuideStep> _steps; + public override List<GuideStep> Steps + { + get + { + if (_steps == null) + { + _steps = GetStepsFromResource("LoadInkCartridge"); + } + return _steps; + } + } + } +} diff --git a/Software/Visual_Studio/PPC/Modules/Tango.PPC.Maintenance/Guides/LoadNewThreadGuide.cs b/Software/Visual_Studio/PPC/Modules/Tango.PPC.Maintenance/Guides/LoadNewThreadGuide.cs new file mode 100644 index 000000000..d5115a748 --- /dev/null +++ b/Software/Visual_Studio/PPC/Modules/Tango.PPC.Maintenance/Guides/LoadNewThreadGuide.cs @@ -0,0 +1,43 @@ +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.SharedUI.Helpers; + +namespace Tango.PPC.Maintenance.Guides +{ + public class LoadNewThreadGuide : GuideBase + { + public override string Name => "Loading New Thread"; + public override String Image => "../Images/Guides/Loading-New-Thread.gif"; + + private BitmapSource _icon; + public override BitmapSource Icon + { + get + { + if (_icon == null) + { + _icon = ResourceHelper.GetImageFromResources("Images/Guides/loading-new-thread.png"); + } + return _icon; + } + } + + private List<GuideStep> _steps; + public override List<GuideStep> Steps + { + get + { + if (_steps == null) + { + _steps = GetStepsFromResource("LoadNewThread"); + } + return _steps; + } + } + } +} diff --git a/Software/Visual_Studio/PPC/Modules/Tango.PPC.Maintenance/Guides/ReplaceAirFilterGuide.cs b/Software/Visual_Studio/PPC/Modules/Tango.PPC.Maintenance/Guides/ReplaceAirFilterGuide.cs new file mode 100644 index 000000000..d335867ca --- /dev/null +++ b/Software/Visual_Studio/PPC/Modules/Tango.PPC.Maintenance/Guides/ReplaceAirFilterGuide.cs @@ -0,0 +1,43 @@ +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.SharedUI.Helpers; + +namespace Tango.PPC.Maintenance.Guides +{ + public class ReplaceAirFilterGuide : GuideBase + { + public override string Name => "Replacing the Air Filter"; + public override String Image => "../Images/Guides/Replacing-the-Air-Filter.gif"; + + private BitmapSource _icon; + public override BitmapSource Icon + { + get + { + if (_icon == null) + { + _icon = ResourceHelper.GetImageFromResources("Images/Guides/replacing-the-air-filter.png"); + } + return _icon; + } + } + + private List<GuideStep> _steps; + public override List<GuideStep> Steps + { + get + { + if (_steps == null) + { + _steps = GetStepsFromResource("ReplaceAirFilter"); + } + return _steps; + } + } + } +} diff --git a/Software/Visual_Studio/PPC/Modules/Tango.PPC.Maintenance/Guides/ReplaceThreadGuide.cs b/Software/Visual_Studio/PPC/Modules/Tango.PPC.Maintenance/Guides/ReplaceThreadGuide.cs new file mode 100644 index 000000000..ecc3f6026 --- /dev/null +++ b/Software/Visual_Studio/PPC/Modules/Tango.PPC.Maintenance/Guides/ReplaceThreadGuide.cs @@ -0,0 +1,43 @@ +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.SharedUI.Helpers; + +namespace Tango.PPC.Maintenance.Guides +{ + public class ReplaceThreadGuide : GuideBase + { + public override string Name => "Replacing the Thread"; + public override String Image => "../Images/Guides/Replacing-the-Thread.gif"; + + private BitmapSource _icon; + public override BitmapSource Icon + { + get + { + if (_icon == null) + { + _icon = ResourceHelper.GetImageFromResources("Images/Guides/replacing-the-thread.png"); + } + return _icon; + } + } + + private List<GuideStep> _steps; + public override List<GuideStep> Steps + { + get + { + if (_steps == null) + { + _steps = GetStepsFromResource("ReplaceThread"); + } + return _steps; + } + } + } +} diff --git a/Software/Visual_Studio/PPC/Modules/Tango.PPC.Maintenance/Helpers/GuideHelper.cs b/Software/Visual_Studio/PPC/Modules/Tango.PPC.Maintenance/Helpers/GuideHelper.cs new file mode 100644 index 000000000..32518974d --- /dev/null +++ b/Software/Visual_Studio/PPC/Modules/Tango.PPC.Maintenance/Helpers/GuideHelper.cs @@ -0,0 +1,33 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using System.Windows; + +namespace Tango.PPC.Maintenance.Helpers +{ + public static class GuideHelper + { + public static List<GuideBase> CreateAllGuides() + { + var resource = new ResourceDictionary + { + Source = new Uri("/Tango.PPC.Maintenance;component/Resources/Guides.xaml", UriKind.RelativeOrAbsolute) + }; + + Application.Current.Resources.MergedDictionaries.Add(resource); + + List<GuideBase> guides = new List<GuideBase>(); + + var callingAssembly = typeof(GuideHelper).Assembly; + + foreach (var guideType in callingAssembly.DefinedTypes.Where(x => x.Namespace == "Tango.PPC.Maintenance.Guides")) + { + guides.Add(Activator.CreateInstance(guideType) as GuideBase); + } + + return guides; + } + } +} diff --git a/Software/Visual_Studio/PPC/Modules/Tango.PPC.Maintenance/Images/Guides/Loading-New-Thread.gif b/Software/Visual_Studio/PPC/Modules/Tango.PPC.Maintenance/Images/Guides/Loading-New-Thread.gif Binary files differnew file mode 100644 index 000000000..b6a974084 --- /dev/null +++ b/Software/Visual_Studio/PPC/Modules/Tango.PPC.Maintenance/Images/Guides/Loading-New-Thread.gif diff --git a/Software/Visual_Studio/PPC/Modules/Tango.PPC.Maintenance/Images/Guides/Loading-an-Ink-Cartridge.gif b/Software/Visual_Studio/PPC/Modules/Tango.PPC.Maintenance/Images/Guides/Loading-an-Ink-Cartridge.gif Binary files differnew file mode 100644 index 000000000..7087ebc64 --- /dev/null +++ b/Software/Visual_Studio/PPC/Modules/Tango.PPC.Maintenance/Images/Guides/Loading-an-Ink-Cartridge.gif diff --git a/Software/Visual_Studio/PPC/Modules/Tango.PPC.Maintenance/Images/Guides/Replacing-the-Air-Filter.gif b/Software/Visual_Studio/PPC/Modules/Tango.PPC.Maintenance/Images/Guides/Replacing-the-Air-Filter.gif Binary files differnew file mode 100644 index 000000000..023adb4a9 --- /dev/null +++ b/Software/Visual_Studio/PPC/Modules/Tango.PPC.Maintenance/Images/Guides/Replacing-the-Air-Filter.gif diff --git a/Software/Visual_Studio/PPC/Modules/Tango.PPC.Maintenance/Images/Guides/Replacing-the-Thread.gif b/Software/Visual_Studio/PPC/Modules/Tango.PPC.Maintenance/Images/Guides/Replacing-the-Thread.gif Binary files differnew file mode 100644 index 000000000..8ab544d8b --- /dev/null +++ b/Software/Visual_Studio/PPC/Modules/Tango.PPC.Maintenance/Images/Guides/Replacing-the-Thread.gif diff --git a/Software/Visual_Studio/PPC/Modules/Tango.PPC.Maintenance/Images/Guides/Residue-Cartridges-A.gif b/Software/Visual_Studio/PPC/Modules/Tango.PPC.Maintenance/Images/Guides/Residue-Cartridges-A.gif Binary files differnew file mode 100644 index 000000000..c310820b4 --- /dev/null +++ b/Software/Visual_Studio/PPC/Modules/Tango.PPC.Maintenance/Images/Guides/Residue-Cartridges-A.gif diff --git a/Software/Visual_Studio/PPC/Modules/Tango.PPC.Maintenance/Images/Guides/handling-the-waste-cartridges.png b/Software/Visual_Studio/PPC/Modules/Tango.PPC.Maintenance/Images/Guides/handling-the-waste-cartridges.png Binary files differnew file mode 100644 index 000000000..188e881bb --- /dev/null +++ b/Software/Visual_Studio/PPC/Modules/Tango.PPC.Maintenance/Images/Guides/handling-the-waste-cartridges.png diff --git a/Software/Visual_Studio/PPC/Modules/Tango.PPC.Maintenance/Images/Guides/loading-an-ink-cartridge.png b/Software/Visual_Studio/PPC/Modules/Tango.PPC.Maintenance/Images/Guides/loading-an-ink-cartridge.png Binary files differnew file mode 100644 index 000000000..4f4dfc375 --- /dev/null +++ b/Software/Visual_Studio/PPC/Modules/Tango.PPC.Maintenance/Images/Guides/loading-an-ink-cartridge.png diff --git a/Software/Visual_Studio/PPC/Modules/Tango.PPC.Maintenance/Images/Guides/loading-new-thread.png b/Software/Visual_Studio/PPC/Modules/Tango.PPC.Maintenance/Images/Guides/loading-new-thread.png Binary files differnew file mode 100644 index 000000000..1f508261b --- /dev/null +++ b/Software/Visual_Studio/PPC/Modules/Tango.PPC.Maintenance/Images/Guides/loading-new-thread.png diff --git a/Software/Visual_Studio/PPC/Modules/Tango.PPC.Maintenance/Images/Guides/machine-image.png b/Software/Visual_Studio/PPC/Modules/Tango.PPC.Maintenance/Images/Guides/machine-image.png Binary files differnew file mode 100644 index 000000000..277599070 --- /dev/null +++ b/Software/Visual_Studio/PPC/Modules/Tango.PPC.Maintenance/Images/Guides/machine-image.png diff --git a/Software/Visual_Studio/PPC/Modules/Tango.PPC.Maintenance/Images/Guides/replacing-the-air-filter.png b/Software/Visual_Studio/PPC/Modules/Tango.PPC.Maintenance/Images/Guides/replacing-the-air-filter.png Binary files differnew file mode 100644 index 000000000..eb8f518a3 --- /dev/null +++ b/Software/Visual_Studio/PPC/Modules/Tango.PPC.Maintenance/Images/Guides/replacing-the-air-filter.png diff --git a/Software/Visual_Studio/PPC/Modules/Tango.PPC.Maintenance/Images/Guides/replacing-the-thread.png b/Software/Visual_Studio/PPC/Modules/Tango.PPC.Maintenance/Images/Guides/replacing-the-thread.png Binary files differnew file mode 100644 index 000000000..e858c3075 --- /dev/null +++ b/Software/Visual_Studio/PPC/Modules/Tango.PPC.Maintenance/Images/Guides/replacing-the-thread.png diff --git a/Software/Visual_Studio/PPC/Modules/Tango.PPC.Maintenance/Images/Waste/absent.png b/Software/Visual_Studio/PPC/Modules/Tango.PPC.Maintenance/Images/Waste/absent.png Binary files differnew file mode 100644 index 000000000..8fc4e1b33 --- /dev/null +++ b/Software/Visual_Studio/PPC/Modules/Tango.PPC.Maintenance/Images/Waste/absent.png diff --git a/Software/Visual_Studio/PPC/Modules/Tango.PPC.Maintenance/Images/Waste/present_empty_error.png b/Software/Visual_Studio/PPC/Modules/Tango.PPC.Maintenance/Images/Waste/present_empty_error.png Binary files differnew file mode 100644 index 000000000..ff2411eb5 --- /dev/null +++ b/Software/Visual_Studio/PPC/Modules/Tango.PPC.Maintenance/Images/Waste/present_empty_error.png diff --git a/Software/Visual_Studio/PPC/Modules/Tango.PPC.Maintenance/Images/Waste/present_empty_right.png b/Software/Visual_Studio/PPC/Modules/Tango.PPC.Maintenance/Images/Waste/present_empty_right.png Binary files differnew file mode 100644 index 000000000..08b9a7076 --- /dev/null +++ b/Software/Visual_Studio/PPC/Modules/Tango.PPC.Maintenance/Images/Waste/present_empty_right.png diff --git a/Software/Visual_Studio/PPC/Modules/Tango.PPC.Maintenance/Images/Waste/present_full_right.png b/Software/Visual_Studio/PPC/Modules/Tango.PPC.Maintenance/Images/Waste/present_full_right.png Binary files differnew file mode 100644 index 000000000..a39b6f073 --- /dev/null +++ b/Software/Visual_Studio/PPC/Modules/Tango.PPC.Maintenance/Images/Waste/present_full_right.png diff --git a/Software/Visual_Studio/PPC/Modules/Tango.PPC.Maintenance/Images/action.png b/Software/Visual_Studio/PPC/Modules/Tango.PPC.Maintenance/Images/action.png Binary files differnew file mode 100644 index 000000000..6d14ec5dc --- /dev/null +++ b/Software/Visual_Studio/PPC/Modules/Tango.PPC.Maintenance/Images/action.png diff --git a/Software/Visual_Studio/PPC/Modules/Tango.PPC.Maintenance/Images/cl-full.png b/Software/Visual_Studio/PPC/Modules/Tango.PPC.Maintenance/Images/cl-full.png Binary files differnew file mode 100644 index 000000000..5aaea8e6c --- /dev/null +++ b/Software/Visual_Studio/PPC/Modules/Tango.PPC.Maintenance/Images/cl-full.png diff --git a/Software/Visual_Studio/PPC/Modules/Tango.PPC.Maintenance/Images/cone-empty.png b/Software/Visual_Studio/PPC/Modules/Tango.PPC.Maintenance/Images/cone-empty.png Binary files differnew file mode 100644 index 000000000..17c3225ed --- /dev/null +++ b/Software/Visual_Studio/PPC/Modules/Tango.PPC.Maintenance/Images/cone-empty.png diff --git a/Software/Visual_Studio/PPC/Modules/Tango.PPC.Maintenance/Images/cone-full.png b/Software/Visual_Studio/PPC/Modules/Tango.PPC.Maintenance/Images/cone-full.png Binary files differnew file mode 100644 index 000000000..b4ed45d1e --- /dev/null +++ b/Software/Visual_Studio/PPC/Modules/Tango.PPC.Maintenance/Images/cone-full.png diff --git a/Software/Visual_Studio/PPC/Modules/Tango.PPC.Maintenance/Images/guides.png b/Software/Visual_Studio/PPC/Modules/Tango.PPC.Maintenance/Images/guides.png Binary files differnew file mode 100644 index 000000000..13b9013d7 --- /dev/null +++ b/Software/Visual_Studio/PPC/Modules/Tango.PPC.Maintenance/Images/guides.png diff --git a/Software/Visual_Studio/PPC/Modules/Tango.PPC.Maintenance/Images/head_cleaning.png b/Software/Visual_Studio/PPC/Modules/Tango.PPC.Maintenance/Images/head_cleaning.png Binary files differnew file mode 100644 index 000000000..373cb78c1 --- /dev/null +++ b/Software/Visual_Studio/PPC/Modules/Tango.PPC.Maintenance/Images/head_cleaning.png diff --git a/Software/Visual_Studio/PPC/Modules/Tango.PPC.Maintenance/Images/inks.png b/Software/Visual_Studio/PPC/Modules/Tango.PPC.Maintenance/Images/inks.png Binary files differnew file mode 100644 index 000000000..3872a77e4 --- /dev/null +++ b/Software/Visual_Studio/PPC/Modules/Tango.PPC.Maintenance/Images/inks.png diff --git a/Software/Visual_Studio/PPC/Modules/Tango.PPC.Maintenance/Images/l-full.png b/Software/Visual_Studio/PPC/Modules/Tango.PPC.Maintenance/Images/l-full.png Binary files differnew file mode 100644 index 000000000..2607f4a26 --- /dev/null +++ b/Software/Visual_Studio/PPC/Modules/Tango.PPC.Maintenance/Images/l-full.png diff --git a/Software/Visual_Studio/PPC/Modules/Tango.PPC.Maintenance/Images/lubricant2.png b/Software/Visual_Studio/PPC/Modules/Tango.PPC.Maintenance/Images/lubricant2.png Binary files differnew file mode 100644 index 000000000..554c16305 --- /dev/null +++ b/Software/Visual_Studio/PPC/Modules/Tango.PPC.Maintenance/Images/lubricant2.png diff --git a/Software/Visual_Studio/PPC/Modules/Tango.PPC.Maintenance/Images/maintenance.png b/Software/Visual_Studio/PPC/Modules/Tango.PPC.Maintenance/Images/maintenance.png Binary files differnew file mode 100644 index 000000000..526284750 --- /dev/null +++ b/Software/Visual_Studio/PPC/Modules/Tango.PPC.Maintenance/Images/maintenance.png diff --git a/Software/Visual_Studio/PPC/Modules/Tango.PPC.Maintenance/Images/status.png b/Software/Visual_Studio/PPC/Modules/Tango.PPC.Maintenance/Images/status.png Binary files differnew file mode 100644 index 000000000..0cc205a6c --- /dev/null +++ b/Software/Visual_Studio/PPC/Modules/Tango.PPC.Maintenance/Images/status.png diff --git a/Software/Visual_Studio/PPC/Modules/Tango.PPC.Maintenance/Images/temperature-green.png b/Software/Visual_Studio/PPC/Modules/Tango.PPC.Maintenance/Images/temperature-green.png Binary files differnew file mode 100644 index 000000000..f67323dde --- /dev/null +++ b/Software/Visual_Studio/PPC/Modules/Tango.PPC.Maintenance/Images/temperature-green.png diff --git a/Software/Visual_Studio/PPC/Modules/Tango.PPC.Maintenance/Images/temperature-red.png b/Software/Visual_Studio/PPC/Modules/Tango.PPC.Maintenance/Images/temperature-red.png Binary files differnew file mode 100644 index 000000000..5e6b505a3 --- /dev/null +++ b/Software/Visual_Studio/PPC/Modules/Tango.PPC.Maintenance/Images/temperature-red.png diff --git a/Software/Visual_Studio/PPC/Modules/Tango.PPC.Maintenance/Images/temperature-yellow.png b/Software/Visual_Studio/PPC/Modules/Tango.PPC.Maintenance/Images/temperature-yellow.png Binary files differnew file mode 100644 index 000000000..359e93d6d --- /dev/null +++ b/Software/Visual_Studio/PPC/Modules/Tango.PPC.Maintenance/Images/temperature-yellow.png diff --git a/Software/Visual_Studio/PPC/Modules/Tango.PPC.Maintenance/Images/thread_loading.png b/Software/Visual_Studio/PPC/Modules/Tango.PPC.Maintenance/Images/thread_loading.png Binary files differnew file mode 100644 index 000000000..5d536e7ae --- /dev/null +++ b/Software/Visual_Studio/PPC/Modules/Tango.PPC.Maintenance/Images/thread_loading.png diff --git a/Software/Visual_Studio/PPC/Modules/Tango.PPC.Maintenance/MaintenanceCommand.cs b/Software/Visual_Studio/PPC/Modules/Tango.PPC.Maintenance/MaintenanceCommand.cs new file mode 100644 index 000000000..5c74d92cd --- /dev/null +++ b/Software/Visual_Studio/PPC/Modules/Tango.PPC.Maintenance/MaintenanceCommand.cs @@ -0,0 +1,81 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using Tango.Core; +using Tango.Core.Commands; +using Tango.Core.DI; +using Tango.Integration.Operation; +using Tango.PPC.Common.Connection; +using Tango.PPC.Common.Notifications; + +namespace Tango.PPC.Maintenance +{ + public abstract class MaintenanceCommand<T> : ExtendedObject + { + private IMachineProvider _machineProvider; + [TangoInject(Mode = TangoInjectMode.WhenAvailable)] + protected IMachineProvider MachineProvider + { + get { return _machineProvider; } + set + { + _machineProvider = value; RaisePropertyChangedAuto(); + _machineProvider.MachineOperator.StatusChanged += MachineOperator_StatusChanged; + } + } + + [TangoInject(Mode = TangoInjectMode.WhenAvailable)] + protected INotificationProvider NotificationProvider { get; set; } + + private RelayCommand _command; + public RelayCommand Command + { + get { return _command; } + set { _command = value; RaisePropertyChangedAuto(); } + } + + private bool _isEnabled; + public bool IsEnabled + { + get { return _isEnabled; } + set { _isEnabled = value; RaisePropertyChangedAuto(); InvalidateRelayCommands(); } + } + + private T _state; + public T State + { + get { return _state; } + set { _state = value; RaisePropertyChangedAuto(); InvalidateRelayCommands(); } + } + + private void MachineOperator_StatusChanged(object sender, MachineStatuses e) + { + InvalidateRelayCommands(); + } + + public MaintenanceCommand() + { + TangoIOC.Default.Inject(this); + IsEnabled = true; + Command = new RelayCommand(Execute, CanExecute); + } + + protected virtual bool CanExecute() + { + if (!IsEnabled) return false; + if (MachineProvider == null) return false; + if (!MachineProvider.MachineOperator.CanPrint) return false; + + return true; + } + + private void Execute() + { + OnExecute(); + } + + protected abstract void OnExecute(); + } +} diff --git a/Software/Visual_Studio/PPC/Modules/Tango.PPC.Maintenance/MaintenanceModule.cs b/Software/Visual_Studio/PPC/Modules/Tango.PPC.Maintenance/MaintenanceModule.cs new file mode 100644 index 000000000..18871ac78 --- /dev/null +++ b/Software/Visual_Studio/PPC/Modules/Tango.PPC.Maintenance/MaintenanceModule.cs @@ -0,0 +1,84 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using System.Windows.Media.Imaging; +using Tango.BL.Enumerations; +using Tango.PPC.Common; +using Tango.PPC.Maintenance.Views; +using Tango.SharedUI.Helpers; + +namespace Tango.PPC.Maintenance +{ + /// <summary> + /// Represents a PPC <see cref="MaintenanceModule"/>. + /// </summary> + /// <seealso cref="Tango.PPC.Common.PPCModuleBase" /> + [PPCModule(3)] + public class MaintenanceModule : PPCModuleBase + { + /// <summary> + /// Gets the module name. + /// </summary> + public override string Name + { + get + { + return "Maintenance"; + } + } + + /// <summary> + /// Gets the module description. + /// </summary> + public override string Description + { + get + { + return "PPC maintenance module."; + } + } + + /// <summary> + /// Gets the module cover image. + /// </summary> + public override BitmapSource Image + { + get + { + return ResourceHelper.GetImageFromResources("Images/maintenance.png"); + } + } + + /// <summary> + /// Gets the module entry point view type. + /// </summary> + public override Type MainViewType + { + get + { + return typeof(MainView); + } + } + + /// <summary> + /// Gets the permission required to see and load this module. + /// </summary> + public override Permissions Permission + { + get + { + return Permissions.RunPPC; + } + } + + /// <summary> + /// Performs application-defined tasks associated with freeing, releasing, or resetting unmanaged resources. + /// </summary> + public override void Dispose() + { + //Dispose module here... + } + } +} diff --git a/Software/Visual_Studio/PPC/Modules/Tango.PPC.Maintenance/Models/MidTankLevelModel.cs b/Software/Visual_Studio/PPC/Modules/Tango.PPC.Maintenance/Models/MidTankLevelModel.cs new file mode 100644 index 000000000..93af310ba --- /dev/null +++ b/Software/Visual_Studio/PPC/Modules/Tango.PPC.Maintenance/Models/MidTankLevelModel.cs @@ -0,0 +1,35 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using Tango.BL.Entities; +using Tango.Core; +using Tango.Integration.Operation; + +namespace Tango.PPC.Maintenance.Models +{ + public class MidTankLevelModel : ExtendedObject + { + public double Max { get; set; } + + private double _level; + public double Level + { + get { return _level; } + set { _level = value; RaisePropertyChangedAuto(); RaisePropertyChanged(nameof(IsLow)); RaisePropertyChanged(nameof(IsEmpty)); } + } + + public bool IsLow + { + get { return Level <= MachineOperator.LOW_MIDTANK_LITERS; } + } + + public bool IsEmpty + { + get { return Level <= MachineOperator.EMPTY_MIDTANK_LITERS; } + } + + public IdsPack IDSPack { get; set; } + } +} diff --git a/Software/Visual_Studio/PPC/Modules/Tango.PPC.Maintenance/Models/OverallTemperatureModel.cs b/Software/Visual_Studio/PPC/Modules/Tango.PPC.Maintenance/Models/OverallTemperatureModel.cs new file mode 100644 index 000000000..694071d0d --- /dev/null +++ b/Software/Visual_Studio/PPC/Modules/Tango.PPC.Maintenance/Models/OverallTemperatureModel.cs @@ -0,0 +1,30 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using Tango.Core; +using Tango.Integration.Operation; + +namespace Tango.PPC.Maintenance.Models +{ + public class OverallTemperatureModel : ExtendedObject + { + private double _temperature; + public double Temperature + { + get { return _temperature; } + set { _temperature = value; RaisePropertyChangedAuto(); RaisePropertyChanged(nameof(IsWarning)); RaisePropertyChanged(nameof(IsError)); } + } + + public bool IsWarning + { + get { return Temperature > MachineOperator.OVERALL_TEMPERATURE_WARNING; } + } + + public bool IsError + { + get { return Temperature >= MachineOperator.OVERALL_TEMPERATURE_ERROR; } + } + } +} diff --git a/Software/Visual_Studio/PPC/Modules/Tango.PPC.Maintenance/Properties/AssemblyInfo.cs b/Software/Visual_Studio/PPC/Modules/Tango.PPC.Maintenance/Properties/AssemblyInfo.cs new file mode 100644 index 000000000..52774bee8 --- /dev/null +++ b/Software/Visual_Studio/PPC/Modules/Tango.PPC.Maintenance/Properties/AssemblyInfo.cs @@ -0,0 +1,20 @@ +using System.Reflection; +using System.Resources; +using System.Runtime.CompilerServices; +using System.Runtime.InteropServices; +using System.Windows; + +// General Information about an assembly is controlled through the following +// set of attributes. Change these attribute values to modify the information +// associated with an assembly. +[assembly: AssemblyTitle("Tango Module")] +[assembly: AssemblyVersion("2.0.1.1407")] + +[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/PPC/Modules/Tango.PPC.Maintenance/Properties/Resources.Designer.cs b/Software/Visual_Studio/PPC/Modules/Tango.PPC.Maintenance/Properties/Resources.Designer.cs new file mode 100644 index 000000000..003dc17e5 --- /dev/null +++ b/Software/Visual_Studio/PPC/Modules/Tango.PPC.Maintenance/Properties/Resources.Designer.cs @@ -0,0 +1,63 @@ +//------------------------------------------------------------------------------ +// <auto-generated> +// 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. +// </auto-generated> +//------------------------------------------------------------------------------ + +namespace Tango.PPC.Maintenance.Properties { + using System; + + + /// <summary> + /// A strongly-typed resource class, for looking up localized strings, etc. + /// </summary> + // 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", "15.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() { + } + + /// <summary> + /// Returns the cached ResourceManager instance used by this class. + /// </summary> + [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] + internal static global::System.Resources.ResourceManager ResourceManager { + get { + if (object.ReferenceEquals(resourceMan, null)) { + global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("Tango.PPC.Maintenance.Properties.Resources", typeof(Resources).Assembly); + resourceMan = temp; + } + return resourceMan; + } + } + + /// <summary> + /// Overrides the current thread's CurrentUICulture property for all + /// resource lookups using this strongly typed resource class. + /// </summary> + [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/PPC/Modules/Tango.PPC.Maintenance/Properties/Resources.resx b/Software/Visual_Studio/PPC/Modules/Tango.PPC.Maintenance/Properties/Resources.resx new file mode 100644 index 000000000..af7dbebba --- /dev/null +++ b/Software/Visual_Studio/PPC/Modules/Tango.PPC.Maintenance/Properties/Resources.resx @@ -0,0 +1,117 @@ +<?xml version="1.0" encoding="utf-8"?> +<root> + <!-- + Microsoft ResX Schema + + Version 2.0 + + The primary goals of this format is to allow a simple XML format + that is mostly human readable. The generation and parsing of the + various data types are done through the TypeConverter classes + associated with the data types. + + Example: + + ... ado.net/XML headers & schema ... + <resheader name="resmimetype">text/microsoft-resx</resheader> + <resheader name="version">2.0</resheader> + <resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader> + <resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader> + <data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data> + <data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data> + <data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64"> + <value>[base64 mime encoded serialized .NET Framework object]</value> + </data> + <data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64"> + <value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value> + <comment>This is a comment</comment> + </data> + + There are any number of "resheader" rows that contain simple + name/value pairs. + + Each data row contains a name, and value. The row also contains a + type or mimetype. Type corresponds to a .NET class that support + text/value conversion through the TypeConverter architecture. + Classes that don't support this are serialized and stored with the + mimetype set. + + The mimetype is used for serialized objects, and tells the + ResXResourceReader how to depersist the object. This is currently not + extensible. For a given mimetype the value must be set accordingly: + + Note - application/x-microsoft.net.object.binary.base64 is the format + that the ResXResourceWriter will generate, however the reader can + read any of the formats listed below. + + mimetype: application/x-microsoft.net.object.binary.base64 + value : The object must be serialized with + : System.Serialization.Formatters.Binary.BinaryFormatter + : and then encoded with base64 encoding. + + mimetype: application/x-microsoft.net.object.soap.base64 + value : The object must be serialized with + : System.Runtime.Serialization.Formatters.Soap.SoapFormatter + : and then encoded with base64 encoding. + + mimetype: application/x-microsoft.net.object.bytearray.base64 + value : The object must be serialized into a byte array + : using a System.ComponentModel.TypeConverter + : and then encoded with base64 encoding. + --> + <xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata"> + <xsd:element name="root" msdata:IsDataSet="true"> + <xsd:complexType> + <xsd:choice maxOccurs="unbounded"> + <xsd:element name="metadata"> + <xsd:complexType> + <xsd:sequence> + <xsd:element name="value" type="xsd:string" minOccurs="0" /> + </xsd:sequence> + <xsd:attribute name="name" type="xsd:string" /> + <xsd:attribute name="type" type="xsd:string" /> + <xsd:attribute name="mimetype" type="xsd:string" /> + </xsd:complexType> + </xsd:element> + <xsd:element name="assembly"> + <xsd:complexType> + <xsd:attribute name="alias" type="xsd:string" /> + <xsd:attribute name="name" type="xsd:string" /> + </xsd:complexType> + </xsd:element> + <xsd:element name="data"> + <xsd:complexType> + <xsd:sequence> + <xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" /> + <xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" /> + </xsd:sequence> + <xsd:attribute name="name" type="xsd:string" msdata:Ordinal="1" /> + <xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" /> + <xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" /> + </xsd:complexType> + </xsd:element> + <xsd:element name="resheader"> + <xsd:complexType> + <xsd:sequence> + <xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" /> + </xsd:sequence> + <xsd:attribute name="name" type="xsd:string" use="required" /> + </xsd:complexType> + </xsd:element> + </xsd:choice> + </xsd:complexType> + </xsd:element> + </xsd:schema> + <resheader name="resmimetype"> + <value>text/microsoft-resx</value> + </resheader> + <resheader name="version"> + <value>2.0</value> + </resheader> + <resheader name="reader"> + <value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value> + </resheader> + <resheader name="writer"> + <value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value> + </resheader> +</root>
\ No newline at end of file diff --git a/Software/Visual_Studio/PPC/Modules/Tango.PPC.Maintenance/Properties/Settings.Designer.cs b/Software/Visual_Studio/PPC/Modules/Tango.PPC.Maintenance/Properties/Settings.Designer.cs new file mode 100644 index 000000000..7b549e7b7 --- /dev/null +++ b/Software/Visual_Studio/PPC/Modules/Tango.PPC.Maintenance/Properties/Settings.Designer.cs @@ -0,0 +1,26 @@ +//------------------------------------------------------------------------------ +// <auto-generated> +// 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. +// </auto-generated> +//------------------------------------------------------------------------------ + +namespace Tango.PPC.Maintenance.Properties { + + + [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "15.8.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/PPC/Modules/Tango.PPC.Maintenance/Properties/Settings.settings b/Software/Visual_Studio/PPC/Modules/Tango.PPC.Maintenance/Properties/Settings.settings new file mode 100644 index 000000000..033d7a5e9 --- /dev/null +++ b/Software/Visual_Studio/PPC/Modules/Tango.PPC.Maintenance/Properties/Settings.settings @@ -0,0 +1,7 @@ +<?xml version='1.0' encoding='utf-8'?> +<SettingsFile xmlns="uri:settings" CurrentProfile="(Default)"> + <Profiles> + <Profile Name="(Default)" /> + </Profiles> + <Settings /> +</SettingsFile>
\ No newline at end of file diff --git a/Software/Visual_Studio/PPC/Modules/Tango.PPC.Maintenance/Resources/Guides.xaml b/Software/Visual_Studio/PPC/Modules/Tango.PPC.Maintenance/Resources/Guides.xaml new file mode 100644 index 000000000..24e1e0d71 --- /dev/null +++ b/Software/Visual_Studio/PPC/Modules/Tango.PPC.Maintenance/Resources/Guides.xaml @@ -0,0 +1,60 @@ +<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" + xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" + xmlns:sys="clr-namespace:System;assembly=mscorlib" + xmlns:local="clr-namespace:Tango.PPC.Maintenance.Resources"> + + <x:Array x:Key="LoadNewThread" Type="sys:String"> + <sys:String>1. Loading New Thread</sys:String> + <sys:String>2. Wait for a message indicating the system is ready to load the thread</sys:String> + <sys:String>3. Place a cone with un-dyed thread into the thread feeding unit</sys:String> + <sys:String>4. Feed the thread along the thread groove to the winder</sys:String> + <sys:String>5. Place an empty collecting cone into the thread winder</sys:String> + <sys:String>6. Insert the end of the thread into the empty collecting cone</sys:String> + <sys:String>7. On the TS-1800 panel, press LOAD again</sys:String> + </x:Array> + + <x:Array x:Key="HandleWasteCartridge" Type="sys:String"> + <sys:String>1. On the TS-1800 panel, press LOAD</sys:String> + <sys:String>2. Wait for a message indicating the system is ready to load the thread</sys:String> + <sys:String>3. Place a cone with un-dyed thread into the thread feeding unit</sys:String> + <sys:String>4. Feed the tread along the feeding path up to the top cover</sys:String> + <sys:String>5. Feed the thread along the thread groove to the winder</sys:String> + <sys:String>6. Place an empty collecting cone into the thread winder</sys:String> + <sys:String>7. Insert the end of the thread into the empty collecting cone</sys:String> + <sys:String>8. On the TS-1800 panel, press LOAD again</sys:String> + </x:Array> + + <x:Array x:Key="ReplaceThread" Type="sys:String"> + <sys:String>1. Cut the current thread just after the feeding cone</sys:String> + <sys:String>2. Remove the current feeding cone</sys:String> + <sys:String>3. Place the new feeding cone into the thread feeding unit</sys:String> + <sys:String>4. Tie the new thread to the current thread</sys:String> + <sys:String>5. Cut off the ends of the thread leaving a small knot</sys:String> + <sys:String>6. On the TS-1800 panel, press and hold the JOG button</sys:String> + <sys:String>7. Hold the JOG button until the knot appears at the collecting cone</sys:String> + <sys:String>8. Cut the thread at the collecting cone after the knot</sys:String> + <sys:String>9. Remove the collecting cone</sys:String> + <sys:String>10. Place an empty collecting cone into the winder</sys:String> + <sys:String>11. Insert the end of the new thread into the empty collecting cone</sys:String> + </x:Array> + + <x:Array x:Key="ReplaceAirFilter" Type="sys:String"> + <sys:String>1. Open the air filter cover</sys:String> + <sys:String>2. Remove the old air filter</sys:String> + <sys:String>3. Insert a new air filter</sys:String> + <sys:String>4. Close the air filter cover</sys:String> + </x:Array> + + <x:Array x:Key="LoadInkCartridge" Type="sys:String"> + <sys:String>1. Open the cartridge cover</sys:String> + <sys:String>2. Insert a full ink cartridge into the ink-loading slot</sys:String> + <sys:String>3. Close the cartridge cover</sys:String> + <sys:String>4. When ink loading is complete, open the cartridge cover</sys:String> + <sys:String>5. Remove the empty ink cartridge</sys:String> + <sys:String>6. Remove the stopper from the residue-filling opening</sys:String> + <sys:String>7. Place the stopper into its allocated position on the top side of the empty ink cartridge</sys:String> + <sys:String>8. Put the empty ink cartridge into storage. Optional: if an empty recycling slot is available</sys:String> + <sys:String>9. Insert the empty ink cartridge into the slot for ink recycling</sys:String> + </x:Array> + +</ResourceDictionary>
\ No newline at end of file diff --git a/Software/Visual_Studio/PPC/Modules/Tango.PPC.Maintenance/Tango.PPC.Maintenance.csproj b/Software/Visual_Studio/PPC/Modules/Tango.PPC.Maintenance/Tango.PPC.Maintenance.csproj new file mode 100644 index 000000000..9dd45add4 --- /dev/null +++ b/Software/Visual_Studio/PPC/Modules/Tango.PPC.Maintenance/Tango.PPC.Maintenance.csproj @@ -0,0 +1,320 @@ +<?xml version="1.0" encoding="utf-8"?> +<Project ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> + <Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" /> + <PropertyGroup> + <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration> + <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform> + <ProjectGuid>{011470AC-6BD6-4366-B5F2-C82C065D4A84}</ProjectGuid> + <OutputType>library</OutputType> + <RootNamespace>Tango.PPC.Maintenance</RootNamespace> + <AssemblyName>Tango.PPC.Maintenance</AssemblyName> + <TargetFrameworkVersion>v4.6.1</TargetFrameworkVersion> + <FileAlignment>512</FileAlignment> + <ProjectTypeGuids>{60dc8134-eba5-43b8-bcc9-bb4bc16c2548};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids> + <WarningLevel>4</WarningLevel> + <TargetFrameworkProfile /> + </PropertyGroup> + <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' "> + <DebugSymbols>true</DebugSymbols> + <DebugType>full</DebugType> + <Optimize>false</Optimize> + <OutputPath>..\..\..\Build\PPC\Debug\</OutputPath> + <DefineConstants>DEBUG;TRACE</DefineConstants> + <ErrorReport>prompt</ErrorReport> + <WarningLevel>4</WarningLevel> + </PropertyGroup> + <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' "> + <DebugType>pdbonly</DebugType> + <Optimize>true</Optimize> + <OutputPath>..\..\..\Build\PPC\Release\</OutputPath> + <DefineConstants>TRACE</DefineConstants> + <ErrorReport>prompt</ErrorReport> + <WarningLevel>4</WarningLevel> + </PropertyGroup> + <ItemGroup> + <Reference Include="EntityFramework, Version=6.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089, processorArchitecture=MSIL"> + <HintPath>..\..\..\packages\EntityFramework.6.2.0\lib\net45\EntityFramework.dll</HintPath> + </Reference> + <Reference Include="EntityFramework.SqlServer, Version=6.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089, processorArchitecture=MSIL"> + <HintPath>..\..\..\packages\EntityFramework.6.2.0\lib\net45\EntityFramework.SqlServer.dll</HintPath> + </Reference> + <Reference Include="FontAwesome.WPF, Version=4.7.0.37774, Culture=neutral, PublicKeyToken=0758b07a11a4f466, processorArchitecture=MSIL"> + <HintPath>..\..\..\packages\FontAwesome.WPF.4.7.0.9\lib\net40\FontAwesome.WPF.dll</HintPath> + </Reference> + <Reference Include="Google.Protobuf, Version=3.4.1.0, Culture=neutral, PublicKeyToken=a7d26565bac4d604, processorArchitecture=MSIL"> + <HintPath>..\..\..\packages\Google.Protobuf.3.4.1\lib\net45\Google.Protobuf.dll</HintPath> + </Reference> + <Reference Include="Ionic.Zip, Version=1.9.1.8, Culture=neutral, PublicKeyToken=edbe51ad942a3f5c, processorArchitecture=MSIL"> + <HintPath>..\..\..\packages\Ionic.Zip.1.9.1.8\lib\Ionic.Zip.dll</HintPath> + </Reference> + <Reference Include="System" /> + <Reference Include="System.ComponentModel.DataAnnotations" /> + <Reference Include="System.Data" /> + <Reference Include="System.Reactive.Core, Version=3.0.3000.0, Culture=neutral, PublicKeyToken=94bc3704cddfc263, processorArchitecture=MSIL"> + <HintPath>..\..\..\packages\System.Reactive.Core.3.1.1\lib\net46\System.Reactive.Core.dll</HintPath> + </Reference> + <Reference Include="System.Reactive.Interfaces, Version=3.0.1000.0, Culture=neutral, PublicKeyToken=94bc3704cddfc263, processorArchitecture=MSIL"> + <HintPath>..\..\..\packages\System.Reactive.Interfaces.3.1.1\lib\net45\System.Reactive.Interfaces.dll</HintPath> + </Reference> + <Reference Include="System.Reactive.Linq, Version=3.0.3000.0, Culture=neutral, PublicKeyToken=94bc3704cddfc263, processorArchitecture=MSIL"> + <HintPath>..\..\..\packages\System.Reactive.Linq.3.1.1\lib\net46\System.Reactive.Linq.dll</HintPath> + </Reference> + <Reference Include="System.Windows.Interactivity, Version=4.5.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL"> + <HintPath>..\..\..\packages\Expression.Blend.Sdk.1.0.2\lib\net45\System.Windows.Interactivity.dll</HintPath> + </Reference> + <Reference Include="System.Xml" /> + <Reference Include="Microsoft.CSharp" /> + <Reference Include="System.Core" /> + <Reference Include="System.Xml.Linq" /> + <Reference Include="System.Data.DataSetExtensions" /> + <Reference Include="System.Net.Http" /> + <Reference Include="System.Xaml"> + <RequiredTargetFramework>4.0</RequiredTargetFramework> + </Reference> + <Reference Include="WindowsBase" /> + <Reference Include="PresentationCore" /> + <Reference Include="PresentationFramework" /> + </ItemGroup> + <ItemGroup> + <Page Include="App.xaml"> + <Generator>MSBuild:Compile</Generator> + <SubType>Designer</SubType> + </Page> + <Page Include="Dialogs\CleanerDispensingView.xaml"> + <Generator>MSBuild:Compile</Generator> + <SubType>Designer</SubType> + </Page> + <Page Include="Dialogs\HeadCleaningView.xaml"> + <Generator>MSBuild:Compile</Generator> + <SubType>Designer</SubType> + </Page> + <Page Include="Resources\Guides.xaml"> + <SubType>Designer</SubType> + <Generator>MSBuild:Compile</Generator> + </Page> + <Page Include="Themes\Generic.xaml"> + <SubType>Designer</SubType> + <Generator>MSBuild:Compile</Generator> + </Page> + <Page Include="Views\GeneralGuideView.xaml"> + <SubType>Designer</SubType> + <Generator>MSBuild:Compile</Generator> + </Page> + <Page Include="Views\MaintenanceView.xaml"> + <Generator>MSBuild:Compile</Generator> + <SubType>Designer</SubType> + </Page> + <Page Include="Views\MainView.xaml"> + <SubType>Designer</SubType> + <Generator>MSBuild:Compile</Generator> + </Page> + </ItemGroup> + <ItemGroup> + <Compile Include="..\..\..\Versioning\GlobalVersionInfo.cs"> + <Link>GlobalVersionInfo.cs</Link> + </Compile> + <Compile Include="Commands\HomingMotorCommand.cs" /> + <Compile Include="Commands\OpenCloseDyeingHeadCommand.cs" /> + <Compile Include="Commands\OpenCloseRightLeadingWheelsCommand.cs" /> + <Compile Include="Commands\OpenCloseLeftLeadingWheelsCommand.cs" /> + <Compile Include="Commands\OpenCloseMotorCommand.cs" /> + <Compile Include="Commands\ResetThreadLoadingCommand.cs" /> + <Compile Include="Controls\StateTouchButton.cs" /> + <Compile Include="Converters\LiquidTypeToBrushConverter.cs" /> + <Compile Include="Converters\LiquidTypeToShortNameConverter.cs" /> + <Compile Include="Converters\MidTankLevelToElementHeightConverter.cs" /> + <Compile Include="Converters\StringToFirstLetterConverter.cs" /> + <Compile Include="Dialogs\CleanerDispensingView.xaml.cs"> + <DependentUpon>CleanerDispensingView.xaml</DependentUpon> + </Compile> + <Compile Include="Dialogs\HeadCleaningView.xaml.cs"> + <DependentUpon>HeadCleaningView.xaml</DependentUpon> + </Compile> + <Compile Include="Dialogs\CleanerDispensingViewVM.cs" /> + <Compile Include="Dialogs\HeadCleaningViewVM.cs" /> + <Compile Include="GuideBase.cs" /> + <Compile Include="GuideStep.cs" /> + <Compile Include="Guides\LoadInkCartridgeGuide.cs" /> + <Compile Include="Guides\ReplaceAirFilterGuide.cs" /> + <Compile Include="Guides\ReplaceThreadGuide.cs" /> + <Compile Include="Guides\HandleWasteCartridgeGuide.cs" /> + <Compile Include="Guides\LoadNewThreadGuide.cs" /> + <Compile Include="Helpers\GuideHelper.cs" /> + <Compile Include="MaintenanceCommand.cs" /> + <Compile Include="MaintenanceModule.cs" /> + <Compile Include="Models\MidTankLevelModel.cs" /> + <Compile Include="Models\OverallTemperatureModel.cs" /> + <Compile Include="Properties\AssemblyInfo.cs"> + <SubType>Code</SubType> + </Compile> + <Compile Include="Properties\Resources.Designer.cs"> + <AutoGen>True</AutoGen> + <DesignTime>True</DesignTime> + <DependentUpon>Resources.resx</DependentUpon> + </Compile> + <Compile Include="Properties\Settings.Designer.cs"> + <AutoGen>True</AutoGen> + <DependentUpon>Settings.settings</DependentUpon> + <DesignTimeSharedInput>True</DesignTimeSharedInput> + </Compile> + <Compile Include="ViewModelLocator.cs" /> + <Compile Include="ViewModels\GeneralGuideViewVM.cs" /> + <Compile Include="ViewModels\MaintenanceViewVM.cs" /> + <Compile Include="ViewModels\MainViewVM.cs" /> + <Compile Include="Views\GeneralGuideView.xaml.cs"> + <DependentUpon>GeneralGuideView.xaml</DependentUpon> + </Compile> + <Compile Include="Views\MaintenanceView.xaml.cs"> + <DependentUpon>MaintenanceView.xaml</DependentUpon> + </Compile> + <Compile Include="Views\MainView.xaml.cs"> + <DependentUpon>MainView.xaml</DependentUpon> + </Compile> + <EmbeddedResource Include="Properties\Resources.resx"> + <Generator>ResXFileCodeGenerator</Generator> + <LastGenOutput>Resources.Designer.cs</LastGenOutput> + </EmbeddedResource> + <None Include="app.config"> + <SubType>Designer</SubType> + </None> + <None Include="packages.config" /> + <None Include="Properties\Settings.settings"> + <Generator>SettingsSingleFileGenerator</Generator> + <LastGenOutput>Settings.Designer.cs</LastGenOutput> + </None> + </ItemGroup> + <ItemGroup> + <ProjectReference Include="..\..\..\Tango.BL\Tango.BL.csproj"> + <Project>{f441feee-322a-4943-b566-110e12fd3b72}</Project> + <Name>Tango.BL</Name> + </ProjectReference> + <ProjectReference Include="..\..\..\Tango.Core\Tango.Core.csproj"> + <Project>{a34ee0f0-649d-41c8-8489-b6f1cc6924ee}</Project> + <Name>Tango.Core</Name> + </ProjectReference> + <ProjectReference Include="..\..\..\Tango.DragAndDrop\Tango.DragAndDrop.csproj"> + <Project>{b112d89a-a106-41ae-a0c1-4abc84c477f5}</Project> + <Name>Tango.DragAndDrop</Name> + </ProjectReference> + <ProjectReference Include="..\..\..\Tango.Explorer\Tango.Explorer.csproj"> + <Project>{4399af76-db52-4cfb-8020-6f85bdb29fd5}</Project> + <Name>Tango.Explorer</Name> + </ProjectReference> + <ProjectReference Include="..\..\..\Tango.Integration\Tango.Integration.csproj"> + <Project>{4206ac58-3b57-4699-8835-90bf6db01a61}</Project> + <Name>Tango.Integration</Name> + </ProjectReference> + <ProjectReference Include="..\..\..\Tango.Logging\Tango.Logging.csproj"> + <Project>{bc932dbd-7cdb-488c-99e4-f02cf441f55e}</Project> + <Name>Tango.Logging</Name> + </ProjectReference> + <ProjectReference Include="..\..\..\Tango.PMR\Tango.PMR.csproj"> + <Project>{e4927038-348d-4295-aaf4-861c58cb3943}</Project> + <Name>Tango.PMR</Name> + </ProjectReference> + <ProjectReference Include="..\..\..\Tango.Settings\Tango.Settings.csproj"> + <Project>{d8f1ad85-526a-4f50-b6dc-d437af63d8d8}</Project> + <Name>Tango.Settings</Name> + </ProjectReference> + <ProjectReference Include="..\..\..\Tango.SharedUI\Tango.SharedUI.csproj"> + <Project>{8491d07b-c1f6-4b62-a412-41b9fd2d6538}</Project> + <Name>Tango.SharedUI</Name> + </ProjectReference> + <ProjectReference Include="..\..\..\Tango.Touch\Tango.Touch.csproj"> + <Project>{fd86424c-6e84-491b-8df9-3d0f5c236a2a}</Project> + <Name>Tango.Touch</Name> + </ProjectReference> + <ProjectReference Include="..\..\..\Tango.Transport\Tango.Transport.csproj"> + <Project>{74e700b0-1156-4126-be40-ee450d3c3026}</Project> + <Name>Tango.Transport</Name> + </ProjectReference> + <ProjectReference Include="..\..\Tango.PPC.Common\Tango.PPC.Common.csproj"> + <Project>{0be74eee-22cb-4dba-b896-793b9e1a3ac0}</Project> + <Name>Tango.PPC.Common</Name> + </ProjectReference> + <ProjectReference Include="..\Tango.PPC.Storage\Tango.PPC.Storage.csproj"> + <Project>{04febb02-f782-4b96-b47d-f6902afa43be}</Project> + <Name>Tango.PPC.Storage</Name> + </ProjectReference> + </ItemGroup> + <ItemGroup> + <Resource Include="Images\maintenance.png" /> + </ItemGroup> + <ItemGroup> + <Resource Include="Images\action.png" /> + <Resource Include="Images\guides.png" /> + <Resource Include="Images\status.png" /> + </ItemGroup> + <ItemGroup> + <Resource Include="Images\temperature-green.png" /> + </ItemGroup> + <ItemGroup> + <Resource Include="Images\inks.png" /> + </ItemGroup> + <ItemGroup> + <Resource Include="Images\Guides\loading-new-thread.png" /> + </ItemGroup> + <ItemGroup> + <Resource Include="Images\Guides\machine-image.png" /> + </ItemGroup> + <ItemGroup> + <Resource Include="Images\Guides\handling-the-waste-cartridges.png" /> + </ItemGroup> + <ItemGroup> + <Resource Include="Images\Guides\loading-an-ink-cartridge.png" /> + </ItemGroup> + <ItemGroup> + <Resource Include="Images\Guides\replacing-the-air-filter.png" /> + </ItemGroup> + <ItemGroup> + <Resource Include="Images\Guides\replacing-the-thread.png" /> + </ItemGroup> + <ItemGroup> + <Resource Include="Images\Guides\Loading-an-Ink-Cartridge.gif" /> + <Resource Include="Images\Guides\Residue-Cartridges-A.gif" /> + </ItemGroup> + <ItemGroup> + <Resource Include="Images\Guides\Replacing-the-Air-Filter.gif" /> + </ItemGroup> + <ItemGroup> + <Resource Include="Images\Guides\Loading-New-Thread.gif" /> + <Resource Include="Images\Guides\Replacing-the-Thread.gif" /> + </ItemGroup> + <ItemGroup> + <Resource Include="Images\temperature-red.png" /> + <Resource Include="Images\temperature-yellow.png" /> + </ItemGroup> + <ItemGroup> + <Resource Include="Images\lubricant2.png" /> + </ItemGroup> + <ItemGroup> + <Resource Include="Images\cl-full.png" /> + <Resource Include="Images\l-full.png" /> + </ItemGroup> + <ItemGroup> + <Resource Include="Images\head_cleaning.png" /> + </ItemGroup> + <ItemGroup> + <Resource Include="Images\cone-empty.png" /> + <Resource Include="Images\cone-full.png" /> + </ItemGroup> + <ItemGroup> + <Resource Include="Images\Waste\present_empty_error.png" /> + </ItemGroup> + <ItemGroup> + <Resource Include="Images\Waste\absent.png" /> + </ItemGroup> + <ItemGroup> + <Resource Include="Images\Waste\present_empty_right.png" /> + <Resource Include="Images\Waste\present_full_right.png" /> + </ItemGroup> + <ItemGroup> + <Resource Include="Images\thread_loading.png" /> + </ItemGroup> + <Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" /> + <ProjectExtensions> + <VisualStudio> + <UserProperties BuildVersion_AssemblyInfoFilename="Properties\AssemblyInfo.cs" BuildVersion_UpdateAssemblyVersion="True" BuildVersion_BuildVersioningStyle="None.None.Increment.TimeStamp" BuildVersion_UseGlobalSettings="False" BuildVersion_StartDate="2000/1/1" /> + </VisualStudio> + </ProjectExtensions> +</Project>
\ No newline at end of file diff --git a/Software/Visual_Studio/PPC/Modules/Tango.PPC.Maintenance/Themes/Generic.xaml b/Software/Visual_Studio/PPC/Modules/Tango.PPC.Maintenance/Themes/Generic.xaml new file mode 100644 index 000000000..a77cc2281 --- /dev/null +++ b/Software/Visual_Studio/PPC/Modules/Tango.PPC.Maintenance/Themes/Generic.xaml @@ -0,0 +1,9 @@ +<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" + xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" + xmlns:touch="clr-namespace:Tango.Touch.Controls;assembly=Tango.Touch" + xmlns:local="clr-namespace:Tango.PPC.Maintenance.Controls"> + + <Style TargetType="{x:Type local:StateTouchButton}" BasedOn="{StaticResource {x:Type touch:TouchButton}}"> + + </Style> +</ResourceDictionary>
\ No newline at end of file diff --git a/Software/Visual_Studio/PPC/Modules/Tango.PPC.Maintenance/ViewModelLocator.cs b/Software/Visual_Studio/PPC/Modules/Tango.PPC.Maintenance/ViewModelLocator.cs new file mode 100644 index 000000000..1db63a9e4 --- /dev/null +++ b/Software/Visual_Studio/PPC/Modules/Tango.PPC.Maintenance/ViewModelLocator.cs @@ -0,0 +1,56 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using Tango.Core.DI; +using Tango.PPC.Maintenance.ViewModels; + +namespace Tango.PPC.Maintenance +{ + public static class ViewModelLocator + { + /// <summary> + /// Initializes a new instance of the ViewModelLocator class. + /// </summary> + static ViewModelLocator() + { + TangoIOC.Default.Register<MainViewVM>(); + TangoIOC.Default.Register<MaintenanceViewVM>(); + TangoIOC.Default.Register<GeneralGuideViewVM>(); + } + + /// <summary> + /// Gets the main view VM. + /// </summary> + public static MainViewVM MainViewVM + { + get + { + return TangoIOC.Default.GetInstance<MainViewVM>(); + } + } + + /// <summary> + /// Gets the maintenance view VM. + /// </summary> + public static MaintenanceViewVM MaintenanceViewVM + { + get + { + return TangoIOC.Default.GetInstance<MaintenanceViewVM>(); + } + } + + /// <summary> + /// Gets the general guide view VM. + /// </summary> + public static GeneralGuideViewVM GeneralGuideViewVM + { + get + { + return TangoIOC.Default.GetInstance<GeneralGuideViewVM>(); + } + } + } +} diff --git a/Software/Visual_Studio/PPC/Modules/Tango.PPC.Maintenance/ViewModels/GeneralGuideViewVM.cs b/Software/Visual_Studio/PPC/Modules/Tango.PPC.Maintenance/ViewModels/GeneralGuideViewVM.cs new file mode 100644 index 000000000..fd0475817 --- /dev/null +++ b/Software/Visual_Studio/PPC/Modules/Tango.PPC.Maintenance/ViewModels/GeneralGuideViewVM.cs @@ -0,0 +1,40 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using Tango.PPC.Common; +using Tango.PPC.Common.Navigation; + +namespace Tango.PPC.Maintenance.ViewModels +{ + public class GeneralGuideViewVM : PPCViewModel, INavigationObjectReceiver<GuideBase> + { + private DateTime _lastTime; + + private GuideBase _guide; + public GuideBase Guide + { + get { return _guide; } + set { _guide = value; RaisePropertyChangedAuto(); } + } + + + public override void OnApplicationStarted() + { + _lastTime = DateTime.Now; + } + + public void OnNavigatedToWithObject(GuideBase guide) + { + if (Guide != guide || (DateTime.Now - _lastTime) > TimeSpan.FromHours(1)) + { + guide.Steps.ForEach(x => x.IsChecked = false); + } + + Guide = guide; + + _lastTime = DateTime.Now; + } + } +} diff --git a/Software/Visual_Studio/PPC/Modules/Tango.PPC.Maintenance/ViewModels/MainViewVM.cs b/Software/Visual_Studio/PPC/Modules/Tango.PPC.Maintenance/ViewModels/MainViewVM.cs new file mode 100644 index 000000000..a614f7be2 --- /dev/null +++ b/Software/Visual_Studio/PPC/Modules/Tango.PPC.Maintenance/ViewModels/MainViewVM.cs @@ -0,0 +1,31 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using Tango.PPC.Common; +using Tango.PPC.Maintenance.Views; + +namespace Tango.PPC.Maintenance.ViewModels +{ + /// <summary> + /// Represents the main view VM and entry point for <see cref="Synchronization.MyModule"/>. + /// </summary> + /// <seealso cref="Tango.PPC.Common.PPCViewModel" /> + public class MainViewVM : PPCViewModel + { + /// <summary> + /// Called when the application has been started + /// </summary> + public override void OnApplicationStarted() + { + //Start initializing here rather then in the constructor. + } + + public override void OnNavigatedTo() + { + base.OnNavigatedTo(); + NavigationManager.NavigateTo<MaintenanceModule>(nameof(MaintenanceView), false); + } + } +} diff --git a/Software/Visual_Studio/PPC/Modules/Tango.PPC.Maintenance/ViewModels/MaintenanceViewVM.cs b/Software/Visual_Studio/PPC/Modules/Tango.PPC.Maintenance/ViewModels/MaintenanceViewVM.cs new file mode 100644 index 000000000..c0dc61150 --- /dev/null +++ b/Software/Visual_Studio/PPC/Modules/Tango.PPC.Maintenance/ViewModels/MaintenanceViewVM.cs @@ -0,0 +1,324 @@ +using Ionic.Zip; +using System; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Data.Entity; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using Tango.BL; +using Tango.Core; +using Tango.Core.Commands; +using Tango.Explorer; +using Tango.Integration.Operation; +using Tango.Logging; +using Tango.PMR.Diagnostics; +using Tango.PMR.IFS; +using Tango.PMR.MachineStatus; +using Tango.PPC.Common; +using Tango.PPC.Maintenance.Commands; +using Tango.PPC.Maintenance.Dialogs; +using Tango.PPC.Maintenance.Helpers; +using Tango.PPC.Maintenance.Models; +using Tango.PPC.Maintenance.Views; +using Tango.PPC.Storage; + +namespace Tango.PPC.Maintenance.ViewModels +{ + public class MaintenanceViewVM : PPCViewModel + { + public class WasteStateModel : ExtendedObject + { + private CartridgeState _state; + public CartridgeState State + { + get { return _state; } + set { _state = value; RaisePropertyChangedAuto(); } + } + + public CartridgeSlot Slot { get; set; } + } + + public ObservableCollection<GuideBase> Guides { get; set; } + + public RelayCommand<GuideBase> OpenGuideCommand { get; set; } + + private List<MidTankLevelModel> _midTankLevels; + public List<MidTankLevelModel> MidTankLevels + { + get { return _midTankLevels; } + set { _midTankLevels = value; RaisePropertyChangedAuto(); } + } + + private OverallTemperatureModel _overallTemperature; + public OverallTemperatureModel OverallTemperature + { + get { return _overallTemperature; } + set { _overallTemperature = value; RaisePropertyChangedAuto(); } + } + + private String _totalDyeTime; + public String TotalDyeTime + { + get { return _totalDyeTime; } + set { _totalDyeTime = value; RaisePropertyChangedAuto(); } + } + + private String _totalDyeMeters; + public String TotalDyeMeters + { + get { return _totalDyeMeters; } + set { _totalDyeMeters = value; RaisePropertyChangedAuto(); } + } + + private SpoolState _spoolState; + public SpoolState SpoolState + { + get { return _spoolState; } + set + { + if (_spoolState != value) + { + _spoolState = value; + RaisePropertyChangedAuto(); + } + } + } + + private List<WasteStateModel> _wasteStates; + public List<WasteStateModel> WasteStates + { + get { return _wasteStates; } + set { _wasteStates = value; RaisePropertyChangedAuto(); } + } + + public RelayCommand ExportLogsCommand { get; set; } + + public OpenCloseDyeingHeadCommand OpenCloseDyeingHeadCommand { get; set; } + + public OpenCloseLeftLeadingWheelsCommand OpenCloseLeftLeadingWheelsCommand { get; set; } + + public OpenCloseRightLeadingWheelsCommand OpenCloseRightLeadingWheelsCommand { get; set; } + + public ResetThreadLoadingCommand ResetThreadLoadingCommand { get; set; } + + public RelayCommand HeadCleaningCommand { get; set; } + + public RelayCommand StartThreadLoadingCommand { get; set; } + + public RelayCommand StartThreadBreakCommand { get; set; } + + public RelayCommand DispenseCleanerLiquidCommand { get; set; } + + public MaintenanceViewVM() + { + Guides = new ObservableCollection<GuideBase>(GuideHelper.CreateAllGuides()); + OverallTemperature = new OverallTemperatureModel(); + + OpenGuideCommand = new RelayCommand<GuideBase>(OpenGuide); + ExportLogsCommand = new RelayCommand(ExportLogsToStorage); + + OpenCloseDyeingHeadCommand = new OpenCloseDyeingHeadCommand(); + OpenCloseLeftLeadingWheelsCommand = new OpenCloseLeftLeadingWheelsCommand(); + OpenCloseRightLeadingWheelsCommand = new OpenCloseRightLeadingWheelsCommand(); + ResetThreadLoadingCommand = new ResetThreadLoadingCommand(); + HeadCleaningCommand = new RelayCommand(PerformHeadCleaning, () => MachineProvider.MachineOperator.CanPrint); + StartThreadLoadingCommand = new RelayCommand(StartThreadLoadingWizard, () => MachineProvider.MachineOperator.CanPrint); + StartThreadBreakCommand = new RelayCommand(StartThreadBreakWizard, () => MachineProvider.MachineOperator.CanPrint); + + WasteStates = new List<WasteStateModel>() + { + new WasteStateModel() { Slot = CartridgeSlot.WasteMiddle, State = CartridgeState.Absent }, + new WasteStateModel() { Slot = CartridgeSlot.WasteLower, State = CartridgeState.Absent } + }; + } + + public override void OnApplicationStarted() + { + MachineProvider.MachineOperator.InkFillingStatusChanged += MachineOperator_InkFillingStatusChanged; + MachineProvider.MachineOperator.MachineStatusChanged += MachineOperator_MachineStatusChanged; + MachineProvider.MachineOperator.MachineEventsStateProvider.EventsChanged += MachineEventsStateProvider_EventsChanged; + + DispenseCleanerLiquidCommand = new RelayCommand(DispenseCleanerLiquid, () => + { + if (MachineProvider.Machine.MachineHeadType == BL.Enumerations.HeadTypes.Arc) + { + return MachineProvider.MachineOperator.MachineEventsStateProvider.Events.Any(x => x.Type == BL.Enumerations.EventTypes.DYEING_HEAD_ARC_LID_IS_OPEN); + } + else + { + return MachineProvider.MachineOperator.MachineEventsStateProvider.Events.Any(x => x.Type == BL.Enumerations.EventTypes.DYEING_HEAD_COVER_IS_OPEN); + } + }); + + RaisePropertyChanged(nameof(DispenseCleanerLiquidCommand)); + } + + public override void OnApplicationReady() + { + base.OnApplicationReady(); + + MidTankLevels = MachineProvider.Machine.Configuration.NoneEmptyIdsPacks.OrderBy(x => x.PackIndex).Select(x => new MidTankLevelModel() + { + Max = MachineOperator.MAX_MIDTANK_LITERS, + IDSPack = x, + }).OrderBy(y => y.IDSPack.LiquidType.Code).ToList(); + } + + private void MachineEventsStateProvider_EventsChanged(object sender, IEnumerable<BL.Entities.MachinesEvent> e) + { + OpenCloseDyeingHeadCommand.IsEnabled = !e.Any(x => x.Type == BL.Enumerations.EventTypes.DRYER_DOOR_OPEN); + + InvokeUI(() => + { + DispenseCleanerLiquidCommand.RaiseCanExecuteChanged(); + }); + } + + private void MachineOperator_MachineStatusChanged(object sender, MachineStatus status) + { + UpdateMidTankLevels(status); + OverallTemperature.Temperature = status.OverallTemperature; + SpoolState = status.SpoolState; + InvalidateRelayCommands(); + } + + private void MachineOperator_InkFillingStatusChanged(object sender, InkFillingStatusChangedEventArgs e) + { + foreach (var cartridge in e.Status.CartridgesStatuses.Where(x => x.Cartridge.Slot != CartridgeSlot.Ink)) + { + var wasteState = WasteStates.SingleOrDefault(x => x.Slot == cartridge.Cartridge.Slot); + + if (wasteState != null) + { + wasteState.State = cartridge.State; + } + } + } + + public async void OpenGuide(GuideBase guide) + { + await NavigationManager.NavigateWithObject<MaintenanceModule, GeneralGuideView, GuideBase>(guide); + } + + private void UpdateMidTankLevels(MachineStatus status) + { + if (IsVisible) + { + foreach (var item in status.IDSPacksLevels) + { + var model = MidTankLevels.SingleOrDefault(x => x.IDSPack.PackIndex == item.Index); + + if (model != null) + { + model.Level = item.MidTankLevel; + } + } + } + } + + private async void ExportLogsToStorage() + { + var result = await NavigationManager. + NavigateForResult<StorageModule, + Storage.Views.MainView, ExplorerFileItem, + Storage.Models.StorageNavigationRequest>( + new Storage.Models.StorageNavigationRequest() + { + Intent = Storage.Models.StorageNavigationIntent.SaveFile, + DefaultFileName = $"Tango-Logs-{DateTime.Now.ToFileName()}", + Filter = "do not display anything", + Title = "Export System Logs", + }); + + if (result != null) + { + String file = result.Path + ".zip"; + + IsFree = false; + + try + { + NotificationProvider.SetGlobalBusyMessage("Exporting system logs..."); + + var appFileLogger = LogManager.RegisteredLoggers.FirstOrDefault(x => x is FileLogger) as FileLogger; + + await Task.Factory.StartNew(() => + { + using (ZipFile zip = new ZipFile(file)) + { + zip.Password = "1Creativity"; + + if (appFileLogger != null) + { + zip.AddDirectory(appFileLogger.Folder); + } + + zip.ParallelDeflateThreshold = -1; + zip.Save(); + } + }); + + NotificationProvider.ReleaseGlobalBusyMessage(); + + await NotificationProvider.ShowSuccess("System logs exported successfully."); + } + catch (Exception ex) + { + NotificationProvider.ReleaseGlobalBusyMessage(); + LogManager.Log(ex, "Error exporting system logs."); + await NotificationProvider.ShowError($"An error occurred while trying to export the system logs.\n{ex.FlattenMessage()}"); + } + finally + { + NotificationProvider.ReleaseGlobalBusyMessage(); + IsFree = true; + } + } + } + + public async override void OnNavigatedTo() + { + base.OnNavigatedTo(); + + try + { + using (ObservablesContext db = ObservablesContext.CreateDefault()) + { + var jobRuns = await db.JobRuns.Select(x => new { x.StartDate, x.EndDate, x.EndPosition }).ToListAsync(); + + TotalDyeTime = TimeSpan.FromHours(jobRuns.Select(x => x.EndDate - x.StartDate).Sum(x => x.TotalHours)).ToStringUnlimitedHours(); + + int meters = (int)jobRuns.Select(x => x.EndPosition).Sum(); + TotalDyeMeters = $"{meters.ToString("N0")} meters"; + } + } + catch (Exception ex) + { + LogManager.Log(ex, "Error loading machine counters."); + TotalDyeTime = "error!"; + TotalDyeMeters = "error!"; + } + } + + private async void PerformHeadCleaning() + { + await NotificationProvider.ShowDialog<HeadCleaningViewVM>(); + } + + private void StartThreadLoadingWizard() + { + ThreadLoadingService.StartThreadLoadingWizard(); + } + + private void StartThreadBreakWizard() + { + ThreadLoadingService.StartThreadBreakWizard(); + } + + private async void DispenseCleanerLiquid() + { + await NotificationProvider.ShowDialog<CleanerDispensingViewVM>(); + } + } +} diff --git a/Software/Visual_Studio/PPC/Modules/Tango.PPC.Maintenance/Views/GeneralGuideView.xaml b/Software/Visual_Studio/PPC/Modules/Tango.PPC.Maintenance/Views/GeneralGuideView.xaml new file mode 100644 index 000000000..ecff03b58 --- /dev/null +++ b/Software/Visual_Studio/PPC/Modules/Tango.PPC.Maintenance/Views/GeneralGuideView.xaml @@ -0,0 +1,55 @@ +<UserControl x:Class="Tango.PPC.Maintenance.Views.GeneralGuideView" + 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.PPC.Maintenance.Views" + xmlns:vm="clr-namespace:Tango.PPC.Maintenance.ViewModels" + xmlns:global="clr-namespace:Tango.PPC.Maintenance" + xmlns:touch="clr-namespace:Tango.Touch.Controls;assembly=Tango.Touch" + mc:Ignorable="d" + d:DesignHeight="1280" d:DesignWidth="800" d:DataContext="{d:DesignInstance Type=vm:GeneralGuideViewVM, IsDesignTimeCreatable=False}" DataContext="{x:Static global:ViewModelLocator.GeneralGuideViewVM}"> + <Grid> + <Grid Background="{StaticResource TangoMidBackgroundBrush}"> + <Grid.RowDefinitions> + <RowDefinition Height="Auto"/> + <RowDefinition Height="1*"/> + </Grid.RowDefinitions> + + <StackPanel Orientation="Horizontal" Margin="20"> + <Image Source="{Binding Guide.Icon}" Stretch="None" VerticalAlignment="Center" /> + <TextBlock Margin="20 0 0 0" VerticalAlignment="Center" FontSize="23" Text="{Binding Guide.Name}"></TextBlock> + </StackPanel> + + <Grid Grid.Row="1" Margin="10"> + <touch:TouchDropShadowBorder Padding="20" Background="{StaticResource TangoPrimaryBackgroundBrush}"> + <DockPanel> + <ItemsControl DockPanel.Dock="Top" ItemsSource="{Binding Guide.Steps}" AlternationCount="2"> + <ItemsControl.ItemTemplate> + <DataTemplate> + <Border x:Name="FooBar" Padding="20 5"> + <DockPanel> + <touch:TouchCheckBox Width="50" Padding="5 0 0 0" Height="50" DockPanel.Dock="Right" IsChecked="{Binding IsChecked,Mode=TwoWay}" /> + <TextBlock VerticalAlignment="Center" FontSize="16" HorizontalAlignment="Left" TextWrapping="Wrap" Text="{Binding Text}"></TextBlock> + </DockPanel> + </Border> + <DataTemplate.Triggers> + <Trigger Property="ItemsControl.AlternationIndex" Value="0"> + <Setter Property="Background" Value="#f9f8f8" TargetName="FooBar"/> + </Trigger> + <Trigger Property="ItemsControl.AlternationIndex" Value="1"> + <Setter Property="Background" Value="{StaticResource TangoPrimaryBackgroundBrush}" TargetName="FooBar"/> + </Trigger> + </DataTemplate.Triggers> + </DataTemplate> + </ItemsControl.ItemTemplate> + + </ItemsControl> + + <touch:TouchGifAnimation Margin="0 20 0 0" HorizontalAlignment="Left" VerticalAlignment="Bottom" EnableAnimation="{Binding IsVisible}" Source="{Binding Guide.Image}" Stretch="Uniform"></touch:TouchGifAnimation> + </DockPanel> + </touch:TouchDropShadowBorder> + </Grid> + </Grid> + </Grid> +</UserControl> diff --git a/Software/Visual_Studio/PPC/Modules/Tango.PPC.Maintenance/Views/GeneralGuideView.xaml.cs b/Software/Visual_Studio/PPC/Modules/Tango.PPC.Maintenance/Views/GeneralGuideView.xaml.cs new file mode 100644 index 000000000..10b5337ce --- /dev/null +++ b/Software/Visual_Studio/PPC/Modules/Tango.PPC.Maintenance/Views/GeneralGuideView.xaml.cs @@ -0,0 +1,33 @@ +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.PPC.Maintenance.Views +{ + /// <summary> + /// Interaction logic for GeneralGuideView.xaml + /// </summary> + public partial class GeneralGuideView : UserControl + { + public GeneralGuideView() + { + InitializeComponent(); + } + + private void TouchCheckBox_Loaded(object sender, RoutedEventArgs e) + { + + } + } +} diff --git a/Software/Visual_Studio/PPC/Modules/Tango.PPC.Maintenance/Views/MainView.xaml b/Software/Visual_Studio/PPC/Modules/Tango.PPC.Maintenance/Views/MainView.xaml new file mode 100644 index 000000000..be6161952 --- /dev/null +++ b/Software/Visual_Studio/PPC/Modules/Tango.PPC.Maintenance/Views/MainView.xaml @@ -0,0 +1,22 @@ +<UserControl x:Class="Tango.PPC.Maintenance.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:vm="clr-namespace:Tango.PPC.Maintenance.ViewModels" + xmlns:global="clr-namespace:Tango.PPC.Maintenance" + xmlns:views="clr-namespace:Tango.PPC.Maintenance.Views" + xmlns:controls="clr-namespace:Tango.SharedUI.Controls;assembly=Tango.SharedUI" + xmlns:touch="clr-namespace:Tango.Touch.Controls;assembly=Tango.Touch" + xmlns:local="clr-namespace:Tango.PPC.Maintenance.Views" + mc:Ignorable="d" + d:DesignHeight="1280" d:DesignWidth="800" d:DataContext="{d:DesignInstance Type=vm:MainViewVM, IsDesignTimeCreatable=False}" DataContext="{x:Static global:ViewModelLocator.MainViewVM}"> + + <Grid> + <controls:NavigationControl TransitionType="Slide" TransitionDuration="00:00:0.2" KeepElementsAttached="True"> + <views:MaintenanceView/> + <views:GeneralGuideView/> + </controls:NavigationControl> + </Grid> + +</UserControl> diff --git a/Software/Visual_Studio/PPC/Modules/Tango.PPC.Maintenance/Views/MainView.xaml.cs b/Software/Visual_Studio/PPC/Modules/Tango.PPC.Maintenance/Views/MainView.xaml.cs new file mode 100644 index 000000000..f859c9524 --- /dev/null +++ b/Software/Visual_Studio/PPC/Modules/Tango.PPC.Maintenance/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.PPC.Maintenance.Views +{ + /// <summary> + /// Interaction logic for MainView.xaml + /// </summary> + public partial class MainView : UserControl + { + public MainView() + { + InitializeComponent(); + } + } +} diff --git a/Software/Visual_Studio/PPC/Modules/Tango.PPC.Maintenance/Views/MaintenanceView.xaml b/Software/Visual_Studio/PPC/Modules/Tango.PPC.Maintenance/Views/MaintenanceView.xaml new file mode 100644 index 000000000..d00b4abb2 --- /dev/null +++ b/Software/Visual_Studio/PPC/Modules/Tango.PPC.Maintenance/Views/MaintenanceView.xaml @@ -0,0 +1,341 @@ +<UserControl x:Class="Tango.PPC.Maintenance.Views.MaintenanceView" + 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:vm="clr-namespace:Tango.PPC.Maintenance.ViewModels" + xmlns:global="clr-namespace:Tango.PPC.Maintenance" + xmlns:ifs="clr-namespace:Tango.PMR.IFS;assembly=Tango.PMR" + xmlns:arr="clr-namespace:System.Collections;assembly=mscorlib" + xmlns:touch="clr-namespace:Tango.Touch.Controls;assembly=Tango.Touch" + xmlns:localConverters="clr-namespace:Tango.PPC.Maintenance.Converters" + xmlns:localControls="clr-namespace:Tango.PPC.Maintenance.Controls" + xmlns:enumerations="clr-namespace:Tango.BL.Enumerations;assembly=Tango.BL" + xmlns:local="clr-namespace:Tango.PPC.Maintenance.Views" + mc:Ignorable="d" + d:DesignHeight="1800" d:DesignWidth="800" d:DataContext="{d:DesignInstance Type=vm:MaintenanceViewVM, IsDesignTimeCreatable=False}" DataContext="{x:Static global:ViewModelLocator.MaintenanceViewVM}"> + + <UserControl.Resources> + + <localConverters:StringToFirstLetterConverter x:Key="StringToFirstLetterConverter" /> + <localConverters:MidTankLevelToElementHeightConverter x:Key="MidTankLevelToElementHeightConverter" /> + <localConverters:LiquidTypeToBrushConverter x:Key="LiquidTypeToBrushConverter" /> + <localConverters:LiquidTypeToShortNameConverter x:Key="LiquidTypeToShortNameConverter"/> + + <Style TargetType="FrameworkElement" x:Key="Level1Container"> + <Setter Property="Margin" Value="20 15 60 15"></Setter> + </Style> + <Style TargetType="FrameworkElement" x:Key="Level2Container"> + <Setter Property="Margin" Value="80 30 60 0"></Setter> + </Style> + <Style TargetType="FrameworkElement" x:Key="Level2ContainerExtraMargin"> + <Setter Property="Margin" Value="80 40 60 0"></Setter> + </Style> + + <DataTemplate x:Key="LiquidBox"> + <DockPanel> + <TextBlock DockPanel.Dock="Top" Text="{Binding IDSPack.LiquidType,Converter={StaticResource LiquidTypeToShortNameConverter}}" HorizontalAlignment="Center"></TextBlock> + <Grid MaxWidth="20" Margin="1 0"> + <touch:TouchIcon Icon="MapMarkerSolid" Width="20" Height="20" HorizontalAlignment="Center" VerticalAlignment="Center" Margin="0 0 0 10" Foreground ="{Binding Path=IDSPack.LiquidType, Converter={StaticResource LiquidTypeToBrushConverter}}"> + <touch:TouchIcon.Style> + <Style TargetType="touch:TouchIcon"> + <Setter Property="Visibility" Value="Hidden"></Setter> + <Style.Triggers> + <DataTrigger Binding="{Binding IsLow}" Value="True"> + <Setter Property="Visibility" Value="Visible"></Setter> + </DataTrigger> + <DataTrigger Binding="{Binding IsEmpty}" Value="True"> + <DataTrigger.EnterActions> + <BeginStoryboard Name="blinkDrop"> + <Storyboard> + <DoubleAnimationUsingKeyFrames Storyboard.TargetProperty="Opacity" Duration="00:00:01" RepeatBehavior="Forever"> + <DiscreteDoubleKeyFrame KeyTime="00:00:00" Value="1" /> + <DiscreteDoubleKeyFrame KeyTime="00:00:0.5" Value="0" /> + </DoubleAnimationUsingKeyFrames> + </Storyboard> + </BeginStoryboard> + </DataTrigger.EnterActions> + <DataTrigger.ExitActions> + <RemoveStoryboard BeginStoryboardName="blinkDrop" /> + </DataTrigger.ExitActions> + </DataTrigger> + </Style.Triggers> + </Style> + </touch:TouchIcon.Style> + </touch:TouchIcon> + <Border BorderThickness="1" BorderBrush="{StaticResource TangoLightBorderBrush}" CornerRadius="3" ClipToBounds="True" x:Name="pathBorder"> + <Canvas Width="30" > + <Path Panel.ZIndex="1" VerticalAlignment="Bottom" ClipToBounds="True" MinHeight="2" Data="M0,0 C2,0 8.9,-1.1705073 11.3,-4.6 14.5,-7.7 15.5,-8 18.7,-10.8 21.7,-13.16 23.3,-14.5 28,-15.6 28,-13.7 28,80 28,100 L0,100 z" Height="90" Width="29" Stretch="Fill" + Canvas.Left="0" Fill="{Binding Path=IDSPack.LiquidType, Converter={StaticResource LiquidTypeToBrushConverter}}" Margin="0 -14 0 0" > + + <Path.Style> + <Style> + <Setter Property="Canvas.Top" > + <Setter.Value> + <MultiBinding Converter="{StaticResource MidTankLevelToElementHeightConverter}"> + <Binding ElementName="pathBorder" Path="ActualHeight" /> + <Binding Path="Level" /> + </MultiBinding> + </Setter.Value> + </Setter> + </Style> + </Path.Style> + </Path> + </Canvas> + </Border> + </Grid> + </DockPanel> + </DataTemplate> + </UserControl.Resources> + + <Grid Background="{StaticResource TangoMidBackgroundBrush}" IsEnabled="{Binding IsFree}"> + <Grid.RowDefinitions> + <RowDefinition Height="Auto"/> + <RowDefinition Height="1*"/> + </Grid.RowDefinitions> + + <Border Padding="20" Background="{StaticResource TangoPrimaryBackgroundBrush}" BorderThickness="0 0 0 1" BorderBrush="{StaticResource TangoDividerBrush}"> + <Border.Effect> + <DropShadowEffect Color="Silver" ShadowDepth="0" BlurRadius="20" Opacity="1" /> + </Border.Effect> + <TextBlock VerticalAlignment="Center" FontSize="{StaticResource TangoHeaderFontSize}" FontWeight="SemiBold">Maintenance</TextBlock> + </Border> + + <Grid Grid.Row="1"> + <touch:LightTouchScrollViewer> + <StackPanel Margin="10 60 10 0"> + + <!--STATUS--> + <touch:TouchDropShadowBorder Padding="0 0 0 50"> + <StackPanel> + <StackPanel Orientation="Horizontal" VerticalAlignment="Center" Style="{StaticResource Level1Container}"> + <Image Source="../Images/status.png" /> + <TextBlock FontWeight="Medium" Margin="20 0 0 0" VerticalAlignment="Center" FontSize="{StaticResource TangoExpanderHeaderFontSize}">Current Status</TextBlock> + </StackPanel> + + <StackPanel Margin="20 40 40 0"> + <Grid> + <Grid.ColumnDefinitions> + <ColumnDefinition Width="180" /> + <ColumnDefinition Width="1*" /> + <ColumnDefinition Width="180" /> + <ColumnDefinition Width="100" /> + </Grid.ColumnDefinitions> + <Grid.RowDefinitions> + <RowDefinition Height="100" /> + <RowDefinition Height="28" /> + </Grid.RowDefinitions> + + <StackPanel Orientation="Horizontal" HorizontalAlignment="Center" VerticalAlignment="Center"> + <Image Stretch="None"> + <Image.Style> + <Style TargetType="Image"> + <Setter Property="Source" Value="../Images/temperature-green.png"></Setter> + <Style.Triggers> + <DataTrigger Binding="{Binding OverallTemperature.IsWarning}" Value="True"> + <Setter Property="Source" Value="../Images/temperature-yellow.png"></Setter> + </DataTrigger> + <DataTrigger Binding="{Binding OverallTemperature.IsError}" Value="True"> + <Setter Property="Source" Value="../Images/temperature-red.png"></Setter> + </DataTrigger> + </Style.Triggers> + </Style> + </Image.Style> + </Image> + <TextBlock Margin="5 0 0 0" VerticalAlignment="Center" FontSize="{StaticResource TangoTitleFontSize}"> + <Run Text="{Binding OverallTemperature.Temperature,StringFormat='0',Mode=OneWay}"></Run> + <Run>º</Run> + </TextBlock> + </StackPanel> + + <Grid Grid.Column="1" Margin="0 0 0 10"> + <ItemsControl ItemsSource="{Binding MidTankLevels}" ItemTemplate="{StaticResource LiquidBox}"> + <ItemsControl.ItemsPanel> + <ItemsPanelTemplate> + <UniformGrid Rows="1" IsItemsHost="True"></UniformGrid> + </ItemsPanelTemplate> + </ItemsControl.ItemsPanel> + </ItemsControl> + </Grid> + + <Image Grid.Column="2" VerticalAlignment="Center" HorizontalAlignment="Center" Margin="15" RenderOptions.BitmapScalingMode="Fant"> + <Image.Style> + <Style TargetType="Image"> + <Setter Property="Source" Value="../Images/cone-empty.png"></Setter> + <Style.Triggers> + <DataTrigger Binding="{Binding SpoolState}" Value="Present"> + <Setter Property="Source" Value="../Images/cone-full.png"></Setter> + </DataTrigger> + </Style.Triggers> + </Style> + </Image.Style> + </Image> + + <Grid Grid.Column="3"> + <ItemsControl ItemsSource="{Binding WasteStates}"> + <ItemsControl.ItemsPanel> + <ItemsPanelTemplate> + <UniformGrid Columns="2" /> + </ItemsPanelTemplate> + </ItemsControl.ItemsPanel> + <ItemsControl.ItemTemplate> + <DataTemplate> + <Image Stretch="None" HorizontalAlignment="Right"> + <Image.Style> + <Style TargetType="Image"> + <Setter Property="Source" Value="../Images/Waste/absent.png"></Setter> + <Style.Triggers> + <DataTrigger Binding="{Binding State}" Value="{x:Static ifs:CartridgeState.Absent}"> + <Setter Property="Source" Value="../Images/Waste/absent.png"></Setter> + </DataTrigger> + <DataTrigger Binding="{Binding State}" Value="{x:Static ifs:CartridgeState.Present}"> + <Setter Property="Source" Value="../Images/Waste/present_empty_right.png"></Setter> + </DataTrigger> + <DataTrigger Binding="{Binding State}" Value="{x:Static ifs:CartridgeState.Empty}"> + <Setter Property="Source" Value="../Images/Waste/present_empty_right.png"></Setter> + </DataTrigger> + <DataTrigger Binding="{Binding State}" Value="{x:Static ifs:CartridgeState.Full}"> + <Setter Property="Source" Value="../Images/Waste/present_full_right.png"></Setter> + </DataTrigger> + <DataTrigger Binding="{Binding State}" Value="{x:Static ifs:CartridgeState.Emptying}"> + <Setter Property="Source" Value="../Images/Waste/present_full_right.png"></Setter> + </DataTrigger> + <DataTrigger Binding="{Binding State}" Value="{x:Static ifs:CartridgeState.Inserted}"> + <Setter Property="Source" Value="../Images/Waste/present_empty_right.png"></Setter> + </DataTrigger> + <DataTrigger Binding="{Binding State}" Value="{x:Static ifs:CartridgeState.EmptyingCompleted}"> + <Setter Property="Source" Value="../Images/Waste/present_empty_right.png"></Setter> + </DataTrigger> + <DataTrigger Binding="{Binding State}" Value="{x:Static ifs:CartridgeState.Error}"> + <Setter Property="Source" Value="../Images/Waste/present_empty_error.png"></Setter> + </DataTrigger> + </Style.Triggers> + </Style> + </Image.Style> + </Image> + </DataTemplate> + </ItemsControl.ItemTemplate> + </ItemsControl> + </Grid> + + <TextBlock Grid.Row="1" HorizontalAlignment="Center" VerticalAlignment="Center" FontSize="{StaticResource TangoTitleFontSize}">Temperature</TextBlock> + <TextBlock Grid.Column="1" Grid.Row="1" HorizontalAlignment="Center" VerticalAlignment="Center" FontSize="{StaticResource TangoTitleFontSize}">Inks</TextBlock> + <TextBlock Grid.Column="2" Grid.Row="1" HorizontalAlignment="Center" VerticalAlignment="Center" FontSize="{StaticResource TangoTitleFontSize}">Collecting Cone</TextBlock> + <TextBlock Margin="20 0 0 0" Grid.Column="3" Grid.Row="1" HorizontalAlignment="Center" VerticalAlignment="Center" FontSize="{StaticResource TangoTitleFontSize}">Waste</TextBlock> + </Grid> + </StackPanel> + </StackPanel> + </touch:TouchDropShadowBorder> + + <!--ACTIONS--> + <touch:TouchDropShadowBorder Margin="0 20 0 0" Padding="0 0 0 50" MinHeight="330"> + <StackPanel> + <StackPanel Orientation="Horizontal" VerticalAlignment="Center" Style="{StaticResource Level1Container}"> + <Image Source="../Images/action.png" /> + <TextBlock FontWeight="Medium" Margin="20 0 0 0" VerticalAlignment="Center" FontSize="{StaticResource TangoExpanderHeaderFontSize}">Actions</TextBlock> + </StackPanel> + + <StackPanel Style="{StaticResource Level2ContainerExtraMargin}"> + <UniformGrid Columns="2" Margin="0 0"> + + <localControls:StateTouchButton Command="{Binding OpenCloseLeftLeadingWheelsCommand.Command}" SelectedState="{Binding OpenCloseLeftLeadingWheelsCommand.State}" Margin="20" CornerRadius="25" Height="50" FontSize="18" Style="{StaticResource TangoHollowButton}"> + <localControls:ButtonState Value="Closed" Content="OPEN LEFT LEADING WHEELS" /> + <localControls:ButtonState Value="Opened" Content="CLOSE LEFT LEADING WHEELS" /> + </localControls:StateTouchButton> + + <localControls:StateTouchButton Command="{Binding OpenCloseRightLeadingWheelsCommand.Command}" SelectedState="{Binding OpenCloseRightLeadingWheelsCommand.State}" Margin="20" CornerRadius="25" Height="50" FontSize="18" Style="{StaticResource TangoHollowButton}"> + <localControls:ButtonState Value="Closed" Content="OPEN RIGHT LEADING WHEELS" /> + <localControls:ButtonState Value="Opened" Content="CLOSE RIGHT LEADING WHEELS" /> + </localControls:StateTouchButton> + + <localControls:StateTouchButton Command="{Binding OpenCloseDyeingHeadCommand.Command}" SelectedState="{Binding OpenCloseDyeingHeadCommand.State}" Margin="20" CornerRadius="25" Height="50" FontSize="18" Style="{StaticResource TangoHollowButton}" Visibility="{Binding MachineProvider.Machine.MachineHeadType,Converter={StaticResource IsToStringEqualToVisibilityConverter},ConverterParameter='Flat'}"> + <localControls:ButtonState Value="Closed" Content="OPEN DYEING HEAD LID" /> + <localControls:ButtonState Value="Opened" Content="CLOSE DYEING HEAD LID" /> + </localControls:StateTouchButton> + + <touch:TouchButton Margin="20" CornerRadius="25" Height="50" FontSize="18" Style="{StaticResource TangoHollowButton}" Command="{Binding HeadCleaningCommand}">RUN HEAD CLEANING</touch:TouchButton> + + <touch:TouchButton Margin="20" CornerRadius="25" Height="50" FontSize="18" Style="{StaticResource TangoHollowButton}" Command="{Binding DispenseCleanerLiquidCommand}">DISPENSE CLEANING LIQUID</touch:TouchButton> + + <touch:TouchButton Margin="20" CornerRadius="25" Height="50" FontSize="18" Style="{StaticResource TangoHollowButton}" Command="{Binding ExportLogsCommand}" Visibility="{Binding ApplicationManager.IsInTechnicianMode,Converter={StaticResource BooleanToVisibilityConverter}}">EXPORT SYSTEM LOGS</touch:TouchButton> + </UniformGrid> + </StackPanel> + </StackPanel> + </touch:TouchDropShadowBorder> + + <!--THREAD LOADING--> + <touch:TouchDropShadowBorder Margin="0 20 0 0" Padding="0 0 0 50" MinHeight="330"> + <StackPanel> + <StackPanel Orientation="Horizontal" VerticalAlignment="Center" Style="{StaticResource Level1Container}"> + <Image Source="../Images/thread_loading.png" Width="48" RenderOptions.BitmapScalingMode="Fant" /> + <TextBlock FontWeight="Medium" Margin="20 0 0 0" VerticalAlignment="Center" FontSize="{StaticResource TangoExpanderHeaderFontSize}">Thread Loading</TextBlock> + </StackPanel> + + <StackPanel Style="{StaticResource Level2ContainerExtraMargin}"> + <UniformGrid Columns="1" Margin="0 0" HorizontalAlignment="Left"> + <StackPanel Margin="20"> + <touch:TouchButton Width="280" HorizontalAlignment="Left" CornerRadius="25" Height="50" FontSize="18" Style="{StaticResource TangoHollowButton}" Command="{Binding StartThreadBreakCommand}">THREAD BREAK WIZARD</touch:TouchButton> + <DockPanel Margin="15 10 0 0" TextElement.Foreground="{StaticResource TangoGrayTextBrush}" HorizontalAlignment="Left"> + <touch:TouchIcon Icon="InformationOutline" Width="14" Height="18" VerticalAlignment="Center" /> + <TextBlock Margin="5 0 0 0" FontSize="{StaticResource TangoSmallFontSize}">This wizard will help you resolve thread breaking issues</TextBlock> + </DockPanel> + </StackPanel> + + <StackPanel Margin="20"> + <touch:TouchButton Width="280" HorizontalAlignment="Left" CornerRadius="25" Height="50" FontSize="18" Style="{StaticResource TangoHollowButton}" Command="{Binding StartThreadLoadingCommand}">THREAD LOADING WIZARD</touch:TouchButton> + <DockPanel Margin="15 10 0 0" TextElement.Foreground="{StaticResource TangoGrayTextBrush}" HorizontalAlignment="Left"> + <touch:TouchIcon Icon="InformationOutline" Width="14" Height="18" VerticalAlignment="Center" /> + <TextBlock Margin="5 0 0 0" FontSize="{StaticResource TangoSmallFontSize}">This wizard will help you load a new thread in to the system</TextBlock> + </DockPanel> + </StackPanel> + + <touch:TouchButton Width="280" HorizontalAlignment="Left" Margin="20" CornerRadius="25" Height="50" FontSize="18" Style="{StaticResource TangoHollowButton}" Command="{Binding ResetThreadLoadingCommand.Command}">RESET THREAD LOADING</touch:TouchButton> + </UniformGrid> + </StackPanel> + </StackPanel> + </touch:TouchDropShadowBorder> + + <!--GUIDES--> + <touch:TouchDropShadowBorder Margin="0 20 0 0" Padding="0 0 0 50"> + <StackPanel> + <StackPanel Orientation="Horizontal" VerticalAlignment="Center" Style="{StaticResource Level1Container}"> + <Image Source="../Images/guides.png" /> + <TextBlock FontWeight="Medium" Margin="20 0 0 0" VerticalAlignment="Center" FontSize="{StaticResource TangoExpanderHeaderFontSize}">Guides</TextBlock> + </StackPanel> + + <StackPanel Margin="65 10 0 0"> + <ItemsControl ItemsSource="{Binding Guides}"> + <ItemsControl.ItemsPanel> + <ItemsPanelTemplate> + <UniformGrid Columns="2" IsItemsHost="True" /> + </ItemsPanelTemplate> + </ItemsControl.ItemsPanel> + <ItemsControl.ItemTemplate> + <DataTemplate> + <touch:TouchButton Command="{Binding RelativeSource={RelativeSource AncestorType=UserControl},Path=DataContext.OpenGuideCommand}" CommandParameter="{Binding}" Padding="20" FontSize="{StaticResource TangoTitleFontSize}" Style="{StaticResource TangoLinkButton}" HorizontalAlignment="Left"> + <TextBlock Text="{Binding Name}"></TextBlock> + </touch:TouchButton> + </DataTemplate> + </ItemsControl.ItemTemplate> + </ItemsControl> + </StackPanel> + </StackPanel> + </touch:TouchDropShadowBorder> + + <!--JOB RUNS--> + <StackPanel Margin="0 20 0 20" TextElement.FontSize="{StaticResource TangoTitleFontSize}" TextElement.Foreground="{StaticResource TangoGrayTextBrush}"> + <StackPanel Orientation="Horizontal" HorizontalAlignment="Center"> + <TextBlock FontWeight="SemiBold">Total Dyeing Time:</TextBlock> + <TextBlock Margin="10 0 0 0" Text="{Binding TotalDyeTime,Mode=OneWay,FallbackValue=0}"></TextBlock> + </StackPanel> + + <StackPanel Orientation="Horizontal" Margin="0 10 0 0" HorizontalAlignment="Center"> + <TextBlock FontWeight="SemiBold">Total Dyed Length:</TextBlock> + <TextBlock Margin="10 0 0 0" Text="{Binding TotalDyeMeters,Mode=OneWay,FallbackValue=0}"></TextBlock> + </StackPanel> + </StackPanel> + </StackPanel> + </touch:LightTouchScrollViewer> + </Grid> + </Grid> +</UserControl> diff --git a/Software/Visual_Studio/PPC/Modules/Tango.PPC.Maintenance/Views/MaintenanceView.xaml.cs b/Software/Visual_Studio/PPC/Modules/Tango.PPC.Maintenance/Views/MaintenanceView.xaml.cs new file mode 100644 index 000000000..8fb9bd7ca --- /dev/null +++ b/Software/Visual_Studio/PPC/Modules/Tango.PPC.Maintenance/Views/MaintenanceView.xaml.cs @@ -0,0 +1,30 @@ +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; +using Tango.Integration.Operation; +using Tango.PPC.Maintenance.Models; + +namespace Tango.PPC.Maintenance.Views +{ + /// <summary> + /// Interaction logic for MainView.xaml + /// </summary> + public partial class MaintenanceView : UserControl + { + public MaintenanceView() + { + InitializeComponent(); + } + } +} diff --git a/Software/Visual_Studio/PPC/Modules/Tango.PPC.Maintenance/app.config b/Software/Visual_Studio/PPC/Modules/Tango.PPC.Maintenance/app.config new file mode 100644 index 000000000..1e22e6a88 --- /dev/null +++ b/Software/Visual_Studio/PPC/Modules/Tango.PPC.Maintenance/app.config @@ -0,0 +1,61 @@ +<?xml version="1.0" encoding="utf-8"?> +<configuration> + <configSections> + <!-- For more information on Entity Framework configuration, visit http://go.microsoft.com/fwlink/?LinkID=237468 --> + <section name="entityFramework" type="System.Data.Entity.Internal.ConfigFile.EntityFrameworkSection, EntityFramework, Version=6.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" requirePermission="false"/> + </configSections> + <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> + <dependentAssembly> + <assemblyIdentity name="System.Collections.Immutable" publicKeyToken="b03f5f7f11d50a3a" culture="neutral"/> + <bindingRedirect oldVersion="0.0.0.0-1.2.2.0" newVersion="1.2.2.0"/> + </dependentAssembly> + <dependentAssembly> + <assemblyIdentity name="System.Reflection.Metadata" publicKeyToken="b03f5f7f11d50a3a" culture="neutral"/> + <bindingRedirect oldVersion="0.0.0.0-1.4.2.0" newVersion="1.4.2.0"/> + </dependentAssembly> + <dependentAssembly> + <assemblyIdentity name="System.IO.FileSystem" publicKeyToken="b03f5f7f11d50a3a" culture="neutral"/> + <bindingRedirect oldVersion="0.0.0.0-4.0.2.0" newVersion="4.0.2.0"/> + </dependentAssembly> + <dependentAssembly> + <assemblyIdentity name="System.ValueTuple" publicKeyToken="cc7b13ffcd2ddd51" culture="neutral"/> + <bindingRedirect oldVersion="0.0.0.0-4.0.2.0" newVersion="4.0.2.0"/> + </dependentAssembly> + <dependentAssembly> + <assemblyIdentity name="System.IO.Compression" publicKeyToken="b77a5c561934e089" culture="neutral"/> + <bindingRedirect oldVersion="0.0.0.0-4.1.2.0" newVersion="4.1.2.0"/> + </dependentAssembly> + <dependentAssembly> + <assemblyIdentity name="System.IO.FileSystem.Primitives" publicKeyToken="b03f5f7f11d50a3a" culture="neutral"/> + <bindingRedirect oldVersion="0.0.0.0-4.0.2.0" newVersion="4.0.2.0"/> + </dependentAssembly> + <dependentAssembly> + <assemblyIdentity name="System.Security.Cryptography.Primitives" publicKeyToken="b03f5f7f11d50a3a" culture="neutral"/> + <bindingRedirect oldVersion="0.0.0.0-4.0.1.0" newVersion="4.0.1.0"/> + </dependentAssembly> + <dependentAssembly> + <assemblyIdentity name="System.Xml.XPath.XDocument" publicKeyToken="b03f5f7f11d50a3a" culture="neutral"/> + <bindingRedirect oldVersion="0.0.0.0-4.0.2.0" newVersion="4.0.2.0"/> + </dependentAssembly> + <dependentAssembly> + <assemblyIdentity name="System.Console" publicKeyToken="b03f5f7f11d50a3a" culture="neutral"/> + <bindingRedirect oldVersion="0.0.0.0-4.0.1.0" newVersion="4.0.1.0"/> + </dependentAssembly> + <dependentAssembly> + <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> + </assemblyBinding> + </runtime> + <entityFramework> + <defaultConnectionFactory type="System.Data.Entity.Infrastructure.SqlConnectionFactory, EntityFramework"/> + <providers> + <provider invariantName="System.Data.SqlClient" type="System.Data.Entity.SqlServer.SqlProviderServices, EntityFramework.SqlServer"/> + </providers> + </entityFramework> +<startup><supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.6.1"/></startup></configuration> diff --git a/Software/Visual_Studio/PPC/Modules/Tango.PPC.Maintenance/packages.config b/Software/Visual_Studio/PPC/Modules/Tango.PPC.Maintenance/packages.config new file mode 100644 index 000000000..468d4f366 --- /dev/null +++ b/Software/Visual_Studio/PPC/Modules/Tango.PPC.Maintenance/packages.config @@ -0,0 +1,11 @@ +<?xml version="1.0" encoding="utf-8"?> +<packages> + <package id="EntityFramework" version="6.2.0" targetFramework="net461" /> + <package id="Expression.Blend.Sdk" version="1.0.2" targetFramework="net46" /> + <package id="FontAwesome.WPF" version="4.7.0.9" targetFramework="net46" /> + <package id="Google.Protobuf" version="3.4.1" targetFramework="net46" /> + <package id="Ionic.Zip" version="1.9.1.8" targetFramework="net461" /> + <package id="System.Reactive.Core" version="3.1.1" targetFramework="net461" /> + <package id="System.Reactive.Interfaces" version="3.1.1" targetFramework="net461" /> + <package id="System.Reactive.Linq" version="3.1.1" targetFramework="net461" /> +</packages>
\ No newline at end of file diff --git a/Software/Visual_Studio/PPC/Modules/Tango.PPC.Storage/Models/StorageNavigationIntent.cs b/Software/Visual_Studio/PPC/Modules/Tango.PPC.Storage/Models/StorageNavigationIntent.cs index 2c2a7f10d..3ec14cc6f 100644 --- a/Software/Visual_Studio/PPC/Modules/Tango.PPC.Storage/Models/StorageNavigationIntent.cs +++ b/Software/Visual_Studio/PPC/Modules/Tango.PPC.Storage/Models/StorageNavigationIntent.cs @@ -9,6 +9,8 @@ namespace Tango.PPC.Storage.Models public enum StorageNavigationIntent { LoadFile, - SaveFile + LoadFiles, + SaveFile, + SaveFiles } } diff --git a/Software/Visual_Studio/PPC/Modules/Tango.PPC.Storage/StorageModule.cs b/Software/Visual_Studio/PPC/Modules/Tango.PPC.Storage/StorageModule.cs index b3553e666..8bbeb4fe2 100644 --- a/Software/Visual_Studio/PPC/Modules/Tango.PPC.Storage/StorageModule.cs +++ b/Software/Visual_Studio/PPC/Modules/Tango.PPC.Storage/StorageModule.cs @@ -15,7 +15,7 @@ namespace Tango.PPC.Storage /// Represents a PPC <see cref="StorageModule"/>. /// </summary> /// <seealso cref="Tango.PPC.Common.PPCModuleBase" /> - [PPCModule(3)] + [PPCModule(5)] public class StorageModule : PPCModuleBase { /// <summary> diff --git a/Software/Visual_Studio/PPC/Modules/Tango.PPC.Storage/ViewModels/MainViewVM.cs b/Software/Visual_Studio/PPC/Modules/Tango.PPC.Storage/ViewModels/MainViewVM.cs index 4a756e7ea..9b22fcdb5 100644 --- a/Software/Visual_Studio/PPC/Modules/Tango.PPC.Storage/ViewModels/MainViewVM.cs +++ b/Software/Visual_Studio/PPC/Modules/Tango.PPC.Storage/ViewModels/MainViewVM.cs @@ -1,5 +1,6 @@ using System; using System.Collections.Generic; +using System.Collections.ObjectModel; using System.Linq; using System.Text; using System.Threading.Tasks; @@ -21,7 +22,6 @@ namespace Tango.PPC.Storage.ViewModels { private bool _allow_exit; private ExplorerFileItem _selectedItem; - private static char[] _invalidChars = System.IO.Path.GetInvalidFileNameChars(); private String _currentPath; public String CurrentPath @@ -63,15 +63,28 @@ namespace Tango.PPC.Storage.ViewModels } } + private bool _displayItems; + public bool DisplayItems + { + get { return _displayItems; } + set { _displayItems = value; RaisePropertyChangedAuto(); } + } + public RelayCommand<ExplorerFileItem> FileSelectedCommand { get; set; } + public ObservableCollection<ExplorerFileItem> SelectedItems { get; set; } + public RelayCommand SaveCommand { get; set; } + public RelayCommand OpenCommand { get; set; } + public MainViewVM() { + SelectedItems = new ObservableCollection<ExplorerFileItem>(); FileSelectedCommand = new RelayCommand<ExplorerFileItem>(OnFileSelected); - SaveCommand = new RelayCommand(OnSaveCommand, (x) => !String.IsNullOrWhiteSpace(FileName)); - Request = new StorageNavigationRequest(); + SaveCommand = new RelayCommand(OnSaveCommand, (x) => !String.IsNullOrWhiteSpace(FileName) || Request.Intent == StorageNavigationIntent.SaveFiles); + Request = new StorageNavigationRequest() { Intent = StorageNavigationIntent.LoadFiles }; + OpenCommand = new RelayCommand(OnOpenCommand, () => Request.Intent == StorageNavigationIntent.LoadFiles); } public override void OnApplicationStarted() @@ -104,6 +117,8 @@ namespace Tango.PPC.Storage.ViewModels { View.EditFileName(); } + + DisplayItems = true; } else { @@ -116,7 +131,9 @@ namespace Tango.PPC.Storage.ViewModels public override void OnNavigatedFrom() { base.OnNavigatedFrom(); - Request = new StorageNavigationRequest(); + DisplayItems = false; + Request = null; + Request = new StorageNavigationRequest() { Intent = StorageNavigationIntent.LoadFiles }; } /// <summary> @@ -158,7 +175,6 @@ namespace Tango.PPC.Storage.ViewModels { if (_allow_exit || CurrentPath == StorageProvider.Drive.RootDirectory.FullName) { - Request = null; return Task.FromResult(true); } else @@ -170,9 +186,17 @@ namespace Tango.PPC.Storage.ViewModels private async void OnFileSelected(ExplorerFileItem fileItem) { + _selectedItem = fileItem; + _allow_exit = true; + await NavigationManager.NavigateBack(); + StorageProvider.SubmitFileSelection(new List<ExplorerFileItem>() { fileItem }); + } + + private async void OnOpenCommand() + { _allow_exit = true; await NavigationManager.NavigateBack(); - StorageProvider.SubmitFileSelection(fileItem); + StorageProvider.SubmitFileSelection(SelectedItems.ToList()); } public ExplorerFileItem GetNavigationResult() @@ -187,10 +211,23 @@ namespace Tango.PPC.Storage.ViewModels private void OnSaveCommand() { - _selectedItem = new ExplorerFileItem() + _allow_exit = true; + + if (Request.Intent == StorageNavigationIntent.SaveFile) + { + _selectedItem = new ExplorerFileItem() + { + Path = CurrentPath + "\\" + FileName, + }; + } + else if (Request.Intent == StorageNavigationIntent.SaveFiles) { - Path = CurrentPath + "\\" + FileName, - }; + _selectedItem = new ExplorerFileItem() + { + Path = CurrentPath, + }; + } + NavigationManager.NavigateBack(); } @@ -200,10 +237,7 @@ namespace Tango.PPC.Storage.ViewModels if (text != null) { - foreach (var c in _invalidChars) - { - text = text.Replace(c.ToString(), ""); - } + text = text.ToValidFileName(); _fileName = text; RaisePropertyChanged(nameof(FileName)); diff --git a/Software/Visual_Studio/PPC/Modules/Tango.PPC.Storage/Views/MainView.xaml b/Software/Visual_Studio/PPC/Modules/Tango.PPC.Storage/Views/MainView.xaml index 74307c9ce..c57735a7b 100644 --- a/Software/Visual_Studio/PPC/Modules/Tango.PPC.Storage/Views/MainView.xaml +++ b/Software/Visual_Studio/PPC/Modules/Tango.PPC.Storage/Views/MainView.xaml @@ -16,7 +16,7 @@ <UserControl.InputBindings> <KeyBinding Key="Return" Command="{Binding SaveCommand}"></KeyBinding> </UserControl.InputBindings> - + <Grid> <Grid Background="{StaticResource TangoMidBackgroundBrush}"> <Grid.RowDefinitions> @@ -32,31 +32,89 @@ </Border> <Grid Margin="10" Grid.Row="1"> <DockPanel> - - <Grid DockPanel.Dock="Top" Visibility="{Binding Request.Intent,Converter={StaticResource EnumToVisibilityConverter},ConverterParameter=SaveFile}"> + <Grid DockPanel.Dock="Top"> + <Grid.Style> + <Style TargetType="Grid"> + <Setter Property="Visibility" Value="Collapsed"></Setter> + <Style.Triggers> + <MultiDataTrigger> + <MultiDataTrigger.Conditions> + <Condition Binding="{Binding Request.Intent}" Value="LoadFiles" /> + <Condition Binding="{Binding ElementName=explorer,Path=IsMultiSelecting}" Value="True" /> + </MultiDataTrigger.Conditions> + <Setter Property="Visibility" Value="Visible"></Setter> + </MultiDataTrigger> + </Style.Triggers> + </Style> + </Grid.Style> + <Border BorderThickness="0 0 0 1" BorderBrush="{StaticResource TangoDividerBrush}" Padding="20"> + <StackPanel> + <DockPanel Margin="0 0 0 0"> + <touch:TouchButton Command="{Binding OpenCommand}" Margin="20 0 0 0" Height="55" Width="200" Style="{StaticResource TangoHollowButton}" CornerRadius="25" DockPanel.Dock="Right"> + <touch:TouchButton.Content> + OPEN + </touch:TouchButton.Content> + </touch:TouchButton> + <Grid> + <TextBlock VerticalAlignment="Center" Foreground="{StaticResource TangoGrayTextBrush}"> + <Run Text="{Binding SelectedItems.Count,Mode=OneWay}"></Run> + <Run>files selected</Run> + </TextBlock> + </Grid> + </DockPanel> + </StackPanel> + </Border> + </Grid> + + <Grid DockPanel.Dock="Top"> + <Grid.Style> + <Style TargetType="Grid"> + <Setter Property="Visibility" Value="Collapsed"></Setter> + <Style.Triggers> + <DataTrigger Binding="{Binding Request.Intent}" Value="SaveFile"> + <Setter Property="Visibility" Value="Visible"></Setter> + </DataTrigger> + <DataTrigger Binding="{Binding Request.Intent}" Value="SaveFiles"> + <Setter Property="Visibility" Value="Visible"></Setter> + </DataTrigger> + </Style.Triggers> + </Style> + </Grid.Style> <Border BorderThickness="0 0 0 1" BorderBrush="{StaticResource TangoDividerBrush}" Padding="20"> <StackPanel> <TextBlock Text="{Binding Request.Title}" FontSize="{StaticResource TangoHeaderFontSize}"></TextBlock> <DockPanel Margin="0 10 0 0"> - <touch:TouchButton Command="{Binding SaveCommand}" Margin="20 0 0 0" Height="50" Width="200" Style="{StaticResource TangoHollowButton}" CornerRadius="0" DockPanel.Dock="Right"> + <touch:TouchButton Command="{Binding SaveCommand}" Margin="20 0 0 0" Height="55" Width="200" Style="{StaticResource TangoHollowButton}" CornerRadius="25" DockPanel.Dock="Right"> <touch:TouchButton.Content> SAVE </touch:TouchButton.Content> </touch:TouchButton> - <touch:TouchTextBox x:Name="txtFileName" KeyboardAction="Go" FocusSelectionMode="SelectAll" VerticalAlignment="Bottom" Text="{Binding FileName,Mode=TwoWay,UpdateSourceTrigger=PropertyChanged}" /> + <Grid> + <touch:TouchTextBox x:Name="txtFileName" Visibility="{Binding Request.Intent,Converter={StaticResource EnumToVisibilityConverter},ConverterParameter=SaveFile}" KeyboardAction="Go" FocusSelectionMode="SelectAll" VerticalAlignment="Bottom" Text="{Binding FileName,Mode=TwoWay,UpdateSourceTrigger=PropertyChanged}" /> + <TextBlock VerticalAlignment="Center" Foreground="{StaticResource TangoGrayTextBrush}" Visibility="{Binding Request.Intent,Converter={StaticResource EnumToVisibilityConverter},ConverterParameter=SaveFiles}">Select destination folder</TextBlock> + </Grid> </DockPanel> </StackPanel> </Border> </Grid> - <explorer:ExplorerControl x:Name="explorer" CurrentPath="{Binding CurrentPath,Mode=TwoWay}" FileSelectedCommand="{Binding FileSelectedCommand}" Filter="{Binding Request.Filter}"> + <explorer:ExplorerControl x:Name="explorer" CurrentPath="{Binding CurrentPath,Mode=TwoWay}" SelectedItems="{Binding SelectedItems}" FileSelectedCommand="{Binding FileSelectedCommand}" Filter="{Binding Request.Filter}" Visibility="{Binding DisplayItems,Converter={StaticResource BooleanToVisibilityConverter}}"> <explorer:ExplorerControl.Style> <Style TargetType="explorer:ExplorerControl" BasedOn="{StaticResource {x:Type explorer:ExplorerControl}}"> <Setter Property="EnableFileSelection" Value="True"></Setter> + <Setter Property="EnableMultiSelect" Value="False"></Setter> <Style.Triggers> <DataTrigger Binding="{Binding Request.Intent}" Value="SaveFile"> <Setter Property="EnableFileSelection" Value="False"></Setter> </DataTrigger> + <DataTrigger Binding="{Binding Request.Intent}" Value="LoadFiles"> + <Setter Property="EnableFileSelection" Value="True"></Setter> + <Setter Property="EnableMultiSelect" Value="True"></Setter> + </DataTrigger> + <DataTrigger Binding="{Binding Request.Intent}" Value="LoadFile"> + <Setter Property="EnableFileSelection" Value="True"></Setter> + <Setter Property="EnableMultiSelect" Value="False"></Setter> + </DataTrigger> </Style.Triggers> </Style> </explorer:ExplorerControl.Style> diff --git a/Software/Visual_Studio/PPC/Modules/Tango.PPC.Technician/Dialogs/EmbeddedLogItemDetailsView.xaml b/Software/Visual_Studio/PPC/Modules/Tango.PPC.Technician/Dialogs/EmbeddedLogItemDetailsView.xaml new file mode 100644 index 000000000..25227fc60 --- /dev/null +++ b/Software/Visual_Studio/PPC/Modules/Tango.PPC.Technician/Dialogs/EmbeddedLogItemDetailsView.xaml @@ -0,0 +1,80 @@ +<UserControl x:Class="Tango.PPC.Technician.Dialogs.EmbeddedLogItemDetailsView" + 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:touch="clr-namespace:Tango.Touch.Controls;assembly=Tango.Touch" + xmlns:local="clr-namespace:Tango.PPC.Technician.Dialogs" + xmlns:converters="clr-namespace:Tango.PPC.Technician.Converters" + xmlns:controls="clr-namespace:Tango.SharedUI.Controls;assembly=Tango.SharedUI" + mc:Ignorable="d" + Background="{StaticResource TangoPrimaryBackgroundBrush}" Width="560" Height="700" d:DataContext="{d:DesignInstance Type=local:EmbeddedLogItemDetailsViewVM, IsDesignTimeCreatable=False}"> + + <UserControl.Resources> + <converters:LogItemToStringConverter x:Key="LogItemToStringConverter" /> + </UserControl.Resources> + + <Grid Margin="5"> + <Grid Grid.RowSpan="2"> + <Grid.RowDefinitions> + <RowDefinition Height="60"/> + <RowDefinition Height="31*"/> + <RowDefinition Height="60"/> + </Grid.RowDefinitions> + + <StackPanel Orientation="Horizontal"> + <touch:TouchIcon Width="42" Height="42" VerticalAlignment="Center"> + <touch:TouchIcon.Style> + <Style TargetType="touch:TouchIcon"> + <Setter Property="Icon" Value="InformationOutline"></Setter> + <Style.Triggers> + <DataTrigger Binding="{Binding Log.Category}" Value="Warning"> + <Setter Property="Icon" Value="ExclamationTriangleSolid"></Setter> + <Setter Property="Foreground" Value="{StaticResource TangoWarningBrush}"></Setter> + </DataTrigger> + <DataTrigger Binding="{Binding Log.Category}" Value="Error"> + <Setter Property="Icon" Value="Alert"></Setter> + <Setter Property="Foreground" Value="{StaticResource TangoErrorBrush}"></Setter> + </DataTrigger> + <DataTrigger Binding="{Binding Log.Category}" Value="Critical"> + <Setter Property="Icon" Value="Alert"></Setter> + <Setter Property="Foreground" Value="{StaticResource TangoErrorBrush}"></Setter> + </DataTrigger> + </Style.Triggers> + </Style> + </touch:TouchIcon.Style> + </touch:TouchIcon> + <TextBlock VerticalAlignment="Center" Text="{Binding Log.Message}" TextWrapping="NoWrap" Height="22" TextTrimming="CharacterEllipsis" Width="500" Margin="10 0 0 0" FontSize="16"></TextBlock> + </StackPanel> + + <Grid Grid.Row="1"> + <DockPanel> + <Grid DockPanel.Dock="Top"> + <controls:TableGrid RowHeight="30"> + <TextBlock Text="Time Stamp:" FontWeight="SemiBold" /> + <TextBlock Text="{Binding Log.TimeStamp,Converter={StaticResource DateTimeUTCToStringConverter},ConverterParameter='MM/dd/yyyy HH:mm:ss.fff'}"></TextBlock> + <TextBlock Text="Category:" FontWeight="SemiBold" /> + <TextBlock Text="{Binding Log.Category}"></TextBlock> + <TextBlock Text="File:" FontWeight="SemiBold" /> + <TextBlock Text="{Binding Log.DebugLogResponse.FileName}"></TextBlock> + <TextBlock Text="Line:" FontWeight="SemiBold" /> + <TextBlock Text="{Binding Log.DebugLogResponse.LineNumber}"></TextBlock> + <TextBlock Text="Module:" FontWeight="SemiBold" /> + <TextBlock Text="{Binding Log.DebugLogResponse.ModuleId}"></TextBlock> + <TextBlock Text="Filter:" FontWeight="SemiBold" /> + <TextBlock Text="{Binding Log.DebugLogResponse.Filter}"></TextBlock> + </controls:TableGrid> + </Grid> + + <Border Padding="5" BorderThickness="1" BorderBrush="{StaticResource TangoLightBorderBrush}"> + <TextBox BorderThickness="0" Text="{Binding Log,Converter={StaticResource LogItemToStringConverter}}" Style="{x:Null}" TextWrapping="Wrap" IsReadOnly="True" HorizontalScrollBarVisibility="Disabled" VerticalScrollBarVisibility="Hidden" Background="Transparent" /> + </Border> + </DockPanel> + </Grid> + + <Grid Grid.Row="2"> + <touch:TouchButton Style="{StaticResource TangoHollowButton}" HorizontalAlignment="Right" Width="170" VerticalAlignment="Bottom" CornerRadius="25" Height="50" Command="{Binding CloseCommand}">CLOSE</touch:TouchButton> + </Grid> + </Grid> + </Grid> +</UserControl> diff --git a/Software/Visual_Studio/PPC/Modules/Tango.PPC.Technician/Dialogs/EmbeddedLogItemDetailsView.xaml.cs b/Software/Visual_Studio/PPC/Modules/Tango.PPC.Technician/Dialogs/EmbeddedLogItemDetailsView.xaml.cs new file mode 100644 index 000000000..83ec6d362 --- /dev/null +++ b/Software/Visual_Studio/PPC/Modules/Tango.PPC.Technician/Dialogs/EmbeddedLogItemDetailsView.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.PPC.Technician.Dialogs +{ + /// <summary> + /// Interaction logic for LogItemDetailsView.xaml + /// </summary> + public partial class EmbeddedLogItemDetailsView : UserControl + { + public EmbeddedLogItemDetailsView() + { + InitializeComponent(); + } + } +} diff --git a/Software/Visual_Studio/PPC/Modules/Tango.PPC.Technician/Dialogs/EmbeddedLogItemDetailsViewVM.cs b/Software/Visual_Studio/PPC/Modules/Tango.PPC.Technician/Dialogs/EmbeddedLogItemDetailsViewVM.cs new file mode 100644 index 000000000..8dc745263 --- /dev/null +++ b/Software/Visual_Studio/PPC/Modules/Tango.PPC.Technician/Dialogs/EmbeddedLogItemDetailsViewVM.cs @@ -0,0 +1,21 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using Tango.Integration.Logging; +using Tango.Logging; +using Tango.SharedUI; + +namespace Tango.PPC.Technician.Dialogs +{ + public class EmbeddedLogItemDetailsViewVM : DialogViewVM + { + private EmbeddedLogItem _log; + public EmbeddedLogItem Log + { + get { return _log; } + set { _log = value; RaisePropertyChangedAuto(); } + } + } +} diff --git a/Software/Visual_Studio/PPC/Modules/Tango.PPC.Technician/Dialogs/SynchronizationDetailsView.xaml b/Software/Visual_Studio/PPC/Modules/Tango.PPC.Technician/Dialogs/SynchronizationDetailsView.xaml new file mode 100644 index 000000000..37fa8b05c --- /dev/null +++ b/Software/Visual_Studio/PPC/Modules/Tango.PPC.Technician/Dialogs/SynchronizationDetailsView.xaml @@ -0,0 +1,74 @@ +<UserControl x:Class="Tango.PPC.Technician.Dialogs.SynchronizationDetailsView" + 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:touch="clr-namespace:Tango.Touch.Controls;assembly=Tango.Touch" + xmlns:local="clr-namespace:Tango.PPC.Technician.Dialogs" + xmlns:converters="clr-namespace:Tango.PPC.Technician.Converters" + xmlns:controls="clr-namespace:Tango.SharedUI.Controls;assembly=Tango.SharedUI" + mc:Ignorable="d" + Background="{StaticResource TangoPrimaryBackgroundBrush}" Width="560" Height="700" d:DataContext="{d:DesignInstance Type=local:SynchronizationDetailsViewVM, IsDesignTimeCreatable=False}"> + + <Grid Margin="5"> + <Grid Grid.RowSpan="2"> + <Grid.RowDefinitions> + <RowDefinition Height="60"/> + <RowDefinition Height="31*"/> + <RowDefinition Height="60"/> + </Grid.RowDefinitions> + + <StackPanel Orientation="Horizontal" DataContext="{Binding Status}"> + <touch:TouchIcon Width="42" Height="42" VerticalAlignment="Center"> + <touch:TouchIcon.Style> + <Style TargetType="touch:TouchIcon"> + <Setter Property="Icon" Value="Information"></Setter> + <Style.Triggers> + <DataTrigger Binding="{Binding State}" Value="Pending"> + <Setter Property="Icon" Value="Pause"></Setter> + <Setter Property="Foreground" Value="{StaticResource TangoGrayBrush}"></Setter> + </DataTrigger> + <DataTrigger Binding="{Binding State}" Value="Synchronizing"> + <Setter Property="Icon" Value="CloudSync"></Setter> + <Setter Property="Foreground" Value="{StaticResource TangoWarningBrush}"></Setter> + </DataTrigger> + <DataTrigger Binding="{Binding State}" Value="Failed"> + <Setter Property="Icon" Value="Alert"></Setter> + <Setter Property="Foreground" Value="{StaticResource TangoErrorBrush}"></Setter> + </DataTrigger> + <DataTrigger Binding="{Binding State}" Value="Completed"> + <Setter Property="Icon" Value="Check"></Setter> + <Setter Property="Foreground" Value="{StaticResource TangoGreenBrush}"></Setter> + </DataTrigger> + </Style.Triggers> + </Style> + </touch:TouchIcon.Style> + </touch:TouchIcon> + <TextBlock VerticalAlignment="Center" Text="{Binding Message}" TextWrapping="NoWrap" Height="22" TextTrimming="CharacterEllipsis" Width="500" Margin="10 0 0 0" FontSize="16"></TextBlock> + </StackPanel> + + <Grid Grid.Row="1"> + <DockPanel> + <Grid DockPanel.Dock="Top"> + <controls:TableGrid RowHeight="30"> + <TextBlock Text="Status:" FontWeight="SemiBold" /> + <TextBlock Text="{Binding Status.State,Converter={StaticResource EnumToDescriptionConverter}}"></TextBlock> + <TextBlock Text="Start Time:" FontWeight="SemiBold" /> + <TextBlock Text="{Binding Status.StartDateTime,Converter={StaticResource DateTimeUTCToStringConverter},ConverterParameter='MM/dd/yyyy HH:mm:ss'}"></TextBlock> + <TextBlock Text="Duration:" FontWeight="SemiBold" /> + <TextBlock Text="{Binding Status.Duration,StringFormat='hh\\:mm\\:ss\\.fff'}"></TextBlock> + </controls:TableGrid> + </Grid> + + <Border Padding="5" BorderThickness="1" BorderBrush="{StaticResource TangoLightBorderBrush}"> + <TextBox BorderThickness="0" Text="{Binding Status.ErrorReason,TargetNullValue='No further Information available.'}" Style="{x:Null}" TextWrapping="Wrap" IsReadOnly="True" HorizontalScrollBarVisibility="Disabled" VerticalScrollBarVisibility="Hidden" Background="Transparent" /> + </Border> + </DockPanel> + </Grid> + + <Grid Grid.Row="2"> + <touch:TouchButton Style="{StaticResource TangoHollowButton}" HorizontalAlignment="Right" Width="170" VerticalAlignment="Bottom" CornerRadius="25" Height="50" Command="{Binding CloseCommand}">CLOSE</touch:TouchButton> + </Grid> + </Grid> + </Grid> +</UserControl> diff --git a/Software/Visual_Studio/PPC/Modules/Tango.PPC.Technician/Dialogs/SynchronizationDetailsView.xaml.cs b/Software/Visual_Studio/PPC/Modules/Tango.PPC.Technician/Dialogs/SynchronizationDetailsView.xaml.cs new file mode 100644 index 000000000..40f7a536c --- /dev/null +++ b/Software/Visual_Studio/PPC/Modules/Tango.PPC.Technician/Dialogs/SynchronizationDetailsView.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.PPC.Technician.Dialogs +{ + /// <summary> + /// Interaction logic for LogItemDetailsView.xaml + /// </summary> + public partial class SynchronizationDetailsView : UserControl + { + public SynchronizationDetailsView() + { + InitializeComponent(); + } + } +} diff --git a/Software/Visual_Studio/PPC/Modules/Tango.PPC.Technician/Dialogs/SynchronizationDetailsViewVM.cs b/Software/Visual_Studio/PPC/Modules/Tango.PPC.Technician/Dialogs/SynchronizationDetailsViewVM.cs new file mode 100644 index 000000000..392c8dd3a --- /dev/null +++ b/Software/Visual_Studio/PPC/Modules/Tango.PPC.Technician/Dialogs/SynchronizationDetailsViewVM.cs @@ -0,0 +1,22 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using Tango.BL.Entities; +using Tango.Logging; +using Tango.PPC.Common.Synchronization; +using Tango.SharedUI; + +namespace Tango.PPC.Technician.Dialogs +{ + public class SynchronizationDetailsViewVM : DialogViewVM + { + private SynchronizationStatus _status; + public SynchronizationStatus Status + { + get { return _status; } + set { _status = value; RaisePropertyChangedAuto(); } + } + } +} diff --git a/Software/Visual_Studio/PPC/Modules/Tango.PPC.Technician/Dialogs/UpdateDetailsView.xaml b/Software/Visual_Studio/PPC/Modules/Tango.PPC.Technician/Dialogs/UpdateDetailsView.xaml new file mode 100644 index 000000000..ccf2062c1 --- /dev/null +++ b/Software/Visual_Studio/PPC/Modules/Tango.PPC.Technician/Dialogs/UpdateDetailsView.xaml @@ -0,0 +1,87 @@ +<UserControl x:Class="Tango.PPC.Technician.Dialogs.UpdateDetailsView" + 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:touch="clr-namespace:Tango.Touch.Controls;assembly=Tango.Touch" + xmlns:local="clr-namespace:Tango.PPC.Technician.Dialogs" + xmlns:converters="clr-namespace:Tango.PPC.Technician.Converters" + xmlns:controls="clr-namespace:Tango.SharedUI.Controls;assembly=Tango.SharedUI" + mc:Ignorable="d" + Background="{StaticResource TangoPrimaryBackgroundBrush}" Width="560" Height="700" d:DataContext="{d:DesignInstance Type=local:UpdateDetailsViewVM, IsDesignTimeCreatable=False}"> + + <Grid Margin="5"> + <Grid Grid.RowSpan="2"> + <Grid.RowDefinitions> + <RowDefinition Height="60"/> + <RowDefinition Height="31*"/> + <RowDefinition Height="60"/> + </Grid.RowDefinitions> + + <StackPanel Orientation="Horizontal" DataContext="{Binding Update}"> + <touch:TouchIcon Width="42" Height="42" VerticalAlignment="Center"> + <touch:TouchIcon.Style> + <Style TargetType="touch:TouchIcon"> + <Setter Property="Icon" Value="Information"></Setter> + <Style.Triggers> + <DataTrigger Binding="{Binding IsSetup}" Value="True"> + <Setter Property="Icon" Value="Settings"></Setter> + </DataTrigger> + <DataTrigger Binding="{Binding IsUpdate}" Value="True"> + <Setter Property="Icon" Value="CloudDownload"></Setter> + </DataTrigger> + <DataTrigger Binding="{Binding IsDataBase}" Value="True"> + <Setter Property="Icon" Value="Database"></Setter> + </DataTrigger> + <DataTrigger Binding="{Binding IsSynchronization}" Value="True"> + <Setter Property="Icon" Value="Sync"></Setter> + </DataTrigger> + <DataTrigger Binding="{Binding IsOfflineUpdate}" Value="True"> + <Setter Property="Icon" Value="Sd"></Setter> + </DataTrigger> + <DataTrigger Binding="{Binding IsOfflineFirmwareUpgrade}" Value="True"> + <Setter Property="Icon" Value="Chip"></Setter> + </DataTrigger> + <DataTrigger Binding="{Binding IsStarted}" Value="True"> + <Setter Property="Foreground" Value="{StaticResource TangoWarningBrush}"></Setter> + </DataTrigger> + <DataTrigger Binding="{Binding IsCompleted}" Value="True"> + <Setter Property="Foreground" Value="{StaticResource TangoSuccessBrush}"></Setter> + </DataTrigger> + <DataTrigger Binding="{Binding IsFailed}" Value="True"> + <Setter Property="Foreground" Value="{StaticResource TangoErrorBrush}"></Setter> + </DataTrigger> + </Style.Triggers> + </Style> + </touch:TouchIcon.Style> + </touch:TouchIcon> + <TextBlock VerticalAlignment="Center" Text="{Binding UpdateStatus,Converter={StaticResource EnumToDescriptionConverter}}" TextWrapping="NoWrap" Height="22" TextTrimming="CharacterEllipsis" Width="500" Margin="10 0 0 0" FontSize="16"></TextBlock> + </StackPanel> + + <Grid Grid.Row="1"> + <DockPanel> + <Grid DockPanel.Dock="Top"> + <controls:TableGrid RowHeight="30"> + <TextBlock Text="Started On:" FontWeight="SemiBold" /> + <TextBlock Text="{Binding Update.StartDate,Converter={StaticResource DateTimeUTCToStringConverter},ConverterParameter='MM/dd/yyyy HH:mm:ss'}"></TextBlock> + <TextBlock Text="Application:" FontWeight="SemiBold" /> + <TextBlock Text="{Binding Update.ApplicationVersion}"></TextBlock> + <TextBlock Text="Firmware:" FontWeight="SemiBold" /> + <TextBlock Text="{Binding Update.FirmwareVersion}"></TextBlock> + <TextBlock Text="Ended:" FontWeight="SemiBold" /> + <TextBlock Text="{Binding Update.EndDate,TargetNullValue='Never',FallbackValue='Never',Converter={StaticResource DateTimeUTCToStringConverter},ConverterParameter='MM/dd/yyyy HH:mm:ss'}"></TextBlock> + </controls:TableGrid> + </Grid> + + <Border Padding="5" BorderThickness="1" BorderBrush="{StaticResource TangoLightBorderBrush}"> + <TextBox BorderThickness="0" Text="{Binding Update.FailedLog,TargetNullValue='No further Information available.'}" Style="{x:Null}" TextWrapping="Wrap" IsReadOnly="True" HorizontalScrollBarVisibility="Disabled" VerticalScrollBarVisibility="Hidden" Background="Transparent" /> + </Border> + </DockPanel> + </Grid> + + <Grid Grid.Row="2"> + <touch:TouchButton Style="{StaticResource TangoHollowButton}" HorizontalAlignment="Right" Width="170" VerticalAlignment="Bottom" CornerRadius="25" Height="50" Command="{Binding CloseCommand}">CLOSE</touch:TouchButton> + </Grid> + </Grid> + </Grid> +</UserControl> diff --git a/Software/Visual_Studio/PPC/Modules/Tango.PPC.Technician/Dialogs/UpdateDetailsView.xaml.cs b/Software/Visual_Studio/PPC/Modules/Tango.PPC.Technician/Dialogs/UpdateDetailsView.xaml.cs new file mode 100644 index 000000000..f2a06aedf --- /dev/null +++ b/Software/Visual_Studio/PPC/Modules/Tango.PPC.Technician/Dialogs/UpdateDetailsView.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.PPC.Technician.Dialogs +{ + /// <summary> + /// Interaction logic for LogItemDetailsView.xaml + /// </summary> + public partial class UpdateDetailsView : UserControl + { + public UpdateDetailsView() + { + InitializeComponent(); + } + } +} diff --git a/Software/Visual_Studio/PPC/Modules/Tango.PPC.Technician/Dialogs/UpdateDetailsViewVM.cs b/Software/Visual_Studio/PPC/Modules/Tango.PPC.Technician/Dialogs/UpdateDetailsViewVM.cs new file mode 100644 index 000000000..36c0fc6d7 --- /dev/null +++ b/Software/Visual_Studio/PPC/Modules/Tango.PPC.Technician/Dialogs/UpdateDetailsViewVM.cs @@ -0,0 +1,21 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using Tango.BL.Entities; +using Tango.Logging; +using Tango.SharedUI; + +namespace Tango.PPC.Technician.Dialogs +{ + public class UpdateDetailsViewVM : DialogViewVM + { + private TangoUpdate _update; + public TangoUpdate Update + { + get { return _update; } + set { _update = value; RaisePropertyChangedAuto(); } + } + } +} diff --git a/Software/Visual_Studio/PPC/Modules/Tango.PPC.Technician/Images/browser.png b/Software/Visual_Studio/PPC/Modules/Tango.PPC.Technician/Images/browser.png Binary files differnew file mode 100644 index 000000000..ebb975b6f --- /dev/null +++ b/Software/Visual_Studio/PPC/Modules/Tango.PPC.Technician/Images/browser.png diff --git a/Software/Visual_Studio/PPC/Modules/Tango.PPC.Technician/Images/circuit-board.png b/Software/Visual_Studio/PPC/Modules/Tango.PPC.Technician/Images/circuit-board.png Binary files differnew file mode 100644 index 000000000..28b535f54 --- /dev/null +++ b/Software/Visual_Studio/PPC/Modules/Tango.PPC.Technician/Images/circuit-board.png diff --git a/Software/Visual_Studio/PPC/Modules/Tango.PPC.Technician/Images/conveyor.png b/Software/Visual_Studio/PPC/Modules/Tango.PPC.Technician/Images/conveyor.png Binary files differnew file mode 100644 index 000000000..1cd649a88 --- /dev/null +++ b/Software/Visual_Studio/PPC/Modules/Tango.PPC.Technician/Images/conveyor.png diff --git a/Software/Visual_Studio/PPC/Modules/Tango.PPC.Technician/Images/exit.png b/Software/Visual_Studio/PPC/Modules/Tango.PPC.Technician/Images/exit.png Binary files differnew file mode 100644 index 000000000..e05db36d4 --- /dev/null +++ b/Software/Visual_Studio/PPC/Modules/Tango.PPC.Technician/Images/exit.png diff --git a/Software/Visual_Studio/PPC/Modules/Tango.PPC.Technician/Images/mobile-phone.png b/Software/Visual_Studio/PPC/Modules/Tango.PPC.Technician/Images/mobile-phone.png Binary files differnew file mode 100644 index 000000000..ea4e685dc --- /dev/null +++ b/Software/Visual_Studio/PPC/Modules/Tango.PPC.Technician/Images/mobile-phone.png diff --git a/Software/Visual_Studio/PPC/Modules/Tango.PPC.Technician/Images/packages.png b/Software/Visual_Studio/PPC/Modules/Tango.PPC.Technician/Images/packages.png Binary files differnew file mode 100644 index 000000000..cf0e936d8 --- /dev/null +++ b/Software/Visual_Studio/PPC/Modules/Tango.PPC.Technician/Images/packages.png diff --git a/Software/Visual_Studio/PPC/Modules/Tango.PPC.Technician/Images/remote_connections.png b/Software/Visual_Studio/PPC/Modules/Tango.PPC.Technician/Images/remote_connections.png Binary files differnew file mode 100644 index 000000000..d9d4a1d45 --- /dev/null +++ b/Software/Visual_Studio/PPC/Modules/Tango.PPC.Technician/Images/remote_connections.png diff --git a/Software/Visual_Studio/PPC/Modules/Tango.PPC.Technician/Images/shutdown.png b/Software/Visual_Studio/PPC/Modules/Tango.PPC.Technician/Images/shutdown.png Binary files differnew file mode 100644 index 000000000..abc4d1a1a --- /dev/null +++ b/Software/Visual_Studio/PPC/Modules/Tango.PPC.Technician/Images/shutdown.png diff --git a/Software/Visual_Studio/PPC/Modules/Tango.PPC.Technician/Images/sync.png b/Software/Visual_Studio/PPC/Modules/Tango.PPC.Technician/Images/sync.png Binary files differnew file mode 100644 index 000000000..46059c5c0 --- /dev/null +++ b/Software/Visual_Studio/PPC/Modules/Tango.PPC.Technician/Images/sync.png diff --git a/Software/Visual_Studio/PPC/Modules/Tango.PPC.Technician/Tango.PPC.Technician.csproj b/Software/Visual_Studio/PPC/Modules/Tango.PPC.Technician/Tango.PPC.Technician.csproj index d135142c4..fc00f83d4 100644 --- a/Software/Visual_Studio/PPC/Modules/Tango.PPC.Technician/Tango.PPC.Technician.csproj +++ b/Software/Visual_Studio/PPC/Modules/Tango.PPC.Technician/Tango.PPC.Technician.csproj @@ -69,9 +69,21 @@ </Compile> <Compile Include="Converters\LogItemMessageToOneLineConverter.cs" /> <Compile Include="Converters\LogItemToStringConverter.cs" /> + <Compile Include="Dialogs\EmbeddedLogItemDetailsView.xaml.cs"> + <DependentUpon>EmbeddedLogItemDetailsView.xaml</DependentUpon> + </Compile> + <Compile Include="Dialogs\SynchronizationDetailsView.xaml.cs"> + <DependentUpon>SynchronizationDetailsView.xaml</DependentUpon> + </Compile> + <Compile Include="Dialogs\UpdateDetailsView.xaml.cs"> + <DependentUpon>UpdateDetailsView.xaml</DependentUpon> + </Compile> <Compile Include="Dialogs\LogItemDetailsView.xaml.cs"> <DependentUpon>LogItemDetailsView.xaml</DependentUpon> </Compile> + <Compile Include="Dialogs\EmbeddedLogItemDetailsViewVM.cs" /> + <Compile Include="Dialogs\SynchronizationDetailsViewVM.cs" /> + <Compile Include="Dialogs\UpdateDetailsViewVM.cs" /> <Compile Include="Dialogs\LogItemDetailsViewVM.cs" /> <Compile Include="Models\DispenserController.cs" /> <Compile Include="TechnicianModule.cs" /> @@ -93,10 +105,22 @@ <Compile Include="ViewModels\DispensersViewVM.cs" /> <Compile Include="ViewModels\LoggingViewVM.cs" /> <Compile Include="ViewModels\MainViewVM.cs" /> + <Compile Include="ViewModels\PackagesViewVM.cs" /> + <Compile Include="ViewModels\RemoteConnectionsViewVM.cs" /> + <Compile Include="ViewModels\UpdatesViewVM.cs" /> <Compile Include="ViewModels\SystemViewVM.cs" /> <Compile Include="Views\CatalogView.xaml.cs"> <DependentUpon>CatalogView.xaml</DependentUpon> </Compile> + <Compile Include="Views\RemoteConnectionsView.xaml.cs"> + <DependentUpon>RemoteConnectionsView.xaml</DependentUpon> + </Compile> + <Compile Include="Views\UpdatesView.xaml.cs"> + <DependentUpon>UpdatesView.xaml</DependentUpon> + </Compile> + <Compile Include="Views\PackagesView.xaml.cs"> + <DependentUpon>PackagesView.xaml</DependentUpon> + </Compile> <Compile Include="Views\DispensersView.xaml.cs"> <DependentUpon>DispensersView.xaml</DependentUpon> </Compile> @@ -161,6 +185,10 @@ <Project>{0BE74EEE-22CB-4DBA-B896-793B9E1A3AC0}</Project> <Name>Tango.PPC.Common</Name> </ProjectReference> + <ProjectReference Include="..\..\Tango.PPC.Shared\Tango.PPC.Shared.csproj"> + <Project>{208C8BD8-72C6-4E3C-ACAA-351091A2ACC7}</Project> + <Name>Tango.PPC.Shared</Name> + </ProjectReference> </ItemGroup> <ItemGroup> <Page Include="App.xaml"> @@ -171,6 +199,18 @@ <SubType>Designer</SubType> <Generator>MSBuild:Compile</Generator> </Page> + <Page Include="Dialogs\EmbeddedLogItemDetailsView.xaml"> + <Generator>MSBuild:Compile</Generator> + <SubType>Designer</SubType> + </Page> + <Page Include="Dialogs\SynchronizationDetailsView.xaml"> + <Generator>MSBuild:Compile</Generator> + <SubType>Designer</SubType> + </Page> + <Page Include="Dialogs\UpdateDetailsView.xaml"> + <Generator>MSBuild:Compile</Generator> + <SubType>Designer</SubType> + </Page> <Page Include="Dialogs\LogItemDetailsView.xaml"> <SubType>Designer</SubType> <Generator>MSBuild:Compile</Generator> @@ -179,6 +219,18 @@ <SubType>Designer</SubType> <Generator>MSBuild:Compile</Generator> </Page> + <Page Include="Views\RemoteConnectionsView.xaml"> + <SubType>Designer</SubType> + <Generator>MSBuild:Compile</Generator> + </Page> + <Page Include="Views\UpdatesView.xaml"> + <Generator>MSBuild:Compile</Generator> + <SubType>Designer</SubType> + </Page> + <Page Include="Views\PackagesView.xaml"> + <Generator>MSBuild:Compile</Generator> + <SubType>Designer</SubType> + </Page> <Page Include="Views\DispensersView.xaml"> <SubType>Designer</SubType> <Generator>MSBuild:Compile</Generator> @@ -208,5 +260,24 @@ <ItemGroup> <Resource Include="Images\dispensers.png" /> </ItemGroup> + <ItemGroup> + <Resource Include="Images\circuit-board.png" /> + <Resource Include="Images\conveyor.png" /> + <Resource Include="Images\exit.png" /> + <Resource Include="Images\mobile-phone.png" /> + <Resource Include="Images\shutdown.png" /> + </ItemGroup> + <ItemGroup> + <Resource Include="Images\packages.png" /> + </ItemGroup> + <ItemGroup> + <Resource Include="Images\sync.png" /> + </ItemGroup> + <ItemGroup> + <Resource Include="Images\browser.png" /> + </ItemGroup> + <ItemGroup> + <Resource Include="Images\remote_connections.png" /> + </ItemGroup> <Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" /> </Project>
\ No newline at end of file diff --git a/Software/Visual_Studio/PPC/Modules/Tango.PPC.Technician/ViewModelLocator.cs b/Software/Visual_Studio/PPC/Modules/Tango.PPC.Technician/ViewModelLocator.cs index ae4678e60..9a8b63c91 100644 --- a/Software/Visual_Studio/PPC/Modules/Tango.PPC.Technician/ViewModelLocator.cs +++ b/Software/Visual_Studio/PPC/Modules/Tango.PPC.Technician/ViewModelLocator.cs @@ -20,6 +20,9 @@ namespace Tango.PPC.Technician TangoIOC.Default.Register<CatalogViewVM>(); TangoIOC.Default.Register<DispensersViewVM>(); TangoIOC.Default.Register<SystemViewVM>(); + TangoIOC.Default.Register<PackagesViewVM>(); + TangoIOC.Default.Register<UpdatesViewVM>(); + TangoIOC.Default.Register<RemoteConnectionsViewVM>(); } /// <summary> @@ -76,5 +79,38 @@ namespace Tango.PPC.Technician return TangoIOC.Default.GetInstance<SystemViewVM>(); } } + + /// <summary> + /// Gets the system view VM. + /// </summary> + public static PackagesViewVM PackagesViewVM + { + get + { + return TangoIOC.Default.GetInstance<PackagesViewVM>(); + } + } + + /// <summary> + /// Gets the synchronization view vm. + /// </summary> + public static UpdatesViewVM UpdatesViewVM + { + get + { + return TangoIOC.Default.GetInstance<UpdatesViewVM>(); + } + } + + /// <summary> + /// Gets the remote connections view vm. + /// </summary> + public static RemoteConnectionsViewVM RemoteConnectionsViewVM + { + get + { + return TangoIOC.Default.GetInstance<RemoteConnectionsViewVM>(); + } + } } } diff --git a/Software/Visual_Studio/PPC/Modules/Tango.PPC.Technician/ViewModels/CatalogViewVM.cs b/Software/Visual_Studio/PPC/Modules/Tango.PPC.Technician/ViewModels/CatalogViewVM.cs index 97bae6f5b..dbc99fa87 100644 --- a/Software/Visual_Studio/PPC/Modules/Tango.PPC.Technician/ViewModels/CatalogViewVM.cs +++ b/Software/Visual_Studio/PPC/Modules/Tango.PPC.Technician/ViewModels/CatalogViewVM.cs @@ -4,6 +4,9 @@ using System.Linq; using System.Text; using System.Threading.Tasks; using Tango.Core.Commands; +//using Tango.PPC.Browser; +//using Tango.PPC.Browser.Navigation; +//using Tango.PPC.Browser.Views; using Tango.PPC.Common; namespace Tango.PPC.Technician.ViewModels @@ -16,16 +19,22 @@ namespace Tango.PPC.Technician.ViewModels public RelayCommand<String> NavigationCommand { get; set; } /// <summary> + /// Gets or sets the browser command. + /// </summary> + public RelayCommand BrowserCommand { get; set; } + + /// <summary> /// Initializes a new instance of the <see cref="CatalogViewVM"/> class. /// </summary> public CatalogViewVM() { NavigationCommand = new RelayCommand<string>(NavigateToView); + BrowserCommand = new RelayCommand(OpenBrowserModule); } public override void OnApplicationStarted() { - + } /// <summary> @@ -36,5 +45,17 @@ namespace Tango.PPC.Technician.ViewModels { NavigationManager.NavigateTo<TechnicianModule>(view); } + + /// <summary> + /// Opens the browser module. + /// </summary> + private void OpenBrowserModule() + { + //NavigationManager.NavigateWithObject<BrowserModule, BrowserView, BrowserNavigationRequest>(new BrowserNavigationRequest() + //{ + // Address = "https://twine-s.com/", + // DisplayAddressBar = true, + //}, true); + } } } diff --git a/Software/Visual_Studio/PPC/Modules/Tango.PPC.Technician/ViewModels/LoggingViewVM.cs b/Software/Visual_Studio/PPC/Modules/Tango.PPC.Technician/ViewModels/LoggingViewVM.cs index 6ca693af6..2aee7f561 100644 --- a/Software/Visual_Studio/PPC/Modules/Tango.PPC.Technician/ViewModels/LoggingViewVM.cs +++ b/Software/Visual_Studio/PPC/Modules/Tango.PPC.Technician/ViewModels/LoggingViewVM.cs @@ -8,8 +8,11 @@ using System.Threading.Tasks; using System.Windows.Data; using Tango.Core; using Tango.Core.Commands; +using Tango.Integration.Logging; +using Tango.Integration.Operation; using Tango.Logging; using Tango.PPC.Common; +using Tango.PPC.Common.Helpers; using Tango.PPC.Technician.Dialogs; namespace Tango.PPC.Technician.ViewModels @@ -17,19 +20,14 @@ namespace Tango.PPC.Technician.ViewModels public class LoggingViewVM : PPCViewModel { private const int MAX_LOGS = 1000; + private List<LogItemBase> paused_logs; + private List<LogItemBase> paused_embedded_logs; public SynchronizedObservableCollection<LogItemBase> ApplicationLogs { get; set; } public SynchronizedObservableCollection<LogItemBase> EmbeddedLogs { get; set; } - private LogItemBase _selectedLog; - public LogItemBase SelectedLog - { - get { return _selectedLog; } - set { _selectedLog = value; RaisePropertyChangedAuto(); OnSelectedLogChanged(); } - } - private ICollectionView _applicationLogsViewSource; public ICollectionView ApplicationLogsViewSource { @@ -37,6 +35,20 @@ namespace Tango.PPC.Technician.ViewModels set { _applicationLogsViewSource = value; RaisePropertyChangedAuto(); } } + private ICollectionView _embeddedLogsViewSource; + public ICollectionView EmbeddedLogsViewSource + { + get { return _embeddedLogsViewSource; } + set { _embeddedLogsViewSource = value; RaisePropertyChangedAuto(); } + } + + private LogItemBase _selectedLog; + public LogItemBase SelectedLog + { + get { return _selectedLog; } + set { _selectedLog = value; RaisePropertyChangedAuto(); OnSelectedLogChanged(); } + } + private String _filter; public String Filter { @@ -46,6 +58,7 @@ namespace Tango.PPC.Technician.ViewModels _filter = value; RaisePropertyChangedAuto(); ApplicationLogsViewSource.Refresh(); + EmbeddedLogsViewSource.Refresh(); } } @@ -56,6 +69,13 @@ namespace Tango.PPC.Technician.ViewModels set { _isPaused = value; RaisePropertyChangedAuto(); OnIsPausedChanged(); } } + private bool _processDebugLogs; + public bool ProcessDebugLogs + { + get { return _processDebugLogs; } + set { _processDebugLogs = value; RaisePropertyChangedAuto(); OnProcessDebugLogsChanged(); } + } + public RelayCommand ClearCommand { get; set; } public LoggingViewVM() @@ -63,8 +83,19 @@ namespace Tango.PPC.Technician.ViewModels ApplicationLogs = new SynchronizedObservableCollection<LogItemBase>(); EmbeddedLogs = new SynchronizedObservableCollection<LogItemBase>(); ApplicationLogsViewSource = CollectionViewSource.GetDefaultView(ApplicationLogs); + EmbeddedLogsViewSource = CollectionViewSource.GetDefaultView(EmbeddedLogs); paused_logs = new List<LogItemBase>(); + paused_embedded_logs = new List<LogItemBase>(); + + var appStartLogs = LogsHelper.GetLogSafe().EmptyAndDispose(); + + foreach (var log in appStartLogs) + { + ApplicationLogs.Insert(0, log); + } + LogManager.NewLog += LogManager_NewLog; + MachineOperator.EmbeddedLogManager.NewLog += EmbeddedLogManager_NewLog; ClearCommand = new RelayCommand(ClearLogs); Filter = "error"; @@ -81,6 +112,31 @@ namespace Tango.PPC.Technician.ViewModels return false; } }; + + EmbeddedLogsViewSource.Filter = (x) => + { + try + { + LogItemBase log = x as LogItemBase; + return String.IsNullOrWhiteSpace(Filter) || log.Category.ToString().ToLower().Contains(Filter.ToLower()) || log.Message.ToLower().Contains(Filter.ToLower()); + } + catch + { + return false; + } + }; + } + + private void OnProcessDebugLogsChanged() + { + if (ProcessDebugLogs) + { + LogManager.Categories.Add(LogCategory.Debug); + } + else + { + LogManager.Categories.RemoveAll(x => x == LogCategory.Debug); + } } private void OnIsPausedChanged() @@ -91,6 +147,14 @@ namespace Tango.PPC.Technician.ViewModels } paused_logs.Clear(); + + + foreach (var log in paused_embedded_logs) + { + EmbeddedLogManager_NewLog(this, log); + } + + paused_embedded_logs.Clear(); } private void LogManager_NewLog(object sender, LogItemBase log) @@ -120,22 +184,59 @@ namespace Tango.PPC.Technician.ViewModels } } + private void EmbeddedLogManager_NewLog(object sender, LogItemBase log) + { + if (!IsPaused) + { + InvokeUI(() => + { + EmbeddedLogs.Insert(0, log); + + try + { + if (EmbeddedLogs.Count > MAX_LOGS) + { + EmbeddedLogs.Remove(EmbeddedLogs.Last()); + } + } + catch + { + //I don't know if this will cause an exception but I'm tired. + } + }); + } + else + { + paused_embedded_logs.Add(log); + } + } + private void ClearLogs() { ApplicationLogs.Clear(); + EmbeddedLogs.Clear(); paused_logs.Clear(); + paused_embedded_logs.Clear(); } private async void OnSelectedLogChanged() { if (SelectedLog != null) { - await NotificationProvider.ShowDialog<LogItemDetailsViewVM>(new LogItemDetailsViewVM() + if (SelectedLog.GetType() == typeof(EmbeddedLogItem)) { - Log = SelectedLog, - }); - - SelectedLog = null; + await NotificationProvider.ShowDialog<EmbeddedLogItemDetailsViewVM>(new EmbeddedLogItemDetailsViewVM() + { + Log = SelectedLog as EmbeddedLogItem, + }); + } + else + { + await NotificationProvider.ShowDialog<LogItemDetailsViewVM>(new LogItemDetailsViewVM() + { + Log = SelectedLog, + }); + } } } diff --git a/Software/Visual_Studio/PPC/Modules/Tango.PPC.Technician/ViewModels/MainViewVM.cs b/Software/Visual_Studio/PPC/Modules/Tango.PPC.Technician/ViewModels/MainViewVM.cs index d63a89f3b..4f8aba952 100644 --- a/Software/Visual_Studio/PPC/Modules/Tango.PPC.Technician/ViewModels/MainViewVM.cs +++ b/Software/Visual_Studio/PPC/Modules/Tango.PPC.Technician/ViewModels/MainViewVM.cs @@ -12,13 +12,13 @@ namespace Tango.PPC.Technician.ViewModels { public override void OnApplicationStarted() { - + } public override void OnNavigatedTo() { base.OnNavigatedTo(); - NavigationManager.NavigateTo<TechnicianModule>(nameof(CatalogView)); + NavigationManager.NavigateTo<TechnicianModule>(nameof(CatalogView), false); } } } diff --git a/Software/Visual_Studio/PPC/Modules/Tango.PPC.Technician/ViewModels/PackagesViewVM.cs b/Software/Visual_Studio/PPC/Modules/Tango.PPC.Technician/ViewModels/PackagesViewVM.cs new file mode 100644 index 000000000..1d7e1780a --- /dev/null +++ b/Software/Visual_Studio/PPC/Modules/Tango.PPC.Technician/ViewModels/PackagesViewVM.cs @@ -0,0 +1,44 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using Tango.Core.DI; +using Tango.PPC.Common; +using Tango.PPC.Common.UpdatePackages; +using Tango.PPC.Shared.Updates; + +namespace Tango.PPC.Technician.ViewModels +{ + public class PackagesViewVM : PPCViewModel + { + [TangoInject(TangoInjectMode.WhenAvailable)] + public IPackageRunner PackageRunner { get; set; } + + private List<PackageInstallation> _packages; + public List<PackageInstallation> Packages + { + get { return _packages; } + set { _packages = value; RaisePropertyChangedAuto(); } + } + + public override void OnApplicationStarted() + { + + } + + public async override void OnApplicationReady() + { + base.OnApplicationReady(); + + try + { + Packages = (await PackageRunner.GetPackagesFile()).PackageInstallations; + } + catch (Exception ex) + { + LogManager.Log(ex, "An error occurred while trying to list the installed update packages."); + } + } + } +} diff --git a/Software/Visual_Studio/PPC/Modules/Tango.PPC.Technician/ViewModels/RemoteConnectionsViewVM.cs b/Software/Visual_Studio/PPC/Modules/Tango.PPC.Technician/ViewModels/RemoteConnectionsViewVM.cs new file mode 100644 index 000000000..2d8857329 --- /dev/null +++ b/Software/Visual_Studio/PPC/Modules/Tango.PPC.Technician/ViewModels/RemoteConnectionsViewVM.cs @@ -0,0 +1,64 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using Tango.Core.Commands; +using Tango.Integration.ExternalBridge; +using Tango.PPC.Common; + +namespace Tango.PPC.Technician.ViewModels +{ + public class RemoteConnectionsViewVM : PPCViewModel + { + public RelayCommand DisconnectCommand { get; set; } + + private ExternalBridgeReceiver _selectedReceiver; + public ExternalBridgeReceiver SelectedReceiver + { + get { return _selectedReceiver; } + set + { + if (value != null) + { + _selectedReceiver = value; + InvalidateRelayCommands(); + } + } + } + + public RemoteConnectionsViewVM() + { + DisconnectCommand = new RelayCommand(DisconnectReceiver, () => SelectedReceiver != null); + } + + private async void DisconnectReceiver() + { + if (SelectedReceiver != null) + { + try + { + await Task.Factory.StartNew(() => + { + SelectedReceiver.Disconnect().Wait(); + }); + } + catch (Exception ex) + { + LogManager.Log(ex, "Error disconnecting the specified receiver."); + } + finally + { + _selectedReceiver = null; + RaisePropertyChanged(nameof(SelectedReceiver)); + InvalidateRelayCommands(); + } + } + } + + public override void OnApplicationStarted() + { + + } + } +} diff --git a/Software/Visual_Studio/PPC/Modules/Tango.PPC.Technician/ViewModels/SystemViewVM.cs b/Software/Visual_Studio/PPC/Modules/Tango.PPC.Technician/ViewModels/SystemViewVM.cs index 444c1d09e..452907366 100644 --- a/Software/Visual_Studio/PPC/Modules/Tango.PPC.Technician/ViewModels/SystemViewVM.cs +++ b/Software/Visual_Studio/PPC/Modules/Tango.PPC.Technician/ViewModels/SystemViewVM.cs @@ -8,16 +8,20 @@ using System.Net.Sockets; using System.Text; using System.Threading.Tasks; using System.Timers; +using Tango.BL; using Tango.Core.Commands; using Tango.PPC.Common; using Tango.PPC.Common.OS; using Tango.Settings; +using System.Data.Entity; +using Tango.PPC.Common.UWF; namespace Tango.PPC.Technician.ViewModels { public class SystemViewVM : PPCViewModel { private IOperationSystemManager _os; + private IUnifiedWriteFilterManager _uwf; private Timer _statsTimer; private bool _resettingDevice; @@ -56,6 +60,20 @@ namespace Tango.PPC.Technician.ViewModels set { _ipAddress = value; RaisePropertyChangedAuto(); } } + private String _totalDyeTime; + public String TotalDyeTime + { + get { return _totalDyeTime; } + set { _totalDyeTime = value; RaisePropertyChangedAuto(); } + } + + private String _totalDyeMeters; + public String TotalDyeMeters + { + get { return _totalDyeMeters; } + set { _totalDyeMeters = value; RaisePropertyChangedAuto(); } + } + public RelayCommand ResetDeviceCommand { get; set; } public RelayCommand RestartCommand { get; set; } @@ -66,9 +84,10 @@ namespace Tango.PPC.Technician.ViewModels public RelayCommand ExitToExplorerCommand { get; set; } - public SystemViewVM(IOperationSystemManager os) + public SystemViewVM(IOperationSystemManager os, IUnifiedWriteFilterManager uwf) { _os = os; + _uwf = uwf; CPU = 0; RAM = 0; @@ -86,7 +105,7 @@ namespace Tango.PPC.Technician.ViewModels { _resettingDevice = true; ResetDeviceCommand.RaiseCanExecuteChanged(); - await MachineProvider.MachineOperator.ResetDFU(); + await MachineProvider.MachineOperator.Reset(); await NotificationProvider.ShowInfo("Embedded device has been reset successfully."); } catch (Exception ex) @@ -102,11 +121,30 @@ namespace Tango.PPC.Technician.ViewModels private async void FactoryReset() { - if (await NotificationProvider.ShowQuestion("Are you sure you want to reset this device and back to factory settings?")) + if (await NotificationProvider.ShowQuestion("Are you sure you want to reset this device back to factory settings?")) { Settings.ApplicationState = ApplicationStates.FactoryRestore; Settings.Save(); - ApplicationManager.Restart(); + try + { + NotificationProvider.SetGlobalBusyMessage("Disabling write filter protection..."); + await _uwf.Disable(); + await Task.Delay(2000); + NotificationProvider.ReleaseGlobalBusyMessage(); + await NavigationManager.NavigateTo(Common.Navigation.NavigationView.RestartingSystemView); + await Task.Delay(4000); + _os.Restart(); + } + catch (Exception ex) + { + LogManager.Log(ex, "Error executing factory reset."); + NotificationProvider.ReleaseGlobalBusyMessage(); + await NotificationProvider.ShowError($"Error executing factory reset.\n{ex.FlattenMessage()}"); + } + finally + { + NotificationProvider.ReleaseGlobalBusyMessage(); + } } } @@ -122,6 +160,8 @@ namespace Tango.PPC.Technician.ViewModels { if (await NotificationProvider.ShowQuestion("Are you sure you want to restart the device?")) { + await NavigationManager.NavigateTo(Common.Navigation.NavigationView.RestartingSystemView); + await Task.Delay(4000); _os.Restart(); } } @@ -130,12 +170,7 @@ namespace Tango.PPC.Technician.ViewModels { if (await NotificationProvider.ShowQuestion("Close the application and start OS shell?")) { - Process.Start(new ProcessStartInfo() - { - UseShellExecute = true, - FileName = "explorer.exe", - }); - + _os.OpenShell(); ApplicationManager.ShutDown(); } } @@ -148,12 +183,6 @@ namespace Tango.PPC.Technician.ViewModels _statsTimer.Start(); } - public override void OnApplicationReady() - { - base.OnApplicationReady(); - IPAddress = GetIpv4Address(); - } - private void _statsTimer_Elapsed(object sender, ElapsedEventArgs e) { if (IsVisible) @@ -244,5 +273,31 @@ namespace Tango.PPC.Technician.ViewModels return "N/A"; } } + + public async override void OnNavigatedTo() + { + base.OnNavigatedTo(); + + IPAddress = GetIpv4Address(); + + try + { + using (ObservablesContext db = ObservablesContext.CreateDefault()) + { + var jobRuns = await db.JobRuns.Select(x => new { x.StartDate, x.EndDate, x.EndPosition }).ToListAsync(); + + TotalDyeTime = TimeSpan.FromHours(jobRuns.Select(x => x.EndDate - x.StartDate).Sum(x => x.TotalHours)).ToStringUnlimitedHours(); + + int meters = (int)jobRuns.Select(x => x.EndPosition).Sum(); + TotalDyeMeters = $"{meters.ToString("N0")} meters"; + } + } + catch (Exception ex) + { + LogManager.Log(ex, "Error loading machine counters."); + TotalDyeTime = "error!"; + TotalDyeMeters = "error!"; + } + } } } diff --git a/Software/Visual_Studio/PPC/Modules/Tango.PPC.Technician/ViewModels/UpdatesViewVM.cs b/Software/Visual_Studio/PPC/Modules/Tango.PPC.Technician/ViewModels/UpdatesViewVM.cs new file mode 100644 index 000000000..3f4232252 --- /dev/null +++ b/Software/Visual_Studio/PPC/Modules/Tango.PPC.Technician/ViewModels/UpdatesViewVM.cs @@ -0,0 +1,107 @@ +using System; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using Tango.BL; +using Tango.BL.Entities; +using Tango.BL.Enumerations; +using Tango.Core.Commands; +using Tango.PPC.Common; +using System.Data.Entity; +using Tango.PPC.Technician.Dialogs; +using Tango.PPC.Common.Synchronization; + +namespace Tango.PPC.Technician.ViewModels +{ + public class UpdatesViewVM : PPCViewModel + { + public RelayCommand SynchronizeCommand { get; set; } + + private List<TangoUpdate> _updates; + public List<TangoUpdate> Updates + { + get { return _updates; } + set { _updates = value; RaisePropertyChangedAuto(); } + } + + private TangoUpdate _selectedUpdate; + public TangoUpdate SelectedUpdate + { + get { return _selectedUpdate; } + set { _selectedUpdate = value; OnSelectedUpdateChanged(); } + } + + private SynchronizationStatus _selectedSynchronization; + public SynchronizationStatus SelectedSynchronization + { + get { return _selectedSynchronization; } + set { _selectedSynchronization = value; OnSelectedSynchronizationChanged(); } + } + + public UpdatesViewVM() + { + Updates = new List<TangoUpdate>(); + SynchronizeCommand = new RelayCommand(Synchronize, () => !MachineDataSynchronizer.IsSynchronizing); + } + + public override void OnApplicationStarted() + { + + } + + public override void OnApplicationReady() + { + base.OnApplicationReady(); + MachineDataSynchronizer.SynchronizationStarted += (_, __) => InvalidateRelayCommands(); + MachineDataSynchronizer.SynchronizationEnded += (_, __) => InvalidateRelayCommands(); + } + + private async void Synchronize() + { + try + { + await MachineDataSynchronizer.Synchronize(); + } + catch { } + } + + public async override void OnNavigatedTo() + { + base.OnNavigatedTo(); + + try + { + using (ObservablesContext db = ObservablesContext.CreateDefault()) + { + Updates = await db.TangoUpdates.Where(x => + x.Status != (int)TangoUpdateStatuses.SynchronizationCompleted && + x.Status != (int)TangoUpdateStatuses.SynchronizationFailed && + x.Status != (int)TangoUpdateStatuses.SynchronizationStarted + ).OrderByDescending(x => x.StartDate).ToListAsync(); + } + } + catch (Exception ex) + { + LogManager.Log(ex, "Error loading update history."); + } + } + + private async void OnSelectedUpdateChanged() + { + if (SelectedUpdate != null) + { + await NotificationProvider.ShowDialog<UpdateDetailsViewVM>(new UpdateDetailsViewVM() { Update = SelectedUpdate }); + } + } + + private async void OnSelectedSynchronizationChanged() + { + if (SelectedSynchronization != null) + { + await NotificationProvider.ShowDialog<SynchronizationDetailsViewVM>(new SynchronizationDetailsViewVM() { Status = SelectedSynchronization }); + } + } + } +} diff --git a/Software/Visual_Studio/PPC/Modules/Tango.PPC.Technician/Views/CatalogView.xaml b/Software/Visual_Studio/PPC/Modules/Tango.PPC.Technician/Views/CatalogView.xaml index 58c88324f..78fa17979 100644 --- a/Software/Visual_Studio/PPC/Modules/Tango.PPC.Technician/Views/CatalogView.xaml +++ b/Software/Visual_Studio/PPC/Modules/Tango.PPC.Technician/Views/CatalogView.xaml @@ -20,32 +20,116 @@ <Border.Effect> <DropShadowEffect Color="Silver" ShadowDepth="0" BlurRadius="20" Opacity="1" /> </Border.Effect> - <TextBlock VerticalAlignment="Center" FontSize="{StaticResource TangoHeaderFontSize}" FontWeight="SemiBold">Technician Mode</TextBlock> + <TextBlock VerticalAlignment="Center" FontSize="{StaticResource TangoHeaderFontSize}" FontWeight="SemiBold">Technician</TextBlock> </Border> - <Grid Grid.Row="1" VerticalAlignment="Top" Margin="20"> - <UniformGrid Columns="2"> - <touch:TouchButton Command="{Binding NavigationCommand}" CommandParameter="LoggingView" Width="250" Height="250" Style="{StaticResource TangoHollowButton}" Padding="20"> - <DockPanel> - <TextBlock Margin="0 10 0 0" DockPanel.Dock="Bottom" HorizontalAlignment="Center" FontSize="{StaticResource TangoExpanderHeaderFontSize}">Logging</TextBlock> - <Image Width="128" Source="../Images/logging.png" /> - </DockPanel> - </touch:TouchButton> + <touch:LightTouchScrollViewer Grid.Row="1"> + <Grid Grid.Row="1" VerticalAlignment="Top" Margin="20"> + <StackPanel Margin="30 0 30 0" DockPanel.Dock="Bottom" VerticalAlignment="Center"> - <touch:TouchButton Command="{Binding NavigationCommand}" CommandParameter="SystemView" Width="250" Height="250" Style="{StaticResource TangoHollowButton}" Padding="20"> - <DockPanel> - <TextBlock Margin="0 10 0 0" DockPanel.Dock="Bottom" HorizontalAlignment="Center" FontSize="{StaticResource TangoExpanderHeaderFontSize}">System</TextBlock> - <Image Width="128" Source="../Images/system.png" /> - </DockPanel> - </touch:TouchButton> + <StackPanel.Resources> + <Style TargetType="touch:TouchButton" x:Key="ButtonMenu"> + <Setter Property="Padding" Value="10"></Setter> + <Setter Property="HorizontalContentAlignment" Value="Left"></Setter> + <Setter Property="Height" Value="140"></Setter> + <Setter Property="Background" Value="Transparent"></Setter> + <Setter Property="BorderBrush" Value="{StaticResource TangoDarkForegroundBrush}"></Setter> + <Setter Property="BorderThickness" Value="1"></Setter> + <Setter Property="Foreground" Value="{StaticResource TangoDarkForegroundBrush}"></Setter> + <Setter Property="EnableDropShadow" Value="False"></Setter> + <Setter Property="CornerRadius" Value="5"></Setter> + <Setter Property="Margin" Value="0 0 0 20"></Setter> + <Setter Property="RippleBrush" Value="#4BB8B8B8"></Setter> + </Style> + </StackPanel.Resources> - <touch:TouchButton Command="{Binding NavigationCommand}" CommandParameter="DispensersView" Margin="0 60 0 0" Width="250" Height="250" Style="{StaticResource TangoHollowButton}" Padding="20"> - <DockPanel> - <TextBlock Margin="0 10 0 0" DockPanel.Dock="Bottom" HorizontalAlignment="Center" FontSize="{StaticResource TangoExpanderHeaderFontSize}">Dispensers</TextBlock> - <Image Width="128" Source="../Images/dispensers.png" /> - </DockPanel> - </touch:TouchButton> - </UniformGrid> - </Grid> + <TextBlock Margin="0 20 0 40" Foreground="{StaticResource TangoGrayTextBrush}">The technician module enables additional diagnostic tools.</TextBlock> + + <touch:TouchButton Command="{Binding NavigationCommand}" CommandParameter="LoggingView" Style="{StaticResource ButtonMenu}"> + <StackPanel Orientation="Horizontal" HorizontalAlignment="Left"> + <Image Source="../Images/logging.png" Width="80" Height="80" /> + <StackPanel Margin="10 0 0 0"> + <TextBlock FontSize="{StaticResource TangoButtonFontSize}">Logging</TextBlock> + <TextBlock Foreground="{StaticResource TangoGrayTextBrush}" TextWrapping="Wrap" Width="580"> + Display and investigate issues using application and embedded device logs. + </TextBlock> + </StackPanel> + </StackPanel> + </touch:TouchButton> + + <touch:TouchButton Command="{Binding NavigationCommand}" CommandParameter="SystemView" Style="{StaticResource ButtonMenu}"> + <StackPanel Orientation="Horizontal" HorizontalAlignment="Left"> + <Image Source="../Images/system.png" Width="80" Height="80" /> + <StackPanel Margin="10 0 0 0"> + <TextBlock FontSize="{StaticResource TangoTitleFontSize}">System</TextBlock> + <TextBlock Foreground="{StaticResource TangoGrayTextBrush}" TextWrapping="Wrap" Width="580"> + Display system properties, perform system actions, reset, shutdown etc... + </TextBlock> + </StackPanel> + </StackPanel> + </touch:TouchButton> + + <touch:TouchButton Command="{Binding NavigationCommand}" CommandParameter="DispensersView" Style="{StaticResource ButtonMenu}"> + <StackPanel Orientation="Horizontal" HorizontalAlignment="Left"> + <Image Source="../Images/dispensers.png" Width="80" Height="80" /> + <StackPanel Margin="10 0 0 0"> + <TextBlock FontSize="{StaticResource TangoButtonFontSize}">Dispensers</TextBlock> + <TextBlock Foreground="{StaticResource TangoGrayTextBrush}" TextWrapping="Wrap" Width="580"> + Perform manual dispensers homing priming. + </TextBlock> + </StackPanel> + </StackPanel> + </touch:TouchButton> + + <touch:TouchButton Command="{Binding NavigationCommand}" CommandParameter="PackagesView" Style="{StaticResource ButtonMenu}"> + <StackPanel Orientation="Horizontal" HorizontalAlignment="Left"> + <Image Source="../Images/packages.png" Width="80" Height="80" /> + <StackPanel Margin="10 0 0 0"> + <TextBlock FontSize="{StaticResource TangoButtonFontSize}">Installed Packages</TextBlock> + <TextBlock Foreground="{StaticResource TangoGrayTextBrush}" TextWrapping="Wrap" Width="580"> + View the history of update packages installation. + </TextBlock> + </StackPanel> + </StackPanel> + </touch:TouchButton> + + <touch:TouchButton Command="{Binding NavigationCommand}" CommandParameter="UpdatesView" Style="{StaticResource ButtonMenu}"> + <StackPanel Orientation="Horizontal" HorizontalAlignment="Left"> + <Image Source="../Images/sync.png" Width="80" Height="80" /> + <StackPanel Margin="10 0 0 0"> + <TextBlock FontSize="{StaticResource TangoButtonFontSize}">Updates & Synchronization</TextBlock> + <TextBlock Foreground="{StaticResource TangoGrayTextBrush}" TextWrapping="Wrap" Width="580"> + View the current status and history of update and synchronization operations. + </TextBlock> + </StackPanel> + </StackPanel> + </touch:TouchButton> + + <touch:TouchButton Command="{Binding NavigationCommand}" CommandParameter="RemoteConnectionsView" Style="{StaticResource ButtonMenu}"> + <StackPanel Orientation="Horizontal" HorizontalAlignment="Left"> + <Image Source="../Images/remote_connections.png" Width="80" Height="80" /> + <StackPanel Margin="10 0 0 0"> + <TextBlock FontSize="{StaticResource TangoButtonFontSize}">Remote Connections</TextBlock> + <TextBlock Foreground="{StaticResource TangoGrayTextBrush}" TextWrapping="Wrap" Width="580"> + View the current status of remote connections to this machine. + </TextBlock> + </StackPanel> + </StackPanel> + </touch:TouchButton> + + <!--<touch:TouchButton Command="{Binding BrowserCommand}" Style="{StaticResource ButtonMenu}"> + <StackPanel Orientation="Horizontal" HorizontalAlignment="Left"> + <Image Source="../Images/browser.png" RenderOptions.BitmapScalingMode="Fant" Width="80" Height="80" /> + <StackPanel Margin="10 0 0 0"> + <TextBlock FontSize="{StaticResource TangoButtonFontSize}">Browser</TextBlock> + <TextBlock Foreground="{StaticResource TangoGrayTextBrush}" TextWrapping="Wrap" Width="580"> + Open the browser module and navigate the web. + </TextBlock> + </StackPanel> + </StackPanel> + </touch:TouchButton>--> + </StackPanel> + </Grid> + </touch:LightTouchScrollViewer> </Grid> </UserControl> diff --git a/Software/Visual_Studio/PPC/Modules/Tango.PPC.Technician/Views/LoggingView.xaml b/Software/Visual_Studio/PPC/Modules/Tango.PPC.Technician/Views/LoggingView.xaml index 39353c286..8393349ea 100644 --- a/Software/Visual_Studio/PPC/Modules/Tango.PPC.Technician/Views/LoggingView.xaml +++ b/Software/Visual_Studio/PPC/Modules/Tango.PPC.Technician/Views/LoggingView.xaml @@ -34,7 +34,7 @@ <DockPanel> <DockPanel DockPanel.Dock="Top"> <StackPanel Orientation="Horizontal"> - <touch:TouchNavigationLinks Margin="20" FontSize="{StaticResource TangoNavigationLinksFontSize}"> + <touch:TouchNavigationLinks x:Name="nav" Margin="20" FontSize="{StaticResource TangoNavigationLinksFontSize}"> <sys:String>Application</sys:String> <sys:String>Embedded</sys:String> </touch:TouchNavigationLinks> @@ -47,91 +47,109 @@ <touch:TouchIcon Icon="Magnify" Foreground="{StaticResource TangoGrayBrush}" Width="16" Height="16" /> <touch:TouchTextBox Width="200" VerticalAlignment="Center" Margin="5 -10 0 0" Text="{Binding Filter,Delay=1000}"></touch:TouchTextBox> </StackPanel> + + <touch:TouchCheckBox IsChecked="{Binding ProcessDebugLogs}" Margin="20 0 0 0" Content="Debug Logs"> + <touch:TouchCheckBox.Style> + <Style TargetType="touch:TouchCheckBox" BasedOn="{StaticResource {x:Type touch:TouchCheckBox}}"> + <Setter Property="Visibility" Value="Collapsed"></Setter> + <Style.Triggers> + <DataTrigger Binding="{Binding ElementName=nav,Path=SelectedIndex}" Value="0"> + <Setter Property="Visibility" Value="Visible"></Setter> + </DataTrigger> + </Style.Triggers> + </Style> + </touch:TouchCheckBox.Style> + </touch:TouchCheckBox> </StackPanel> </StackPanel> <touch:TouchDatePicker Visibility="Collapsed" SelectedDate="12/15/2018" Height="40" /> </DockPanel> <Grid Margin="20"> - <touch:TouchSimpleDataGrid AutoGenerateColumns="False" SelectionMode="Single" SelectionUnit="FullRow" BorderThickness="1" BorderBrush="{StaticResource TangoDarkForegroundBrush}" HeadersVisibility="Column" CanUserAddRows="False" CanUserDeleteRows="False" CanUserReorderColumns="False" CanUserResizeRows="False" CanUserResizeColumns="False" CanUserSortColumns="False" IsReadOnly="True" ItemsSource="{Binding ApplicationLogsViewSource}" SelectedItem="{Binding SelectedLog}" VerticalGridLinesBrush="{x:Null}" HorizontalGridLinesBrush="{StaticResource TangoGrayBrush}" RowHeight="50" VerticalScrollBarVisibility="Visible" HorizontalScrollBarVisibility="Disabled"> - <DataGrid.Resources> - <Style BasedOn="{StaticResource {x:Type DataGridColumnHeader}}" TargetType="{x:Type DataGridColumnHeader}"> - <Setter Property="Background" Value="{StaticResource TangoDarkForegroundBrush}" /> - <Setter Property="Foreground" Value="{StaticResource TangoLightForegroundBrush}" /> - <Setter Property="Padding" Value="5"></Setter> - </Style> - </DataGrid.Resources> - <DataGrid.RowStyle> - <Style TargetType="DataGridRow" BasedOn="{StaticResource {x:Type DataGridRow}}"> - <Style.Triggers> - <Trigger Property="IsSelected" Value="True"> - <Setter Property="Background" Value="Transparent"></Setter> - <Setter Property="Foreground" Value="{StaticResource TangoPrimaryAccentBrush}" /> - </Trigger> - <Trigger Property="IsFocused" Value="True"> - <Setter Property="Background" Value="Transparent"></Setter> - <Setter Property="Foreground" Value="{StaticResource TangoPrimaryAccentBrush}" /> - </Trigger> - </Style.Triggers> - </Style> - </DataGrid.RowStyle> - <DataGrid.CellStyle> - <Style TargetType="{x:Type DataGridCell}"> - <Setter Property="Template"> - <Setter.Value> - <ControlTemplate TargetType="{x:Type DataGridCell}"> - <Grid Background="{TemplateBinding Background}"> - <ContentPresenter VerticalAlignment="Center" /> - </Grid> - </ControlTemplate> - </Setter.Value> - </Setter> - <Style.Triggers> - <Trigger Property="IsSelected" Value="True"> - <Setter Property="Background" Value="Transparent"></Setter> - <Setter Property="Foreground" Value="{StaticResource TangoPrimaryAccentBrush}" /> - </Trigger> - </Style.Triggers> - </Style> - </DataGrid.CellStyle> - <DataGrid.Columns> - <DataGridTemplateColumn Header="" Width="50"> - <DataGridTemplateColumn.CellTemplate> - <DataTemplate> - <touch:TouchIcon Width="16"> - <touch:TouchIcon.Style> - <Style TargetType="touch:TouchIcon"> - <Setter Property="Icon" Value="InformationOutline"></Setter> - <Style.Triggers> - <DataTrigger Binding="{Binding Category}" Value="Warning"> - <Setter Property="Icon" Value="ExclamationTriangleSolid"></Setter> - <Setter Property="Foreground" Value="{StaticResource TangoWarningBrush}"></Setter> - </DataTrigger> - <DataTrigger Binding="{Binding Category}" Value="Error"> - <Setter Property="Icon" Value="Alert"></Setter> - <Setter Property="Foreground" Value="{StaticResource TangoErrorBrush}"></Setter> - </DataTrigger> - <DataTrigger Binding="{Binding Category}" Value="Critical"> - <Setter Property="Icon" Value="Alert"></Setter> - <Setter Property="Foreground" Value="{StaticResource TangoErrorBrush}"></Setter> - </DataTrigger> - </Style.Triggers> - </Style> - </touch:TouchIcon.Style> - </touch:TouchIcon> - </DataTemplate> - </DataGridTemplateColumn.CellTemplate> - </DataGridTemplateColumn> - <DataGridTextColumn Header="Time" Width="120" Binding="{Binding TimeStamp,Converter={StaticResource DateTimeUTCToStringConverter},Mode=OneWay,ConverterParameter='hh\\:mm\\:ss.ff'}" /> - <DataGridTemplateColumn Header="Message" Width="1*"> - <DataGridTemplateColumn.CellTemplate> - <DataTemplate> - <TextBlock Text="{Binding Message,Converter={StaticResource LogItemMessageToOneLineConverter},ConverterParameter='70',Mode=OneWay}"/> - </DataTemplate> - </DataGridTemplateColumn.CellTemplate> - </DataGridTemplateColumn> - </DataGrid.Columns> - </touch:TouchSimpleDataGrid> + <TabControl Padding="0" BorderThickness="0" Margin="0 10 0 0" Background="Transparent" SelectedIndex="{Binding ElementName=nav,Path=SelectedIndex,Mode=OneWay}"> + <TabItem Header="Application" Visibility="Collapsed"> + <touch:TouchSimpleDataGrid x:Name="gridApplication" Style="{StaticResource TechGrid}" ItemsSource="{Binding ApplicationLogsViewSource}" SelectedItem="{Binding SelectedLog}"> + <DataGrid.Columns> + <DataGridTemplateColumn Header="" Width="50"> + <DataGridTemplateColumn.CellTemplate> + <DataTemplate> + <touch:TouchIcon Width="16"> + <touch:TouchIcon.Style> + <Style TargetType="touch:TouchIcon"> + <Setter Property="Icon" Value="InformationOutline"></Setter> + <Style.Triggers> + <DataTrigger Binding="{Binding Category}" Value="Warning"> + <Setter Property="Icon" Value="ExclamationTriangleSolid"></Setter> + <Setter Property="Foreground" Value="{StaticResource TangoWarningBrush}"></Setter> + </DataTrigger> + <DataTrigger Binding="{Binding Category}" Value="Error"> + <Setter Property="Icon" Value="Alert"></Setter> + <Setter Property="Foreground" Value="{StaticResource TangoErrorBrush}"></Setter> + </DataTrigger> + <DataTrigger Binding="{Binding Category}" Value="Critical"> + <Setter Property="Icon" Value="Alert"></Setter> + <Setter Property="Foreground" Value="{StaticResource TangoErrorBrush}"></Setter> + </DataTrigger> + </Style.Triggers> + </Style> + </touch:TouchIcon.Style> + </touch:TouchIcon> + </DataTemplate> + </DataGridTemplateColumn.CellTemplate> + </DataGridTemplateColumn> + <DataGridTextColumn Header="Time" Width="120" Binding="{Binding TimeStamp,Converter={StaticResource DateTimeUTCToStringConverter},Mode=OneWay,ConverterParameter='hh\\:mm\\:ss.ff'}" /> + <DataGridTemplateColumn Header="Message" Width="1*"> + <DataGridTemplateColumn.CellTemplate> + <DataTemplate> + <TextBlock Text="{Binding Message,Converter={StaticResource LogItemMessageToOneLineConverter},ConverterParameter='70',Mode=OneWay}"/> + </DataTemplate> + </DataGridTemplateColumn.CellTemplate> + </DataGridTemplateColumn> + </DataGrid.Columns> + </touch:TouchSimpleDataGrid> + </TabItem> + <TabItem Header="Embedded" Visibility="Collapsed"> + <touch:TouchSimpleDataGrid x:Name="gridEmbedded" Style="{StaticResource TechGrid}" ItemsSource="{Binding EmbeddedLogsViewSource}" SelectedItem="{Binding SelectedLog}"> + <DataGrid.Columns> + <DataGridTemplateColumn Header="" Width="50"> + <DataGridTemplateColumn.CellTemplate> + <DataTemplate> + <touch:TouchIcon Width="16"> + <touch:TouchIcon.Style> + <Style TargetType="touch:TouchIcon"> + <Setter Property="Icon" Value="InformationOutline"></Setter> + <Style.Triggers> + <DataTrigger Binding="{Binding Category}" Value="Warning"> + <Setter Property="Icon" Value="ExclamationTriangleSolid"></Setter> + <Setter Property="Foreground" Value="{StaticResource TangoWarningBrush}"></Setter> + </DataTrigger> + <DataTrigger Binding="{Binding Category}" Value="Error"> + <Setter Property="Icon" Value="Alert"></Setter> + <Setter Property="Foreground" Value="{StaticResource TangoErrorBrush}"></Setter> + </DataTrigger> + <DataTrigger Binding="{Binding Category}" Value="Critical"> + <Setter Property="Icon" Value="Alert"></Setter> + <Setter Property="Foreground" Value="{StaticResource TangoErrorBrush}"></Setter> + </DataTrigger> + </Style.Triggers> + </Style> + </touch:TouchIcon.Style> + </touch:TouchIcon> + </DataTemplate> + </DataGridTemplateColumn.CellTemplate> + </DataGridTemplateColumn> + <DataGridTextColumn Header="Time" Width="120" Binding="{Binding TimeStamp,Converter={StaticResource DateTimeUTCToStringConverter},Mode=OneWay,ConverterParameter='hh\\:mm\\:ss.ff'}" /> + <DataGridTemplateColumn Header="Message" Width="1*"> + <DataGridTemplateColumn.CellTemplate> + <DataTemplate> + <TextBlock Text="{Binding Message,Converter={StaticResource LogItemMessageToOneLineConverter},ConverterParameter='70',Mode=OneWay}"/> + </DataTemplate> + </DataGridTemplateColumn.CellTemplate> + </DataGridTemplateColumn> + </DataGrid.Columns> + </touch:TouchSimpleDataGrid> + </TabItem> + </TabControl> </Grid> </DockPanel> diff --git a/Software/Visual_Studio/PPC/Modules/Tango.PPC.Technician/Views/MainView.xaml b/Software/Visual_Studio/PPC/Modules/Tango.PPC.Technician/Views/MainView.xaml index 08f9a335a..d4235341c 100644 --- a/Software/Visual_Studio/PPC/Modules/Tango.PPC.Technician/Views/MainView.xaml +++ b/Software/Visual_Studio/PPC/Modules/Tango.PPC.Technician/Views/MainView.xaml @@ -17,6 +17,9 @@ <local:LoggingView/> <local:DispensersView/> <local:SystemView/> + <local:PackagesView/> + <local:UpdatesView/> + <local:RemoteConnectionsView/> </controls:NavigationControl> </Grid> </UserControl> diff --git a/Software/Visual_Studio/PPC/Modules/Tango.PPC.Technician/Views/PackagesView.xaml b/Software/Visual_Studio/PPC/Modules/Tango.PPC.Technician/Views/PackagesView.xaml new file mode 100644 index 000000000..a7944497b --- /dev/null +++ b/Software/Visual_Studio/PPC/Modules/Tango.PPC.Technician/Views/PackagesView.xaml @@ -0,0 +1,103 @@ +<UserControl x:Class="Tango.PPC.Technician.Views.PackagesView" + 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.PPC.Technician.Views" + xmlns:controls="clr-namespace:Tango.PPC.Technician.Controls" + xmlns:sys="clr-namespace:System;assembly=mscorlib" + xmlns:vm="clr-namespace:Tango.PPC.Technician.ViewModels" + xmlns:touch="clr-namespace:Tango.Touch.Controls;assembly=Tango.Touch" + xmlns:global="clr-namespace:Tango.PPC.Technician" + mc:Ignorable="d" + d:DesignHeight="1280" d:DesignWidth="800" d:DataContext="{d:DesignInstance Type=vm:PackagesViewVM, IsDesignTimeCreatable=False}" DataContext="{x:Static global:ViewModelLocator.PackagesViewVM}"> + <Grid Background="{StaticResource TangoMidBackgroundBrush}"> + <Grid.RowDefinitions> + <RowDefinition Height="Auto"/> + <RowDefinition Height="1*"/> + </Grid.RowDefinitions> + + <Border Padding="20" Background="{StaticResource TangoPrimaryBackgroundBrush}" BorderThickness="0 0 0 1" BorderBrush="{StaticResource TangoDividerBrush}"> + <Border.Effect> + <DropShadowEffect Color="Silver" ShadowDepth="0" BlurRadius="20" Opacity="1" /> + </Border.Effect> + <TextBlock VerticalAlignment="Center" FontSize="{StaticResource TangoHeaderFontSize}" FontWeight="SemiBold">Installed Packages</TextBlock> + </Border> + + <Grid Grid.Row="1"> + <Grid Margin="20"> + <touch:TouchSimpleDataGrid Background="{StaticResource TangoPrimaryBackgroundBrush}" AutoGenerateColumns="False" SelectionMode="Single" SelectionUnit="FullRow" BorderThickness="1" BorderBrush="{StaticResource TangoDarkForegroundBrush}" HeadersVisibility="Column" CanUserAddRows="False" CanUserDeleteRows="False" CanUserReorderColumns="False" CanUserResizeRows="False" CanUserResizeColumns="False" CanUserSortColumns="False" IsReadOnly="True" ItemsSource="{Binding Packages}" VerticalGridLinesBrush="{x:Null}" HorizontalGridLinesBrush="{StaticResource TangoGrayBrush}" RowHeight="50" VerticalScrollBarVisibility="Visible" HorizontalScrollBarVisibility="Disabled"> + <DataGrid.Resources> + <Style BasedOn="{StaticResource {x:Type DataGridColumnHeader}}" TargetType="{x:Type DataGridColumnHeader}"> + <Setter Property="Background" Value="{StaticResource TangoDarkForegroundBrush}" /> + <Setter Property="Foreground" Value="{StaticResource TangoLightForegroundBrush}" /> + <Setter Property="Padding" Value="5"></Setter> + </Style> + </DataGrid.Resources> + <DataGrid.RowStyle> + <Style TargetType="DataGridRow" BasedOn="{StaticResource {x:Type DataGridRow}}"> + <Style.Triggers> + <Trigger Property="IsSelected" Value="True"> + <Setter Property="Background" Value="Transparent"></Setter> + <Setter Property="Foreground" Value="{StaticResource TangoPrimaryAccentBrush}" /> + </Trigger> + <Trigger Property="IsFocused" Value="True"> + <Setter Property="Background" Value="Transparent"></Setter> + <Setter Property="Foreground" Value="{StaticResource TangoPrimaryAccentBrush}" /> + </Trigger> + </Style.Triggers> + </Style> + </DataGrid.RowStyle> + <DataGrid.CellStyle> + <Style TargetType="{x:Type DataGridCell}"> + <Setter Property="Template"> + <Setter.Value> + <ControlTemplate TargetType="{x:Type DataGridCell}"> + <Grid Background="{TemplateBinding Background}"> + <ContentPresenter VerticalAlignment="Center" /> + </Grid> + </ControlTemplate> + </Setter.Value> + </Setter> + <Style.Triggers> + <Trigger Property="IsSelected" Value="True"> + <Setter Property="Background" Value="Transparent"></Setter> + <Setter Property="Foreground" Value="{StaticResource TangoPrimaryAccentBrush}" /> + </Trigger> + </Style.Triggers> + </Style> + </DataGrid.CellStyle> + <DataGrid.Columns> + <DataGridTemplateColumn Header="" Width="50"> + <DataGridTemplateColumn.CellTemplate> + <DataTemplate> + <touch:TouchIcon Width="16"> + <touch:TouchIcon.Style> + <Style TargetType="touch:TouchIcon"> + <Setter Property="Icon" Value="Pause"></Setter> + <Setter Property="Foreground" Value="{StaticResource TangoDarkForegroundBrush}"></Setter> + <Style.Triggers> + <DataTrigger Binding="{Binding State}" Value="Failed"> + <Setter Property="Icon" Value="Alert"></Setter> + <Setter Property="Foreground" Value="{StaticResource TangoErrorBrush}"></Setter> + </DataTrigger> + <DataTrigger Binding="{Binding State}" Value="Installed"> + <Setter Property="Icon" Value="Check"></Setter> + <Setter Property="Foreground" Value="{StaticResource TangoSuccessBrush}"></Setter> + </DataTrigger> + </Style.Triggers> + </Style> + </touch:TouchIcon.Style> + </touch:TouchIcon> + </DataTemplate> + </DataGridTemplateColumn.CellTemplate> + </DataGridTemplateColumn> + <DataGridTextColumn Header="Type" Width="60" Binding="{Binding Type}" /> + <DataGridTextColumn Header="Date" Width="180" Binding="{Binding InstallationDate}" /> + <DataGridTextColumn Header="Name" Width="*" Binding="{Binding PackageName}" /> + </DataGrid.Columns> + </touch:TouchSimpleDataGrid> + </Grid> + </Grid> + </Grid> +</UserControl> diff --git a/Software/Visual_Studio/PPC/Modules/Tango.PPC.Technician/Views/PackagesView.xaml.cs b/Software/Visual_Studio/PPC/Modules/Tango.PPC.Technician/Views/PackagesView.xaml.cs new file mode 100644 index 000000000..52384fe73 --- /dev/null +++ b/Software/Visual_Studio/PPC/Modules/Tango.PPC.Technician/Views/PackagesView.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.PPC.Technician.Views +{ + /// <summary> + /// Interaction logic for DispensersView.xaml + /// </summary> + public partial class PackagesView : UserControl + { + public PackagesView() + { + InitializeComponent(); + } + } +} diff --git a/Software/Visual_Studio/PPC/Modules/Tango.PPC.Technician/Views/RemoteConnectionsView.xaml b/Software/Visual_Studio/PPC/Modules/Tango.PPC.Technician/Views/RemoteConnectionsView.xaml new file mode 100644 index 000000000..af93a56e5 --- /dev/null +++ b/Software/Visual_Studio/PPC/Modules/Tango.PPC.Technician/Views/RemoteConnectionsView.xaml @@ -0,0 +1,88 @@ +<UserControl x:Class="Tango.PPC.Technician.Views.RemoteConnectionsView" + 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:vm="clr-namespace:Tango.PPC.Technician.ViewModels" + xmlns:touch="clr-namespace:Tango.Touch.Controls;assembly=Tango.Touch" + xmlns:global="clr-namespace:Tango.PPC.Technician" + xmlns:local="clr-namespace:Tango.PPC.Technician.Views" + mc:Ignorable="d" + d:DesignHeight="1280" d:DesignWidth="800" d:DataContext="{d:DesignInstance Type=vm:RemoteConnectionsViewVM, IsDesignTimeCreatable=False}" DataContext="{x:Static global:ViewModelLocator.RemoteConnectionsViewVM}"> + <Grid Background="{StaticResource TangoMidBackgroundBrush}"> + <Grid.RowDefinitions> + <RowDefinition Height="Auto"/> + <RowDefinition Height="1*"/> + </Grid.RowDefinitions> + + <Border Padding="20" Background="{StaticResource TangoPrimaryBackgroundBrush}" BorderThickness="0 0 0 1" BorderBrush="{StaticResource TangoDividerBrush}"> + <Border.Effect> + <DropShadowEffect Color="Silver" ShadowDepth="0" BlurRadius="20" Opacity="1" /> + </Border.Effect> + <TextBlock VerticalAlignment="Center" FontSize="{StaticResource TangoHeaderFontSize}" FontWeight="SemiBold">Remote Connections</TextBlock> + </Border> + + <Grid Grid.Row="1"> + <Grid Margin="20"> + <DockPanel> + <touch:TouchButton Command="{Binding DisconnectCommand}" DockPanel.Dock="Bottom" HorizontalAlignment="Right" Style="{StaticResource TangoHollowButton}" Height="60" Width="250" Margin="0 20 0 0">DISCONNECT</touch:TouchButton> + <touch:TouchSimpleDataGrid IsSynchronizedWithCurrentItem="True" SelectedItem="{Binding SelectedReceiver,Mode=TwoWay}" Background="{StaticResource TangoPrimaryBackgroundBrush}" AutoGenerateColumns="False" SelectionMode="Single" SelectionUnit="FullRow" BorderThickness="1" BorderBrush="{StaticResource TangoDarkForegroundBrush}" HeadersVisibility="Column" CanUserAddRows="False" CanUserDeleteRows="False" CanUserReorderColumns="False" CanUserResizeRows="False" CanUserResizeColumns="False" CanUserSortColumns="False" IsReadOnly="True" ItemsSource="{Binding ExternalBridgeService.ActiveReceivers}" VerticalGridLinesBrush="{x:Null}" HorizontalGridLinesBrush="{StaticResource TangoGrayBrush}" RowHeight="50" VerticalScrollBarVisibility="Visible" HorizontalScrollBarVisibility="Disabled"> + <DataGrid.Resources> + <Style BasedOn="{StaticResource {x:Type DataGridColumnHeader}}" TargetType="{x:Type DataGridColumnHeader}"> + <Setter Property="Background" Value="{StaticResource TangoDarkForegroundBrush}" /> + <Setter Property="Foreground" Value="{StaticResource TangoLightForegroundBrush}" /> + <Setter Property="Padding" Value="5"></Setter> + </Style> + </DataGrid.Resources> + <DataGrid.RowStyle> + <Style TargetType="DataGridRow" BasedOn="{StaticResource {x:Type DataGridRow}}"> + <Style.Triggers> + <Trigger Property="IsSelected" Value="True"> + <Setter Property="Background" Value="Transparent"></Setter> + <Setter Property="Foreground" Value="{StaticResource TangoPrimaryAccentBrush}" /> + </Trigger> + <Trigger Property="IsFocused" Value="True"> + <Setter Property="Background" Value="Transparent"></Setter> + <Setter Property="Foreground" Value="{StaticResource TangoPrimaryAccentBrush}" /> + </Trigger> + </Style.Triggers> + </Style> + </DataGrid.RowStyle> + <DataGrid.CellStyle> + <Style TargetType="{x:Type DataGridCell}"> + <Setter Property="Template"> + <Setter.Value> + <ControlTemplate TargetType="{x:Type DataGridCell}"> + <Grid Background="{TemplateBinding Background}"> + <ContentPresenter VerticalAlignment="Center" /> + </Grid> + </ControlTemplate> + </Setter.Value> + </Setter> + <Style.Triggers> + <Trigger Property="IsSelected" Value="True"> + <Setter Property="Background" Value="Transparent"></Setter> + <Setter Property="Foreground" Value="{StaticResource TangoPrimaryAccentBrush}" /> + </Trigger> + </Style.Triggers> + </Style> + </DataGrid.CellStyle> + <DataGrid.Columns> + <DataGridTemplateColumn Header="" Width="50"> + <DataGridTemplateColumn.CellTemplate> + <DataTemplate> + <touch:TouchIcon Width="16" Icon="Bridge" /> + </DataTemplate> + </DataGridTemplateColumn.CellTemplate> + </DataGridTemplateColumn> + <DataGridTextColumn Header="App ID" Width="130" Binding="{Binding LoginInfo.AppID}" /> + <DataGridTextColumn Header="User" Width="180" Binding="{Binding LoginInfo.UserName}" /> + <DataGridTextColumn Header="Host Name" Width="180" Binding="{Binding LoginInfo.HostName}" /> + <DataGridTextColumn Header="Safety Level Permissions" Width="1*" Binding="{Binding LoginInfo.RequireSafetyLevelOperations,Converter={StaticResource BooleanToYesNoConverter}}" /> + </DataGrid.Columns> + </touch:TouchSimpleDataGrid> + </DockPanel> + </Grid> + </Grid> + </Grid> +</UserControl> diff --git a/Software/Visual_Studio/PPC/Modules/Tango.PPC.Technician/Views/RemoteConnectionsView.xaml.cs b/Software/Visual_Studio/PPC/Modules/Tango.PPC.Technician/Views/RemoteConnectionsView.xaml.cs new file mode 100644 index 000000000..5d8e32444 --- /dev/null +++ b/Software/Visual_Studio/PPC/Modules/Tango.PPC.Technician/Views/RemoteConnectionsView.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.PPC.Technician.Views +{ + /// <summary> + /// Interaction logic for RemoteConnectionsView.xaml + /// </summary> + public partial class RemoteConnectionsView : UserControl + { + public RemoteConnectionsView() + { + InitializeComponent(); + } + } +} diff --git a/Software/Visual_Studio/PPC/Modules/Tango.PPC.Technician/Views/SystemView.xaml b/Software/Visual_Studio/PPC/Modules/Tango.PPC.Technician/Views/SystemView.xaml index f2bfcdf7d..52abfc239 100644 --- a/Software/Visual_Studio/PPC/Modules/Tango.PPC.Technician/Views/SystemView.xaml +++ b/Software/Visual_Studio/PPC/Modules/Tango.PPC.Technician/Views/SystemView.xaml @@ -8,9 +8,10 @@ xmlns:vm="clr-namespace:Tango.PPC.Technician.ViewModels" xmlns:converters="clr-namespace:Tango.SharedUI.Converters;assembly=Tango.SharedUI" xmlns:touch="clr-namespace:Tango.Touch.Controls;assembly=Tango.Touch" + xmlns:controls="clr-namespace:Tango.SharedUI.Controls;assembly=Tango.SharedUI" xmlns:global="clr-namespace:Tango.PPC.Technician" mc:Ignorable="d" - d:DesignHeight="1280" d:DesignWidth="800" d:DataContext="{d:DesignInstance Type=vm:SystemViewVM, IsDesignTimeCreatable=False}" DataContext="{x:Static global:ViewModelLocator.SystemViewVM}" x:Name="view"> + d:DesignHeight="1260" d:DesignWidth="600" d:DataContext="{d:DesignInstance Type=vm:SystemViewVM, IsDesignTimeCreatable=False}" DataContext="{x:Static global:ViewModelLocator.SystemViewVM}" x:Name="view"> <UserControl.Resources> <converters:ByteArrayToFileSizeConverter x:Key="ByteArrayToFileSizeConverter" /> @@ -29,55 +30,283 @@ <TextBlock VerticalAlignment="Center" FontSize="{StaticResource TangoHeaderFontSize}" FontWeight="SemiBold">System</TextBlock> </Border> - <Grid Grid.Row="1" Margin="20"> + <Grid Grid.Row="1"> - <DockPanel> - <UniformGrid DockPanel.Dock="Top" Columns="3" Margin="50" TextElement.FontSize="{StaticResource TangoHeaderFontSize}"> - <TextBlock HorizontalAlignment="Center" FontWeight="SemiBold"> - <Run>CPU:</Run> - <Run Text="{Binding CPU,Mode=OneWay,StringFormat='0'}"></Run><Run>%</Run> - </TextBlock> + <touch:LightTouchScrollViewer> + <DockPanel Margin="20"> + <StackPanel Margin="30 40 30 0" DockPanel.Dock="Bottom" VerticalAlignment="Center"> - <TextBlock HorizontalAlignment="Center" FontWeight="SemiBold"> - <Run>RAM:</Run> - <Run Text="{Binding RAM,Mode=OneWay,Converter={StaticResource ByteArrayToFileSizeConverter},StringFormat='0'}"></Run> - </TextBlock> + <StackPanel.Resources> + <Style TargetType="touch:TouchButton" x:Key="ButtonMenu"> + <Setter Property="Padding" Value="10"></Setter> + <Setter Property="HorizontalContentAlignment" Value="Left"></Setter> + <Setter Property="Height" Value="100"></Setter> + <Setter Property="Background" Value="Transparent"></Setter> + <Setter Property="BorderBrush" Value="{StaticResource TangoDarkForegroundBrush}"></Setter> + <Setter Property="BorderThickness" Value="1"></Setter> + <Setter Property="Foreground" Value="{StaticResource TangoDarkForegroundBrush}"></Setter> + <Setter Property="EnableDropShadow" Value="False"></Setter> + <Setter Property="CornerRadius" Value="5"></Setter> + <Setter Property="Margin" Value="0 0 0 20"></Setter> + <Setter Property="RippleBrush" Value="#4BB8B8B8"></Setter> + </Style> + </StackPanel.Resources> - <TextBlock HorizontalAlignment="Center" FontWeight="SemiBold"> - <Run>TEMP:</Run> - <Run Text="{Binding Temperature,Mode=OneWay,StringFormat='0 °C'}"></Run> - </TextBlock> - </UniformGrid> + <touch:TouchButton Command="{Binding ResetDeviceCommand}" Style="{StaticResource ButtonMenu}"> + <StackPanel Orientation="Horizontal" HorizontalAlignment="Left"> + <Image Source="../Images/circuit-board.png" Width="60" Height="60" /> + <StackPanel Margin="10 0 0 0"> + <TextBlock FontSize="{StaticResource TangoButtonFontSize}">Reset Embedded Device</TextBlock> + <TextBlock Foreground="{StaticResource TangoGrayTextBrush}"> + Resets the embedded device using the DFU channel. + </TextBlock> + </StackPanel> + </StackPanel> + </touch:TouchButton> - <DockPanel> + <touch:TouchButton Command="{Binding RestartCommand}" Style="{StaticResource ButtonMenu}"> + <StackPanel Orientation="Horizontal" HorizontalAlignment="Left"> + <Image Source="../Images/mobile-phone.png" Width="60" Height="60" /> + <StackPanel Margin="10 0 0 0"> + <TextBlock FontSize="{StaticResource TangoButtonFontSize}">Restart Panel PC</TextBlock> + <TextBlock Foreground="{StaticResource TangoGrayTextBrush}"> + Restarts the panel PC operation system. + </TextBlock> + </StackPanel> + </StackPanel> + </touch:TouchButton> + <touch:TouchButton Command="{Binding ShutdownCommand}" Style="{StaticResource ButtonMenu}"> + <StackPanel Orientation="Horizontal" HorizontalAlignment="Left"> + <Image Source="../Images/shutdown.png" Width="60" Height="60" /> + <StackPanel Margin="10 0 0 0"> + <TextBlock FontSize="{StaticResource TangoButtonFontSize}">Shutdown Panel PC</TextBlock> + <TextBlock Foreground="{StaticResource TangoGrayTextBrush}"> + Turns off the panel PC (requires turning on from reset button). + </TextBlock> + </StackPanel> + </StackPanel> + </touch:TouchButton> + <touch:TouchButton Command="{Binding FactoryResetCommand}" Style="{StaticResource ButtonMenu}"> + <StackPanel Orientation="Horizontal" HorizontalAlignment="Left"> + <Image Source="../Images/conveyor.png" Width="60" Height="60" /> + <StackPanel Margin="10 0 0 0"> + <TextBlock FontSize="{StaticResource TangoButtonFontSize}">Factory Reset</TextBlock> + <TextBlock Foreground="{StaticResource TangoGrayTextBrush}"> + Removes all data associated with this machine and installs the latest version. + </TextBlock> + </StackPanel> + </StackPanel> + </touch:TouchButton> + <touch:TouchButton Command="{Binding ExitToExplorerCommand}" Style="{StaticResource ButtonMenu}"> + <StackPanel Orientation="Horizontal" HorizontalAlignment="Left"> + <Image Source="../Images/exit.png" Width="60" Height="60" /> + <StackPanel Margin="10 0 0 0"> + <TextBlock FontSize="{StaticResource TangoButtonFontSize}">Exit To Shell</TextBlock> + <TextBlock Foreground="{StaticResource TangoGrayTextBrush}"> + Closes the PPC application and opens the windows shell. + </TextBlock> + </StackPanel> + </StackPanel> + </touch:TouchButton> + </StackPanel> - <StackPanel DockPanel.Dock="Top" HorizontalAlignment="Center"> - <TextBlock HorizontalAlignment="Center" FontWeight="SemiBold" FontSize="{StaticResource TangoHeaderFontSize}"> - <Run>UP TIME:</Run> - <Run Text="{Binding UpTime,StringFormat=hh\\:mm\\:ss,FallbackValue='00:00:00'}"></Run> - </TextBlock> + <FlowDocumentScrollViewer VerticalScrollBarVisibility="Disabled"> + <FlowDocument> + <Table CellSpacing="0" FontFamily="{StaticResource TangoFlexoFontFamily}"> + <Table.Resources> + <Style TargetType="{x:Type TableRowGroup}"> + <Setter Property="FontSize" Value="{StaticResource TangoDefaultFontSize}"/> + </Style> - <TextBlock HorizontalAlignment="Center" Margin="0 20 0 0" FontWeight="SemiBold" FontSize="{StaticResource TangoHeaderFontSize}"> - <Run>IP ADDRESS:</Run> - <Run Text="{Binding IPAddress}"></Run> - </TextBlock> - </StackPanel> + <Style TargetType="TableCell"> + <Setter Property="BorderThickness" Value="0 0 0 1"></Setter> + <Setter Property="BorderBrush" Value="{StaticResource TangoGrayBrush}"></Setter> + <Setter Property="Padding" Value="5"></Setter> + </Style> + </Table.Resources> + <Table.Columns> + <TableColumn Width="160" /> + <TableColumn /> + <TableColumn /> + </Table.Columns> - <StackPanel HorizontalAlignment="Center" VerticalAlignment="Center" Width="300" TextElement.FontSize="{StaticResource TangoTitleFontSize}"> - <touch:TouchButton Command="{Binding ResetDeviceCommand}" Height="60" Content="Reset Machine"> - <touch:TouchButton.Style> - <Style TargetType="touch:TouchButton" BasedOn="{StaticResource {x:Type touch:TouchButton}}"> - <Setter Property="Background" Value="{StaticResource TangoErrorBrush}"></Setter> - </Style> - </touch:TouchButton.Style> - </touch:TouchButton> - <touch:TouchButton Command="{Binding RestartCommand}" Height="60" Background="{StaticResource TangoErrorBrush}" Margin="0 20 0 0">Restart Device</touch:TouchButton> - <touch:TouchButton Command="{Binding ShutdownCommand}" Height="60" Background="{StaticResource TangoErrorBrush}" Margin="0 20 0 0">Shutdown Device</touch:TouchButton> - <touch:TouchButton Command="{Binding FactoryResetCommand}" Height="60" Background="{StaticResource TangoErrorBrush}" Margin="0 20 0 0">Factory Reset</touch:TouchButton> - <touch:TouchButton Command="{Binding ExitToExplorerCommand}" Height="60" Background="{StaticResource TangoErrorBrush}" Margin="0 20 0 0">Exit To Shell</touch:TouchButton> - </StackPanel> + <TableRowGroup> + <TableRow> + <TableCell> + <Paragraph> + <TextBlock>Application Version:</TextBlock> + </Paragraph> + </TableCell> + + <TableCell> + <Paragraph> + <TextBlock Text="{Binding ApplicationManager.Version,Mode=OneWay,TargetNullValue='N/A',FallbackValue='N/A'}"/> + </Paragraph> + </TableCell> + </TableRow> + + <TableRow> + <TableCell> + <Paragraph> + <TextBlock>Firmware Version:</TextBlock> + </Paragraph> + </TableCell> + + <TableCell> + <Paragraph> + <TextBlock Text="{Binding MachineProvider.MachineOperator.DeviceInformation.Version,Mode=OneWay,TargetNullValue='N/A',FallbackValue='N/A'}"/> + </Paragraph> + </TableCell> + </TableRow> + + <TableRow> + <TableCell> + <Paragraph> + <TextBlock>FPGA 1:</TextBlock> + </Paragraph> + </TableCell> + + <TableCell> + <Paragraph> + <TextBlock Text="{Binding MachineProvider.MachineOperator.DeviceInformation.FPGA1Version,Mode=OneWay,TargetNullValue='N/A',FallbackValue='N/A'}"/> + </Paragraph> + </TableCell> + </TableRow> + + <TableRow> + <TableCell> + <Paragraph> + <TextBlock>FPGA 2:</TextBlock> + </Paragraph> + </TableCell> + + <TableCell> + <Paragraph> + <TextBlock Text="{Binding MachineProvider.MachineOperator.DeviceInformation.FPGA2Version,Mode=OneWay,TargetNullValue='N/A',FallbackValue='N/A'}"/> + </Paragraph> + </TableCell> + </TableRow> + + <TableRow> + <TableCell> + <Paragraph> + <TextBlock>FPGA 3:</TextBlock> + </Paragraph> + </TableCell> + + <TableCell> + <Paragraph> + <TextBlock Text="{Binding MachineProvider.MachineOperator.DeviceInformation.FPGA3Version,Mode=OneWay,TargetNullValue='N/A',FallbackValue='N/A'}"/> + </Paragraph> + </TableCell> + </TableRow> + + <TableRow> + <TableCell> + <Paragraph> + <TextBlock>CPU:</TextBlock> + </Paragraph> + </TableCell> + + <TableCell> + <Paragraph> + <TextBlock> + <Run Text="{Binding CPU,Mode=OneWay,StringFormat='0',FallbackValue=0}"></Run> + <Run>%</Run> + </TextBlock> + </Paragraph> + </TableCell> + </TableRow> + + <TableRow> + <TableCell> + <Paragraph> + <TextBlock>RAM:</TextBlock> + </Paragraph> + </TableCell> + + <TableCell> + <Paragraph> + <TextBlock Text="{Binding RAM,Mode=OneWay,FallbackValue=0,Converter={StaticResource ByteArrayToFileSizeConverter},StringFormat='0'}"></TextBlock> + </Paragraph> + </TableCell> + </TableRow> + + <TableRow> + <TableCell> + <Paragraph> + <TextBlock>Temperature:</TextBlock> + </Paragraph> + </TableCell> + + <TableCell> + <Paragraph> + <TextBlock Text="{Binding Temperature,Mode=OneWay,FallbackValue=0,StringFormat='0 °C'}"></TextBlock> + </Paragraph> + </TableCell> + </TableRow> + + <TableRow> + <TableCell> + <Paragraph> + <TextBlock>Up Time:</TextBlock> + </Paragraph> + </TableCell> + + <TableCell> + <Paragraph> + <TextBlock Text="{Binding UpTime,Mode=OneWay,StringFormat=hh\\:mm\\:ss,FallbackValue='00:00:00'}"></TextBlock> + </Paragraph> + </TableCell> + </TableRow> + + <TableRow> + <TableCell> + <Paragraph> + <TextBlock>IP Address:</TextBlock> + </Paragraph> + </TableCell> + + <TableCell> + <Paragraph> + <TextBlock Text="{Binding IPAddress,Mode=OneWay,FallbackValue=0}"></TextBlock> + </Paragraph> + </TableCell> + </TableRow> + + <TableRow> + <TableCell> + <Paragraph> + <TextBlock>Total Dye Time:</TextBlock> + </Paragraph> + </TableCell> + + <TableCell> + <Paragraph> + <TextBlock Text="{Binding TotalDyeTime,Mode=OneWay,FallbackValue=0}"></TextBlock> + </Paragraph> + </TableCell> + </TableRow> + + <TableRow> + <TableCell> + <Paragraph> + <TextBlock>Total Dye Meters:</TextBlock> + </Paragraph> + </TableCell> + + <TableCell> + <Paragraph> + <TextBlock Text="{Binding TotalDyeMeters,Mode=OneWay,FallbackValue=0}"></TextBlock> + </Paragraph> + </TableCell> + </TableRow> + </TableRowGroup> + </Table> + </FlowDocument> + </FlowDocumentScrollViewer> </DockPanel> - </DockPanel> + </touch:LightTouchScrollViewer> </Grid> </Grid> </UserControl> diff --git a/Software/Visual_Studio/PPC/Modules/Tango.PPC.Technician/Views/UpdatesView.xaml b/Software/Visual_Studio/PPC/Modules/Tango.PPC.Technician/Views/UpdatesView.xaml new file mode 100644 index 000000000..501632bfa --- /dev/null +++ b/Software/Visual_Studio/PPC/Modules/Tango.PPC.Technician/Views/UpdatesView.xaml @@ -0,0 +1,160 @@ +<UserControl x:Class="Tango.PPC.Technician.Views.UpdatesView" + 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.PPC.Technician.Views" + xmlns:sys="clr-namespace:System;assembly=mscorlib" + xmlns:vm="clr-namespace:Tango.PPC.Technician.ViewModels" + xmlns:touch="clr-namespace:Tango.Touch.Controls;assembly=Tango.Touch" + xmlns:converters="clr-namespace:Tango.PPC.Technician.Converters" + xmlns:global="clr-namespace:Tango.PPC.Technician" + mc:Ignorable="d" + d:DesignHeight="1280" d:DesignWidth="800" d:DataContext="{d:DesignInstance Type=vm:UpdatesViewVM, IsDesignTimeCreatable=False}" DataContext="{x:Static global:ViewModelLocator.UpdatesViewVM}"> + + <UserControl.Resources> + <converters:LogItemMessageToOneLineConverter x:Key="LogItemMessageToOneLineConverter" /> + </UserControl.Resources> + + <Grid Background="{StaticResource TangoMidBackgroundBrush}"> + <Grid.RowDefinitions> + <RowDefinition Height="Auto"/> + <RowDefinition Height="1*"/> + </Grid.RowDefinitions> + + <Border Padding="20" Background="{StaticResource TangoPrimaryBackgroundBrush}" BorderThickness="0 0 0 1" BorderBrush="{StaticResource TangoDividerBrush}"> + <Border.Effect> + <DropShadowEffect Color="Silver" ShadowDepth="0" BlurRadius="20" Opacity="1" /> + </Border.Effect> + <TextBlock VerticalAlignment="Center" FontSize="{StaticResource TangoHeaderFontSize}" FontWeight="SemiBold">Updates & Synchronization</TextBlock> + </Border> + + <Grid Grid.Row="1" Margin="15"> + + <DockPanel> + <touch:TouchNavigationLinks x:Name="nav" DockPanel.Dock="Top" FontSize="{StaticResource TangoTitleFontSize}"> + <sys:String>Updates</sys:String> + <sys:String>Synchronization</sys:String> + </touch:TouchNavigationLinks> + <TabControl Padding="0" BorderThickness="0" Margin="0 10 0 0" Background="Transparent" SelectedIndex="{Binding ElementName=nav,Path=SelectedIndex,Mode=OneWay}"> + <TabItem Visibility="Collapsed" Header="Software Updates"> + <touch:TouchSimpleDataGrid Style="{StaticResource TechGrid}" ItemsSource="{Binding Updates}" SelectedItem="{Binding SelectedUpdate}"> + <DataGrid.Columns> + <DataGridTemplateColumn Header="" Width="50"> + <DataGridTemplateColumn.CellTemplate> + <DataTemplate> + <touch:TouchIcon Width="16"> + <touch:TouchIcon.Style> + <Style TargetType="touch:TouchIcon"> + <Setter Property="Icon" Value="Pause"></Setter> + <Style.Triggers> + <DataTrigger Binding="{Binding IsSetup}" Value="True"> + <Setter Property="Icon" Value="Settings"></Setter> + </DataTrigger> + <DataTrigger Binding="{Binding IsUpdate}" Value="True"> + <Setter Property="Icon" Value="CloudDownload"></Setter> + </DataTrigger> + <DataTrigger Binding="{Binding IsDataBase}" Value="True"> + <Setter Property="Icon" Value="Database"></Setter> + </DataTrigger> + <DataTrigger Binding="{Binding IsSynchronization}" Value="True"> + <Setter Property="Icon" Value="Sync"></Setter> + </DataTrigger> + <DataTrigger Binding="{Binding IsOfflineUpdate}" Value="True"> + <Setter Property="Icon" Value="Sd"></Setter> + </DataTrigger> + <DataTrigger Binding="{Binding IsOfflineFirmwareUpgrade}" Value="True"> + <Setter Property="Icon" Value="Chip"></Setter> + </DataTrigger> + <DataTrigger Binding="{Binding IsStarted}" Value="True"> + <Setter Property="Foreground" Value="{StaticResource TangoWarningBrush}"></Setter> + </DataTrigger> + <DataTrigger Binding="{Binding IsCompleted}" Value="True"> + <Setter Property="Foreground" Value="{StaticResource TangoSuccessBrush}"></Setter> + </DataTrigger> + <DataTrigger Binding="{Binding IsFailed}" Value="True"> + <Setter Property="Foreground" Value="{StaticResource TangoErrorBrush}"></Setter> + </DataTrigger> + </Style.Triggers> + </Style> + </touch:TouchIcon.Style> + </touch:TouchIcon> + </DataTemplate> + </DataGridTemplateColumn.CellTemplate> + </DataGridTemplateColumn> + <DataGridTextColumn Header="Date" Width="120" Binding="{Binding StartDate,Converter={StaticResource DateTimeUTCToShortDateTimeConverter}}" /> + <DataGridTextColumn Header="Application" Width="120" Binding="{Binding ApplicationVersion}" /> + <DataGridTextColumn Header="Firmware" Width="120" Binding="{Binding FirmwareVersion}" /> + <DataGridTemplateColumn Header="Message" Width="1*"> + <DataGridTemplateColumn.CellTemplate> + <DataTemplate> + <TextBlock Text="{Binding UpdateStatus,Converter={StaticResource EnumToDescriptionConverter}}"/> + </DataTemplate> + </DataGridTemplateColumn.CellTemplate> + </DataGridTemplateColumn> + </DataGrid.Columns> + </touch:TouchSimpleDataGrid> + </TabItem> + <TabItem Visibility="Collapsed" Header="Synchronization"> + <DockPanel> + <DockPanel DockPanel.Dock="Bottom"> + <DockPanel Margin="20"> + <touch:TouchButton IsEnabled="{Binding MachineDataSynchronizer.IsEnabled}" DockPanel.Dock="Right" Padding="50 20" CornerRadius="30" Command="{Binding SynchronizeCommand}">Synchronize Now</touch:TouchButton> + <TextBlock Foreground="{StaticResource TangoGrayTextBrush}" VerticalAlignment="Center" TextWrapping="Wrap" Margin="0 0 20 0">Synchronization occurres automatically in the background. You can choose to synchronize now.</TextBlock> + </DockPanel> + </DockPanel> + + <Grid> + <touch:TouchSimpleDataGrid Style="{StaticResource TechGrid}" ItemsSource="{Binding MachineDataSynchronizer.StatusHistory}" SelectedItem="{Binding SelectedSynchronization}"> + <DataGrid.Columns> + <DataGridTemplateColumn Header="" Width="50"> + <DataGridTemplateColumn.CellTemplate> + <DataTemplate> + <touch:TouchIcon Width="16"> + <touch:TouchIcon.Style> + <Style TargetType="touch:TouchIcon"> + <Setter Property="Icon" Value="Pause"></Setter> + <Style.Triggers> + <DataTrigger Binding="{Binding State}" Value="Pending"> + <Setter Property="Icon" Value="Pause"></Setter> + <Setter Property="Foreground" Value="{StaticResource TangoGrayBrush}"></Setter> + </DataTrigger> + <DataTrigger Binding="{Binding State}" Value="Synchronizing"> + <Setter Property="Icon" Value="CloudSync"></Setter> + <Setter Property="Foreground" Value="{StaticResource TangoWarningBrush}"></Setter> + </DataTrigger> + <DataTrigger Binding="{Binding State}" Value="Failed"> + <Setter Property="Icon" Value="Alert"></Setter> + <Setter Property="Foreground" Value="{StaticResource TangoErrorBrush}"></Setter> + </DataTrigger> + <DataTrigger Binding="{Binding State}" Value="Completed"> + <Setter Property="Icon" Value="Check"></Setter> + <Setter Property="Foreground" Value="{StaticResource TangoGreenBrush}"></Setter> + </DataTrigger> + </Style.Triggers> + </Style> + </touch:TouchIcon.Style> + </touch:TouchIcon> + </DataTemplate> + </DataGridTemplateColumn.CellTemplate> + </DataGridTemplateColumn> + <DataGridTextColumn Header="Start Time" Width="120" Binding="{Binding StartDateTime,StringFormat=t}" /> + <DataGridTextColumn Header="Status" Width="120" Binding="{Binding State,Converter={StaticResource EnumToDescriptionConverter}}" /> + <DataGridTextColumn Header="Duration" Width="120" Binding="{Binding Duration,StringFormat='hh\\:mm\\:ss'}" /> + <DataGridTemplateColumn Header="Message" Width="1*"> + <DataGridTemplateColumn.CellTemplate> + <DataTemplate> + <TextBlock Text="{Binding Message,Converter={StaticResource StringEllipsisConverter},ConverterParameter='70',Mode=OneWay}"/> + </DataTemplate> + </DataGridTemplateColumn.CellTemplate> + </DataGridTemplateColumn> + </DataGrid.Columns> + </touch:TouchSimpleDataGrid> + </Grid> + </DockPanel> + </TabItem> + </TabControl> + </DockPanel> + </Grid> + </Grid> +</UserControl> diff --git a/Software/Visual_Studio/PPC/Modules/Tango.PPC.Technician/Views/UpdatesView.xaml.cs b/Software/Visual_Studio/PPC/Modules/Tango.PPC.Technician/Views/UpdatesView.xaml.cs new file mode 100644 index 000000000..cdac5cbbb --- /dev/null +++ b/Software/Visual_Studio/PPC/Modules/Tango.PPC.Technician/Views/UpdatesView.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.PPC.Technician.Views +{ + /// <summary> + /// Interaction logic for UpdatesView.xaml + /// </summary> + public partial class UpdatesView : UserControl + { + public UpdatesView() + { + InitializeComponent(); + } + } +} |
