Пример #1
0
        private void updateMenuItem_Click(object sender, EventArgs e)
        {
            if (!System.IO.Directory.Exists(Application.StartupPath + "//Items"))
            {
                System.IO.Directory.CreateDirectory(Application.StartupPath + "//Items");
            }

            if (itemSaved == false && this.basicRow.askSaveToFile == true)
            {
                //Message: Save Item
                DialogResult dialog = MessageBox.Show(Locales.GetString("save_item_ask"), Locales.GetString("save_item_title"), MessageBoxButtons.YesNoCancel, MessageBoxIcon.Question);

                //User klickt ja
                if (dialog == DialogResult.Yes)
                {
                    saveItem(null, null);
                }
                else if (dialog == DialogResult.Cancel)
                {
                    return;
                }
            }

            updaterForm  updaterFormular = new updaterForm(this);
            DialogResult result          = updaterFormular.ShowDialog();

            if (result == DialogResult.Cancel)
            {
                if (updaterFormular.startUpdater == true)
                {
                    try
                    {
                        // Shut down the current app instance
                        Application.ExitThread();
                        System.Diagnostics.Process.Start(Application.StartupPath + "//ItemCreatorUpdater.exe");
                    }
                    catch (Exception ex)
                    {
                        MessageBox.Show(ex.Message);
                    }
                }
                else if (updaterFormular.restartApp == true)
                {
                    try
                    {
                        // Shut down the current app instance
                        Application.Restart();
                    }
                    catch (Exception ex)
                    {
                        MessageBox.Show(ex.Message);
                    }
                }
            }
        }
Пример #2
0
        public MainForm()
        {
            //Locales
            this.Locales = new System.Resources.ResourceManager("ItemCreator.Resources.winFormStrings", typeof(MainForm).Assembly);

            SplashScreen splash = new SplashScreen();

            splash.Show();
            splash.updateState(Locales.GetString("splash_loading"), 0);

            System.Threading.Thread.CurrentThread.CurrentUICulture = new System.Globalization.CultureInfo(Properties.Settings.Default.language);
            InitializeComponent();

            //Set language Menu
            this.setLanguagesMenu();

            //Hole alle Daten aus base.xml und lade sie in das From
            splash.updateState(Locales.GetString("splash_loading_xml"), 25);
            bool loadComboBoxesCheck = loadComboBoxes();

            //if (loadComboBoxesCheck == false) Application.ExitThread();

            splash.updateState(Locales.GetString("splash_loading_preferences"), 50);
            loadPreferences();

            splash.updateState(Locales.GetString("splash_checking_mysql_settings"), 75);
            setMysqlConnection();

            //Überprüfe nach neuen Verisonen wenn erwünscht
            if (basicRow.checkApplicationUpdates || basicRow.checkDatabaseUpdates)
            {
                splash.updateState(Locales.GetString("splash_checking_versions"), 85);

                updaterForm updater = new updaterForm(this);
                updater.checkVersions();
                if ((basicRow.checkApplicationUpdates && updater.IsNewApplicationVersionAvailable()) || (basicRow.checkDatabaseUpdates && updater.IsNewDatabaseUpdateAvailable()))
                {
                    //Message: New versions of Application or Databases are available!
                    MessageBox.Show(Locales.GetString("updater_new_versions_are_available"), Locales.GetString("updater_new_versions_are_available_title"), MessageBoxButtons.OK, MessageBoxIcon.Information);
                }
                updater.Dispose();
            }

            splash.updateState(Locales.GetString("splash_starting"), 100);
            splash.Close();
            splash.Dispose();

            this.versionInformation.Text = "v" + Application.ProductVersion;
        }
Пример #3
0
        public MainForm()
        {
            //Locales
            this.Locales = new System.Resources.ResourceManager("ItemCreator.Resources.winFormStrings", typeof(MainForm).Assembly);

            SplashScreen splash = new SplashScreen();
            splash.Show();
            splash.updateState(Locales.GetString("splash_loading"), 0);

            System.Threading.Thread.CurrentThread.CurrentUICulture = new System.Globalization.CultureInfo(Properties.Settings.Default.language);
            InitializeComponent();

            //Set language Menu
            this.setLanguagesMenu();

            //Hole alle Daten aus base.xml und lade sie in das From
            splash.updateState(Locales.GetString("splash_loading_xml"), 25);
            bool loadComboBoxesCheck = loadComboBoxes();
            //if (loadComboBoxesCheck == false) Application.ExitThread();

            splash.updateState(Locales.GetString("splash_loading_preferences"), 50);
            loadPreferences();

            splash.updateState(Locales.GetString("splash_checking_mysql_settings"), 75);
            setMysqlConnection();

            //Überprüfe nach neuen Verisonen wenn erwünscht
            if (basicRow.checkApplicationUpdates || basicRow.checkDatabaseUpdates)
            {
                splash.updateState(Locales.GetString("splash_checking_versions"), 85);

                updaterForm updater = new updaterForm(this);
                updater.checkVersions();
                if ((basicRow.checkApplicationUpdates && updater.IsNewApplicationVersionAvailable()) || (basicRow.checkDatabaseUpdates && updater.IsNewDatabaseUpdateAvailable()))
                {
                    //Message: New versions of Application or Databases are available!
                    MessageBox.Show(Locales.GetString("updater_new_versions_are_available"), Locales.GetString("updater_new_versions_are_available_title"), MessageBoxButtons.OK, MessageBoxIcon.Information);
                }
                updater.Dispose();
            }

            splash.updateState(Locales.GetString("splash_starting"), 100);
            splash.Close();
            splash.Dispose();

            this.versionInformation.Text = "v" + Application.ProductVersion;
        }
Пример #4
0
        private void updateMenuItem_Click(object sender, EventArgs e)
        {
            if (!System.IO.Directory.Exists(Application.StartupPath + "//Items"))
            {
                System.IO.Directory.CreateDirectory(Application.StartupPath + "//Items");
            }

            if (itemSaved == false && this.basicRow.askSaveToFile == true)
            {
                //Message: Save Item
                DialogResult dialog = MessageBox.Show(Locales.GetString("save_item_ask"), Locales.GetString("save_item_title"), MessageBoxButtons.YesNoCancel, MessageBoxIcon.Question);

                //User klickt ja
                if (dialog == DialogResult.Yes)
                {
                    saveItem(null, null);
                }
                else if (dialog == DialogResult.Cancel)
                {
                    return;
                }
            }

            updaterForm updaterFormular = new updaterForm(this);
            DialogResult result = updaterFormular.ShowDialog();
            if (result == DialogResult.Cancel)
            {
                if (updaterFormular.startUpdater == true)
                {
                    try
                    {
                        // Shut down the current app instance
                        Application.ExitThread();
                        System.Diagnostics.Process.Start(Application.StartupPath + "//ItemCreatorUpdater.exe");
                    }
                    catch (Exception ex)
                    {
                        MessageBox.Show(ex.Message);
                    }
                }
                else if (updaterFormular.restartApp == true)
                {
                    try
                    {
                        // Shut down the current app instance
                        Application.Restart();
                    }
                    catch (Exception ex)
                    {
                        MessageBox.Show(ex.Message);
                    }
                }
            }
        }