Remove almost unused AppService in favor of using flute.exe

This commit is contained in:
FelixSe committed 2018-03-10 00:06:25 +01:00
1 parent 1ca7371103
commit 6dfacdfebd
3 files changed
+7 -73

No files matched your search

@@ -2,18 +2,14 @@
using System.Collections.Generic;
using System.Diagnostics;
using System.Linq;
using System.Threading.Tasks;
using System.Windows.Forms;
using Windows.ApplicationModel;
using Windows.ApplicationModel.AppService;
using Windows.ApplicationModel.Core;
using Windows.Foundation.Collections;
namespace FluentTerminal.SystemTray
{
public class SystemTrayApplicationContext : ApplicationContext
{
private AppServiceConnection _connection;
private readonly NotifyIcon _notifyIcon;
public SystemTrayApplicationContext()
@@ -34,19 +30,9 @@ namespace FluentTerminal.SystemTray
_notifyIcon.Visible = true;
}
private void Connection_ServiceClosed(AppServiceConnection sender, AppServiceClosedEventArgs args)
private void Exit(object sender, EventArgs e)
{
_connection.ServiceClosed -= Connection_ServiceClosed;
_connection = null;
}
private async void Exit(object sender, EventArgs e)
{
var message = new ValueSet
{
{ "exit", string.Empty }
};
await SendMessage(message);
Process.Start("flute.exe", "close");
Application.Exit();
}
@@ -61,28 +47,6 @@ namespace FluentTerminal.SystemTray
await appListEntries.First().LaunchAsync();
}
private async Task SendMessage(ValueSet message)
{
if (_connection == null)
{
_connection = new AppServiceConnection
{
PackageFamilyName = Package.Current.Id.FamilyName,
AppServiceName = "FluentTerminalAppService"
};
_connection.ServiceClosed += Connection_ServiceClosed;
AppServiceConnectionStatus connectionStatus = await _connection.OpenAsync();
if (connectionStatus != AppServiceConnectionStatus.Success)
{
MessageBox.Show("Status: " + connectionStatus.ToString());
return;
}
}
await _connection.SendMessageAsync(message);
}
private void ShowSettings(object sender, EventArgs e)
{
Process.Start("flute.exe", "settings");