-
Notifications
You must be signed in to change notification settings - Fork 109
/
AddFeedView.xaml
193 lines (169 loc) · 8.53 KB
/
AddFeedView.xaml
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
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
<!--
// Copyright (c) Microsoft Corporation. All rights reserved.
//
// The MIT License (MIT)
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
// in the Software without restriction, including without limitation the rights
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
// copies of the Software, and to permit persons to whom the Software is
// furnished to do so, subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included in
// all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
// THE SOFTWARE.
-->
<Page x:Class="RssReader.Views.AddFeedView"
NavigationCacheMode="Required"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:local="using:RssReader.Views"
xmlns:common="using:RssReader.Common"
xmlns:controls="using:RssReader.Controls"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:MUXC="using:Microsoft.UI.Xaml.Controls"
mc:Ignorable="d">
<Page.Resources>
<common:BooleanToVisibilityConverter x:Key="BooleanToVisibilityConverter" />
</Page.Resources>
<Grid Background="{ThemeResource Background100CloudBrush}">
<Grid.RowDefinitions>
<RowDefinition Height="Auto" />
<RowDefinition Height="Auto" />
<RowDefinition Height="Auto" />
<RowDefinition Height="Auto" />
</Grid.RowDefinitions>
<controls:PageHeader>
<controls:PageHeader.HeaderContent>
<TextBlock Text="Add a feed"
Foreground="{ThemeResource Foreground100CrimsonBrush}"
Style="{ThemeResource SubtitleTextBlockStyle}" />
</controls:PageHeader.HeaderContent>
</controls:PageHeader>
<Rectangle Grid.Row="1"
Margin="24,0"
Height="1"
HorizontalAlignment="Stretch"
Fill="{ThemeResource Border100PaleRoseBrush}" />
<TextBlock x:Name="AddRSSHelp"
Grid.Row="2"
Margin="24,24,24,0"
Text="Enter or paste the URL to a publication's RSS Feed below to add it to your list."
TextWrapping="Wrap"
VerticalAlignment="Top"
Foreground="{ThemeResource Foreground100DimGrayBrush}"
Style="{StaticResource CaptionTextBlockStyle}" />
<Grid Grid.Row="3">
<Grid.RowDefinitions>
<RowDefinition Height="Auto" />
<RowDefinition Height="Auto" />
<RowDefinition Height="Auto" />
<RowDefinition Height="Auto" />
<RowDefinition Height="Auto" />
</Grid.RowDefinitions>
<TextBox x:Name="LinkTextBox"
Grid.Row="0"
Margin="24,24,24,12"
Text="{x:Bind ViewModel.CurrentFeed.LinkAsString, Mode=TwoWay}"
PlaceholderText="RSS feed URL"
Header="RSS feed URL"
KeyDown="LinkTextBox_KeyDown"
Style="{StaticResource TextBoxStyle1}" />
<!--Waiting for response message-->
<MUXC:ProgressBar Grid.Row="1"
Margin="24, 0"
IsIndeterminate="True"
Visibility="{x:Bind ViewModel.CurrentFeed.IsLoading, Mode=OneWay, Converter={StaticResource BooleanToVisibilityConverter}}"
Style="{ThemeResource ProgressBarStyle1}" />
<!--Error message-->
<Grid Grid.Row="1"
Margin="24, 0"
Visibility="{x:Bind ViewModel.CurrentFeed.IsInError, Mode=OneWay, Converter={StaticResource BooleanToVisibilityConverter}}">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="20" />
<ColumnDefinition Width="Auto" />
</Grid.ColumnDefinitions>
<FontIcon Margin="0,0,5,0"
Glyph=""
Foreground="{ThemeResource Foreground100AmberBrush}"
FontSize="15"
FontFamily="{ThemeResource SymbolThemeFontFamily}" />
<TextBlock Grid.Column="1"
Text="{x:Bind ViewModel.CurrentFeed.ErrorMessage, Mode=OneWay}"
Foreground="{ThemeResource Foreground100DimGrayBrush}"
Style="{ThemeResource CaptionTextBlockStyle}" />
</Grid>
<TextBox x:Name="NameTextBox"
Grid.Row="2"
Margin="24,18,24,12"
PlaceholderText="RSS feed name"
Header="RSS feed name"
Text="{x:Bind ViewModel.CurrentFeed.Name, Mode=TwoWay}"
IsEnabled="{x:Bind AreFeedControlsEnabled, Mode=OneWay}"
KeyDown="NameTextBox_KeyDown"
Style="{StaticResource TextBoxStyle1}" />
<Grid Grid.Row="3"
Margin="24">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="7*" />
<ColumnDefinition Width="10*" />
</Grid.ColumnDefinitions>
<Button x:Name="SaveAndLeaveButton"
Grid.Column="0"
HorizontalAlignment="Stretch"
Margin="0,0,10,0"
Content="Save"
Click="SaveAndLeaveButton_Click"
IsEnabled="{x:Bind AreSaveButtonsEnabled, Mode=OneWay}"
Style="{StaticResource ButtonStyle2}" />
<Button x:Name="SaveAndStayButton"
Grid.Column="1"
HorizontalAlignment="Stretch"
Margin="10,0,0,0"
Content="Save & add another"
Click="SaveAndStayButton_Click"
IsEnabled="{x:Bind AreSaveButtonsEnabled, Mode=OneWay}"
Style="{StaticResource ButtonStyle2}" />
</Grid>
<!--Success message; disappears after five seconds.-->
<Grid Grid.Row="4"
Margin="24,6,24,0"
Visibility="{x:Bind ViewModel.IsFeedAddedMessageShowing, Mode=OneWay, Converter={StaticResource BooleanToVisibilityConverter}}">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="20" />
<ColumnDefinition />
</Grid.ColumnDefinitions>
<FontIcon Glyph=""
HorizontalAlignment="Left"
VerticalAlignment="Top"
Foreground="{ThemeResource Foreground100FieldGreenBrush}"
FontSize="15"
FontFamily="{ThemeResource SymbolThemeFontFamily}" />
<RichTextBlock Grid.Column="1"
Margin="0"
Height="Auto"
HorizontalAlignment="Left"
VerticalAlignment="Top"
TextWrapping="Wrap">
<Paragraph FontSize="13"
TextAlignment="Left">
<Run Text="{x:Bind ViewModel.NameOfFeedJustAdded, Mode=OneWay}"
Foreground="{ThemeResource Foreground100BlackBrush}"
FontWeight="SemiBold" />
<Run Text="was added to your list."
Foreground="{ThemeResource Foreground100DimGrayBrush}" />
</Paragraph>
</RichTextBlock>
</Grid>
</Grid>
</Grid>
</Page>