BaconBuilder.View.MainWindow.MainWindow_FormClosing C# (CSharp) Method

MainWindow_FormClosing() private method

Called when the form is closing. Prompts the user for synchronisation. Creates an FTP uploader to sync the webserver with the working directory.
private MainWindow_FormClosing ( object sender, FormClosingEventArgs e ) : void
sender object
e System.Windows.Forms.FormClosingEventArgs
return void
        private void MainWindow_FormClosing(object sender, FormClosingEventArgs e)
        {
            string uri;
            _hasConnection = ConnectionExists(out uri);
            if (!_hasConnection)
            {
                MessageBox.Show(string.Format("Could not connect to {0}", uri), "Error");
                return;
            }
            // Promp user.
            DialogResult result =
                MessageBox.Show(
                    @"Would you like to synchronise your content with the distribution server before exiting?",
                    @"Confirm", MessageBoxButtons.YesNoCancel, MessageBoxIcon.Question, MessageBoxDefaultButton.Button3);

            // Sync at user behest.
            if (result == DialogResult.Yes)
            {
                LogGenerator.CreateContentLog();
                var ftpDialog = new SyncDialog(new SyncInfo(Resources.ContentDirectory, "Content/", SyncJobType.Upload));
                ftpDialog.ShowDialog();
            }

            // Cancel if this was all a horrible mistake.
            if (result == DialogResult.Cancel)
                e.Cancel = true;
        }