Beispiel #1
0
        //Controla a exibição do formulário através da tecla de atalho ou TrayIcon
        private void NotificationIconClick(object sender, EventArgs e)
        {
            if ((e == null) || ((e is MouseEventArgs) && ((MouseEventArgs)e).Button == MouseButtons.Left))
            {
                IntPtr hand = WinNoteApi.GetForegroundWindow();

                iconMenuMinimizar.Text = "&Minimizar";
                Form form = Application.OpenForms["frPrincipal"];
                if (!form.Visible)
                {
                    form.Visible     = true;
                    form.WindowState = formState;
                    WinNoteApi.ForceForegroundWindow(form.Handle);
                    reText.Focus();
                }
                else if (!form.Handle.Equals(hand) && sender == null)
                {
                    WinNoteApi.ForceForegroundWindow(form.Handle);
                    reText.Focus();
                }
                else
                {
                    formState              = form.WindowState;
                    form.Visible           = false;
                    iconMenuMinimizar.Text = "&Restaurar";
                }
            }
        }
Beispiel #2
0
        public frPrincipal()
        {
            InitializeComponent();

            if (!WinNoteApi.RegisterHotKey(this.Handle, 0, (int)WinNoteApi.KeyModifier.Alt + (int)WinNoteApi.KeyModifier.Control, Keys.N.GetHashCode()))
            {
                MessageBox.Show("Could not register CTRL + ALT + N hotkey! \n :(", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
            notifyIcon = new NotifyIcon();

            notifyIcon.DoubleClick += NotificationIconClick;
            notifyIcon.Click       += NotificationIconClick;
            var resources = new System.ComponentModel.ComponentResourceManager(typeof(NotificationIcon));

            notifyIcon.Icon             = this.Icon;
            notifyIcon.Text             = "MyNotesFree.net";
            notifyIcon.ContextMenuStrip = iconMenu;

            NotificationIcon notificationIcon = new NotificationIcon();

            notifyIcon.Visible = true;

            this.Text += Application.ProductVersion;

            populate_lvAnnotations();
            populate_Categories();

            populateToolbarValues();

            populateColorButtons();

            //TODO: Temporário
            lvAnnotations.Items[0].Selected = true;

            currentBackColor = reText.BackColor;
            currentForeColor = reText.ForeColor;

            LoadPositions();
        }
Beispiel #3
0
 void FrPrincipalFormClosed(object sender, FormClosedEventArgs e)
 {
     notifyIcon.Dispose();
     WinNoteApi.UnregisterHotKey(this.Handle, 0);
 }