Exemplo n.º 1
0
        async void startup_sequence()
        {
            #region Aktualizační a inicializační sekvence
            if (System.IO.Directory.Exists(System.Windows.Forms.Application.StartupPath + @"\temp"))
            {
                System.IO.Directory.Delete(System.Windows.Forms.Application.StartupPath + @"\temp", true);
            }

            if (Properties.Settings.Default.update)
            {
                await core.updatecheck(true);

                this.Dispatcher.Invoke(System.Windows.Threading.DispatcherPriority.Background, new System.Threading.ThreadStart(delegate
                {
                    if (core.updatedata.server_status == "up" & core.updatedata.update == true)
                    {
                        if (core.updatedata.updatetype == "program")
                        {
                            Application.Current.MainWindow.Hide(); Window updatedialog = new updater(); updatedialog.ShowDialog(); Application.Current.MainWindow.Show();
                        }
                        else if (core.updatedata.updatetype == "database")
                        {
                            core.databaseupdate();
                        }
                        else if (core.updatedata.updatetype == "both")
                        {
                            core.databaseupdate(); Window updatedialog = new updater(); updatedialog.Owner = Application.Current.MainWindow; updatedialog.ShowDialog(); Application.Current.MainWindow.Show();
                        }
                    }
                }));
            }

            #endregion
        }
Exemplo n.º 2
0
        private async void updatecheck_Click(object sender, RoutedEventArgs e)
        {
            updatecheck.IsEnabled = false;
            await core.updatecheck(true);

            if (core.updatedata.server_status == "up" & core.updatedata.update == true)
            {
                if (core.updatedata.updatetype == "program")
                {
                    Application.Current.MainWindow.Hide(); Window updatedialog = new updater(); updatedialog.ShowDialog(); Application.Current.MainWindow.Show();
                }
                else if (core.updatedata.updatetype == "database")
                {
                    core.databaseupdate(); MessageBox.Show(languages.messages.dbupdated.text, languages.messages.dbupdated.title, MessageBoxButton.OK, MessageBoxImage.Information); core.dbconnect(); core.sqlite.Close(); dbver.Content = Core.core.database_ver[Core.core.database_ver.Length - 3] + "." + Core.core.database_ver[Core.core.database_ver.Length - 2] + "." + Core.core.database_ver[Core.core.database_ver.Length - 1];
                }
                else if (core.updatedata.updatetype == "both")
                {
                    core.databaseupdate(); Application.Current.MainWindow.Hide(); Window updatedialog = new updater(); updatedialog.Owner = Application.Current.MainWindow; updatedialog.ShowDialog(); Application.Current.MainWindow.Show();
                }
            }
            else if (core.updatedata.update == false)
            {
                MessageBox.Show(languages.messages.no_update.text, languages.messages.no_update.title, MessageBoxButton.OK, MessageBoxImage.Information);
            }
            else
            {
                MessageBox.Show(languages.messages.server_down.text, languages.messages.server_down.title, MessageBoxButton.OK, MessageBoxImage.Warning);
            }
            updatecheck.IsEnabled = true;
        }