mirror of
https://github.com/XFox111/GUTSchedule.git
synced 2026-04-22 06:58:01 +03:00
Code cleanup and optimizing
This commit is contained in:
@@ -1,11 +1,10 @@
|
||||
using System;
|
||||
using System.Linq;
|
||||
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;
|
||||
using GUTSchedule.UWP.Pages;
|
||||
|
||||
namespace GUTSchedule.UWP
|
||||
{
|
||||
@@ -26,14 +25,12 @@ namespace GUTSchedule.UWP
|
||||
Windows.Globalization.ApplicationLanguages.PrimaryLanguageOverride = "en";
|
||||
|
||||
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();
|
||||
}
|
||||
|
||||
@@ -44,60 +41,16 @@ namespace GUTSchedule.UWP
|
||||
/// <param name="e">Details about the launch request and process.</param>
|
||||
protected override void OnLaunched(LaunchActivatedEventArgs e)
|
||||
{
|
||||
// Do not repeat app initialization when the Window already has content,
|
||||
// just ensure that the window is active
|
||||
if (!(Window.Current.Content is Frame rootFrame))
|
||||
{
|
||||
// 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;
|
||||
}
|
||||
Window.Current.Content = rootFrame = new Frame();
|
||||
|
||||
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();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
+1
-1
@@ -1,5 +1,5 @@
|
||||
<ContentDialog
|
||||
x:Class="GUTSchedule.UWP.ClearCalendarControl"
|
||||
x:Class="GUTSchedule.UWP.Controls.ClearCalendarControl"
|
||||
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"
|
||||
+1
-1
@@ -1,7 +1,7 @@
|
||||
using System.Collections.Generic;
|
||||
using Windows.UI.Xaml.Controls;
|
||||
|
||||
namespace GUTSchedule.UWP
|
||||
namespace GUTSchedule.UWP.Controls
|
||||
{
|
||||
public sealed partial class ClearCalendarControl : ContentDialog
|
||||
{
|
||||
@@ -124,17 +124,17 @@
|
||||
<RestoreProjectStyle>PackageReference</RestoreProjectStyle>
|
||||
</PropertyGroup>
|
||||
<ItemGroup>
|
||||
<Compile Include="AboutPage.xaml.cs">
|
||||
<Compile Include="Pages\AboutPage.xaml.cs">
|
||||
<DependentUpon>AboutPage.xaml</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="App.xaml.cs">
|
||||
<DependentUpon>App.xaml</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="Calendar.cs" />
|
||||
<Compile Include="ClearCalendarControl.xaml.cs">
|
||||
<Compile Include="Controls\ClearCalendarControl.xaml.cs">
|
||||
<DependentUpon>ClearCalendarControl.xaml</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="MainPage.xaml.cs">
|
||||
<Compile Include="Pages\MainPage.xaml.cs">
|
||||
<DependentUpon>MainPage.xaml</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="Properties\AssemblyInfo.cs" />
|
||||
@@ -199,15 +199,15 @@
|
||||
<Generator>MSBuild:Compile</Generator>
|
||||
<SubType>Designer</SubType>
|
||||
</ApplicationDefinition>
|
||||
<Page Include="AboutPage.xaml">
|
||||
<Page Include="Pages\AboutPage.xaml">
|
||||
<SubType>Designer</SubType>
|
||||
<Generator>MSBuild:Compile</Generator>
|
||||
</Page>
|
||||
<Page Include="ClearCalendarControl.xaml">
|
||||
<Page Include="Controls\ClearCalendarControl.xaml">
|
||||
<SubType>Designer</SubType>
|
||||
<Generator>MSBuild:Compile</Generator>
|
||||
</Page>
|
||||
<Page Include="MainPage.xaml">
|
||||
<Page Include="Pages\MainPage.xaml">
|
||||
<Generator>MSBuild:Compile</Generator>
|
||||
<SubType>Designer</SubType>
|
||||
</Page>
|
||||
@@ -219,9 +219,6 @@
|
||||
<PackageReference Include="Microsoft.Services.Store.Engagement">
|
||||
<Version>10.1901.28001</Version>
|
||||
</PackageReference>
|
||||
<PackageReference Include="Newtonsoft.Json">
|
||||
<Version>12.0.3</Version>
|
||||
</PackageReference>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\GUTSchedule\GUTSchedule.csproj">
|
||||
|
||||
@@ -1,16 +1,14 @@
|
||||
<?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"
|
||||
xmlns:rescap="http://schemas.microsoft.com/appx/manifest/foundation/windows10/restrictedcapabilities"
|
||||
IgnorableNamespaces="uap mp">
|
||||
|
||||
<Identity
|
||||
Name="53949MichaelXFoxGordeev.GUT.Schedule"
|
||||
Publisher="CN=FD7A34DD-FE4D-4D7D-9D33-2DA9EBBE7725"
|
||||
Version="2020.222.1.0" />
|
||||
Version="2020.313.2.0" />
|
||||
|
||||
<mp:PhoneIdentity PhoneProductId="ea5f6ab0-1992-40f5-b89c-11fc3a97ae9f" PhonePublisherId="00000000-0000-0000-0000-000000000000"/>
|
||||
|
||||
|
||||
+1
-1
@@ -1,5 +1,5 @@
|
||||
<Page
|
||||
x:Class="GUTSchedule.UWP.AboutPage"
|
||||
x:Class="GUTSchedule.UWP.Pages.AboutPage"
|
||||
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"
|
||||
+6
-8
@@ -1,20 +1,18 @@
|
||||
using Microsoft.Services.Store.Engagement;
|
||||
using Newtonsoft.Json;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Net.Http;
|
||||
using Windows.ApplicationModel;
|
||||
using Windows.ApplicationModel.Resources;
|
||||
using Windows.Data.Json;
|
||||
using Windows.System;
|
||||
using Windows.UI.Xaml;
|
||||
using Windows.UI.Xaml.Controls;
|
||||
using Windows.UI.Xaml.Documents;
|
||||
|
||||
namespace GUTSchedule.UWP
|
||||
namespace GUTSchedule.UWP.Pages
|
||||
{
|
||||
public sealed partial class AboutPage : Page
|
||||
{
|
||||
private readonly ResourceLoader resources = ResourceLoader.GetForCurrentView();
|
||||
public AboutPage()
|
||||
{
|
||||
InitializeComponent();
|
||||
@@ -39,11 +37,11 @@ namespace GUTSchedule.UWP
|
||||
|
||||
HttpResponseMessage response = await client.SendAsync(request);
|
||||
string resposeContent = await response.Content.ReadAsStringAsync();
|
||||
dynamic parsedResponse = JsonConvert.DeserializeObject(resposeContent);
|
||||
JsonObject parsedResponse = JsonObject.Parse(resposeContent);
|
||||
|
||||
foreach (var i in parsedResponse)
|
||||
if (i.type == "User" && ((string)i.login).ToLower() != "xfox111")
|
||||
contributorsList.Add((string)i.login);
|
||||
if (i.Value.GetObject()["type"].GetString() == "User" && i.Value.GetObject()["login"].GetString().ToLower() != "xfox111")
|
||||
contributorsList.Add(i.Value.GetObject()["login"].GetString());
|
||||
|
||||
request.Dispose();
|
||||
client.Dispose();
|
||||
@@ -87,4 +85,4 @@ namespace GUTSchedule.UWP
|
||||
private void BackRequested(object sender, RoutedEventArgs e) =>
|
||||
Frame.GoBack();
|
||||
}
|
||||
}
|
||||
}
|
||||
+1
-1
@@ -1,5 +1,5 @@
|
||||
<Page
|
||||
x:Class="GUTSchedule.UWP.MainPage"
|
||||
x:Class="GUTSchedule.UWP.Pages.MainPage"
|
||||
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"
|
||||
+3
-6
@@ -1,4 +1,5 @@
|
||||
using GUTSchedule.Models;
|
||||
using GUTSchedule.UWP.Controls;
|
||||
using System;
|
||||
using Windows.Security.Credentials;
|
||||
using Windows.System;
|
||||
@@ -15,7 +16,7 @@ using Microsoft.Services.Store.Engagement;
|
||||
using Windows.ApplicationModel;
|
||||
using Windows.ApplicationModel.Core;
|
||||
|
||||
namespace GUTSchedule.UWP
|
||||
namespace GUTSchedule.UWP.Pages
|
||||
{
|
||||
public sealed partial class MainPage : Page
|
||||
{
|
||||
@@ -276,8 +277,4 @@ namespace GUTSchedule.UWP
|
||||
await dialog.ShowAsync();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// TODO: Reminder prefs broken
|
||||
// TODO: Calendar prefs broken
|
||||
// TODO: Faculty prefs broken
|
||||
}
|
||||
@@ -1,16 +1,15 @@
|
||||
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: AssemblyTitle("GUT.Schedule")]
|
||||
[assembly: AssemblyDescription("")]
|
||||
[assembly: AssemblyConfiguration("")]
|
||||
[assembly: AssemblyCompany("")]
|
||||
[assembly: AssemblyProduct("GUT.Schedule.UWP")]
|
||||
[assembly: AssemblyCopyright("Copyright © 2020")]
|
||||
[assembly: AssemblyCompany("Michael \"XFox\" Gordeev")]
|
||||
[assembly: AssemblyProduct("GUT.Schedule")]
|
||||
[assembly: AssemblyCopyright("Copyright ©2020 Michael \"XFox\" Gordeev")]
|
||||
[assembly: AssemblyTrademark("")]
|
||||
[assembly: AssemblyCulture("")]
|
||||
|
||||
|
||||
@@ -1,31 +1,5 @@
|
||||
<!--
|
||||
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>
|
||||
<Application>
|
||||
<Assembly Name="*Application*" Dynamic="Required All" />
|
||||
</Application>
|
||||
</Directives>
|
||||
Reference in New Issue
Block a user