Beispiel #1
0
        /// <summary> Performs all of the querying to determine if this application needs to be
        /// updated, queries the user, and updates as necessary. </summary>
        /// <returns> TRUE if it is updating, otherwise FALSE </returns>
        /// <example> To see examples, look at the examples listed under the main <see cref="VersionChecker"/> class. </example>
        public bool UpdateAsNecessary()
        {
            // Check to see if an update exists
            if (UpdateExists())
            {
                // LDetermine if the update is mandatory or not
                if (UpdateMandatory())
                {
                    System.Windows.Forms.MessageBox.Show("There is a new version of this application which must be installed.      \n\n"
                                                         + "Please stand by as the installation software is launched.        \n\nIf you are not an administrator on this machine, please ask your supervisor to update this.       ", "New Version Needed",
                                                         System.Windows.Forms.MessageBoxButtons.OK, System.Windows.Forms.MessageBoxIcon.Information);

                    // Start the Setup files to update this application and then exit
                    Update();
                }
                else
                {
                    // A non-mandatory update exists
                    System.Windows.Forms.DialogResult update = System.Windows.Forms.MessageBox.Show("A newer version of this software is available.            \n\nWould you like to upgrade now?",
                                                                                                    "New Version Available", System.Windows.Forms.MessageBoxButtons.YesNo, System.Windows.Forms.MessageBoxIcon.Question);
                    if (update.Equals(System.Windows.Forms.DialogResult.Yes))
                    {
                        // Start the Setup files to update this application and then exit
                        Update();
                    }
                }
            }

            // Return the updating flag
            return(updating);
        }
Beispiel #2
0
        void exportJobLogMenuItem_Click(object sender, RoutedEventArgs e)
        {
            object selectedItem = this.SyncHistoryListBox.SelectedItem;

            if (selectedItem != null)
            {
                string      jobId       = this.syncRecordDict[(ListBoxItem)selectedItem];
                SyncSetting syncSetting = SyncRecord.LoadSyncSettingByJobId(jobId);
                if (syncSetting != null)
                {
                    System.Windows.Forms.SaveFileDialog dlg = new System.Windows.Forms.SaveFileDialog();
                    dlg.Title  = "选择保存文件";
                    dlg.Filter = "Log (*.log)|*.log";

                    System.Windows.Forms.DialogResult dr = dlg.ShowDialog();
                    if (dr.Equals(System.Windows.Forms.DialogResult.OK))
                    {
                        string logSaveFilePath = dlg.FileName;
                        LogExporter.exportLog(
                            Path.Combine(this.myAppPath, "logs", jobId, "success.log"),
                            Path.Combine(this.myAppPath, "logs", jobId, "error.log"),
                            Path.Combine(this.myAppPath, "logs", jobId, "skipped.log"),
                            Path.Combine(this.myAppPath, "logs", jobId, "exists.log"),
                            Path.Combine(this.myAppPath, "logs", jobId, "not_overwrite.log"),
                            Path.Combine(this.myAppPath, "logs", jobId, "overwrite.log"),
                            logSaveFilePath);
                    }
                }
            }
        }
        private void BPickFolder_Click(object sender, RoutedEventArgs e)
        {
            ValidFolder = false;
            using (var dialog = new System.Windows.Forms.FolderBrowserDialog())
            {
                dialog.Description = "Choose a Folder for your Project";
                if (Properties.Settings.Default.LastProjectFolder != string.Empty)
                {
                    if (System.IO.Directory.Exists(Properties.Settings.Default.LastProjectFolder))
                    {
                        dialog.SelectedPath = Properties.Settings.Default.LastProjectFolder;
                    }
                }

                System.Windows.Forms.DialogResult result = dialog.ShowDialog();
                if (result.Equals(System.Windows.Forms.DialogResult.OK))
                {
                    FolderName = TBFoldername.Text = dialog.SelectedPath;
                    if (TBFoldername.Text.Length > 0)
                    {
                        ValidFolder = true;
                    }
                }
            }
            BContinue.IsEnabled = ValidProject();
        }
Beispiel #4
0
        private void FolderBtn_Click(object sender, RoutedEventArgs e)
        {
            var dlg = new System.Windows.Forms.FolderBrowserDialog();

            System.Windows.Forms.DialogResult result = dlg.ShowDialog();
            if (result.Equals(System.Windows.Forms.DialogResult.OK))
            {
                Properties.Settings.Default["Path"] = dlg.SelectedPath;
                pathTxt.Text = dlg.SelectedPath;
                Properties.Settings.Default.Save();
            }
        }
 private void browsPath_Click(object sender, RoutedEventArgs e)
 {
     System.Windows.Forms.FolderBrowserDialog savePath = new System.Windows.Forms.FolderBrowserDialog();
     savePath.Description         = "Select the directory that you want to use as the default.";
     savePath.ShowNewFolderButton = true;
     savePath.RootFolder          = Environment.SpecialFolder.Desktop;
     System.Windows.Forms.DialogResult folderResult = savePath.ShowDialog();
     if (folderResult.Equals(System.Windows.Forms.DialogResult.OK))
     {
         Properties.Settings.Default.backupPath = savePath.SelectedPath;
         this.backupPathText.Text = savePath.SelectedPath;
     }
 }
