public TomightyApplication()
        {
            var eventHub        = new SynchronousEventHub();
            var timer           = new Tomighty.Timer(eventHub);
            var userPreferences = new UserPreferences();
            var pomodoroEngine  = new PomodoroEngine(timer, userPreferences, eventHub);

            var trayMenu             = new TrayMenu() as ITrayMenu;
            var trayIcon             = CreateTrayIcon(trayMenu);
            var timerWindowPresenter = new TimerWindowPresenter(pomodoroEngine, timer, eventHub);

            new TrayIconController(trayIcon, timerWindowPresenter, eventHub);
            new TrayMenuController(trayMenu, this, pomodoroEngine, eventHub);
            new NotificationsPresenter(pomodoroEngine, userPreferences, eventHub);
            new SoundNotificationPlayer(userPreferences, eventHub);
            new AutoUpdate(userPreferences).Start();

            var aboutWindowPresenter     = new AboutWindowPresenter();
            var userPreferencesPresenter = new UserPreferencesPresenter(userPreferences);

            trayMenu.OnAboutClick((sender, e) => aboutWindowPresenter.Show());
            trayMenu.OnPreferencesClick((sender, e) => userPreferencesPresenter.Show());

            ThreadExit += (sender, e) => trayIcon.Dispose();

            new StartupEvents(eventHub);
        }
Beispiel #2
0
        private void TrayIcon_MouseClick(object sender, MouseEventArgs e)
        {
            Rectangle PScreen = Screen.PrimaryScreen.WorkingArea;

            if (e.Button == MouseButtons.Left)
            {
                Left = MousePosition.X - (Width / 2);
                if ((PScreen.Right) < (Left + Width))
                {
                    Left = (PScreen.Width - Width) - BottomRightMargin;
                }
                Top = (PScreen.Bottom - Height) - BottomRightMargin;
                FadeIn();
                Activate();
            }
            if (e.Button == MouseButtons.Right)
            {
                Opacity  = 0;
                Location = MousePosition;
                Show();
                Activate();
                TrayMenu.Show(this, new Point(0, 0));
                Hide();
                Opacity = 1;
            }
        }
Beispiel #3
0
 private void notifyIcon_MouseUp(object sender, MouseEventArgs e)
 {
     if (e.Button == MouseButtons.Right)
     {
         TrayMenu.Show();
     }
 }
Beispiel #4
0
 public SettingsView(Storage storage, ZoneList zoneList, TrayMenu del)
 {
     this.storage  = storage;
     this.del      = del;
     this.zoneList = zoneList;
     InitializeComponent();
 }
Beispiel #5
0
        public MainForm()
        {
            this.InitializeComponent();

            this._uiTray = new TrayMenu(this.trayIcon);

            ConfigManager.Instance.ConfigSaved += this.Instance_OnConfigSaved;
        }
        private void InitializeTrayMenu()
        {
            Program.TrayMenu.Items.AddRange(new MenuItem[]
            {
                new MenuItem("Show", TrayMenu.CreateEventHandler(ShowFromTray)),
                new MenuItem("Exit", TrayMenu.CreateEventHandler(Close)),
            });

            Program.TrayMenu.Icon.DoubleClick          += TrayMenu.CreateEventHandler(ShowFromTray);
            Program.TrayMenu.NpcWorkTrayCheckBox.Click += TrayMenu.CreateEventHandler(NpcWorkCheckChange);
            Program.TrayMenu.TopMostCheckBox.Click     += TrayMenu.CreateEventHandler(TopMostChange);
        }
Beispiel #7
0
        private void TrayIcon_MouseClick(object sender, MouseEventArgs e)
        {
            switch (e.Button)
            {
            case MouseButtons.Left:
                Ripristina();
                break;

            case MouseButtons.Right:
                TrayMenu.Show();
                break;
            }
        }
Beispiel #8
0
        static void Main()
        {
            Application.EnableVisualStyles();
            Application.SetCompatibleTextRenderingDefault(false);
            ConfigController.EnsureRunningConfig();
            var clashProcessManager = ClashProcessManager.Instance;

            clashProcessManager.ProcessErrorEvnet += new ClashProcessManager.ProcessErrorHandler(clashProcessError);
            clashProcessManager.Start();
            ConfigController.Instance.Init(clashProcessManager);
            trayMenu = new TrayMenu();
            trayMenu.Show();
            Application.ApplicationExit += new EventHandler(application_exit);
            trayMenu.ShowMessage("Running", "ClashW已启动");
            Application.Run();
        }
Beispiel #9
0
        public void InitalizeIcon()
        {
            InitalizeMenuButtons();
            programmTrayMenu = new TrayMenu(mainMenu);

            mainMenu.ShowInTaskbar = true;
            System.Windows.Forms.NotifyIcon ni = new System.Windows.Forms.NotifyIcon();
            ni.Icon        = new System.Drawing.Icon(System.IO.Directory.GetCurrentDirectory() + @"/Resourses/trayIco.ico");
            ni.ContextMenu = new System.Windows.Forms.ContextMenu();

            ni.Visible = true;
            ni.Click  +=
                delegate(object x1, EventArgs x2)
            {
                programmTrayMenu.Left = System.Windows.Forms.Cursor.Position.X - programmTrayMenu.Width;
                programmTrayMenu.Top  = System.Windows.Forms.Cursor.Position.Y - programmTrayMenu.Height;
                programmTrayMenu.Show();
            };
        }
