Example #1
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();
        }
Example #2
0
        public static void main(string[] args)
        {
            Application.EnableVisualStyles();
            Application.SetCompatibleTextRenderingDefault(false);

            bool isFirstInstance;

            // Please use a unique name for the mutex to prevent conflicts with other programs
            using (Mutex mtx = new Mutex(true, "MyNotesFree", out isFirstInstance)) {
                if (isFirstInstance)
                {
                    NotificationIcon notificationIcon = new NotificationIcon();
                    notificationIcon.notifyIcon.Visible = true;
                    Application.Run();
                    notificationIcon.notifyIcon.Dispose();
                }
                else
                {
                    // The application is already running
                    // TODO: Display message box or change focus to existing application instance
                }
            }             // releases the Mutex
        }