mirror of
https://github.com/XFox111/GUTSchedule.git
synced 2026-04-22 06:58:01 +03:00
Complete UWP app (without translations)
This commit is contained in:
@@ -1,30 +1,90 @@
|
||||
using System;
|
||||
using Microsoft.Services.Store.Engagement;
|
||||
using Newtonsoft.Json;
|
||||
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 System.Net.Http;
|
||||
using Windows.ApplicationModel;
|
||||
using Windows.ApplicationModel.Resources;
|
||||
using Windows.System;
|
||||
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
|
||||
using Windows.UI.Xaml.Documents;
|
||||
|
||||
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
|
||||
{
|
||||
private readonly ResourceLoader resources = ResourceLoader.GetForCurrentView();
|
||||
public AboutPage()
|
||||
{
|
||||
this.InitializeComponent();
|
||||
InitializeComponent();
|
||||
KeyDown += (s, e) =>
|
||||
{
|
||||
if (e.Key == VirtualKey.Back || e.Key == VirtualKey.GoBack)
|
||||
BackRequested(s, null);
|
||||
};
|
||||
}
|
||||
|
||||
private async void Page_Loaded(object sender, RoutedEventArgs e)
|
||||
{
|
||||
PackageVersion ver = Package.Current.Id.Version;
|
||||
version.Text = $"v{ver.Major}{ver.Major}.{ver.Revision} (ci-id #{ver.Build})";
|
||||
|
||||
List<string> contributorsList = new List<string>();
|
||||
try
|
||||
{
|
||||
HttpClient client = new HttpClient();
|
||||
HttpRequestMessage request = new HttpRequestMessage(HttpMethod.Get, "https://api.github.com/repos/xfox111/gutschedule/contributors");
|
||||
request.Headers.Add("User-Agent", "Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:72.0) Gecko/20100101 Firefox/72.0");
|
||||
|
||||
HttpResponseMessage response = await client.SendAsync(request);
|
||||
string resposeContent = await response.Content.ReadAsStringAsync();
|
||||
dynamic parsedResponse = JsonConvert.DeserializeObject(resposeContent);
|
||||
|
||||
foreach (var i in parsedResponse)
|
||||
if (i.type == "User" && ((string)i.login).ToLower() != "xfox111")
|
||||
contributorsList.Add((string)i.login);
|
||||
|
||||
request.Dispose();
|
||||
client.Dispose();
|
||||
}
|
||||
finally
|
||||
{
|
||||
if (contributorsList.Count > 0)
|
||||
{
|
||||
foreach(string i in contributorsList)
|
||||
{
|
||||
Hyperlink link = new Hyperlink
|
||||
{
|
||||
NavigateUri = new Uri("https://github.com.i")
|
||||
};
|
||||
link.Inlines.Add(new Run
|
||||
{
|
||||
Text = "@" + i
|
||||
});
|
||||
contributors.Inlines.Add(link);
|
||||
contributors.Inlines.Add(new Run
|
||||
{
|
||||
Text = ", "
|
||||
});
|
||||
}
|
||||
contributors.Inlines.RemoveAt(contributors.Inlines.Count - 1);
|
||||
|
||||
contributorsTitle.Visibility = Visibility.Visible;
|
||||
contributors.Visibility = Visibility.Visible;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private async void Feedback_Click(object sender, RoutedEventArgs e)
|
||||
{
|
||||
if (StoreServicesFeedbackLauncher.IsSupported())
|
||||
await StoreServicesFeedbackLauncher.GetDefault().LaunchAsync();
|
||||
else
|
||||
await Launcher.LaunchUriAsync(new Uri("mailto:feedback@xfox111.net"));
|
||||
}
|
||||
|
||||
private void BackRequested(object sender, RoutedEventArgs e) =>
|
||||
Frame.GoBack();
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user