Beispiel #6
0
 //General Brows Button click Event
 private void GeneralButtonBrowsCLick(object sender, System.Windows.RoutedEventArgs e)
 {
     System.Windows.Forms.FolderBrowserDialog genearlFolderBrowser = new System.Windows.Forms.FolderBrowserDialog();
     genearlFolderBrowser.Description = "Select a folder to save your backup file";
     genearlFolderBrowser.RootFolder  = System.Environment.SpecialFolder.Desktop;
     System.Windows.Forms.DialogResult generalDialogResult = genearlFolderBrowser.ShowDialog();
     if (generalDialogResult.Equals(System.Windows.Forms.DialogResult.OK))
     {
         this.generalLabelSavePath.Text           = genearlFolderBrowser.SelectedPath;
         Properties.Settings.Default.LastSavePath = genearlFolderBrowser.SelectedPath;
         Properties.Settings.Default.Save();
     }
 }
Beispiel #7
0
        private void ExportLog_EventHandler(object sender, RoutedEventArgs e)
        {
            System.Windows.Forms.SaveFileDialog dlg = new System.Windows.Forms.SaveFileDialog();
            dlg.Title  = "选择保存文件";
            dlg.Filter = "Log (*.log)|*.log";

            System.Windows.Forms.DialogResult dr = dlg.ShowDialog();
            if (dr.Equals(System.Windows.Forms.DialogResult.OK))
            {
                string logFilePath = dlg.FileName;
                LogExporter.exportLog(this.fileUploadSuccessLogPath,
                                      this.fileUploadErrorLogPath,
                                      this.fileSkippedLogPath,
                                      this.fileExistsLogPath,
                                      this.fileNotOverwriteLogPath,
                                      this.fileOverwriteLogPath, logFilePath);
            }
        }
        private void browse(object sender, RoutedEventArgs e)
        {
            //Microsoft.Win32.OpenFileDialog dlg = new Microsoft.Win32.OpenFileDialog();
            System.Windows.Forms.FolderBrowserDialog dlg = new System.Windows.Forms.FolderBrowserDialog();
            dlg.RootFolder          = System.Environment.SpecialFolder.MyDocuments;
            dlg.ShowNewFolderButton = false;

            // Set filter for file extension and default file extension
            //dlg.DefaultExt = ".jpg";
            //dlg.Filter = "JPEG Files (*.jpeg)|*.jpeg|PNG Files (*.png)|*.png|JPG Files (*.jpg)|*.jpg|GIF Files (*.gif)|*.gif";

            // Display OpenFileDialog by calling ShowDialog method
            System.Windows.Forms.DialogResult result = dlg.ShowDialog();

            // Get the selected file name and display in a TextBox
            if (result.Equals(System.Windows.Forms.DialogResult.OK))
            {
                string pathName = dlg.SelectedPath;
                path.Text = pathName;
            }
        }
Beispiel #9
0
        /// <summary>
        /// Allows the game to run logic such as updating the world,
        /// checking for collisions, gathering input, and playing audio.
        /// </summary>
        /// <param name="gameTime">Provides a snapshot of timing values.</param>
        protected override void Update(GameTime gameTime)
        {
            // Allows the game to exit
            if (GamePad.GetState(PlayerIndex.One).Buttons.Back == ButtonState.Pressed)
            {
                this.Exit();
            }

            // TODO: Add your update logic here
            if (gameState == GameState.Game)
            {
                if (board.IsGameOver && board.IsGameQuit == false)
                {
                    if (endOfGame == 0)
                    {
                        endOfGame = gameTime.TotalGameTime.Seconds;
                    }
                    else
                    {
                        if (endOfGame + 3 < gameTime.TotalGameTime.Seconds)
                        {
                            endOfGame = 0;
                            System.Windows.Forms.DialogResult result = System.Windows.Forms.MessageBox.Show("Would you like to start a new game?", "New Game", System.Windows.Forms.MessageBoxButtons.YesNo);
                            if (result.Equals(System.Windows.Forms.DialogResult.Yes))
                            {
                                board     = null;
                                gameState = GameState.Game;
                                CreateChessGame();
                            }
                            else
                            {
                                board     = null;
                                gameState = GameState.Menu;
                            }
                        }
                    }
                }
                else if (board.IsGameQuit)
                {
                    System.Windows.Forms.DialogResult result = System.Windows.Forms.MessageBox.Show("Would you like to start a new game?", "New Game", System.Windows.Forms.MessageBoxButtons.YesNo);
                    if (result.Equals(System.Windows.Forms.DialogResult.Yes))
                    {
                        board     = null;
                        gameState = GameState.Game;
                        CreateChessGame();
                    }
                    else
                    {
                        board     = null;
                        gameState = GameState.Menu;
                    }
                }
                else
                {
                    board.Update(gameTime);
                }
            }
            else if (gameState == GameState.Menu)
            {
                if (menu.PlayClicked)
                {
                    //Reset Game Then Start it
                    gameState        = GameState.Game;
                    menu.PlayClicked = false;
                    CreateChessGame();
                }
                else if (menu.QuitClicked)
                {
                    this.Exit();
                }
                menu.Update(gameTime);
            }

            base.Update(gameTime);
        }