* create "About" page in settings * add content to About page * Get latest version from GitHub * Add NotificationService to servies * Enable actions on notifications * Get latest version asynchroniously * Handle when latest version is not found and clean code * Remove old UpdateService * Remove old NotificationService * Add icon for about tab * Update About page styling * Make About menu item a footer menu item * Update About page layout Based on suggestions by @felixse * Instatiate temporary navigation item only once This seems to solve display issues when opening the "About" page multiple times where the main navigation list is being rerendered for no apparent reason. * Revert unintended changes * Added shortcut to about page in hamburger menu * Move About page properties to the AboutPageViewModel * Make "loading..." and "Not found" italic to indicate non-default behaviour * move update check back to systemtray * Made IUpdateService async
70 lines
2.0 KiB
C#
70 lines
2.0 KiB
C#
using FluentTerminal.App.Services;
|
|
using FluentTerminal.App.Services.EventArgs;
|
|
using System;
|
|
using System.Threading.Tasks;
|
|
using Windows.ApplicationModel.Core;
|
|
using Windows.UI.Core;
|
|
using Windows.UI.Core.Preview;
|
|
using Windows.UI.ViewManagement;
|
|
|
|
namespace FluentTerminal.App.Adapters
|
|
{
|
|
public class ApplicationViewAdapter : IApplicationView
|
|
{
|
|
private readonly ApplicationView _applicationView;
|
|
private readonly CoreDispatcher _dispatcher;
|
|
|
|
public event CloseRequestedHandler CloseRequested;
|
|
|
|
public ApplicationViewAdapter()
|
|
{
|
|
_applicationView = ApplicationView.GetForCurrentView();
|
|
_dispatcher = CoreApplication.GetCurrentView().Dispatcher;
|
|
SystemNavigationManagerPreview.GetForCurrentView().CloseRequested += OnCloseRequest;
|
|
}
|
|
|
|
public string Title
|
|
{
|
|
get => _applicationView.Title;
|
|
set => _applicationView.Title = value;
|
|
}
|
|
|
|
public Task RunOnDispatcherThread(Action action)
|
|
{
|
|
return _dispatcher.RunAsync(CoreDispatcherPriority.Normal, () => action()).AsTask();
|
|
}
|
|
|
|
public Task<bool> TryClose()
|
|
{
|
|
return _applicationView.TryConsolidateAsync().AsTask();
|
|
}
|
|
|
|
public bool ToggleFullScreen()
|
|
{
|
|
if (_applicationView.IsFullScreenMode)
|
|
{
|
|
_applicationView.ExitFullScreenMode();
|
|
return true;
|
|
}
|
|
else
|
|
{
|
|
return _applicationView.TryEnterFullScreenMode();
|
|
}
|
|
}
|
|
|
|
private async void OnCloseRequest(object sender, SystemNavigationCloseRequestedPreviewEventArgs e)
|
|
{
|
|
var deferral = e.GetDeferral();
|
|
|
|
var args = new CancelableEventArgs();
|
|
if (CloseRequested != null)
|
|
{
|
|
await CloseRequested.Invoke(this, args);
|
|
}
|
|
|
|
e.Handled = args.Cancelled;
|
|
|
|
deferral.Complete();
|
|
}
|
|
}
|
|
} |