aboutsummaryrefslogtreecommitdiffstats
path: root/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/Views/FirmwareUpgradeView.xaml
blob: 5cf23e79e15c2beaeb7f54f74e4b68cce73a1e9f (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
<UserControl x:Class="Tango.MachineStudio.UI.Views.FirmwareUpgradeView"
             xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
             xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
             xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" 
             xmlns:d="http://schemas.microsoft.com/expression/blend/2008" 
             xmlns:local="clr-namespace:Tango.MachineStudio.UI.Views"
             xmlns:converters="clr-namespace:Tango.SharedUI.Converters;assembly=Tango.SharedUI"
             xmlns:materialDesign="http://materialdesigninxaml.net/winfx/xaml/themes"
             xmlns:vm="clr-namespace:Tango.MachineStudio.UI.ViewModels"
             xmlns:controls="clr-namespace:Tango.SharedUI.Controls;assembly=Tango.SharedUI"
             mc:Ignorable="d" 
             d:DesignHeight="300" d:DesignWidth="300" Width="800" Height="400" Background="{StaticResource Dialog.Background}" d:DataContext="{d:DesignInstance Type=vm:FirmwareUpgradeViewVM, IsDesignTimeCreatable=False}" Foreground="{StaticResource MainWindow.Foreground}">

    <UserControl.Resources>
        <converters:EnumToDescriptionConverter x:Key="EnumToDescriptionConverter" />
    </UserControl.Resources>

    <UserControl.Style>
        <Style TargetType="UserControl">
            <Setter Property="Cursor" Value="Arrow"></Setter>
            <Style.Triggers>
                <DataTrigger Binding="{Binding IsFree}" Value="False">
                    <Setter Property="Cursor" Value="Wait"></Setter>
                </DataTrigger>
            </Style.Triggers>
        </Style>
    </UserControl.Style>

    <Grid>
        <Grid Margin="10">
            <Grid.RowDefinitions>
                <RowDefinition Height="121"/>
                <RowDefinition Height="1*"/>
            </Grid.RowDefinitions>

            <Grid>
                <StackPanel>
                    <StackPanel Orientation="Horizontal">
                        <Image Source="/Images/firmware_upgrade.png" Height="100" />
                        <TextBlock VerticalAlignment="Center" FontSize="30" FontWeight="SemiBold" Margin="20 0 0 0">FIRMWARE UPGRADE</TextBlock>
                    </StackPanel>
                    <Rectangle Stroke="{StaticResource BorderBrushGainsboro}"  StrokeDashArray="5 5 5 5" Margin="20 10" />
                </StackPanel>
            </Grid>

            <Grid Grid.Row="1">
                <controls:NavigationControl TransitionType="Zoom" SelectedIndex="{Binding CurrentPage}" TransitionDuration="00:00:0.3">

                    <Grid>
                        <Grid>
                            <Grid.RowDefinitions>
                                <RowDefinition Height="174*"/>
                                <RowDefinition Height="85*"/>
                            </Grid.RowDefinitions>
                            <StackPanel VerticalAlignment="Center" HorizontalAlignment="Center">
                                <TextBlock TextAlignment="Center">
                        <Run>This upgrade wizard will help you upgrade the connected machine firmware version.</Run>
                        <LineBreak/>
                        <Run>Press 'SELECT' to browse for an .tfp file (Tango Firmware Package).</Run>
                                </TextBlock>
                                <StackPanel>
                                    <DockPanel Margin="0 30 0 0" Width="600" HorizontalAlignment="Left">
                                        <Button DockPanel.Dock="Right" Margin="10 0 0 0" Command="{Binding SelectCommand}">SELECT</Button>
                                        <TextBox Style="{x:Null}" VerticalContentAlignment="Center" BorderBrush="{StaticResource AccentColorBrush}" Padding="5 0" Foreground="{StaticResource DimGrayBrush}" IsReadOnly="True" Text="{Binding SelectedFile,Mode=OneWay}"></TextBox>
                                    </DockPanel>

                                    <StackPanel Orientation="Horizontal" Margin="0 5 0 0">
                                        <RadioButton IsChecked="{Binding DFU,Mode=TwoWay}">DFU</RadioButton>
                                        <RadioButton IsChecked="{Binding UploadTFP,Mode=TwoWay}" Margin="25 0 0 0">TFP Package</RadioButton>
                                        <RadioButton IsChecked="{Binding DFUAndTFP,Mode=TwoWay}" Margin="10 0 0 0">DFU &amp; Package</RadioButton>
                                    </StackPanel>
                                </StackPanel>
                            </StackPanel>

                            <Grid Height="60" Grid.Row="1">
                                <Button Height="50" Width="200" VerticalAlignment="Top" Command="{Binding UpgradeCommand}">
                                    <StackPanel Orientation="Horizontal">
                                        <materialDesign:PackIcon Kind="Flash" Width="32" Height="32" />
                                        <TextBlock VerticalAlignment="Center" Margin="5 0 0 0">UPGRADE</TextBlock>
                                    </StackPanel>
                                </Button>
                            </Grid>
                        </Grid>
                    </Grid>

                    <Grid>
                        <StackPanel HorizontalAlignment="Center" VerticalAlignment="Center">
                            <TextBlock HorizontalAlignment="Center" FontSize="18" FontWeight="SemiBold">Upgrading Machine Firmware</TextBlock>
                            <TextBlock Margin="0 40 0 0" HorizontalAlignment="Center" Foreground="{StaticResource GrayBrush}" Text="{Binding Handler.Message,Converter={StaticResource EnumToDescriptionConverter},Mode=OneWay}"></TextBlock>
                            <ProgressBar Height="15" Width="600" Margin="0 5 0 0" Maximum="{Binding Handler.Total,Mode=OneWay}" Value="{Binding Handler.Current,Mode=OneWay}" IsIndeterminate="{Binding Handler.IsIndeterminate,Mode=OneWay}"></ProgressBar>
                            <Button Width="150" Background="{StaticResource RedBrush100}" BorderBrush="{StaticResource RedBrush100}" Margin="0 40 0 0" Height="35" Command="{Binding AbortCommand}">ABORT</Button>
                        </StackPanel>
                    </Grid>

                    <Grid>
                        <StackPanel HorizontalAlignment="Center" VerticalAlignment="Center">
                            <TextBlock HorizontalAlignment="Center" FontSize="18" FontWeight="SemiBold">Firmware Upgrade Completed</TextBlock>
                            <materialDesign:PackIcon HorizontalAlignment="Center" Width="100" Margin="0 10 0 0" Height="100" Kind="Check" Foreground="#2DCB2D" />
                            <Button Width="150" Margin="0 10 0 0" Height="35" Command="{Binding CloseCommand}">CLOSE</Button>
                        </StackPanel>
                    </Grid>

                    <Grid>
                        <StackPanel HorizontalAlignment="Center" VerticalAlignment="Center">
                            <TextBlock HorizontalAlignment="Center" FontSize="18" FontWeight="SemiBold">Firmware Upgrade Failed</TextBlock>
                            <materialDesign:PackIcon HorizontalAlignment="Center" Width="100" Margin="0 10 0 0" Height="100" Kind="AlertOutline" Foreground="{StaticResource RedBrush100}" />
                            <TextBlock HorizontalAlignment="Center" TextAlignment="Center" TextWrapping="Wrap" Text="{Binding UpgradeError}" Foreground="{StaticResource RedBrush100}" FontWeight="SemiBold"></TextBlock>
                            <Button Width="150" Margin="0 15 0 0" Height="35" Command="{Binding CloseCommand}">CLOSE</Button>
                        </StackPanel>
                    </Grid>
                </controls:NavigationControl>
            </Grid>

        </Grid>
    </Grid>
</UserControl>
class="p">( string.Concat( "ChRFbWJyb2lkZXJ5RmlsZS5wcm90bxIUVGFuZ28uUE1SLkVtYnJvaWRlcnka", "DUV4dGVudHMucHJvdG8aDFN0aXRjaC5wcm90bxoRU3RpdGNoQ29sb3IucHJv", "dG8i8gEKDkVtYnJvaWRlcnlGaWxlEhIKCkRlc2lnbk5hbWUYASABKAkSEAoI", "RmlsZU5hbWUYAiABKAkSEwoLU3RpdGNoQ291bnQYAyABKAUSEgoKQ29sb3JD", "b3VudBgEIAEoBRIuCgdFeHRlbnRzGAUgASgLMh0uVGFuZ28uUE1SLkVtYnJv", "aWRlcnkuRXh0ZW50cxIxCgZDb2xvcnMYBiADKAsyIS5UYW5nby5QTVIuRW1i", "cm9pZGVyeS5TdGl0Y2hDb2xvchIuCghTdGl0Y2hlcxgHIAMoCzIcLlRhbmdv", "LlBNUi5FbWJyb2lkZXJ5LlN0aXRjaEIgCh5jb20udHdpbmUudGFuZ28ucG1y", "LmVtYnJvaWRlcnliBnByb3RvMw==")); descriptor = pbr::FileDescriptor.FromGeneratedCode(descriptorData, new pbr::FileDescriptor[] { global::Tango.PMR.Embroidery.ExtentsReflection.Descriptor, global::Tango.PMR.Embroidery.StitchReflection.Descriptor, global::Tango.PMR.Embroidery.StitchColorReflection.Descriptor, }, new pbr::GeneratedClrTypeInfo(null, new pbr::GeneratedClrTypeInfo[] { new pbr::GeneratedClrTypeInfo(typeof(global::Tango.PMR.Embroidery.EmbroideryFile), global::Tango.PMR.Embroidery.EmbroideryFile.Parser, new[]{ "DesignName", "FileName", "StitchCount", "ColorCount", "Extents", "Colors", "Stitches" }, null, null, null) })); } #endregion } #region Messages public sealed partial class EmbroideryFile : pb::IMessage<EmbroideryFile> { private static readonly pb::MessageParser<EmbroideryFile> _parser = new pb::MessageParser<EmbroideryFile>(() => new EmbroideryFile()); [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public static pb::MessageParser<EmbroideryFile> Parser { get { return _parser; } } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public static pbr::MessageDescriptor Descriptor { get { return global::Tango.PMR.Embroidery.EmbroideryFileReflection.Descriptor.MessageTypes[0]; } } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] pbr::MessageDescriptor pb::IMessage.Descriptor { get { return Descriptor; } } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public EmbroideryFile() { OnConstruction(); } partial void OnConstruction(); [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public EmbroideryFile(EmbroideryFile other) : this() { designName_ = other.designName_; fileName_ = other.fileName_; stitchCount_ = other.stitchCount_; colorCount_ = other.colorCount_; Extents = other.extents_ != null ? other.Extents.Clone() : null; colors_ = other.colors_.Clone(); stitches_ = other.stitches_.Clone(); } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public EmbroideryFile Clone() { return new EmbroideryFile(this); } /// <summary>Field number for the "DesignName" field.</summary> public const int DesignNameFieldNumber = 1; private string designName_ = ""; [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public string DesignName { get { return designName_; } set { designName_ = pb::ProtoPreconditions.CheckNotNull(value, "value"); } } /// <summary>Field number for the "FileName" field.</summary> public const int FileNameFieldNumber = 2; private string fileName_ = ""; [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public string FileName { get { return fileName_; } set { fileName_ = pb::ProtoPreconditions.CheckNotNull(value, "value"); } } /// <summary>Field number for the "StitchCount" field.</summary> public const int StitchCountFieldNumber = 3; private int stitchCount_; [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public int StitchCount { get { return stitchCount_; } set { stitchCount_ = value; } } /// <summary>Field number for the "ColorCount" field.</summary> public const int ColorCountFieldNumber = 4; private int colorCount_; [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public int ColorCount { get { return colorCount_; } set { colorCount_ = value; } } /// <summary>Field number for the "Extents" field.</summary> public const int ExtentsFieldNumber = 5; private global::Tango.PMR.Embroidery.Extents extents_; [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public global::Tango.PMR.Embroidery.Extents Extents { get { return extents_; } set { extents_ = value; } } /// <summary>Field number for the "Colors" field.</summary> public const int ColorsFieldNumber = 6; private static readonly pb::FieldCodec<global::Tango.PMR.Embroidery.StitchColor> _repeated_colors_codec = pb::FieldCodec.ForMessage(50, global::Tango.PMR.Embroidery.StitchColor.Parser); private readonly pbc::RepeatedField<global::Tango.PMR.Embroidery.StitchColor> colors_ = new pbc::RepeatedField<global::Tango.PMR.Embroidery.StitchColor>(); [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public pbc::RepeatedField<global::Tango.PMR.Embroidery.StitchColor> Colors { get { return colors_; } } /// <summary>Field number for the "Stitches" field.</summary> public const int StitchesFieldNumber = 7; private static readonly pb::FieldCodec<global::Tango.PMR.Embroidery.Stitch> _repeated_stitches_codec = pb::FieldCodec.ForMessage(58, global::Tango.PMR.Embroidery.Stitch.Parser); private readonly pbc::RepeatedField<global::Tango.PMR.Embroidery.Stitch> stitches_ = new pbc::RepeatedField<global::Tango.PMR.Embroidery.Stitch>(); [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public pbc::RepeatedField<global::Tango.PMR.Embroidery.Stitch> Stitches { get { return stitches_; } } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public override bool Equals(object other) { return Equals(other as EmbroideryFile); } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public bool Equals(EmbroideryFile other) { if (ReferenceEquals(other, null)) { return false; } if (ReferenceEquals(other, this)) { return true; } if (DesignName != other.DesignName) return false; if (FileName != other.FileName) return false; if (StitchCount != other.StitchCount) return false; if (ColorCount != other.ColorCount) return false; if (!object.Equals(Extents, other.Extents)) return false; if(!colors_.Equals(other.colors_)) return false; if(!stitches_.Equals(other.stitches_)) return false; return true; } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public override int GetHashCode() { int hash = 1; if (DesignName.Length != 0) hash ^= DesignName.GetHashCode(); if (FileName.Length != 0) hash ^= FileName.GetHashCode(); if (StitchCount != 0) hash ^= StitchCount.GetHashCode(); if (ColorCount != 0) hash ^= ColorCount.GetHashCode(); if (extents_ != null) hash ^= Extents.GetHashCode(); hash ^= colors_.GetHashCode(); hash ^= stitches_.GetHashCode(); return hash; } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public override string ToString() { return pb::JsonFormatter.ToDiagnosticString(this); } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public void WriteTo(pb::CodedOutputStream output) { if (DesignName.Length != 0) { output.WriteRawTag(10); output.WriteString(DesignName); } if (FileName.Length != 0) { output.WriteRawTag(18); output.WriteString(FileName); } if (StitchCount != 0) { output.WriteRawTag(24); output.WriteInt32(StitchCount); } if (ColorCount != 0) { output.WriteRawTag(32); output.WriteInt32(ColorCount); } if (extents_ != null) { output.WriteRawTag(42); output.WriteMessage(Extents); } colors_.WriteTo(output, _repeated_colors_codec); stitches_.WriteTo(output, _repeated_stitches_codec); } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public int CalculateSize() { int size = 0; if (DesignName.Length != 0) { size += 1 + pb::CodedOutputStream.ComputeStringSize(DesignName); } if (FileName.Length != 0) { size += 1 + pb::CodedOutputStream.ComputeStringSize(FileName); } if (StitchCount != 0) { size += 1 + pb::CodedOutputStream.ComputeInt32Size(StitchCount); } if (ColorCount != 0) { size += 1 + pb::CodedOutputStream.ComputeInt32Size(ColorCount); } if (extents_ != null) { size += 1 + pb::CodedOutputStream.ComputeMessageSize(Extents); } size += colors_.CalculateSize(_repeated_colors_codec); size += stitches_.CalculateSize(_repeated_stitches_codec); return size; } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public void MergeFrom(EmbroideryFile other) { if (other == null) { return; } if (other.DesignName.Length != 0) { DesignName = other.DesignName; } if (other.FileName.Length != 0) { FileName = other.FileName; } if (other.StitchCount != 0) { StitchCount = other.StitchCount; } if (other.ColorCount != 0) { ColorCount = other.ColorCount; } if (other.extents_ != null) { if (extents_ == null) { extents_ = new global::Tango.PMR.Embroidery.Extents(); } Extents.MergeFrom(other.Extents); } colors_.Add(other.colors_); stitches_.Add(other.stitches_); } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public void MergeFrom(pb::CodedInputStream input) { uint tag; while ((tag = input.ReadTag()) != 0) { switch(tag) { default: input.SkipLastField(); break; case 10: { DesignName = input.ReadString(); break; } case 18: { FileName = input.ReadString(); break; } case 24: { StitchCount = input.ReadInt32(); break; } case 32: { ColorCount = input.ReadInt32(); break; } case 42: { if (extents_ == null) { extents_ = new global::Tango.PMR.Embroidery.Extents(); } input.ReadMessage(extents_); break; } case 50: { colors_.AddEntriesFrom(input, _repeated_colors_codec); break; } case 58: { stitches_.AddEntriesFrom(input, _repeated_stitches_codec); break; } } } } } #endregion } #endregion Designer generated code