Esempio n. 1
0
        void settingMI_Click(object sender, EventArgs e)
        {
            MainSettingForm msf = new MainSettingForm(u, this.im);

            FormCollection fc      = Application.OpenForms;
            bool           already = false;

            foreach (Form frm in fc)
            {
                if (frm is MainSettingForm)
                {
                    already = true;
                }
            }

            if (!already)
            {
                msf.Show();
                msf.BringToFront();
            }
        }
Esempio n. 2
0
        public TaskBarMenu()
        {
            InitializeComponent();

            im = new ItemManager(mainMenuItems);

            ItemContainerSaving.loadAllItems(im);

            trayMenu = new ContextMenu();
            MenuItem toMainProgress = new MenuItem("Main Menu");
            MenuItem settingMI      = new MenuItem("Settings");
            MenuItem aboutMI        = new MenuItem("About...");

            exitMI = new MenuItem("Exit");

            toMainProgress.Click += toMainProgressAction;
            exitMI.Click         += exitApp;
            settingMI.Click      += settingMI_Click;
            aboutMI.Click        += aboutMI_Click;
            trayMenu.MenuItems.Add(toMainProgress);
            trayMenu.MenuItems.Add(settingMI);
            trayMenu.MenuItems.Add(aboutMI);
            trayMenu.MenuItems.Add(exitMI);
            // Create a tray icon. In this example we use a
            // standard system icon for simplicity, but you
            // can of course use your own custom icon too.
            trayIcon      = new NotifyIcon();
            trayIcon.Text = "OSRS Progress Tracker";

            trayIcon.Icon = new Icon(Resources.Spellbook_Swap_icon, 40, 40);

            // Add menu to tray icon and show it.
            trayIcon.ContextMenu = trayMenu;
            trayIcon.Visible     = true;


            //LOAD SETTINGS
            u = new UserSettings();
            if (SaveSettings.loadSettings() != null)
            {
                u = SaveSettings.loadSettings();
            }
            else
            {
                SaveSettings.saveSettings(this.u);
            }
            welcomeNotification();

            if (u.firstBootup)
            {
                DialogResult dialogResult = MessageBox.Show("Hello and welcome to the OSRS Progress Tracker, would you like your username tracked for some extra functionality?", "Welcome!", MessageBoxButtons.YesNo);
                if (dialogResult == DialogResult.Yes)
                {
                    MainSettingForm msf = new MainSettingForm(u, this.im);

                    FormCollection fc      = Application.OpenForms;
                    bool           already = false;
                    foreach (Form frm in fc)
                    {
                        if (frm is MainSettingForm)
                        {
                            already = true;
                        }
                    }

                    if (!already)
                    {
                        msf.Show();
                        msf.BringToFront();
                    }
                    //FirstTimeEntry fte = new FirstTimeEntry();

                    //fte.Show();
                    //fte.TopMost = true;

                    //do something
                }
                else if (dialogResult == DialogResult.No)
                {
                    u.firstBootup = false;
                    FormCollection fc      = Application.OpenForms;
                    MainMenu       mm      = new MainMenu(this.im, new Point(300, 300), this.u);
                    bool           already = false;
                    foreach (Form frm in fc)
                    {
                        already = true;
                    }

                    if (!already)
                    {
                        mm.fillMenu();
                        mm.Show();
                        mm.BringToFront();
                    }
                }
            }
            else
            {
                MainMenu mm = new MainMenu(this.im, new Point(300, 300), this.u);
                mm.fillMenu();
                mm.Show();
                mm.BringToFront();
            }
        }