Win.CodeNavi.frmMain.frmMain_FormClosing C# (CSharp) Method

frmMain_FormClosing() private method

Handle the form closing
private frmMain_FormClosing ( object sender, FormClosingEventArgs e ) : void
sender object
e FormClosingEventArgs
return void
        private void frmMain_FormClosing(object sender, FormClosingEventArgs e)
        {
            // When the application is exiting, write the application data to the
            // user file and close it.

            if (this.MdiChildren.Count() > 0)
            {
                if (MessageBox.Show("You have open windows, are you sure you wish to exit?", "Do you want to save?", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == System.Windows.Forms.DialogResult.No)
                {
                    try
                    {
                        e.Cancel = true;
                    }
                    catch (Exception)
                    {

                    }
                }
            }

            if (bNotesPending == true)
            {
                if (MessageBox.Show("There are unsaved changes to your notes would you like to save them now?", "Do you want to save?", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == System.Windows.Forms.DialogResult.Yes)
                {
                    try
                    {
                        richNotes.SaveFile(Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments) + "\\NCCCodeNavi.rtf");
                    }
                    catch (Exception)
                    {

                    }
                }
            }

            //if(workerThread.IsAlive){
            //    workerThread.Abort();
            //}
            if (workerThreadV.IsAlive)
            {
                workerThreadV.Abort();
            }
        }