From 576828e6e39695603c30a46fb223118113e8de17 Mon Sep 17 00:00:00 2001 From: Stefan Ruepp Date: Mon, 7 Aug 2017 23:25:46 +0200 Subject: [PATCH] added working notifications --- EveChatNotifier/EveChatNotifier.csproj | 5 ++ EveChatNotifier/FormMain.cs | 74 +++++++++++++++--- EveChatNotifier/Properties/AssemblyInfo.cs | 4 +- .../Properties/Resources.Designer.cs | 66 ++++++++-------- EveChatNotifier/Properties/Resources.resx | 17 ++-- .../Resources/eve-logo-landing2.png | Bin 0 -> 1721 bytes EveChatNotifier/packages.config | 1 + 7 files changed, 115 insertions(+), 52 deletions(-) create mode 100644 EveChatNotifier/Resources/eve-logo-landing2.png diff --git a/EveChatNotifier/EveChatNotifier.csproj b/EveChatNotifier/EveChatNotifier.csproj index 1382d7c..80c819b 100644 --- a/EveChatNotifier/EveChatNotifier.csproj +++ b/EveChatNotifier/EveChatNotifier.csproj @@ -48,6 +48,9 @@ + + ..\packages\Tulpep.NotificationWindow.1.1.23\lib\net40\Tulpep.NotificationWindow.dll + @@ -73,6 +76,7 @@ True Resources.resx + True @@ -88,6 +92,7 @@ + \ No newline at end of file diff --git a/EveChatNotifier/FormMain.cs b/EveChatNotifier/FormMain.cs index 4b4aa41..a73b97f 100644 --- a/EveChatNotifier/FormMain.cs +++ b/EveChatNotifier/FormMain.cs @@ -10,6 +10,7 @@ using System.Windows.Forms; using NAudio; using NAudio.Wave; +using Tulpep.NotificationWindow; namespace EveChatNotifier { @@ -21,6 +22,7 @@ public partial class FormMain : Form private bool firstShown = true; private static bool isPlaying = false; private DateTime lastNotified = DateTime.Now; + private PopupNotifier Notifier = new PopupNotifier(); public FormMain() { @@ -33,6 +35,24 @@ public FormMain() Properties.Settings.Default.Reload(); } + // popup notifier settings + Notifier.IsRightToLeft = false; + Notifier.ShowCloseButton = true; + Notifier.ShowGrip = false; + Notifier.Image = Properties.Resources.eve_logo_landing2; + + Notifier.Delay = 5000; + Notifier.AnimationDuration = 500; + + Notifier.BodyColor = Color.Black; + Notifier.BorderColor = Color.Red; + Notifier.ContentColor = Color.Orange; + Notifier.ContentHoverColor = Color.Orange; + Notifier.HeaderColor = Color.White; + Notifier.TitleColor = Color.LightGray; + + Notifier.Click += Notifier_Click; + Logging.WriteLine("Starting chat notifier."); InitializeComponent(); @@ -134,9 +154,26 @@ private void NewChatLines(object sender, LogFile.EveChatEventArgs e) // if notification is needed if (needsNotify) // isPlaying is managing the notification using sound (only one at a time) { - lastNotified = DateTime.Now; Logging.WriteLine(string.Format("Notify for chat message of '{0}' in '{1}': {2}", le.Sender, curLog.LogInfo.ChannelName, le.Text)); + if (string.IsNullOrWhiteSpace(Properties.Settings.Default.SoundFilePath) || Properties.Settings.Default.ShowNotification) + { + if ((DateTime.Now - lastNotified).TotalSeconds > 1) + { + lastNotified = DateTime.Now; + // send notification + //notifyIcon.ShowBalloonTip(10000, "[EVE] chat notification", string.Format("[{0}] {1}: {2}", curLog.LogInfo.ChannelName, le.Sender, le.Text), ToolTipIcon.Info); + + + + Notifier.TitleText = string.Format("{0} in '{1}'", le.Sender, curLog.LogInfo.ChannelName); + Notifier.ContentText = le.Text; + + + Notifier.Popup(); + } + } + // send sound alert if (!string.IsNullOrWhiteSpace(Properties.Settings.Default.SoundFilePath)) { @@ -163,20 +200,20 @@ private void NewChatLines(object sender, LogFile.EveChatEventArgs e) Properties.Settings.Default.Reload(); } } - - if(string.IsNullOrWhiteSpace(Properties.Settings.Default.SoundFilePath) || Properties.Settings.Default.ShowNotification) - { - if((DateTime.Now - lastNotified).TotalSeconds > 1) - { - lastNotified = DateTime.Now; - // send notification - notifyIcon.ShowBalloonTip(10000, "[EVE] chat notification", string.Format("[{0}] {1}: {2}", curLog.LogInfo.ChannelName, le.Sender, le.Text), ToolTipIcon.Info); - } - } } } } + private void Notifier_Click(object sender, EventArgs e) + { + try + { + PopupNotifier pn = (PopupNotifier)sender; + pn.Hide(); + } + catch { } + } + private void Wp_PlaybackStopped(object sender, NAudio.Wave.StoppedEventArgs e) { isPlaying = false; @@ -197,18 +234,29 @@ private void FormMain_Resize(object sender, EventArgs e) { if(this.WindowState == FormWindowState.Minimized) { - notifyIcon.Visible = true; + //notifyIcon.Visible = true; this.Hide(); } else { - notifyIcon.Visible = false; + //notifyIcon.Visible = false; } } private void notifyIcon_DoubleClick(object sender, EventArgs e) { this.Show(); + try + { + this.WindowState = FormWindowState.Normal; + } + catch { } + try + { + this.Focus(); + } + catch { } + //this.Focus(); //this.TopMost = true; //this.TopMost = false; diff --git a/EveChatNotifier/Properties/AssemblyInfo.cs b/EveChatNotifier/Properties/AssemblyInfo.cs index 26faa20..e4711d2 100644 --- a/EveChatNotifier/Properties/AssemblyInfo.cs +++ b/EveChatNotifier/Properties/AssemblyInfo.cs @@ -32,5 +32,5 @@ // Sie können alle Werte angeben oder Standardwerte für die Build- und Revisionsnummern verwenden, // übernehmen, indem Sie "*" eingeben: // [assembly: AssemblyVersion("1.0.*")] -[assembly: AssemblyVersion("1.3.3.0")] -[assembly: AssemblyFileVersion("1.3.3.0")] +[assembly: AssemblyVersion("1.3.4.0")] +[assembly: AssemblyFileVersion("1.3.4.0")] diff --git a/EveChatNotifier/Properties/Resources.Designer.cs b/EveChatNotifier/Properties/Resources.Designer.cs index e1ca999..3a497da 100644 --- a/EveChatNotifier/Properties/Resources.Designer.cs +++ b/EveChatNotifier/Properties/Resources.Designer.cs @@ -1,71 +1,73 @@ //------------------------------------------------------------------------------ // // Dieser Code wurde von einem Tool generiert. -// Laufzeitversion: 4.0.30319.42000 +// Laufzeitversion:4.0.30319.42000 // -// Änderungen an dieser Datei können fehlerhaftes Verhalten verursachen und gehen verloren, wenn -// der Code neu generiert wird. +// Änderungen an dieser Datei können falsches Verhalten verursachen und gehen verloren, wenn +// der Code erneut generiert wird. // //------------------------------------------------------------------------------ -namespace EveChatNotifier.Properties -{ - - +namespace EveChatNotifier.Properties { + using System; + + /// /// Eine stark typisierte Ressourcenklasse zum Suchen von lokalisierten Zeichenfolgen usw. /// - // Diese Klasse wurde von der StronglyTypedResourceBuilder-Klasse - // über ein Tool wie ResGen oder Visual Studio automatisch generiert. + // Diese Klasse wurde von der StronglyTypedResourceBuilder automatisch generiert + // -Klasse über ein Tool wie ResGen oder Visual Studio automatisch generiert. // Um einen Member hinzuzufügen oder zu entfernen, bearbeiten Sie die .ResX-Datei und führen dann ResGen - // mit der Option /str erneut aus, oder erstellen Sie Ihr VS-Projekt neu. + // mit der /str-Option erneut aus, oder Sie erstellen Ihr VS-Projekt neu. [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "4.0.0.0")] [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] - internal class Resources - { - + internal class Resources { + private static global::System.Resources.ResourceManager resourceMan; - + private static global::System.Globalization.CultureInfo resourceCulture; - + [global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")] - internal Resources() - { + internal Resources() { } - + /// /// Gibt die zwischengespeicherte ResourceManager-Instanz zurück, die von dieser Klasse verwendet wird. /// [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] - internal static global::System.Resources.ResourceManager ResourceManager - { - get - { - if ((resourceMan == null)) - { + internal static global::System.Resources.ResourceManager ResourceManager { + get { + if (object.ReferenceEquals(resourceMan, null)) { global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("EveChatNotifier.Properties.Resources", typeof(Resources).Assembly); resourceMan = temp; } return resourceMan; } } - + /// /// Überschreibt die CurrentUICulture-Eigenschaft des aktuellen Threads für alle - /// Ressourcenlookups, die diese stark typisierte Ressourcenklasse verwenden. + /// Ressourcenzuordnungen, die diese stark typisierte Ressourcenklasse verwenden. /// [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] - internal static global::System.Globalization.CultureInfo Culture - { - get - { + internal static global::System.Globalization.CultureInfo Culture { + get { return resourceCulture; } - set - { + set { resourceCulture = value; } } + + /// + /// Sucht eine lokalisierte Ressource vom Typ System.Drawing.Bitmap. + /// + internal static System.Drawing.Bitmap eve_logo_landing2 { + get { + object obj = ResourceManager.GetObject("eve_logo_landing2", resourceCulture); + return ((System.Drawing.Bitmap)(obj)); + } + } } } diff --git a/EveChatNotifier/Properties/Resources.resx b/EveChatNotifier/Properties/Resources.resx index af7dbeb..985253b 100644 --- a/EveChatNotifier/Properties/Resources.resx +++ b/EveChatNotifier/Properties/Resources.resx @@ -46,7 +46,7 @@ mimetype: application/x-microsoft.net.object.binary.base64 value : The object must be serialized with - : System.Serialization.Formatters.Binary.BinaryFormatter + : System.Runtime.Serialization.Formatters.Binary.BinaryFormatter : and then encoded with base64 encoding. mimetype: application/x-microsoft.net.object.soap.base64 @@ -60,6 +60,7 @@ : and then encoded with base64 encoding. --> + @@ -68,9 +69,10 @@ - + + @@ -85,9 +87,10 @@ - + + @@ -109,9 +112,13 @@ 2.0 - System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + ..\Resources\eve-logo-landing2.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a + \ No newline at end of file diff --git a/EveChatNotifier/Resources/eve-logo-landing2.png b/EveChatNotifier/Resources/eve-logo-landing2.png new file mode 100644 index 0000000000000000000000000000000000000000..589baf2eb1d021780841e0f6ac0a19d992445fbc GIT binary patch literal 1721 zcmaJ?Yfuws6io+^m(WoV73jDI1t}rfgh$9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mV?d00001 diff --git a/EveChatNotifier/packages.config b/EveChatNotifier/packages.config index c1bc002..efb5e6e 100644 --- a/EveChatNotifier/packages.config +++ b/EveChatNotifier/packages.config @@ -1,4 +1,5 @@  + \ No newline at end of file