aboutsummaryrefslogtreecommitdiffstats
path: root/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.Publisher.UI/MainWindow.xaml
blob: cd23547c2087696b51ca0ccc5ce7b20015ad09c5 (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
<Window x:Class="Tango.MachineStudio.Publisher.UI.MainWindow"
        xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
        xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
        xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
        xmlns:local="clr-namespace:Tango.MachineStudio.Publisher.UI"
        xmlns:converters="clr-namespace:Tango.SharedUI.Converters;assembly=Tango.SharedUI"
        xmlns:web="clr-namespace:Tango.Web;assembly=Tango.Web"
        mc:Ignorable="d"
        Title="Machine Studio Publisher" Height="620" Width="700" WindowStartupLocation="CenterScreen" WindowStyle="ToolWindow" ResizeMode="NoResize" Foreground="#202020" d:DataContext="{d:DesignInstance Type=local:MainWindowVM, IsDesignTimeCreatable=False}">

    <Window.Resources>
        <converters:EnumToItemsSourceConverter x:Key="EnumToItemsSourceConverter" />
    </Window.Resources>

    <Window.Style>
        <Style TargetType="Window">
            <Setter Property="Cursor" Value="Arrow"></Setter>
            <Style.Triggers>
                <DataTrigger Binding="{Binding IsBusy}" Value="True">
                    <Setter Property="Cursor" Value="Wait"></Setter>
                </DataTrigger>
            </Style.Triggers>
        </Style>
    </Window.Style>

    <Border BorderThickness="1" BorderBrush="#0288D1">
        <Grid>
            <Grid.RowDefinitions>
                <RowDefinition Height="60"/>
                <RowDefinition Height="156*"/>
            </Grid.RowDefinitions>

            <Grid Background="#0288D1">
                <Grid.Effect>
                    <DropShadowEffect BlurRadius="10" ShadowDepth="5" Direction="270" Opacity="0.5" />
                </Grid.Effect>

                <StackPanel Orientation="Horizontal" Margin="8" HorizontalAlignment="Center">
                    <Image Source="/Images/machine-trans.png" RenderOptions.BitmapScalingMode="Fant"></Image>
                    <TextBlock Foreground="White" VerticalAlignment="Center" Margin="10 0 0 0" FontSize="23">MACHINE STUDIO</TextBlock>
                </StackPanel>
            </Grid>

            <Grid Grid.Row="1" Margin="10" IsEnabled="{Binding IsFree}">
                <DockPanel>
                    <StackPanel DockPanel.Dock="Top" HorizontalAlignment="Left" Margin="0 20 0 0" x:Name="stackDetails">
                        <TextBlock FontSize="16">
                            <Run>Remote Version:</Run>
                            <Run Text="{Binding RemoteVersion}" FontStyle="Italic" FontWeight="SemiBold"></Run>
                        </TextBlock>
                        <TextBlock Margin="0 10 0 0" FontSize="16" >
                            <Run>Local Version:</Run>
                            <Run Text="{Binding LocalVersion}" FontStyle="Italic" FontWeight="SemiBold"></Run>
                        </TextBlock>

                        <ComboBox Width="200" Margin="0 10 0 0" HorizontalAlignment="Left" ItemsSource="{Binding Source={x:Type web:DeploymentSlot},Converter={StaticResource EnumToItemsSourceConverter}}" SelectedValue="{Binding Options.Environment}" SelectedValuePath="Value" DisplayMemberPath="DisplayName"></ComboBox>


                        <StackPanel Margin="0 20 0 0" Orientation="Horizontal">
                            <TextBlock FontSize="16">Email:</TextBlock>
                            <TextBox Margin="5 0 0 0" Width="230" BorderThickness="0 0 0 1" Text="{Binding Options.Email,Mode=TwoWay,UpdateSourceTrigger=PropertyChanged}"></TextBox>
                        </StackPanel>

                        <StackPanel Margin="0 10 0 0" Orientation="Horizontal">
                            <TextBlock FontSize="16">Password:</TextBlock>
                            <TextBox Margin="5 0 0 0" Width="200" BorderThickness="0 0 0 1" Text="{Binding Options.Password,Mode=TwoWay,UpdateSourceTrigger=PropertyChanged}"></TextBox>
                        </StackPanel>

                        <StackPanel Margin="0 10 0 0" Orientation="Horizontal">
                            <TextBlock FontSize="16">Installer Project:</TextBlock>
                            <TextBox Margin="5 0 0 0" Width="500" BorderThickness="0 0 0 1" Text="{Binding Options.InstallerProject,Mode=TwoWay,UpdateSourceTrigger=PropertyChanged}"></TextBox>
                        </StackPanel>

                        <StackPanel Margin="0 10 0 0" Orientation="Horizontal">
                            <TextBlock FontSize="16">Installer Output Folder:</TextBlock>
                            <TextBox Margin="5 0 0 0" Width="500" BorderThickness="0 0 0 1" Text="{Binding Options.InstallerOutputFolder,Mode=TwoWay,UpdateSourceTrigger=PropertyChanged}"></TextBox>
                        </StackPanel>

                        <TextBlock FontSize="16" Margin="0 20 0 0">Comments</TextBlock>
                        <TextBox HorizontalAlignment="Left" Height="70" Margin="0 5 0 0" Width="500" AcceptsReturn="True" TextWrapping="Wrap" Text="{Binding Options.Comments,Mode=TwoWay,UpdateSourceTrigger=PropertyChanged}"></TextBox>

                        <StackPanel Margin="0 20 0 0">
                            <CheckBox x:Name="chkCreateTag" IsChecked="{Binding Options.CreateTag}">Create Tag On Repository</CheckBox>
                            <CheckBox Margin="0 5 0 0" IsChecked="{Binding Options.AutoCommitAndPush}">Auto Commit &amp; Push</CheckBox>
                            <TextBlock Margin="0 10 0 0">Personal Access Token</TextBlock>
                            <TextBox BorderThickness="0 0 0 1" IsEnabled="{Binding ElementName=chkCreateTag,Path=IsChecked}" Margin="0 5 0 0" Text="{Binding Options.PersonalAccessToken}"></TextBox>
                        </StackPanel>
                    </StackPanel>

                    <Grid DockPanel.Dock="Bottom">
                        <DockPanel>
                            <StackPanel Orientation="Horizontal" HorizontalAlignment="Right" DockPanel.Dock="Right">
                                <Button Background="#0288D1" BorderThickness="0" Height="30" MinWidth="140" Foreground="White" FontWeight="SemiBold" Command="{Binding PublishCommand}">PUBLISH</Button>
                            </StackPanel>

                            <StackPanel HorizontalAlignment="Left">
                                <TextBlock Text="{Binding PublishArgs.Message}" Foreground="Gray"></TextBlock>
                                <ProgressBar Width="500" Height="10" Margin="0 5 0 0" Maximum="{Binding PublishArgs.Total}" Value="{Binding PublishArgs.Progress}" Foreground="#0288D1"></ProgressBar>
                            </StackPanel>
                        </DockPanel>
                    </Grid>

                    <Grid>

                    </Grid>

                </DockPanel>
            </Grid>
        </Grid>
    </Border>
</Window>
class="o">= visualLength; this.DocumentLength = documentLength; } /// <summary> /// Gets the length of this element in visual columns. /// </summary> public int VisualLength { get; private set; } /// <summary> /// Gets the length of this element in the text document. /// </summary> public int DocumentLength { get; private set; } /// <summary> /// Gets the visual column where this element starts. /// </summary> [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Naming", "CA1721:PropertyNamesShouldNotMatchGetMethods", Justification = "This property holds the start visual column, use GetVisualColumn to get inner visual columns.")] public int VisualColumn { get; internal set; } /// <summary> /// Gets the text offset where this element starts, relative to the start text offset of the visual line. /// </summary> public int RelativeTextOffset { get; internal set; } /// <summary> /// Gets the text run properties. /// A unique <see cref="VisualLineElementTextRunProperties"/> instance is used for each /// <see cref="VisualLineElement"/>; colorizing code may assume that modifying the /// <see cref="VisualLineElementTextRunProperties"/> will affect only this /// <see cref="VisualLineElement"/>. /// </summary> public VisualLineElementTextRunProperties TextRunProperties { get; private set; } /// <summary> /// Gets/sets the brush used for the background of this <see cref="VisualLineElement" />. /// </summary> public Brush BackgroundBrush { get; set; } internal void SetTextRunProperties(VisualLineElementTextRunProperties p) { this.TextRunProperties = p; } /// <summary> /// Creates the TextRun for this line element. /// </summary> /// <param name="startVisualColumn"> /// The visual column from which the run should be constructed. /// Normally the same value as the <see cref="VisualColumn"/> property is used to construct the full run; /// but when word-wrapping is active, partial runs might be created. /// </param> /// <param name="context"> /// Context object that contains information relevant for text run creation. /// </param> public abstract TextRun CreateTextRun(int startVisualColumn, ITextRunConstructionContext context); /// <summary> /// Retrieves the text span immediately before the visual column. /// </summary> /// <remarks>This method is used for word-wrapping in bidirectional text.</remarks> public virtual TextSpan<CultureSpecificCharacterBufferRange> GetPrecedingText(int visualColumnLimit, ITextRunConstructionContext context) { return null; } /// <summary> /// Gets if this VisualLineElement can be split. /// </summary> public virtual bool CanSplit { get { return false; } } /// <summary> /// Splits the element. /// </summary> /// <param name="splitVisualColumn">Position inside this element at which it should be broken</param> /// <param name="elements">The collection of line elements</param> /// <param name="elementIndex">The index at which this element is in the elements list.</param> public virtual void Split(int splitVisualColumn, IList<VisualLineElement> elements, int elementIndex) { throw new NotSupportedException(); } /// <summary> /// Helper method for splitting this line element into two, correctly updating the /// <see cref="VisualLength"/>, <see cref="DocumentLength"/>, <see cref="VisualColumn"/> /// and <see cref="RelativeTextOffset"/> properties. /// </summary> /// <param name="firstPart">The element before the split position.</param> /// <param name="secondPart">The element after the split position.</param> /// <param name="splitVisualColumn">The split position as visual column.</param> /// <param name="splitRelativeTextOffset">The split position as text offset.</param> protected void SplitHelper(VisualLineElement firstPart, VisualLineElement secondPart, int splitVisualColumn, int splitRelativeTextOffset) { if (firstPart == null) throw new ArgumentNullException("firstPart"); if (secondPart == null) throw new ArgumentNullException("secondPart"); int relativeSplitVisualColumn = splitVisualColumn - VisualColumn; int relativeSplitRelativeTextOffset = splitRelativeTextOffset - RelativeTextOffset; if (relativeSplitVisualColumn <= 0 || relativeSplitVisualColumn >= VisualLength) throw new ArgumentOutOfRangeException("splitVisualColumn", splitVisualColumn, "Value must be between " + (VisualColumn + 1) + " and " + (VisualColumn + VisualLength - 1)); if (relativeSplitRelativeTextOffset < 0 || relativeSplitRelativeTextOffset > DocumentLength) throw new ArgumentOutOfRangeException("splitRelativeTextOffset", splitRelativeTextOffset, "Value must be between " + (RelativeTextOffset) + " and " + (RelativeTextOffset + DocumentLength)); int oldVisualLength = VisualLength; int oldDocumentLength = DocumentLength; int oldVisualColumn = VisualColumn; int oldRelativeTextOffset = RelativeTextOffset; firstPart.VisualColumn = oldVisualColumn; secondPart.VisualColumn = oldVisualColumn + relativeSplitVisualColumn; firstPart.RelativeTextOffset = oldRelativeTextOffset; secondPart.RelativeTextOffset = oldRelativeTextOffset + relativeSplitRelativeTextOffset; firstPart.VisualLength = relativeSplitVisualColumn; secondPart.VisualLength = oldVisualLength - relativeSplitVisualColumn; firstPart.DocumentLength = relativeSplitRelativeTextOffset; secondPart.DocumentLength = oldDocumentLength - relativeSplitRelativeTextOffset; if (firstPart.TextRunProperties == null) firstPart.TextRunProperties = TextRunProperties.Clone(); if (secondPart.TextRunProperties == null) secondPart.TextRunProperties = TextRunProperties.Clone(); } /// <summary> /// Gets the visual column of a text location inside this element. /// The text offset is given relative to the visual line start. /// </summary> public virtual int GetVisualColumn(int relativeTextOffset) { if (relativeTextOffset >= this.RelativeTextOffset + DocumentLength) return VisualColumn + VisualLength; else return VisualColumn; } /// <summary> /// Gets the text offset of a visual column inside this element. /// </summary> /// <returns>A text offset relative to the visual line start.</returns> public virtual int GetRelativeOffset(int visualColumn) { if (visualColumn >= this.VisualColumn + VisualLength) return RelativeTextOffset + DocumentLength; else return RelativeTextOffset; } /// <summary> /// Gets the next caret position inside this element. /// </summary> /// <param name="visualColumn">The visual column from which the search should be started.</param> /// <param name="direction">The search direction (forwards or backwards).</param> /// <param name="mode">Whether to stop only at word borders.</param> /// <returns>The visual column of the next caret position, or -1 if there is no next caret position.</returns> /// <remarks> /// In the space between two line elements, it is sufficient that one of them contains a caret position; /// though in many cases, both of them contain one. /// </remarks> public virtual int GetNextCaretPosition(int visualColumn, LogicalDirection direction, CaretPositioningMode mode) { int stop1 = this.VisualColumn; int stop2 = this.VisualColumn + this.VisualLength; if (direction == LogicalDirection.Backward) { if (visualColumn > stop2 && mode != CaretPositioningMode.WordStart && mode != CaretPositioningMode.WordStartOrSymbol) return stop2; else if (visualColumn > stop1) return stop1; } else { if (visualColumn < stop1) return stop1; else if (visualColumn < stop2 && mode != CaretPositioningMode.WordStart && mode != CaretPositioningMode.WordStartOrSymbol) return stop2; } return -1; } /// <summary> /// Gets whether the specified offset in this element is considered whitespace. /// </summary> public virtual bool IsWhitespace(int visualColumn) { return false; } /// <summary> /// Gets whether the <see cref="GetNextCaretPosition"/> implementation handles line borders. /// If this property returns false, the caller of GetNextCaretPosition should handle the line /// borders (i.e. place caret stops at the start and end of the line). /// This property has an effect only for VisualLineElements that are at the start or end of a /// <see cref="VisualLine"/>. /// </summary> public virtual bool HandlesLineBorders { get { return false; } } /// <summary> /// Queries the cursor over the visual line element. /// </summary> protected internal virtual void OnQueryCursor(QueryCursorEventArgs e) { } /// <summary> /// Allows the visual line element to handle a mouse event. /// </summary> protected internal virtual void OnMouseDown(MouseButtonEventArgs e) { } /// <summary> /// Allows the visual line element to handle a mouse event. /// </summary> protected internal virtual void OnMouseUp(MouseButtonEventArgs e) { } } }