Exemple #1
0
 /// <summary>
 /// The tools settings_ click.
 /// </summary>
 /// <param name="sender">The sender.</param>
 /// <param name="e">The e.</param>
 /// <remarks></remarks>
 private void toolsSettings_Click(object sender, EventArgs e)
 {
     Settings settings = new Settings();
     settings.ShowDialog();
 }
Exemple #2
0
        /// <summary>
        /// Initializes a new instance of the <see cref="Form1"/> class.
        /// </summary>
        /// <remarks></remarks>
        public Form1()
        {
            InitializeComponent();

            // Hopefully this will fix the sorting issues on Vista (7 too?). XP looks fine.
            this.tsPanelTop.Controls.Clear();
            this.tsPanelTop.Controls.Add(this.mainMenu1);
            this.tsPanelTop.Controls.Add(this.menuStrip1);
            this.tsPanelTop.Controls.Add(this.menuStripDebug);

            // Locks the toolbars in place. Left unlocked at design time for easy editing
            this.tsPanelTop.Locked = true;
            updateMenuStripLock();

            this.Text = Assembly.GetExecutingAssembly().GetName().Name + "  " +
                        Assembly.GetExecutingAssembly().GetName().Version.Major + "." +
                        Assembly.GetExecutingAssembly().GetName().Version.Minor + "." +
                        Assembly.GetExecutingAssembly().GetName().Version.Build;

            // load preferences & add recently opened files to Menu List
            if (Prefs.Load())
            {
                this.AddRecentFilesToMenu();
            }
            else
            {
                MessageBox.Show(
                        "Error: \"" + Prefs.FilePath + "\" not found.\n" +
                        "Please setup default map directories first.");
                Settings settings = new Settings();
                settings.ShowDialog();
            }

            #region Try to load the selected skin here & show an error ONCE if it fails (not while debugging)
            #if !DEBUG
            try
            {
                StreamReader SettingsStreamReader = new StreamReader(Global.StartupPath + "\\Skins\\Settings.xml");
                SettingsStreamReader.Close();
            }
            catch (Exception ex)
            {
                Global.ShowErrorMsg("There was an error while loading the skin",ex);
            }
            #endif
            #endregion

            #region check Update

            bool checkUpdate = false;
            TimeSpan tSpan;
            tSpan = DateTime.Now.Subtract(Prefs.lastCheck);
            switch (Prefs.checkUpdate)
            {
                case Prefs.updateFrequency.Always:
                    checkUpdate = true;
                    break;
                case Prefs.updateFrequency.Daily:
                    if (tSpan.Days > 0)
                    {
                        checkUpdate = true;
                    }

                    break;
                case Prefs.updateFrequency.Weekly:
                    if (tSpan.Days > 6)
                    {
                        checkUpdate = true;
                    }

                    break;
                case Prefs.updateFrequency.Monthly:
                    if (tSpan.Days > 30)
                    {
                        checkUpdate = true;
                    }

                    break;
            }

            if (checkUpdate)
            {
                Thread thr = new Thread(IsThereAnUpdate);
                thr.Start(false);
            }

            #endregion

            #region Load available plugins
            this.LoadPlugins();
            #endregion

            #region Load any dropped maps

            string[] temp = Environment.GetCommandLineArgs();
            if (temp.Length > 1)
            {
                TryLoadMapForm(temp[1]);
            }

            #endregion
        }