private void OpenDatabaseView_Show(
            DatabaseMode theMode,
            FileInfo theDatabaseFileInfo)
        {
            // Instantiate an instance
            OpenDatabaseView theView = new OpenDatabaseView(theMode);

            theView.textboxSourceDirectory.Leave +=
                new EventHandler(OpenDatabaseView_textboxSourceDirectory_Leave);
            theView.buttonSourceDirectory.Click += 
                new EventHandler(OpenDatabaseView_buttonSourceDirectory_Click);
            theView.buttonDatabaseFile.Click +=
                new EventHandler(OpenDatabaseView_buttonDatabaseFile_Click);
            theView.buttonOK.Click +=
                new EventHandler(OpenDatabaseView_buttonOK_Click);

            switch (theView.Mode)
            {
                case DatabaseMode.OpenMusicDatabase:
                    theView.Text = "Open Music Database";

                    theView.OpenFileDialog.Filter =
                        "Karakidex Music Databases|*.kmdb";
                    theView.OpenFileDialog.DefaultExt =
                        "kmdb";
                    break;
                default:
                    theView.Text = "Open Karaoke Database";

                    theView.OpenFileDialog.Filter =
                        "Karakidex Karaoke Databases|*.kkdb";
                    theView.OpenFileDialog.DefaultExt =
                        "kkdb";
                    break;
            }

            if (theDatabaseFileInfo.Exists)
            {
                theView.textboxDatabaseFile.Text =
                    theDatabaseFileInfo.FullName;

                theView.textboxSourceDirectory.Text =
                    DatabaseLayer.GetSourceDirectory(
                        new FileInfo(theDatabaseFileInfo.FullName));

                Controller.IsViewValid(theView);
            }

            // Show the form
            theView.ShowDialog(this._MainView);
        }
        private void OpenDatabaseView_Show(
            DatabaseMode theMode)
        {
            // Instantiate an instance
            OpenDatabaseView theView = new OpenDatabaseView(theMode);

            theView.textboxDatabaseFile.Leave += 
                new EventHandler(OpenDatabaseView_textboxDatabaseFile_Leave);
            theView.buttonDatabaseFile.Click +=
                new EventHandler(OpenDatabaseView_buttonDatabaseFile_Click);
            theView.textboxSourceDirectory.Leave += 
                new EventHandler(OpenDatabaseView_textboxSourceDirectory_Leave);
            theView.buttonSourceDirectory.Click +=
                new EventHandler(OpenDatabaseView_buttonSourceDirectory_Click);
            theView.buttonOK.Click +=
                new EventHandler(OpenDatabaseView_buttonOK_Click);

            switch (theMode)
            {
                case DatabaseMode.OpenMusicDatabase:
                    theView.OpenFileDialog.Filter =
                        "Karakidex Music Databases|*.kmdb";
                    theView.OpenFileDialog.DefaultExt =
                        "kmdb";
                    break;
                default:
                    theView.OpenFileDialog.Filter =
                        "Karakidex Karaoke Databases|*.kkdb";
                    theView.OpenFileDialog.DefaultExt =
                        "kkdb";
                    break;
            }

            // Show the form
            theView.ShowDialog(this._MainView);
        }
        private static void IsViewValid(
            OpenDatabaseView theView)
        {
            theView.buttonOK.Enabled = false;

            if (String.IsNullOrEmpty(theView.textboxSourceDirectory.Text) ||
                String.IsNullOrEmpty(theView.textboxDatabaseFile.Text))
            {
                return;
            }

            if (!File.Exists(theView.textboxDatabaseFile.Text))
            {
                MessageBox.Show(
                    theView,
                    "The database file specified does not exist",
                    theView.Text,
                    MessageBoxButtons.OK,
                    MessageBoxIcon.Stop,
                    MessageBoxDefaultButton.Button1);

                Application.DoEvents();
                return;
            } 
            if (!Directory.Exists(theView.textboxSourceDirectory.Text))
            {
                MessageBox.Show(
                    theView,
                    "The source directory specified does not exist",
                    theView.Text,
                    MessageBoxButtons.OK,
                    MessageBoxIcon.Stop,
                    MessageBoxDefaultButton.Button1);

                Application.DoEvents();
                return;
            }

            theView.buttonOK.Enabled = true;
        }