|
5 | 5 | xmlns:m="using:SourceGit.Models"
|
6 | 6 | xmlns:v="using:SourceGit.Views"
|
7 | 7 | xmlns:vm="using:SourceGit.ViewModels"
|
| 8 | + xmlns:c="using:SourceGit.Converters" |
8 | 9 | mc:Ignorable="d" d:DesignWidth="800" d:DesignHeight="450"
|
9 | 10 | x:Class="SourceGit.Views.LauncherPage"
|
10 | 11 | x:DataType="vm:LauncherPage">
|
|
38 | 39 | </ContentControl.DataTemplates>
|
39 | 40 | </ContentControl>
|
40 | 41 | </Border>
|
41 |
| - |
42 |
| - <!-- Popup --> |
43 |
| - <Grid Grid.Row="1" IsVisible="{Binding Popup, Converter={x:Static ObjectConverters.IsNotNull}}" ClipToBounds="True"> |
44 |
| - <Border Background="Transparent" PointerPressed="OnPopupCancelByClickMask"/> |
45 | 42 |
|
46 |
| - <Border Width="500" HorizontalAlignment="Center" VerticalAlignment="Top" Effect="drop-shadow(0 0 8 #8F000000)" CornerRadius="0,0,8,8" ClipToBounds="True"> |
47 |
| - <ContentControl Content="{Binding Popup}" Background="{DynamicResource Brush.Popup}"> |
48 |
| - <ContentControl.DataTemplates> |
49 |
| - <DataTemplate DataType="vm:Popup"> |
50 |
| - <StackPanel Orientation="Vertical" Background="{DynamicResource Brush.Popup}"> |
51 |
| - <!-- Popup Widget --> |
52 |
| - <ContentPresenter Margin="8,16,8,8" |
53 |
| - Content="{Binding View}" |
54 |
| - IsHitTestVisible="{Binding InProgress, Converter={x:Static BoolConverters.Not}}"/> |
| 43 | + <!-- Floating --> |
| 44 | + <Grid Grid.Row="1" ClipToBounds="True"> |
| 45 | + <Grid.IsVisible> |
| 46 | + <MultiBinding Converter="{x:Static BoolConverters.Or}"> |
| 47 | + <Binding Path="Popup" Converter="{x:Static ObjectConverters.IsNotNull}"/> |
| 48 | + <Binding Path="Notifications.Count" Converter="{x:Static c:IntConverters.IsGreaterThanZero}"/> |
| 49 | + </MultiBinding> |
| 50 | + </Grid.IsVisible> |
55 | 51 |
|
56 |
| - <!-- Options --> |
57 |
| - <StackPanel Margin="8,4,8,8" |
58 |
| - Height="32" |
59 |
| - Orientation="Horizontal" |
60 |
| - HorizontalAlignment="Right" |
61 |
| - IsVisible="{Binding InProgress, Converter={x:Static BoolConverters.Not}}"> |
62 |
| - <Button Classes="flat primary" |
63 |
| - Width="80" Height="28" |
64 |
| - Padding="0" |
65 |
| - HorizontalContentAlignment="Center" |
66 |
| - VerticalContentAlignment="Center" |
67 |
| - Content="{DynamicResource Text.Sure}" |
68 |
| - Click="OnPopupSure" |
69 |
| - HotKey="Enter"/> |
70 |
| - <Button Classes="flat" |
71 |
| - Width="80" Height="28" |
72 |
| - Margin="8,0,0,0" |
73 |
| - Padding="0" |
74 |
| - HorizontalContentAlignment="Center" |
75 |
| - VerticalContentAlignment="Center" |
76 |
| - Content="{DynamicResource Text.Cancel}" |
77 |
| - Click="OnPopupCancel"/> |
78 |
| - </StackPanel> |
| 52 | + <Border Background="Transparent" |
| 53 | + PointerPressed="OnMaskClicked" |
| 54 | + IsVisible="{Binding Popup, Converter={x:Static ObjectConverters.IsNotNull}}"/> |
79 | 55 |
|
80 |
| - <!-- Running --> |
81 |
| - <v:PopupRunningStatus Margin="12,8" |
82 |
| - Description="{Binding ProgressDescription}" |
83 |
| - IsVisible="{Binding InProgress}"/> |
84 |
| - </StackPanel> |
85 |
| - </DataTemplate> |
86 |
| - </ContentControl.DataTemplates> |
87 |
| - </ContentControl> |
88 |
| - </Border> |
89 |
| - </Grid> |
90 |
| - |
91 |
| - <!-- Notification --> |
92 |
| - <Grid Grid.Row="1" Width="480" HorizontalAlignment="Right" VerticalAlignment="Top"> |
93 |
| - <ScrollViewer HorizontalScrollBarVisibility="Disabled" VerticalScrollBarVisibility="Auto"> |
94 |
| - <ItemsControl ItemsSource="{Binding Notifications}"> |
95 |
| - <ItemsControl.ItemTemplate> |
96 |
| - <DataTemplate DataType="m:Notification"> |
97 |
| - <Border Margin="10,6" HorizontalAlignment="Stretch" VerticalAlignment="Top" Effect="drop-shadow(0 0 12 #A0000000)"> |
98 |
| - <Border Padding="8" CornerRadius="6" Background="{DynamicResource Brush.Popup}"> |
99 |
| - <Grid RowDefinitions="26,Auto,32"> |
100 |
| - <StackPanel Grid.Row="0" Margin="8,0,0,0" Orientation="Horizontal" IsVisible="{Binding IsError}"> |
101 |
| - <Path Width="14" Height="14" Data="{StaticResource Icons.Error}" Fill="Red"/> |
102 |
| - <TextBlock Margin="8,0,0,0" FontWeight="Bold" FontSize="14" Text="{DynamicResource Text.Launcher.Error}"/> |
103 |
| - </StackPanel> |
104 |
| - <StackPanel Grid.Row="0" Margin="8,0,0,0" Orientation="Horizontal" IsVisible="{Binding !IsError}"> |
105 |
| - <Path Width="14" Height="14" Data="{StaticResource Icons.Info}" Fill="Green"/> |
106 |
| - <TextBlock Margin="8,0,0,0" FontWeight="Bold" FontSize="14" Text="{DynamicResource Text.Launcher.Info}"/> |
107 |
| - </StackPanel> |
| 56 | + <Grid RowDefinitions="Auto,*" Width="512" HorizontalAlignment="Center"> |
| 57 | + <!-- Popup --> |
| 58 | + <Border Grid.Row="0" |
| 59 | + Margin="6,0" |
| 60 | + Effect="drop-shadow(0 0 8 #8F000000)" |
| 61 | + CornerRadius="0,0,8,8" |
| 62 | + ClipToBounds="True" |
| 63 | + IsVisible="{Binding Popup, Converter={x:Static ObjectConverters.IsNotNull}}"> |
| 64 | + <ContentControl Content="{Binding Popup}" Background="{DynamicResource Brush.Popup}"> |
| 65 | + <ContentControl.DataTemplates> |
| 66 | + <DataTemplate DataType="vm:Popup"> |
| 67 | + <StackPanel Orientation="Vertical" Background="{DynamicResource Brush.Popup}"> |
| 68 | + <!-- Popup Widget --> |
| 69 | + <ContentPresenter Margin="8,16,8,8" |
| 70 | + Content="{Binding View}" |
| 71 | + IsHitTestVisible="{Binding InProgress, Converter={x:Static BoolConverters.Not}}"/> |
| 72 | + |
| 73 | + <!-- Options --> |
| 74 | + <StackPanel Margin="8,4,8,8" |
| 75 | + Height="32" |
| 76 | + Orientation="Horizontal" |
| 77 | + HorizontalAlignment="Right" |
| 78 | + IsVisible="{Binding InProgress, Converter={x:Static BoolConverters.Not}}"> |
| 79 | + <Button Classes="flat primary" |
| 80 | + Width="80" Height="28" |
| 81 | + Padding="0" |
| 82 | + HorizontalContentAlignment="Center" |
| 83 | + VerticalContentAlignment="Center" |
| 84 | + Content="{DynamicResource Text.Sure}" |
| 85 | + Click="OnPopupSure" |
| 86 | + HotKey="Enter"/> |
| 87 | + <Button Classes="flat" |
| 88 | + Width="80" Height="28" |
| 89 | + Margin="8,0,0,0" |
| 90 | + Padding="0" |
| 91 | + HorizontalContentAlignment="Center" |
| 92 | + VerticalContentAlignment="Center" |
| 93 | + Content="{DynamicResource Text.Cancel}" |
| 94 | + Click="OnPopupCancel"/> |
| 95 | + </StackPanel> |
| 96 | + |
| 97 | + <!-- Running --> |
| 98 | + <v:PopupRunningStatus Margin="12,8" |
| 99 | + Description="{Binding ProgressDescription}" |
| 100 | + IsVisible="{Binding InProgress}"/> |
| 101 | + </StackPanel> |
| 102 | + </DataTemplate> |
| 103 | + </ContentControl.DataTemplates> |
| 104 | + </ContentControl> |
| 105 | + </Border> |
108 | 106 |
|
109 |
| - <TextBox Grid.Row="1" |
110 |
| - Classes="no_background no_border" |
111 |
| - IsReadOnly="True" |
112 |
| - TextWrapping="Wrap" |
113 |
| - ScrollViewer.VerticalScrollBarVisibility="Auto" |
114 |
| - MaxHeight="100" |
115 |
| - Margin="8" Padding="0" |
116 |
| - VerticalContentAlignment="Top" |
117 |
| - Text="{Binding Message}"/> |
| 107 | + <!-- Notifications --> |
| 108 | + <ScrollViewer Grid.Row="1" Margin="0,6,0,0" VerticalAlignment="Top" HorizontalScrollBarVisibility="Disabled" VerticalScrollBarVisibility="Auto"> |
| 109 | + <ItemsControl ItemsSource="{Binding Notifications}"> |
| 110 | + <ItemsControl.ItemTemplate> |
| 111 | + <DataTemplate DataType="m:Notification"> |
| 112 | + <Border Margin="6" HorizontalAlignment="Stretch" VerticalAlignment="Top" Effect="drop-shadow(0 0 12 #A0000000)"> |
| 113 | + <Border Padding="8" CornerRadius="6" Background="{DynamicResource Brush.Popup}"> |
| 114 | + <Grid RowDefinitions="26,Auto"> |
| 115 | + <Grid Grid.Row="0" ColumnDefinitions="Auto,*,Auto" Margin="8,0"> |
| 116 | + <Path Grid.Column="0" Width="14" Height="14" Data="{StaticResource Icons.Error}" Fill="Red" IsVisible="{Binding IsError}"/> |
| 117 | + <Path Grid.Column="0" Width="14" Height="14" Data="{StaticResource Icons.Info}" Fill="Green" IsVisible="{Binding !IsError}"/> |
| 118 | + <TextBlock Grid.Column="1" Margin="8,0,0,0" FontWeight="Bold" FontSize="14" Text="{DynamicResource Text.Launcher.Error}" IsVisible="{Binding IsError}"/> |
| 119 | + <TextBlock Grid.Column="1" Margin="8,0,0,0" FontWeight="Bold" FontSize="14" Text="{DynamicResource Text.Launcher.Info}" IsVisible="{Binding !IsError}"/> |
| 120 | + <Button Grid.Column="2" Classes="icon_button" Width="16" Height="16" Click="OnDismissNotification"> |
| 121 | + <Path Width="10" Height="10" Data="{StaticResource Icons.Window.Close}"/> |
| 122 | + </Button> |
| 123 | + </Grid> |
118 | 124 |
|
119 |
| - <StackPanel Grid.Row="2" Margin="0,4,0,0" Orientation="Horizontal" HorizontalAlignment="Right"> |
120 |
| - <Button Classes="flat" |
121 |
| - Margin="0,0,8,0" |
122 |
| - Command="{Binding CopyMessage}" |
123 |
| - Content="{DynamicResource Text.CopyMessage}" |
124 |
| - IsVisible="{Binding IsError}"/> |
125 |
| - |
126 |
| - <Button Classes="flat primary" |
127 |
| - Margin="0,0" |
128 |
| - Content="{DynamicResource Text.Close}" |
129 |
| - Click="OnDismissNotification"/> |
130 |
| - </StackPanel> |
131 |
| - </Grid> |
| 125 | + <ScrollViewer Grid.Row="1" Margin="8" MaxHeight="100" HorizontalScrollBarVisibility="Disabled" VerticalScrollBarVisibility="Auto"> |
| 126 | + <SelectableTextBlock TextWrapping="Wrap" Text="{Binding Message}"/> |
| 127 | + </ScrollViewer> |
| 128 | + </Grid> |
| 129 | + </Border> |
132 | 130 | </Border>
|
133 |
| - </Border> |
134 |
| - </DataTemplate> |
135 |
| - </ItemsControl.ItemTemplate> |
136 |
| - </ItemsControl> |
137 |
| - </ScrollViewer> |
| 131 | + </DataTemplate> |
| 132 | + </ItemsControl.ItemTemplate> |
| 133 | + </ItemsControl> |
| 134 | + </ScrollViewer> |
| 135 | + </Grid> |
138 | 136 | </Grid>
|
139 | 137 | </Grid>
|
140 | 138 | </UserControl>
|
0 commit comments