-
Notifications
You must be signed in to change notification settings - Fork 0
/
Program.cs
68 lines (63 loc) · 2.18 KB
/
Program.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
using System;
using System.Collections.Generic;
using System.Drawing;
using System.IO;
using System.Linq;
using System.Threading.Tasks;
using System.Windows.Forms;
using Win11Toolbar.Core;
using Win11Toolbar.Properties;
namespace Win11Toolbar
{
internal static class Program
{
static ConfigManager cm;
static TabManager tm;
static Win11Toolbar.ToobarForm _toolbarForm;
static Win11Toolbar.ConfigurationForm _configForm;
/// <summary>
/// The main entry point for the application.
/// </summary>
[STAThread]
static void Main()
{
Application.EnableVisualStyles();
Application.SetCompatibleTextRenderingDefault(false);
//Application.Run(new NotifyIconForm());
cm = ConfigManager.Instance;
tm = TabManager.Instance;
_toolbarForm = new Win11Toolbar.ToobarForm();
//_configForm = new Win11Toolbar.ConfigurationForm();
_toolbarForm.Hide();
_toolbarForm.LostFocus += _toolbarForm_LostFocus;
NotifyIcon _notifiyIcon = new NotifyIcon();
_notifiyIcon.MouseClick += _notifiyIcon_MouseClick;
_notifiyIcon.Visible = true;
_notifiyIcon.Icon = Win11Toolbar.Properties.Resources.favicon2;
Application.Run();
}
private static void _notifiyIcon_MouseClick(object sender, MouseEventArgs e)
{
if (e.Button == MouseButtons.Left)
{
Point cursPos = Utilities.GetCursorPosition();
if (_toolbarForm.form_X == 0)
{
_toolbarForm.form_X = cursPos.X - (_toolbarForm.Width / 2);
}
_toolbarForm.Show();
_toolbarForm.Activate();
}
else if (e.Button == MouseButtons.Right)
{
_configForm = new Win11Toolbar.ConfigurationForm();
_configForm.Show();
}
}
private static void _toolbarForm_LostFocus(object sender, EventArgs e)
{
Win11Toolbar.ToobarForm tf = (Win11Toolbar.ToobarForm)sender;
tf.Hide();
}
}
}