mirror of
https://github.com/DaKerboul/perun.git
synced 2026-08-09 18:05:40 +02:00
Removed NativeMethods - not used as we allow multiple instances now; changed tray icon hover text
This commit is contained in:
@@ -1,13 +0,0 @@
|
|||||||
// This class just wraps some Win32 stuff that we're going to use for blocking of multiple instances
|
|
||||||
using System;
|
|
||||||
using System.Runtime.InteropServices;
|
|
||||||
|
|
||||||
internal class NativeMethods
|
|
||||||
{
|
|
||||||
public const int HWND_BROADCAST = 0xffff;
|
|
||||||
public static readonly int WM_SHOWME = RegisterWindowMessage("WM_SHOWME");
|
|
||||||
[DllImport("user32")]
|
|
||||||
public static extern bool PostMessage(IntPtr hwnd, int msg, IntPtr wparam, IntPtr lparam);
|
|
||||||
[DllImport("user32")]
|
|
||||||
public static extern int RegisterWindowMessage(string message);
|
|
||||||
}
|
|
||||||
@@ -497,7 +497,6 @@
|
|||||||
this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedSingle;
|
this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedSingle;
|
||||||
this.Icon = ((System.Drawing.Icon)(resources.GetObject("$this.Icon")));
|
this.Icon = ((System.Drawing.Icon)(resources.GetObject("$this.Icon")));
|
||||||
this.MaximizeBox = false;
|
this.MaximizeBox = false;
|
||||||
this.MinimizeBox = false;
|
|
||||||
this.Name = "form_Main";
|
this.Name = "form_Main";
|
||||||
this.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen;
|
this.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen;
|
||||||
this.Text = "Perun for DCS World";
|
this.Text = "Perun for DCS World";
|
||||||
|
|||||||
@@ -187,6 +187,9 @@ namespace Perun_v1
|
|||||||
|
|
||||||
// Set title bar
|
// Set title bar
|
||||||
this.Text = "[#"+ con_txt_dcs_instance.Text + "] " + Globals.strPerunTitleText;
|
this.Text = "[#"+ con_txt_dcs_instance.Text + "] " + Globals.strPerunTitleText;
|
||||||
|
|
||||||
|
// Set notification icon text
|
||||||
|
trayIconMain.Text = this.Text;
|
||||||
}
|
}
|
||||||
|
|
||||||
private void con_Button_Listen_OFF_Click(object sender, EventArgs e)
|
private void con_Button_Listen_OFF_Click(object sender, EventArgs e)
|
||||||
@@ -232,6 +235,7 @@ namespace Perun_v1
|
|||||||
|
|
||||||
// Set title bar
|
// Set title bar
|
||||||
this.Text = Globals.strPerunTitleText;
|
this.Text = Globals.strPerunTitleText;
|
||||||
|
trayIconMain.Text = this.Text;
|
||||||
|
|
||||||
// Set globals
|
// Set globals
|
||||||
Globals.intInstanceId = 0;
|
Globals.intInstanceId = 0;
|
||||||
@@ -300,16 +304,6 @@ namespace Perun_v1
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
protected override void WndProc(ref Message m)
|
|
||||||
{
|
|
||||||
// Try to run of 2nd instance
|
|
||||||
if (m.Msg == NativeMethods.WM_SHOWME)
|
|
||||||
{
|
|
||||||
form_Main_BringFromTray();
|
|
||||||
}
|
|
||||||
base.WndProc(ref m);
|
|
||||||
}
|
|
||||||
|
|
||||||
private void form_Main_SendToTray()
|
private void form_Main_SendToTray()
|
||||||
{
|
{
|
||||||
// Sends app to system tray
|
// Sends app to system tray
|
||||||
|
|||||||
@@ -129,7 +129,6 @@
|
|||||||
<Compile Include="01_Classes\Globals.cs" />
|
<Compile Include="01_Classes\Globals.cs" />
|
||||||
<Compile Include="01_Classes\DatabaseController.cs" />
|
<Compile Include="01_Classes\DatabaseController.cs" />
|
||||||
<Compile Include="01_Classes\PerunHelper.cs" />
|
<Compile Include="01_Classes\PerunHelper.cs" />
|
||||||
<Compile Include="01_Classes\NativeMethods.cs" />
|
|
||||||
<Compile Include="02_Forms\form_Main.cs">
|
<Compile Include="02_Forms\form_Main.cs">
|
||||||
<SubType>Form</SubType>
|
<SubType>Form</SubType>
|
||||||
</Compile>
|
</Compile>
|
||||||
|
|||||||
Reference in New Issue
Block a user