1
0
mirror of https://github.com/XFox111/GUTSchedule.git synced 2026-04-22 06:58:01 +03:00

UWP folder cleanup and improvements

This commit is contained in:
Michael Gordeev
2020-02-17 13:42:56 +03:00
parent 867e9b5393
commit 4363d25ff3
21 changed files with 447 additions and 29 deletions
@@ -0,0 +1,22 @@
<Page
x:Class="GUTSchedule.UWP.AboutPage"
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"
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>
</Page>
@@ -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();
}
}
}
+23
View File
@@ -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>
+99
View File
@@ -0,0 +1,99 @@
using System;
using Windows.ApplicationModel;
using Windows.ApplicationModel.Activation;
using Windows.UI.Popups;
using Windows.UI.Xaml;
using Windows.UI.Xaml.Controls;
using Windows.UI.Xaml.Navigation;
namespace GUTSchedule.UWP
{
/// <summary>
/// Provides application-specific behavior to supplement the default Application class.
/// </summary>
sealed partial class App : Application
{
/// <summary>
/// Initializes the singleton application object. This is the first line of authored code
/// executed, and as such is the logical equivalent of main() or WinMain().
/// </summary>
public App()
{
InitializeComponent();
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>
/// Invoked when the application is launched normally by the end user. Other entry points
/// will be used such as when the application is launched to open a specific file.
/// </summary>
/// <param name="e">Details about the launch request and process.</param>
protected override void OnLaunched(LaunchActivatedEventArgs e)
{
Frame rootFrame = Window.Current.Content as Frame;
// Do not repeat app initialization when the Window already has content,
// just ensure that the window is active
if (rootFrame == null)
{
// Create a Frame to act as the navigation context and navigate to the first page
rootFrame = new Frame();
rootFrame.NavigationFailed += OnNavigationFailed;
if (e.PreviousExecutionState == ApplicationExecutionState.Terminated)
{
//TODO: Load state from previously suspended application
}
// Place the frame in the current Window
Window.Current.Content = rootFrame;
}
if (e.PrelaunchActivated == false)
{
if (rootFrame.Content == null)
{
// When the navigation stack isn't restored navigate to the first page,
// configuring the new page by passing required information as a navigation
// parameter
rootFrame.Navigate(typeof(MainPage), e.Arguments);
}
// Ensure the current window is active
Window.Current.Activate();
}
}
/// <summary>
/// Invoked when Navigation to a certain page fails
/// </summary>
/// <param name="sender">The Frame which failed navigation</param>
/// <param name="e">Details about the navigation failure</param>
void OnNavigationFailed(object sender, NavigationFailedEventArgs e)
{
throw new Exception("Failed to load Page " + e.SourcePageType.FullName);
}
/// <summary>
/// Invoked when application execution is being suspended. Application state is saved
/// without knowing whether the application will be terminated or resumed with the contents
/// of memory still intact.
/// </summary>
/// <param name="sender">The source of the suspend request.</param>
/// <param name="e">Details about the suspend request.</param>
private void OnSuspending(object sender, SuspendingEventArgs e)
{
var deferral = e.SuspendingOperation.GetDeferral();
//TODO: Save application state and stop any background activity
deferral.Complete();
}
}
}
Binary file not shown.

After

Width:  |  Height:  |  Size: 1.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 7.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.1 KiB

+17
View File
@@ -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)
{
}
}
}
@@ -0,0 +1,182 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="15.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">x86</Platform>
<ProjectGuid>{AC7E8D95-1E2A-409C-9A95-477C2AC8E47F}</ProjectGuid>
<OutputType>AppContainerExe</OutputType>
<AppDesignerFolder>Properties</AppDesignerFolder>
<RootNamespace>GUTSchedule.UWP</RootNamespace>
<AssemblyName>GUTSchedule.UWP</AssemblyName>
<DefaultLanguage>en-US</DefaultLanguage>
<TargetPlatformIdentifier>UAP</TargetPlatformIdentifier>
<TargetPlatformVersion Condition=" '$(TargetPlatformVersion)' == '' ">10.0.16299.0</TargetPlatformVersion>
<TargetPlatformMinVersion>10.0.10240.0</TargetPlatformMinVersion>
<MinimumVisualStudioVersion>14</MinimumVisualStudioVersion>
<FileAlignment>512</FileAlignment>
<ProjectTypeGuids>{A5A43C5B-DE2A-4C0C-9213-0A381AF9435A};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
<WindowsXamlEnableOverview>true</WindowsXamlEnableOverview>
<AppxPackageSigningEnabled>false</AppxPackageSigningEnabled>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Debug|x86'">
<DebugSymbols>true</DebugSymbols>
<OutputPath>bin\x86\Debug\</OutputPath>
<DefineConstants>DEBUG;TRACE;NETFX_CORE;WINDOWS_UWP</DefineConstants>
<NoWarn>;2008</NoWarn>
<DebugType>full</DebugType>
<PlatformTarget>x86</PlatformTarget>
<UseVSHostingProcess>false</UseVSHostingProcess>
<ErrorReport>prompt</ErrorReport>
<Prefer32Bit>true</Prefer32Bit>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Release|x86'">
<OutputPath>bin\x86\Release\</OutputPath>
<DefineConstants>TRACE;NETFX_CORE;WINDOWS_UWP</DefineConstants>
<Optimize>true</Optimize>
<NoWarn>;2008</NoWarn>
<DebugType>pdbonly</DebugType>
<PlatformTarget>x86</PlatformTarget>
<UseVSHostingProcess>false</UseVSHostingProcess>
<ErrorReport>prompt</ErrorReport>
<Prefer32Bit>true</Prefer32Bit>
<UseDotNetNativeToolchain>true</UseDotNetNativeToolchain>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Debug|ARM'">
<DebugSymbols>true</DebugSymbols>
<OutputPath>bin\ARM\Debug\</OutputPath>
<DefineConstants>DEBUG;TRACE;NETFX_CORE;WINDOWS_UWP</DefineConstants>
<NoWarn>;2008</NoWarn>
<DebugType>full</DebugType>
<PlatformTarget>ARM</PlatformTarget>
<UseVSHostingProcess>false</UseVSHostingProcess>
<ErrorReport>prompt</ErrorReport>
<Prefer32Bit>true</Prefer32Bit>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Release|ARM'">
<OutputPath>bin\ARM\Release\</OutputPath>
<DefineConstants>TRACE;NETFX_CORE;WINDOWS_UWP</DefineConstants>
<Optimize>true</Optimize>
<NoWarn>;2008</NoWarn>
<DebugType>pdbonly</DebugType>
<PlatformTarget>ARM</PlatformTarget>
<UseVSHostingProcess>false</UseVSHostingProcess>
<ErrorReport>prompt</ErrorReport>
<Prefer32Bit>true</Prefer32Bit>
<UseDotNetNativeToolchain>true</UseDotNetNativeToolchain>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Debug|ARM64'">
<DebugSymbols>true</DebugSymbols>
<OutputPath>bin\ARM64\Debug\</OutputPath>
<DefineConstants>DEBUG;TRACE;NETFX_CORE;WINDOWS_UWP</DefineConstants>
<NoWarn>;2008</NoWarn>
<DebugType>full</DebugType>
<PlatformTarget>ARM64</PlatformTarget>
<UseVSHostingProcess>false</UseVSHostingProcess>
<ErrorReport>prompt</ErrorReport>
<Prefer32Bit>true</Prefer32Bit>
<UseDotNetNativeToolchain>true</UseDotNetNativeToolchain>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Release|ARM64'">
<OutputPath>bin\ARM64\Release\</OutputPath>
<DefineConstants>TRACE;NETFX_CORE;WINDOWS_UWP</DefineConstants>
<Optimize>true</Optimize>
<NoWarn>;2008</NoWarn>
<DebugType>pdbonly</DebugType>
<PlatformTarget>ARM64</PlatformTarget>
<UseVSHostingProcess>false</UseVSHostingProcess>
<ErrorReport>prompt</ErrorReport>
<Prefer32Bit>true</Prefer32Bit>
<UseDotNetNativeToolchain>true</UseDotNetNativeToolchain>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Debug|x64'">
<DebugSymbols>true</DebugSymbols>
<OutputPath>bin\x64\Debug\</OutputPath>
<DefineConstants>DEBUG;TRACE;NETFX_CORE;WINDOWS_UWP</DefineConstants>
<NoWarn>;2008</NoWarn>
<DebugType>full</DebugType>
<PlatformTarget>x64</PlatformTarget>
<UseVSHostingProcess>false</UseVSHostingProcess>
<ErrorReport>prompt</ErrorReport>
<Prefer32Bit>true</Prefer32Bit>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Release|x64'">
<OutputPath>bin\x64\Release\</OutputPath>
<DefineConstants>TRACE;NETFX_CORE;WINDOWS_UWP</DefineConstants>
<Optimize>true</Optimize>
<NoWarn>;2008</NoWarn>
<DebugType>pdbonly</DebugType>
<PlatformTarget>x64</PlatformTarget>
<UseVSHostingProcess>false</UseVSHostingProcess>
<ErrorReport>prompt</ErrorReport>
<Prefer32Bit>true</Prefer32Bit>
<UseDotNetNativeToolchain>true</UseDotNetNativeToolchain>
</PropertyGroup>
<PropertyGroup>
<RestoreProjectStyle>PackageReference</RestoreProjectStyle>
</PropertyGroup>
<ItemGroup>
<Compile Include="AboutPage.xaml.cs">
<DependentUpon>AboutPage.xaml</DependentUpon>
</Compile>
<Compile Include="App.xaml.cs">
<DependentUpon>App.xaml</DependentUpon>
</Compile>
<Compile Include="Calendar.cs" />
<Compile Include="MainPage.xaml.cs">
<DependentUpon>MainPage.xaml</DependentUpon>
</Compile>
<Compile Include="Properties\AssemblyInfo.cs" />
</ItemGroup>
<ItemGroup>
<AppxManifest Include="Package.appxmanifest">
<SubType>Designer</SubType>
</AppxManifest>
</ItemGroup>
<ItemGroup>
<Content Include="Properties\Default.rd.xml" />
<Content Include="Assets\LockScreenLogo.scale-200.png" />
<Content Include="Assets\SplashScreen.scale-200.png" />
<Content Include="Assets\Square150x150Logo.scale-200.png" />
<Content Include="Assets\Square44x44Logo.scale-200.png" />
<Content Include="Assets\Square44x44Logo.targetsize-24_altform-unplated.png" />
<Content Include="Assets\StoreLogo.png" />
<Content Include="Assets\Wide310x150Logo.scale-200.png" />
</ItemGroup>
<ItemGroup>
<ApplicationDefinition Include="App.xaml">
<Generator>MSBuild:Compile</Generator>
<SubType>Designer</SubType>
</ApplicationDefinition>
<Page Include="AboutPage.xaml">
<SubType>Designer</SubType>
<Generator>MSBuild:Compile</Generator>
</Page>
<Page Include="MainPage.xaml">
<Generator>MSBuild:Compile</Generator>
<SubType>Designer</SubType>
</Page>
</ItemGroup>
<ItemGroup>
<PackageReference Include="Microsoft.NETCore.UniversalWindowsPlatform">
<Version>6.2.9</Version>
</PackageReference>
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\GUTSchedule\GUTSchedule.csproj">
<Project>{a6f6de35-0eb4-4d11-9ff9-f4601595b639}</Project>
<Name>GUTSchedule</Name>
</ProjectReference>
</ItemGroup>
<PropertyGroup Condition=" '$(VisualStudioVersion)' == '' or '$(VisualStudioVersion)' &lt; '14.0' ">
<VisualStudioVersion>14.0</VisualStudioVersion>
</PropertyGroup>
<Import Project="$(MSBuildExtensionsPath)\Microsoft\WindowsXaml\v$(VisualStudioVersion)\Microsoft.Windows.UI.Xaml.CSharp.targets" />
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
Other similar extension points exist, see Microsoft.Common.targets.
<Target Name="BeforeBuild">
</Target>
<Target Name="AfterBuild">
</Target>
-->
</Project>
+125
View File
@@ -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="&#xEBE8;"/>
</AppBarButton.Icon>
</AppBarButton>
<AppBarButton Label="About application" Tag="about" Click="AppBarButton_Click">
<AppBarButton.Icon>
<FontIcon Glyph="&#xE946;"/>
</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;
}
}
}
@@ -0,0 +1,50 @@
<?xml version="1.0" encoding="utf-8"?>
<Package
xmlns="http://schemas.microsoft.com/appx/manifest/foundation/windows10"
xmlns:mp="http://schemas.microsoft.com/appx/2014/phone/manifest"
xmlns:uap="http://schemas.microsoft.com/appx/manifest/uap/windows10"
IgnorableNamespaces="uap mp">
<Identity
Name="3f032359-f68f-4a46-b88c-113efc87b82b"
Publisher="CN=Michael Gordeev"
Version="1.0.0.0" />
<mp:PhoneIdentity PhoneProductId="3f032359-f68f-4a46-b88c-113efc87b82b" PhonePublisherId="00000000-0000-0000-0000-000000000000"/>
<Properties>
<DisplayName>GUT.Schedule.UWP</DisplayName>
<PublisherDisplayName>Michael &quot;XFox&quot; Gordeev</PublisherDisplayName>
<Logo>Assets\StoreLogo.png</Logo>
</Properties>
<Dependencies>
<TargetDeviceFamily Name="Windows.Universal" MinVersion="10.0.0.0" MaxVersionTested="10.0.0.0" />
</Dependencies>
<Resources>
<Resource Language="x-generate"/>
</Resources>
<Applications>
<Application Id="App"
Executable="$targetnametoken$.exe"
EntryPoint="GUT.Schedule.UWP.App">
<uap:VisualElements
DisplayName="GUT.Schedule"
Square150x150Logo="Assets\Square150x150Logo.png"
Square44x44Logo="Assets\Square44x44Logo.png"
Description="Application which exports SPbSUT timetable to calendar"
BackgroundColor="transparent">
<uap:DefaultTile Wide310x150Logo="Assets\Wide310x150Logo.png"/>
<uap:SplashScreen Image="Assets\SplashScreen.png" />
</uap:VisualElements>
</Application>
</Applications>
<Capabilities>
<Capability Name="internetClient" />
<uap:Capability Name="appointments"/>
</Capabilities>
</Package>
@@ -0,0 +1,29 @@
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
// General Information about an assembly is controlled through the following
// set of attributes. Change these attribute values to modify the information
// associated with an assembly.
[assembly: AssemblyTitle("GUT.Schedule.UWP")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("GUT.Schedule.UWP")]
[assembly: AssemblyCopyright("Copyright © 2020")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
// Version information for an assembly consists of the following four values:
//
// Major Version
// Minor Version
// Build Number
// Revision
//
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("1.0.0.0")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: ComVisible(false)]
@@ -0,0 +1,31 @@
<!--
This file contains Runtime Directives used by .NET Native. The defaults here are suitable for most
developers. However, you can modify these parameters to modify the behavior of the .NET Native
optimizer.
Runtime Directives are documented at https://go.microsoft.com/fwlink/?LinkID=391919
To fully enable reflection for App1.MyClass and all of its public/private members
<Type Name="App1.MyClass" Dynamic="Required All"/>
To enable dynamic creation of the specific instantiation of AppClass<T> over System.Int32
<TypeInstantiation Name="App1.AppClass" Arguments="System.Int32" Activate="Required Public" />
Using the Namespace directive to apply reflection policy to all the types in a particular namespace
<Namespace Name="DataClasses.ViewModels" Serialize="All" />
-->
<Directives xmlns="http://schemas.microsoft.com/netfx/2013/01/metadata">
<Application>
<!--
An Assembly element with Name="*Application*" applies to all assemblies in
the application package. The asterisks are not wildcards.
-->
<Assembly Name="*Application*" Dynamic="Required All" />
<!-- Add your application specific runtime directives here. -->
</Application>
</Directives>