AniDBmini.OptionsWindow.MPCBrowseOnClick C# (CSharp) Method

MPCBrowseOnClick() private method

private MPCBrowseOnClick ( object sender, RoutedEventArgs e ) : void
sender object
e System.Windows.RoutedEventArgs
return void
        private void MPCBrowseOnClick(object sender, RoutedEventArgs e)
        {
            string pFilesPath = Environment.GetFolderPath(Environment.SpecialFolder.ProgramFiles);
            Microsoft.Win32.OpenFileDialog dlg = new Microsoft.Win32.OpenFileDialog();
            dlg.Filter = "MPC-HC main executable|mpc-hc.exe;mpc-hc64.exe";
            dlg.InitialDirectory = !string.IsNullOrWhiteSpace(mpchcLocationTextBox.Text) ? mpchcLocationTextBox.Text :
                                   (System.IO.Directory.Exists(pFilesPath + @"\Media Player Classic - Home Cinema") ?
                                   pFilesPath + @"\Media Player Classic - Home Cinema" : pFilesPath);

            Nullable<bool> result = dlg.ShowDialog();

            if (result == true)
            {
                if (System.IO.Path.GetFileNameWithoutExtension(dlg.FileName) == "mpc-hc64" && IntPtr.Size == 4)
                    MessageBox.Show(String.Format("Media Player Classic - Home Cinema 64bit will not work\nwith the 32bit version of {0}.\n\n" +
                                    "Please use the 64bit version of {0}.\nOr use the 32bit version of Media Player Classic - Home Cinema.",  MainWindow.m_AppName),
                                    "Alert!", MessageBoxButton.OK, MessageBoxImage.Exclamation);
                else
                    mpchcLocationTextBox.Text = dlg.FileName;
            }
        }