/trunk/Winify/MainForm.cs |
@@ -20,29 +20,13 @@ |
using Winify.Settings; |
using Winify.Utilities; |
using Winify.Utilities.Serialization; |
using ScheduledContinuation = Toasts.ScheduledContinuation; |
using Toasts = Toasts.Toasts; |
|
namespace Winify |
{ |
public partial class MainForm : Form |
{ |
private void LogViewToolStripMenuItem_Click(object sender, EventArgs e) |
{ |
if (_logViewForm != null) return; |
|
_logViewForm = new LogViewForm(this, _memorySink, _cancellationToken); |
_logViewForm.Closing += LogViewForm_Closing; |
_logViewForm.Show(); |
} |
|
private void LogViewForm_Closing(object sender, CancelEventArgs e) |
{ |
if (_logViewForm == null) return; |
|
_logViewForm.Closing -= LogViewForm_Closing; |
_logViewForm.Close(); |
_logViewForm = null; |
} |
|
#region Public Enums, Properties and Fields |
|
public Configuration.Configuration Configuration { get; set; } |
@@ -71,6 +55,8 @@ |
|
private readonly LogMemorySink _memorySink; |
|
private readonly global::Toasts.Toasts _toasts; |
|
#endregion |
|
#region Constructors, Destructors and Finalizers |
@@ -81,6 +67,8 @@ |
_cancellationToken = _cancellationTokenSource.Token; |
|
ChangedConfigurationContinuation = new ScheduledContinuation(); |
|
_toasts = new global::Toasts.Toasts(_cancellationToken); |
} |
|
public MainForm(Mutex mutex) : this() |
@@ -139,6 +127,24 @@ |
} |
} |
|
private void LogViewToolStripMenuItem_Click(object sender, EventArgs e) |
{ |
if (_logViewForm != null) return; |
|
_logViewForm = new LogViewForm(this, _memorySink, _cancellationToken); |
_logViewForm.Closing += LogViewForm_Closing; |
_logViewForm.Show(); |
} |
|
private void LogViewForm_Closing(object sender, CancelEventArgs e) |
{ |
if (_logViewForm == null) return; |
|
_logViewForm.Closing -= LogViewForm_Closing; |
_logViewForm.Close(); |
_logViewForm = null; |
} |
|
private async void SettingsToolStripMenuItem_Click(object sender, EventArgs e) |
{ |
if (_settingsForm == null) |
@@ -191,9 +197,9 @@ |
var configuredNotification = new ToastForm( |
$"{e.Notification.Title} ({e.Notification.Server.Name}/{e.Notification.AppId})", |
e.Notification.Message, announcement.LingerTime, e.Image); |
|
await _toasts.Queue(configuredNotification); |
|
Application.Run(configuredNotification); |
|
return; |
} |
|
@@ -203,7 +209,7 @@ |
$"{e.Notification.Title} ({e.Notification.Server.Name}/{e.Notification.AppId})", |
e.Notification.Message, e.Image); |
|
Application.Run(infiniteToastForm); |
await _toasts.Queue(infiniteToastForm); |
|
return; |
} |
@@ -211,8 +217,8 @@ |
var toastForm = new ToastForm( |
$"{e.Notification.Title} ({e.Notification.Server.Name}/{e.Notification.AppId})", |
e.Notification.Message, Configuration.ToastDuration, e.Image); |
|
Application.Run(toastForm); |
|
await _toasts.Queue(toastForm); |
} |
|
private void SettingsForm_Closing(object sender, CancelEventArgs e) |