UWP folder cleanup and improvements
@@ -1,7 +0,0 @@
|
|||||||
<Application
|
|
||||||
x:Class="GUTSchedule.UWP.App"
|
|
||||||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
|
||||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
|
||||||
xmlns:local="using:GUTSchedule.UWP">
|
|
||||||
|
|
||||||
</Application>
|
|
||||||
@@ -1,17 +0,0 @@
|
|||||||
using Windows.UI.Xaml.Controls;
|
|
||||||
|
|
||||||
// The Blank Page item template is documented at https://go.microsoft.com/fwlink/?LinkId=402352&clcid=0x409
|
|
||||||
|
|
||||||
namespace GUTSchedule.UWP
|
|
||||||
{
|
|
||||||
/// <summary>
|
|
||||||
/// An empty page that can be used on its own or navigated to within a Frame.
|
|
||||||
/// </summary>
|
|
||||||
public sealed partial class MainPage : Page
|
|
||||||
{
|
|
||||||
public MainPage()
|
|
||||||
{
|
|
||||||
InitializeComponent();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,5 +1,5 @@
|
|||||||
<Page
|
<Page
|
||||||
x:Class="GUTSchedule.UWP.MainPage"
|
x:Class="GUTSchedule.UWP.AboutPage"
|
||||||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||||
xmlns:local="using:GUTSchedule.UWP"
|
xmlns:local="using:GUTSchedule.UWP"
|
||||||
@@ -8,6 +8,14 @@
|
|||||||
mc:Ignorable="d"
|
mc:Ignorable="d"
|
||||||
Background="{ThemeResource ApplicationPageBackgroundThemeBrush}">
|
Background="{ThemeResource ApplicationPageBackgroundThemeBrush}">
|
||||||
|
|
||||||
|
<Page.TopAppBar>
|
||||||
|
<CommandBar ClosedDisplayMode="Compact" Background="{StaticResource SystemAccentColor}" RequestedTheme="Dark">
|
||||||
|
<CommandBar.Content>
|
||||||
|
<TextBlock Text="About application" Style="{StaticResource TitleTextBlockStyle}" Margin="10,6"/>
|
||||||
|
</CommandBar.Content>
|
||||||
|
</CommandBar>
|
||||||
|
</Page.TopAppBar>
|
||||||
|
|
||||||
<Grid>
|
<Grid>
|
||||||
|
|
||||||
</Grid>
|
</Grid>
|
||||||
@@ -0,0 +1,30 @@
|
|||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.IO;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Runtime.InteropServices.WindowsRuntime;
|
||||||
|
using Windows.Foundation;
|
||||||
|
using Windows.Foundation.Collections;
|
||||||
|
using Windows.UI.Xaml;
|
||||||
|
using Windows.UI.Xaml.Controls;
|
||||||
|
using Windows.UI.Xaml.Controls.Primitives;
|
||||||
|
using Windows.UI.Xaml.Data;
|
||||||
|
using Windows.UI.Xaml.Input;
|
||||||
|
using Windows.UI.Xaml.Media;
|
||||||
|
using Windows.UI.Xaml.Navigation;
|
||||||
|
|
||||||
|
// The Blank Page item template is documented at https://go.microsoft.com/fwlink/?LinkId=234238
|
||||||
|
|
||||||
|
namespace GUTSchedule.UWP
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// An empty page that can be used on its own or navigated to within a Frame.
|
||||||
|
/// </summary>
|
||||||
|
public sealed partial class AboutPage : Page
|
||||||
|
{
|
||||||
|
public AboutPage()
|
||||||
|
{
|
||||||
|
this.InitializeComponent();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,23 @@
|
|||||||
|
<Application
|
||||||
|
x:Class="GUTSchedule.UWP.App"
|
||||||
|
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||||
|
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
|
||||||
|
|
||||||
|
<Application.Resources>
|
||||||
|
<Style TargetType="Button">
|
||||||
|
<Setter Property="HorizontalAlignment" Value="Stretch"/>
|
||||||
|
<Setter Property="Margin" Value="2"/>
|
||||||
|
</Style>
|
||||||
|
<Style TargetType="ComboBox">
|
||||||
|
<Setter Property="HorizontalAlignment" Value="Stretch"/>
|
||||||
|
</Style>
|
||||||
|
<Style TargetType="TextBlock">
|
||||||
|
<Setter Property="TextWrapping" Value="WrapWholeWords"/>
|
||||||
|
</Style>
|
||||||
|
<Style TargetType="CalendarDatePicker">
|
||||||
|
<Setter Property="HorizontalAlignment" Value="Stretch"/>
|
||||||
|
<Setter Property="Margin" Value="2"/>
|
||||||
|
</Style>
|
||||||
|
<Color x:Key="SystemAccentColor">#ff8000</Color>
|
||||||
|
</Application.Resources>
|
||||||
|
</Application>
|
||||||
@@ -1,6 +1,7 @@
|
|||||||
using System;
|
using System;
|
||||||
using Windows.ApplicationModel;
|
using Windows.ApplicationModel;
|
||||||
using Windows.ApplicationModel.Activation;
|
using Windows.ApplicationModel.Activation;
|
||||||
|
using Windows.UI.Popups;
|
||||||
using Windows.UI.Xaml;
|
using Windows.UI.Xaml;
|
||||||
using Windows.UI.Xaml.Controls;
|
using Windows.UI.Xaml.Controls;
|
||||||
using Windows.UI.Xaml.Navigation;
|
using Windows.UI.Xaml.Navigation;
|
||||||
@@ -20,6 +21,14 @@ namespace GUTSchedule.UWP
|
|||||||
{
|
{
|
||||||
InitializeComponent();
|
InitializeComponent();
|
||||||
Suspending += OnSuspending;
|
Suspending += OnSuspending;
|
||||||
|
UnhandledException += OnError;
|
||||||
|
}
|
||||||
|
|
||||||
|
private async void OnError(object sender, UnhandledExceptionEventArgs e)
|
||||||
|
{
|
||||||
|
e.Handled = true;
|
||||||
|
|
||||||
|
await new MessageDialog(e.Message, e.GetType().ToString()).ShowAsync();
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
Before Width: | Height: | Size: 1.4 KiB After Width: | Height: | Size: 1.4 KiB |
|
Before Width: | Height: | Size: 7.5 KiB After Width: | Height: | Size: 7.5 KiB |
|
Before Width: | Height: | Size: 2.9 KiB After Width: | Height: | Size: 2.9 KiB |
|
Before Width: | Height: | Size: 1.6 KiB After Width: | Height: | Size: 1.6 KiB |
|
Before Width: | Height: | Size: 1.2 KiB After Width: | Height: | Size: 1.2 KiB |
|
Before Width: | Height: | Size: 1.4 KiB After Width: | Height: | Size: 1.4 KiB |
|
Before Width: | Height: | Size: 3.1 KiB After Width: | Height: | Size: 3.1 KiB |
@@ -0,0 +1,17 @@
|
|||||||
|
using GUTSchedule.Models;
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
|
namespace GUTSchedule.UWP
|
||||||
|
{
|
||||||
|
public static class Calendar
|
||||||
|
{
|
||||||
|
public static void Export(List<Occupation> schedule)
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -116,9 +116,13 @@
|
|||||||
<RestoreProjectStyle>PackageReference</RestoreProjectStyle>
|
<RestoreProjectStyle>PackageReference</RestoreProjectStyle>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
|
<Compile Include="AboutPage.xaml.cs">
|
||||||
|
<DependentUpon>AboutPage.xaml</DependentUpon>
|
||||||
|
</Compile>
|
||||||
<Compile Include="App.xaml.cs">
|
<Compile Include="App.xaml.cs">
|
||||||
<DependentUpon>App.xaml</DependentUpon>
|
<DependentUpon>App.xaml</DependentUpon>
|
||||||
</Compile>
|
</Compile>
|
||||||
|
<Compile Include="Calendar.cs" />
|
||||||
<Compile Include="MainPage.xaml.cs">
|
<Compile Include="MainPage.xaml.cs">
|
||||||
<DependentUpon>MainPage.xaml</DependentUpon>
|
<DependentUpon>MainPage.xaml</DependentUpon>
|
||||||
</Compile>
|
</Compile>
|
||||||
@@ -144,6 +148,10 @@
|
|||||||
<Generator>MSBuild:Compile</Generator>
|
<Generator>MSBuild:Compile</Generator>
|
||||||
<SubType>Designer</SubType>
|
<SubType>Designer</SubType>
|
||||||
</ApplicationDefinition>
|
</ApplicationDefinition>
|
||||||
|
<Page Include="AboutPage.xaml">
|
||||||
|
<SubType>Designer</SubType>
|
||||||
|
<Generator>MSBuild:Compile</Generator>
|
||||||
|
</Page>
|
||||||
<Page Include="MainPage.xaml">
|
<Page Include="MainPage.xaml">
|
||||||
<Generator>MSBuild:Compile</Generator>
|
<Generator>MSBuild:Compile</Generator>
|
||||||
<SubType>Designer</SubType>
|
<SubType>Designer</SubType>
|
||||||
@@ -0,0 +1,125 @@
|
|||||||
|
<Page
|
||||||
|
x:Class="GUTSchedule.UWP.MainPage"
|
||||||
|
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||||
|
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||||
|
xmlns:local="using:GUTSchedule.UWP"
|
||||||
|
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||||
|
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||||
|
mc:Ignorable="d">
|
||||||
|
|
||||||
|
<Page.Background>
|
||||||
|
<ImageBrush ImageSource="https://cabs.itut.ru/cabinet/ini/general/0/cabinet/img/bg_n.jpg" Stretch="UniformToFill"/>
|
||||||
|
</Page.Background>
|
||||||
|
|
||||||
|
<VisualStateManager.VisualStateGroups>
|
||||||
|
<VisualStateGroup>
|
||||||
|
<VisualState>
|
||||||
|
<VisualState.StateTriggers>
|
||||||
|
<AdaptiveTrigger MinWindowWidth="400"/>
|
||||||
|
</VisualState.StateTriggers>
|
||||||
|
<VisualState.Setters>
|
||||||
|
<Setter Target="emptyColumn.Width" Value="*"/>
|
||||||
|
</VisualState.Setters>
|
||||||
|
</VisualState>
|
||||||
|
</VisualStateGroup>
|
||||||
|
</VisualStateManager.VisualStateGroups>
|
||||||
|
|
||||||
|
<Page.TopAppBar>
|
||||||
|
<CommandBar ClosedDisplayMode="Compact" Background="{StaticResource SystemAccentColor}" RequestedTheme="Dark">
|
||||||
|
<CommandBar.Content>
|
||||||
|
<TextBlock Text="GUT.Schedule" Style="{StaticResource TitleTextBlockStyle}" Margin="10,6"/>
|
||||||
|
</CommandBar.Content>
|
||||||
|
<CommandBar.SecondaryCommands>
|
||||||
|
<AppBarButton Icon="Delete" Label="Clear schedule" Tag="clear" Click="AppBarButton_Click"/>
|
||||||
|
<AppBarButton Label="Report error" Tag="report" Click="AppBarButton_Click">
|
||||||
|
<AppBarButton.Icon>
|
||||||
|
<FontIcon Glyph=""/>
|
||||||
|
</AppBarButton.Icon>
|
||||||
|
</AppBarButton>
|
||||||
|
<AppBarButton Label="About application" Tag="about" Click="AppBarButton_Click">
|
||||||
|
<AppBarButton.Icon>
|
||||||
|
<FontIcon Glyph=""/>
|
||||||
|
</AppBarButton.Icon>
|
||||||
|
</AppBarButton>
|
||||||
|
</CommandBar.SecondaryCommands>
|
||||||
|
</CommandBar>
|
||||||
|
</Page.TopAppBar>
|
||||||
|
|
||||||
|
<Grid>
|
||||||
|
<ScrollViewer>
|
||||||
|
<Grid>
|
||||||
|
<Grid.ColumnDefinitions>
|
||||||
|
<ColumnDefinition/>
|
||||||
|
<ColumnDefinition x:Name="emptyColumn" Width="0"/>
|
||||||
|
</Grid.ColumnDefinitions>
|
||||||
|
<StackPanel Padding="10" Background="{ThemeResource ApplicationPageBackgroundThemeBrush}">
|
||||||
|
<TextBlock Style="{StaticResource SubtitleTextBlockStyle}" Text="Schedule parameters"/>
|
||||||
|
|
||||||
|
<CheckBox Content="Authorize via personal cabinet" Checked="ChangeAuthorizationMethod" IsChecked="True" x:Name="authorize"/>
|
||||||
|
<StackPanel x:Name="credentialMethod">
|
||||||
|
<TextBox PlaceholderText="E-mail" x:Name="email"/>
|
||||||
|
<PasswordBox PlaceholderText="Password" x:Name="password"/>
|
||||||
|
<CheckBox Content="Remember" x:Name="rememberCredential" IsChecked="True"/>
|
||||||
|
</StackPanel>
|
||||||
|
<StackPanel x:Name="defaultMethod" Visibility="Collapsed">
|
||||||
|
<ComboBox x:Name="faculty" PlaceholderText="No schedule is available" Header="Course" SelectionChanged="Faculty_SelectionChanged"/>
|
||||||
|
<ComboBox x:Name="course" SelectedIndex="0" Header="Course" SelectionChanged="Course_SelectionChanged">
|
||||||
|
<ComboBoxItem Content="1"/>
|
||||||
|
<ComboBoxItem Content="2"/>
|
||||||
|
<ComboBoxItem Content="3"/>
|
||||||
|
<ComboBoxItem Content="4"/>
|
||||||
|
</ComboBox>
|
||||||
|
<ComboBox x:Name="group" PlaceholderText="No schedule is available" Header="Group"/>
|
||||||
|
</StackPanel>
|
||||||
|
|
||||||
|
<TextBlock Style="{StaticResource SubtitleTextBlockStyle}" Text="Export parameters"/>
|
||||||
|
|
||||||
|
<Grid>
|
||||||
|
<Grid.ColumnDefinitions>
|
||||||
|
<ColumnDefinition/>
|
||||||
|
<ColumnDefinition/>
|
||||||
|
</Grid.ColumnDefinitions>
|
||||||
|
<Grid.RowDefinitions>
|
||||||
|
<RowDefinition Height="Auto"/>
|
||||||
|
<RowDefinition Height="Auto"/>
|
||||||
|
</Grid.RowDefinitions>
|
||||||
|
|
||||||
|
<CalendarDatePicker Header="Export from" x:Name="startDate"/>
|
||||||
|
<CalendarDatePicker Grid.Row="1" Header="Export to" VerticalAlignment="Top" x:Name="endDate"/>
|
||||||
|
|
||||||
|
<Button Content="Today" Grid.Column="1" VerticalAlignment="Bottom" Click="SetTodayDate" />
|
||||||
|
<StackPanel Grid.Column="1" Grid.Row="1" Margin="0,28,0,0">
|
||||||
|
<Button Content="For day" Click="SetEndDate" Tag="0"/>
|
||||||
|
<Button Content="For week" Click="SetEndDate" Tag="6"/>
|
||||||
|
<Button Content="For month" Click="SetEndDate" Tag="30"/>
|
||||||
|
<Button Content="For semester" Click="SetForSemester"/>
|
||||||
|
</StackPanel>
|
||||||
|
</Grid>
|
||||||
|
|
||||||
|
<ComboBox Header="Set reminder for:" x:Name="reminder" SelectedIndex="0">
|
||||||
|
<ComboBoxItem Content="None"/>
|
||||||
|
<ComboBoxItem Content="None"/>
|
||||||
|
<ComboBoxItem Content="None"/>
|
||||||
|
</ComboBox>
|
||||||
|
|
||||||
|
<CheckBox Content="Add group number to event title" x:Name="addGroupToTitle"/>
|
||||||
|
|
||||||
|
<ComboBox Header="Destination calendar" x:Name="calendar" SelectedIndex="0" PlaceholderText="No calendar is available"/>
|
||||||
|
|
||||||
|
<TextBlock Foreground="Red" Visibility="Collapsed" Text="Error" x:Name="errorPlaceholder"/>
|
||||||
|
<Button Content="Add schedule" Background="{StaticResource SystemAccentColor}" RequestedTheme="Dark" FontWeight="Bold" Margin="0,10" Click="Export"/>
|
||||||
|
|
||||||
|
<TextBlock Style="{StaticResource CaptionTextBlockStyle}" Text="©2020 Michael Gordeev, INS, ICT-907"/>
|
||||||
|
<TextBlock Style="{StaticResource CaptionTextBlockStyle}" Text="v$(Build.BuildNumber) (ci-id #$(Build.BuildId))"/>
|
||||||
|
</StackPanel>
|
||||||
|
</Grid>
|
||||||
|
</ScrollViewer>
|
||||||
|
|
||||||
|
<Grid Background="{StaticResource SystemAccentColor}" x:Name="loading" Visibility="Collapsed">
|
||||||
|
<StackPanel VerticalAlignment="Center">
|
||||||
|
<ProgressRing Width="100" Height="100" Foreground="White" IsActive="True" HorizontalAlignment="Center"/>
|
||||||
|
<TextBlock Style="{StaticResource TitleTextBlockStyle}" x:Name="status" Text="Processing..." HorizontalAlignment="Center" Foreground="White"/>
|
||||||
|
</StackPanel>
|
||||||
|
</Grid>
|
||||||
|
</Grid>
|
||||||
|
</Page>
|
||||||
@@ -0,0 +1,219 @@
|
|||||||
|
using GUTSchedule.Models;
|
||||||
|
using System;
|
||||||
|
using Windows.Security.Credentials;
|
||||||
|
using Windows.System;
|
||||||
|
using Windows.UI.Xaml;
|
||||||
|
using Windows.UI.Xaml.Controls;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Net.Http;
|
||||||
|
using Windows.UI.Popups;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
using Windows.ApplicationModel.Resources;
|
||||||
|
using Windows.Storage;
|
||||||
|
|
||||||
|
// The Blank Page item template is documented at https://go.microsoft.com/fwlink/?LinkId=402352&clcid=0x409
|
||||||
|
|
||||||
|
namespace GUTSchedule.UWP
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// An empty page that can be used on its own or navigated to within a Frame.
|
||||||
|
/// </summary>
|
||||||
|
public sealed partial class MainPage : Page
|
||||||
|
{
|
||||||
|
private readonly PasswordVault vault = new PasswordVault();
|
||||||
|
private readonly ResourceLoader resources = ResourceLoader.GetForCurrentView();
|
||||||
|
static readonly ApplicationDataContainer settings = ApplicationData.Current.LocalSettings;
|
||||||
|
|
||||||
|
public static List<(string id, string name)> Faculties { get; set; }
|
||||||
|
|
||||||
|
public MainPage()
|
||||||
|
{
|
||||||
|
InitializeComponent();
|
||||||
|
startDate.Date = DateTime.Today;
|
||||||
|
endDate.Date = startDate.Date.Value.AddDays(6);
|
||||||
|
|
||||||
|
if (vault.FindAllByResource("xfox111.gutschedule") is IReadOnlyList<PasswordCredential> credentials && credentials.Count > 0)
|
||||||
|
{
|
||||||
|
email.Text = credentials.First().UserName;
|
||||||
|
credentials.First().RetrievePassword();
|
||||||
|
password.Password = credentials.First().Password;
|
||||||
|
}
|
||||||
|
|
||||||
|
authorize.IsChecked = (bool?)settings.Values["Authorize"] ?? true;
|
||||||
|
rememberCredential.IsChecked = (bool?)settings.Values["RememberCredential"] ?? true;
|
||||||
|
reminder.SelectedIndex = (int?)settings.Values["Reminder"] ?? 1;
|
||||||
|
addGroupToTitle.IsChecked = (bool?)settings.Values["AddGroupToTitle"] ?? false;
|
||||||
|
|
||||||
|
faculty.ItemsSource = Faculties.Select(i => new ComboBoxItem
|
||||||
|
{
|
||||||
|
Content = i.name,
|
||||||
|
Tag = i.id
|
||||||
|
});
|
||||||
|
faculty.SelectedIndex = (int?)settings.Values["Faculty"] ?? 0;
|
||||||
|
course.SelectedIndex = (int?)settings.Values["Course"] ?? 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
private async void AppBarButton_Click(object sender, RoutedEventArgs e)
|
||||||
|
{
|
||||||
|
switch (((FrameworkElement)sender).Tag)
|
||||||
|
{
|
||||||
|
case "clear":
|
||||||
|
break;
|
||||||
|
case "about":
|
||||||
|
Frame.Navigate(typeof(AboutPage));
|
||||||
|
break;
|
||||||
|
case "report":
|
||||||
|
await Launcher.LaunchUriAsync(new Uri("mailto:feedback@xfox111.net"));
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void ChangeAuthorizationMethod(object sender, RoutedEventArgs e)
|
||||||
|
{
|
||||||
|
if (authorize.IsChecked.Value)
|
||||||
|
{
|
||||||
|
credentialMethod.Visibility = Visibility.Visible;
|
||||||
|
credentialMethod.Visibility = Visibility.Collapsed;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
credentialMethod.Visibility = Visibility.Collapsed;
|
||||||
|
credentialMethod.Visibility = Visibility.Visible;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void SetTodayDate(object sender, RoutedEventArgs e) =>
|
||||||
|
startDate.Date = DateTime.Today;
|
||||||
|
|
||||||
|
private void SetEndDate(object sender, RoutedEventArgs e) =>
|
||||||
|
endDate.Date = startDate.Date.Value.AddDays((int)((FrameworkElement)sender).Tag);
|
||||||
|
|
||||||
|
private void SetForSemester(object sender, RoutedEventArgs e)
|
||||||
|
{
|
||||||
|
if (DateTime.Today.Month == 1)
|
||||||
|
endDate.Date = new DateTime(DateTime.Today.Year, 1, 31);
|
||||||
|
else if (DateTime.Today.Month > 8)
|
||||||
|
endDate.Date = new DateTime(DateTime.Today.Year + 1, 1, 31);
|
||||||
|
else
|
||||||
|
endDate.Date = new DateTime(DateTime.Today.Year, 8, 31);
|
||||||
|
}
|
||||||
|
|
||||||
|
private async void Export(object sender, RoutedEventArgs args)
|
||||||
|
{
|
||||||
|
errorPlaceholder.Visibility = Visibility.Collapsed;
|
||||||
|
|
||||||
|
if (startDate.Date > endDate.Date)
|
||||||
|
{
|
||||||
|
errorPlaceholder.Text = resources.GetString("invalidDateRangeError");
|
||||||
|
errorPlaceholder.Visibility = Visibility.Visible;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
ExportParameters exportParameters;
|
||||||
|
|
||||||
|
if (authorize.IsChecked.Value)
|
||||||
|
{
|
||||||
|
if (string.IsNullOrWhiteSpace(email.Text) || string.IsNullOrWhiteSpace(password.Password))
|
||||||
|
{
|
||||||
|
errorPlaceholder.Text = resources.GetString("invalidAuthorizationError");
|
||||||
|
errorPlaceholder.Visibility = Visibility.Visible;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
exportParameters = new CabinetExportParameters
|
||||||
|
{
|
||||||
|
Email = email.Text,
|
||||||
|
Password = password.Password,
|
||||||
|
EndDate = endDate.Date.Value.DateTime,
|
||||||
|
StartDate = startDate.Date.Value.DateTime
|
||||||
|
};
|
||||||
|
|
||||||
|
if (rememberCredential.IsChecked.Value)
|
||||||
|
vault.Add(new PasswordCredential("xfox111.gutschedule", email.Text, password.Password));
|
||||||
|
else
|
||||||
|
foreach (PasswordCredential credential in vault.FindAllByResource("xfox111.gutschedule"))
|
||||||
|
vault.Remove(credential);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
if (group.Items.Count < 1)
|
||||||
|
{
|
||||||
|
errorPlaceholder.Text = resources.GetString("groupSelectionError");
|
||||||
|
errorPlaceholder.Visibility = Visibility.Visible;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
exportParameters = new DefaultExportParameters
|
||||||
|
{
|
||||||
|
EndDate = endDate.Date.Value.DateTime,
|
||||||
|
StartDate = startDate.Date.Value.DateTime,
|
||||||
|
Course = (course.SelectedIndex + 1).ToString(),
|
||||||
|
FacultyId = ((ComboBoxItem)faculty.SelectedItem).Tag as string,
|
||||||
|
GroupId = ((ComboBoxItem)group.SelectedItem).Tag as string
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
AddGroupToTitle = addGroupToTitle.IsChecked;
|
||||||
|
SelectedCalendarIndex = calendar.SelectedItemPosition;
|
||||||
|
Reminder = (reminder.SelectedIndex - 1) * 5;
|
||||||
|
|
||||||
|
loading.Visibility = Visibility.Visible;
|
||||||
|
try
|
||||||
|
{
|
||||||
|
status.Text = resources.GetString("loadingStatus");
|
||||||
|
|
||||||
|
List<Occupation> schedule = await Parser.GetSchedule(exportParameters);
|
||||||
|
|
||||||
|
status.Text = resources.GetString("calendarExportStatus");
|
||||||
|
Calendar.Export(schedule);
|
||||||
|
|
||||||
|
status.Text = resources.GetString("doneStatus");
|
||||||
|
await Task.Delay(1000);
|
||||||
|
}
|
||||||
|
catch (HttpRequestException e)
|
||||||
|
{
|
||||||
|
MessageDialog dialog = new MessageDialog(resources.GetString("connectionFailMessage"), e.Message);
|
||||||
|
dialog.Commands.Add(new UICommand(resources.GetString("repeat"), (command) => Export(sender, args)));
|
||||||
|
dialog.Commands.Add(new UICommand("OK", (command) => loading.Visibility = Visibility.Collapsed));
|
||||||
|
|
||||||
|
dialog.CancelCommandIndex = 1;
|
||||||
|
dialog.DefaultCommandIndex = 0;
|
||||||
|
|
||||||
|
await dialog.ShowAsync();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
catch (Exception e)
|
||||||
|
{
|
||||||
|
MessageDialog dialog = new MessageDialog(e.Message, e.GetType().ToString());
|
||||||
|
dialog.Commands.Add(new UICommand("OK", (command) => loading.Visibility = Visibility.Collapsed));
|
||||||
|
|
||||||
|
await dialog.ShowAsync();
|
||||||
|
}
|
||||||
|
|
||||||
|
loading.Visibility = Visibility.Collapsed;
|
||||||
|
}
|
||||||
|
|
||||||
|
private void Faculty_SelectionChanged(object sender, SelectionChangedEventArgs e)
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
private void Course_SelectionChanged(object sender, SelectionChangedEventArgs e)
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
private async void UpdateGroupsList()
|
||||||
|
{
|
||||||
|
List<(string id, string name)> groups = await Parser.GetGroups(Faculties[faculty.SelectedIndex].id, (course.SelectedIndex + 1).ToString());
|
||||||
|
group.ItemsSource = groups.Select(i => new ComboBoxItem
|
||||||
|
{
|
||||||
|
Content = i.name,
|
||||||
|
Tag = i.id
|
||||||
|
});
|
||||||
|
|
||||||
|
group.SelectedIndex = (int?)settings.Values["Group"] ?? 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -15,7 +15,7 @@
|
|||||||
|
|
||||||
<Properties>
|
<Properties>
|
||||||
<DisplayName>GUT.Schedule.UWP</DisplayName>
|
<DisplayName>GUT.Schedule.UWP</DisplayName>
|
||||||
<PublisherDisplayName>Michael Gordeev</PublisherDisplayName>
|
<PublisherDisplayName>Michael "XFox" Gordeev</PublisherDisplayName>
|
||||||
<Logo>Assets\StoreLogo.png</Logo>
|
<Logo>Assets\StoreLogo.png</Logo>
|
||||||
</Properties>
|
</Properties>
|
||||||
|
|
||||||
@@ -32,10 +32,10 @@
|
|||||||
Executable="$targetnametoken$.exe"
|
Executable="$targetnametoken$.exe"
|
||||||
EntryPoint="GUT.Schedule.UWP.App">
|
EntryPoint="GUT.Schedule.UWP.App">
|
||||||
<uap:VisualElements
|
<uap:VisualElements
|
||||||
DisplayName="GUT.Schedule.UWP"
|
DisplayName="GUT.Schedule"
|
||||||
Square150x150Logo="Assets\Square150x150Logo.png"
|
Square150x150Logo="Assets\Square150x150Logo.png"
|
||||||
Square44x44Logo="Assets\Square44x44Logo.png"
|
Square44x44Logo="Assets\Square44x44Logo.png"
|
||||||
Description="GUT.Schedule.UWP"
|
Description="Application which exports SPbSUT timetable to calendar"
|
||||||
BackgroundColor="transparent">
|
BackgroundColor="transparent">
|
||||||
<uap:DefaultTile Wide310x150Logo="Assets\Wide310x150Logo.png"/>
|
<uap:DefaultTile Wide310x150Logo="Assets\Wide310x150Logo.png"/>
|
||||||
<uap:SplashScreen Image="Assets\SplashScreen.png" />
|
<uap:SplashScreen Image="Assets\SplashScreen.png" />
|
||||||
@@ -45,5 +45,6 @@
|
|||||||
|
|
||||||
<Capabilities>
|
<Capabilities>
|
||||||
<Capability Name="internetClient" />
|
<Capability Name="internetClient" />
|
||||||
|
<uap:Capability Name="appointments"/>
|
||||||
</Capabilities>
|
</Capabilities>
|
||||||
</Package>
|
</Package>
|
||||||
@@ -5,7 +5,7 @@ VisualStudioVersion = 16.0.29609.76
|
|||||||
MinimumVisualStudioVersion = 10.0.40219.1
|
MinimumVisualStudioVersion = 10.0.40219.1
|
||||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "GUTSchedule.Droid", "GUTSchedule.Droid\GUTSchedule.Droid.csproj", "{A0471165-37F5-4309-8A92-42F1A6589EEE}"
|
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "GUTSchedule.Droid", "GUTSchedule.Droid\GUTSchedule.Droid.csproj", "{A0471165-37F5-4309-8A92-42F1A6589EEE}"
|
||||||
EndProject
|
EndProject
|
||||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "GUTSchedule.UWP", "GUT.Schedule.UWP\GUTSchedule.UWP.csproj", "{AC7E8D95-1E2A-409C-9A95-477C2AC8E47F}"
|
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "GUTSchedule.UWP", "GUTSchedule.UWP\GUTSchedule.UWP.csproj", "{AC7E8D95-1E2A-409C-9A95-477C2AC8E47F}"
|
||||||
EndProject
|
EndProject
|
||||||
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "GUTSchedule", "GUTSchedule\GUTSchedule.csproj", "{A6F6DE35-0EB4-4D11-9FF9-F4601595B639}"
|
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "GUTSchedule", "GUTSchedule\GUTSchedule.csproj", "{A6F6DE35-0EB4-4D11-9FF9-F4601595B639}"
|
||||||
EndProject
|
EndProject
|
||||||
@@ -74,6 +74,8 @@ Global
|
|||||||
{A0471165-37F5-4309-8A92-42F1A6589EEE}.Release|x86.Build.0 = Release|Any CPU
|
{A0471165-37F5-4309-8A92-42F1A6589EEE}.Release|x86.Build.0 = Release|Any CPU
|
||||||
{A0471165-37F5-4309-8A92-42F1A6589EEE}.Release|x86.Deploy.0 = Release|Any CPU
|
{A0471165-37F5-4309-8A92-42F1A6589EEE}.Release|x86.Deploy.0 = Release|Any CPU
|
||||||
{AC7E8D95-1E2A-409C-9A95-477C2AC8E47F}.Debug|Any CPU.ActiveCfg = Debug|x86
|
{AC7E8D95-1E2A-409C-9A95-477C2AC8E47F}.Debug|Any CPU.ActiveCfg = Debug|x86
|
||||||
|
{AC7E8D95-1E2A-409C-9A95-477C2AC8E47F}.Debug|Any CPU.Build.0 = Debug|x86
|
||||||
|
{AC7E8D95-1E2A-409C-9A95-477C2AC8E47F}.Debug|Any CPU.Deploy.0 = Debug|x86
|
||||||
{AC7E8D95-1E2A-409C-9A95-477C2AC8E47F}.Debug|ARM.ActiveCfg = Debug|ARM
|
{AC7E8D95-1E2A-409C-9A95-477C2AC8E47F}.Debug|ARM.ActiveCfg = Debug|ARM
|
||||||
{AC7E8D95-1E2A-409C-9A95-477C2AC8E47F}.Debug|ARM.Build.0 = Debug|ARM
|
{AC7E8D95-1E2A-409C-9A95-477C2AC8E47F}.Debug|ARM.Build.0 = Debug|ARM
|
||||||
{AC7E8D95-1E2A-409C-9A95-477C2AC8E47F}.Debug|ARM.Deploy.0 = Debug|ARM
|
{AC7E8D95-1E2A-409C-9A95-477C2AC8E47F}.Debug|ARM.Deploy.0 = Debug|ARM
|
||||||