예제 #1
0
        private void InitWindowsMouseEvents()
        {
            Point previousWindowPos = new Point(this.Left, this.Top);
            Point actualWindowsPos  = previousWindowPos;

            MouseLeftButtonUp += (object sender, MouseButtonEventArgs e) =>
            {
                actualWindowsPos = new Point(this.Left, this.Top);
                if (actualWindowsPos.Equals(previousWindowPos))
                {
                    ShowActivity(ActivityEnum.Allowed);
                    ClickableIcon.Source = ICON_NORMAL;
                    if (WindowState.Minimized == notifierWindow.WindowState)
                    {
                        notifierWindow.RestoreWindowState();
                    }
                    else
                    {
                        notifierWindow.HideWindowState();
                    }
                }
                else
                {
                    previousWindowPos = actualWindowsPos;
                    Settings.Default.ActivityWindow_Position = actualWindowsPos;
                    Settings.Default.Save();
                }
            };
            MouseLeftButtonDown += (object sender, MouseButtonEventArgs e) =>
            {
                DragMove();
            };
        }
예제 #2
0
        private WinForms::ContextMenuStrip InitMenu()
        {
            WinForms::ContextMenuStrip contextMenu = new WinForms::ContextMenuStrip();

            void MenuShow_Click(object Sender, EventArgs e)
            {
                notifierWindow.RestoreWindowState();
            }

            void MenuClose_Click(object Sender, EventArgs e)
            {
                // Dispose and close the window which exits the app
                notifierWindow.Close();
                contextMenu.Dispose();
                trayIcon.Dispose();
                Environment.Exit(0);
            }

            void MenuConsole_Click(object Sender, EventArgs e)
            {
                Process.Start(Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "WFN.exe"));
            }

            void MenuShowActivity_Click(object Sender, EventArgs e)
            {
                App.GetActivityWindow().Show();
            }

            contextMenu.Items.Add(Messages.NotifierTrayIcon_ShowNotifier, null, MenuShow_Click);
            contextMenu.Items.Add(Messages.NotifierTrayIcon_OpenConsole, null, MenuConsole_Click);
            contextMenu.Items.Add(Messages.NotifierTrayIcon_ShowActivityWindow, null, MenuShowActivity_Click);
            contextMenu.Items.Add(Messages.NotifierTrayIcon_DiscardAndClose, null, MenuClose_Click);
            return(contextMenu);
        }
예제 #3
0
 void MenuShow_Click(object Sender, EventArgs e)
 {
     notifierWindow.RestoreWindowState();
 }