diff options
| author | Roy Ben-Shabat <Roy@Twine-s.com> | 2018-08-08 18:06:43 +0300 |
|---|---|---|
| committer | Roy Ben-Shabat <Roy@Twine-s.com> | 2018-08-08 18:06:43 +0300 |
| commit | 5e66f7f601bfbb2f4d46b7b379fd37a5cb88d0bf (patch) | |
| tree | c6fa1f4bcf331d3d36b8f92798e1edac81d90b61 /Software/Visual_Studio | |
| parent | 9c5f5c1351c78536b54df2c90742efae19f00b59 (diff) | |
| download | Tango-5e66f7f601bfbb2f4d46b7b379fd37a5cb88d0bf.tar.gz Tango-5e66f7f601bfbb2f4d46b7b379fd37a5cb88d0bf.zip | |
Working on machine setup.
Diffstat (limited to 'Software/Visual_Studio')
8 files changed, 76 insertions, 10 deletions
diff --git a/Software/Visual_Studio/PPC/Tango.PPC.Common/MachineSetup/IMachineSetupManager.cs b/Software/Visual_Studio/PPC/Tango.PPC.Common/MachineSetup/IMachineSetupManager.cs index 69acfbbcf..52fc5acd1 100644 --- a/Software/Visual_Studio/PPC/Tango.PPC.Common/MachineSetup/IMachineSetupManager.cs +++ b/Software/Visual_Studio/PPC/Tango.PPC.Common/MachineSetup/IMachineSetupManager.cs @@ -10,6 +10,8 @@ namespace Tango.PPC.Common.MachineSetup { MachineSetupSteps CurrentStep { get; } event EventHandler<String> ProgressLog; + double UpdatingPackagesProgress { get; } + String UpdatingPackagesStatus { get; } event EventHandler<MachineSetupSteps> ProgressStep; Task Setup(String serialNumber, String hostAddress); } diff --git a/Software/Visual_Studio/PPC/Tango.PPC.Common/MachineSetup/MachineSetupManager.cs b/Software/Visual_Studio/PPC/Tango.PPC.Common/MachineSetup/MachineSetupManager.cs index f469fb799..dc5164465 100644 --- a/Software/Visual_Studio/PPC/Tango.PPC.Common/MachineSetup/MachineSetupManager.cs +++ b/Software/Visual_Studio/PPC/Tango.PPC.Common/MachineSetup/MachineSetupManager.cs @@ -37,10 +37,17 @@ namespace Tango.PPC.Common.MachineSetup } private double _downloadProgress; - public double DownloadProgress + public double UpdatingPackagesProgress { get { return _downloadProgress; } - set { _downloadProgress = value; RaisePropertyChangedAuto(); } + private set { _downloadProgress = value; RaisePropertyChangedAuto(); } + } + + private String _updatingPackagesStatus; + public String UpdatingPackagesStatus + { + get { return _updatingPackagesStatus; } + set { _updatingPackagesStatus = value; RaisePropertyChangedAuto(); } } public Task Setup(string serialNumber, string machineServiceAddress) @@ -49,7 +56,9 @@ namespace Tango.PPC.Common.MachineSetup { //Connect to machine service and get matching packages for this machine. - CurrentStep = MachineSetupSteps.DownloadingPackage; + CurrentStep = MachineSetupSteps.UpdatingPackages; + UpdatingPackagesProgress = 0; + UpdatingPackagesStatus = "Connecting to machine service..."; MachineSetupRequest request = new MachineSetupRequest(); request.SerialNumber = serialNumber; @@ -72,15 +81,17 @@ namespace Tango.PPC.Common.MachineSetup //Download software package. var tempFile = TemporaryManager.CreateFile(".zip"); + UpdatingPackagesStatus = "Downloading application package..."; + int fileSize = 0; - DownloadProgress = 0; + UpdatingPackagesProgress = 0; using (FileStreamWrapper fs = new FileStreamWrapper(tempFile.Path, FileMode.Create, (current) => { InvokeUINow(() => { Thread.Sleep(10); - DownloadProgress = ((double)current / (double)fileSize) * 100d; + UpdatingPackagesProgress = ((double)current / (double)fileSize) * 100d; }); })) { @@ -102,15 +113,17 @@ namespace Tango.PPC.Common.MachineSetup //Download embedded package. tempFile = TemporaryManager.CreateFile(".zip"); + UpdatingPackagesStatus = "Downloading embedded package..."; + fileSize = 0; - DownloadProgress = 0; + UpdatingPackagesProgress = 0; using (FileStreamWrapper fs = new FileStreamWrapper(tempFile.Path, FileMode.Create, (current) => { InvokeUINow(() => { Thread.Sleep(10); - DownloadProgress = ((double)current / (double)fileSize) * 100d; + UpdatingPackagesProgress = ((double)current / (double)fileSize) * 100d; }); })) { diff --git a/Software/Visual_Studio/PPC/Tango.PPC.Common/MachineSetup/MachineSetupSteps.cs b/Software/Visual_Studio/PPC/Tango.PPC.Common/MachineSetup/MachineSetupSteps.cs index 3db1eb4b0..1262eb248 100644 --- a/Software/Visual_Studio/PPC/Tango.PPC.Common/MachineSetup/MachineSetupSteps.cs +++ b/Software/Visual_Studio/PPC/Tango.PPC.Common/MachineSetup/MachineSetupSteps.cs @@ -10,7 +10,7 @@ namespace Tango.PPC.Common.MachineSetup public enum MachineSetupSteps { [Description("Downloading Package")] - DownloadingPackage, + UpdatingPackages, [Description("Synchronizing Schema")] SynchronizingSchema, [Description("Synchronizing Data")] diff --git a/Software/Visual_Studio/PPC/Tango.PPC.UI/Views/MachineSetupView.xaml b/Software/Visual_Studio/PPC/Tango.PPC.UI/Views/MachineSetupView.xaml index b7bd4d803..521da0e35 100644 --- a/Software/Visual_Studio/PPC/Tango.PPC.UI/Views/MachineSetupView.xaml +++ b/Software/Visual_Studio/PPC/Tango.PPC.UI/Views/MachineSetupView.xaml @@ -62,7 +62,12 @@ </Style> </touch:TouchBusyIndicator.Style> </touch:TouchBusyIndicator> - <touch:TouchStepProgressBar Width="720" Height="50" Margin="0 100 0 0" ItemsSource="{Binding Source={x:Type setup:MachineSetupSteps},Converter={StaticResource EnumToItemsSourceConverter}}" SelectedValue="{Binding MachineSetupManager.CurrentStep}" SelectedValuePath="Value" DisplayMemberPath="DisplayName" /> + <touch:TouchStepProgressBar FontSize="10" Width="720" Height="50" Margin="0 100 0 0" ItemsSource="{Binding Source={x:Type setup:MachineSetupSteps},Converter={StaticResource EnumToItemsSourceConverter}}" SelectedValue="{Binding MachineSetupManager.CurrentStep}" SelectedValuePath="Value" DisplayMemberPath="DisplayName" /> + + <StackPanel Margin="100 100 100 0" Visibility="{Binding MachineSetupManager.CurrentStep,Converter={StaticResource EnumToVisibilityConverter},ConverterParameter='DownloadingPackage'}"> + <TextBlock>Downloading package...</TextBlock> + <touch:TouchProgressBar Margin="0 10 0 0" Height="10" Maximum="100" Value="{Binding MachineSetupManager.UpdatingPackagesProgress,Mode=OneWay}" /> + </StackPanel> </StackPanel> <StackPanel Visibility="{Binding State,Converter={StaticResource EnumToVisibilityConverter},ConverterParameter='Completed'}"> diff --git a/Software/Visual_Studio/Tango.Touch/Controls/TouchProgressBar.cs b/Software/Visual_Studio/Tango.Touch/Controls/TouchProgressBar.cs new file mode 100644 index 000000000..99d208d4e --- /dev/null +++ b/Software/Visual_Studio/Tango.Touch/Controls/TouchProgressBar.cs @@ -0,0 +1,25 @@ +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.Touch.Controls +{ + public class TouchProgressBar : ProgressBar + { + static TouchProgressBar() + { + DefaultStyleKeyProperty.OverrideMetadata(typeof(TouchProgressBar), new FrameworkPropertyMetadata(typeof(TouchProgressBar))); + } + } +} diff --git a/Software/Visual_Studio/Tango.Touch/Controls/TouchProgressBar.xaml b/Software/Visual_Studio/Tango.Touch/Controls/TouchProgressBar.xaml new file mode 100644 index 000000000..769efd930 --- /dev/null +++ b/Software/Visual_Studio/Tango.Touch/Controls/TouchProgressBar.xaml @@ -0,0 +1,15 @@ +<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" + xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" + xmlns:local="clr-namespace:Tango.Touch.Controls"> + + <ResourceDictionary.MergedDictionaries> + <ResourceDictionary Source="../Resources/Colors.xaml" /> + </ResourceDictionary.MergedDictionaries> + + <Style TargetType="{x:Type local:TouchProgressBar}" BasedOn="{StaticResource {x:Type ProgressBar}}"> + <Setter Property="Background" Value="{StaticResource TangoGrayBrush}"></Setter> + <Setter Property="BorderThickness" Value="0"></Setter> + <Setter Property="Foreground" Value="{StaticResource TangoPrimaryAccentBrush}"></Setter> + </Style> + +</ResourceDictionary>
\ No newline at end of file diff --git a/Software/Visual_Studio/Tango.Touch/Tango.Touch.csproj b/Software/Visual_Studio/Tango.Touch/Tango.Touch.csproj index 3e7a68897..fc0c13207 100644 --- a/Software/Visual_Studio/Tango.Touch/Tango.Touch.csproj +++ b/Software/Visual_Studio/Tango.Touch/Tango.Touch.csproj @@ -78,6 +78,7 @@ <Compile Include="Controls\TouchListBoxItem.cs" /> <Compile Include="Controls\TouchNativeListBox.cs" /> <Compile Include="Controls\TouchNumericTextBox.cs" /> + <Compile Include="Controls\TouchProgressBar.cs" /> <Compile Include="Controls\TouchRingProgress.cs" /> <Compile Include="Controls\TouchSlider.cs" /> <Compile Include="Controls\TouchStaticListBox.cs" /> @@ -185,6 +186,10 @@ <SubType>Designer</SubType> <Generator>MSBuild:Compile</Generator> </Page> + <Page Include="Controls\TouchProgressBar.xaml"> + <SubType>Designer</SubType> + <Generator>MSBuild:Compile</Generator> + </Page> <Page Include="Controls\TouchRingProgress.xaml"> <SubType>Designer</SubType> <Generator>MSBuild:Compile</Generator> @@ -369,7 +374,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/Tango.Touch/Themes/Generic.xaml b/Software/Visual_Studio/Tango.Touch/Themes/Generic.xaml index 288307852..ad85463dd 100644 --- a/Software/Visual_Studio/Tango.Touch/Themes/Generic.xaml +++ b/Software/Visual_Studio/Tango.Touch/Themes/Generic.xaml @@ -41,6 +41,7 @@ <ResourceDictionary Source="pack://application:,,,/Tango.Touch;component/Controls/TouchGifAnimation.xaml" /> <ResourceDictionary Source="pack://application:,,,/Tango.Touch;component/Controls/TouchFlatListBox.xaml" /> <ResourceDictionary Source="pack://application:,,,/Tango.Touch;component/Controls/TouchStepProgressBar.xaml" /> + <ResourceDictionary Source="pack://application:,,,/Tango.Touch;component/Controls/TouchProgressBar.xaml" /> <ResourceDictionary Source="pack://application:,,,/Tango.Touch;component/Styles/TouchToggleButton.xaml" /> |