Beispiel #10
0
        public MainMenuModel(Contract_Client contract_Client)
        {
            this.contract = contract_Client;

            removeAttachmentCommand   = new RelayCommand((x) => { RemoveAttachment((AttachmentIcon)x); });
            downloadAttachmentCommand = new RelayCommand((x) => { DownloadAttachment(((AttachmentIcon)x)._attachmentData.id); });
            addAttachmentCommand      = new RelayCommand((x) => { AddAttachment(new ShortRequestWithAttachments()
                {
                    attachmentList = new List <ShortAttachmentData>(), Request = new Request()
                }); });
            addAttachmentToWindowCommand = new RelayCommand((x) =>
            {
                AddAttachment(new ShortRequestWithAttachments()
                {
                    attachmentList = new List <ShortAttachmentData>(), Request = new Request()
                });
                AttachmentsList = new ObservableCollection <AttachmentIcon>(contract.GetAttachmentsList().ShortAttachmentList.Select(i => new AttachmentIcon(i, false)));
                attachmentsWindow.AttachmentsField.GetBindingExpression(ItemsControl.ItemsSourceProperty).UpdateTarget();                //its working!!!
            });

            ActualRequestsList = new ObservableCollection <RequestPanel>();
            this.middlePage    = new TasksPage()
            {
                DataContext = this
            };
            InitalizeMenuButtons();
            mainMenu = new MainMenu()
            {
                DataContext = this
            };
            programmTrayMenu = new TrayMenu(mainMenu);


            mainMenu.Show();
            InitalizeIcon();
        }
Beispiel #11
0
 /// <summary>
 /// Creates an instance of the class
 /// </summary>
 /// <param name="owner">item owner</param>
 /// <param name="text">shown caption</param>
 internal TrayMenuTextboxItem(TrayMenu owner, string text) : base(owner, text)
 {
     ItemType = TrayMenuItemType.TextBox;
 }
Beispiel #12
0
 /// <summary>
 /// Creates an instance of the class
 /// </summary>
 /// <param name="owner">item owner</param>
 /// <param name="text">shown caption</param>
 /// <param name="visible">item visibility</param>
 internal TrayMenuButtonItem(TrayMenu owner, string text, bool visible) : base(owner, text, visible)
 {
     ItemType = TrayMenuItemType.Button;
 }
Beispiel #13
0
 /// <summary>
 /// Creates an instance of the class
 /// </summary>
 /// <param name="owner">item owner</param>
 /// <param name="text">shown caption</param>
 internal TrayMenuButtonItem(TrayMenu owner, string text) : base(owner, text)
 {
     ItemType = TrayMenuItemType.Button;
 }
 /// <summary>
 /// Creates an instance of the class
 /// </summary>
 /// <param name="owner">item owner</param>
 /// <param name="text">shown caption</param>
 internal TrayMenuSeparatorItem(TrayMenu owner, string text) : base(owner, text)
 {
     ItemType = TrayMenuItemType.Separator;
 }
 /// <summary>
 /// Creates an instance of the class
 /// </summary>
 /// <param name="owner">item owner</param>
 /// <param name="text">shown caption</param>
 /// <param name="visible">item visibility</param>
 internal TrayMenuProgressItem(TrayMenu owner, string text, bool visible) : base(owner, text, visible)
 {
     ItemType = TrayMenuItemType.Progress;
 }
 /// <summary>
 /// Creates an instance of the class
 /// </summary>
 /// <param name="owner">item owner</param>
 /// <param name="text">shown caption</param>
 internal TrayMenuCloseItem(TrayMenu owner, string text) : base(owner, text)
 {
     ItemType = TrayMenuItemType.Close;
 }
 /// <summary>
 /// Creates an instance of the class
 /// </summary>
 /// <param name="owner">item owner</param>
 /// <param name="text">shown caption</param>
 /// <param name="visible">item visibility</param>
 internal TrayMenuSeparatorItem(TrayMenu owner, string text, bool visible) : base(owner, text, visible)
 {
     ItemType = TrayMenuItemType.Separator;
 }
Beispiel #18
0
 public static void Dispose()
 {
     GameProcess.Dispose();
     TrayMenu.Dispose();
 }
Beispiel #19
0
 /// <summary>
 /// Creates an instance of the class
 /// </summary>
 /// <param name="owner">item owner</param>
 /// <param name="text">shown caption</param>
 /// <param name="visible">item visibility</param>
 internal TrayMenuCheckboxItem(TrayMenu owner, string text, bool visible) : base(owner, text, visible)
 {
     ItemType = TrayMenuItemType.CheckBox;
 }
Beispiel #20
0
 /// <summary>
 /// Creates an instance of the class
 /// </summary>
 /// <param name="owner">item owner</param>
 /// <param name="text">shown caption</param>
 internal TrayMenuCheckboxItem(TrayMenu owner, string text) : base(owner, text)
 {
     ItemType = TrayMenuItemType.CheckBox;
 }
Beispiel #21
0
 /// <summary>
 /// Creates an instance of the class
 /// </summary>
 /// <param name="owner">item owner</param>
 /// <param name="text">shown caption</param>
 /// <param name="visible">item visibility</param>
 internal TrayMenuTextboxItem(TrayMenu owner, string text, bool visible) : base(owner, text, visible)
 {
     ItemType = TrayMenuItemType.TextBox;
 }
 /// <summary>
 /// Creates an instance of the class
 /// </summary>
 /// <param name="owner">item owner</param>
 /// <param name="text">shown caption</param>
 /// <param name="visible">item visibility</param>
 internal TrayMenuCloseItem(TrayMenu owner, string text, bool visible) : base(owner, text, visible)
 {
     ItemType = TrayMenuItemType.Close;
 }
 /// <summary>
 /// Creates an instance of the class
 /// </summary>
 /// <param name="owner">item owner</param>
 /// <param name="text">shown caption</param>
 internal TrayMenuProgressItem(TrayMenu owner, string text) : base(owner, text)
 {
     ItemType = TrayMenuItemType.Progress;
 }