aboutsummaryrefslogtreecommitdiffstats
path: root/Software/Visual_Studio/PPC/Modules/Tango.PPC.Events/EventsViews/JobEventView.xaml
blob: d283b08d362f1793e5d5956e38c7074694d13e2a (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
<UserControl x:Class="Tango.PPC.Events.EventsViews.JobEventView"
             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: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}" />

                    <TextBlock Text="{Binding Description}" TextWrapping="Wrap">
                        
                    </TextBlock>
                </StackPanel>
            </DockPanel>
        </DockPanel>
    </Grid>
</UserControl>
="w"> System.Linq; using System.Text; using System.Threading.Tasks; using Tango.Core; using Tango.Integration.Storage; namespace Tango.Integration.Upgrade { public class FirmwareUpgradeHandler : ExtendedObject { private Action _cancelAction; public event EventHandler<FirmwareUpgradeProgressEventArgs> Progress; public event EventHandler Completed; public event EventHandler Canceled; public event EventHandler<Exception> Failed; internal FirmwareUpgradeHandler() { Message = "Initializing..."; } internal FirmwareUpgradeHandler(Action cancelAction) : this() { _cancelAction = cancelAction; } private String _message; public String Message { get { return _message; } set { _message = value; RaisePropertyChangedAuto(); } } private FirmwareUpgradeStatus _status; public FirmwareUpgradeStatus Status { get { return _status; } private set { _status = value; RaisePropertyChangedAuto(); } } private long _current; public long Current { get { return _current; } internal set { _current = value; RaisePropertyChangedAuto(); } } private long _total; public long Total { get { return _total; } internal set { _total = value; RaisePropertyChangedAuto(); } } public Task Cancel() { return Task.Factory.StartNew(() => { _cancelAction.Invoke(); Message = "Canceled."; Status = FirmwareUpgradeStatus.Canceled; Canceled?.Invoke(this, new EventArgs()); }); } internal void RaiseCompleted() { Status = FirmwareUpgradeStatus.Completed; Message = "Completed."; Completed?.Invoke(this, new EventArgs()); } internal void RaiseCanceled() { Status = FirmwareUpgradeStatus.Canceled; Message = "Canceled."; Canceled?.Invoke(this, new EventArgs()); } internal void RaiseFailed(Exception ex) { Status = FirmwareUpgradeStatus.Failed; Message = "Failed."; Failed?.Invoke(this, ex); } internal void RaiseProgress(long current, FirmwareUpgradeStatus status, String message) { Current = current; Status = status; Message = message; Progress?.Invoke(this, new FirmwareUpgradeProgressEventArgs() { Current = Current, Status = Status, Total = Total, Message = Message, }); } } }