Exemplo n.º 1
0
        public static void Main(string[] astrArg)
        {
            ContextMenu cm;
            MenuItem    miCurr;
            int         iIndex = 0;

            // Kontextmenü erzeugen
            cm = new ContextMenu();

            // Kontextmenüeinträge erzeugen
            miCurr        = new MenuItem();
            miCurr.Index  = iIndex++;
            miCurr.Text   = "&Open";         // Eigenen Text einsetzen
            miCurr.Click += new System.EventHandler(OpenClick);
            cm.MenuItems.Add(miCurr);

            // Kontextmenüeinträge erzeugen
            miCurr        = new MenuItem();
            miCurr.Index  = iIndex++;
            miCurr.Text   = "&Close";
            miCurr.Click += new System.EventHandler(ExitClick);
            cm.MenuItems.Add(miCurr);

            // NotifyIcon selbst erzeugen
            NotifyIcon              = new NotifyIcon();
            NotifyIcon.Icon         = new Icon("logo.ico"); // Eigenes Icon einsetzen
            NotifyIcon.Text         = "ElvUI Update";       // Eigenen Text einsetzen
            NotifyIcon.Visible      = true;
            NotifyIcon.ContextMenu  = cm;
            NotifyIcon.DoubleClick += new EventHandler(OpenClick);

            Config = new Config(Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "config.ini"));
            ElvUI  = new ElvUI();

            MainWindow = new Main();
            MainWindow.Show();

            if (bool.Parse(Config.Read("Settings", "AutostartCheck")))
            {
                ElvUI.Start();
            }

            // Ohne Appplication.Run geht es nicht
            Application.Run(MainWindow);
        }