BIMSource.SPWriter.MainWindow.LoadFile C# (CSharp) Method

LoadFile() private method

private LoadFile ( ) : string
return string
        private string LoadFile()
        {
            OpenFileDialog openFileDialog = new OpenFileDialog();
            string directory = Environment.GetFolderPath(Environment.SpecialFolder.Personal);

            openFileDialog.InitialDirectory = directory;
            openFileDialog.Filter = "txt files (*.txt)|*.txt|All files (*.*)|*.*";
            openFileDialog.FilterIndex = 1;
            openFileDialog.RestoreDirectory = true;
            openFileDialog.Title = "Please Select the Shared Parameter File";

            string filename = null;
            if (openFileDialog.ShowDialog() == System.Windows.Forms.DialogResult.OK)
            {
                filename = openFileDialog.FileName;
                if(File.Exists(filename))
                {
                    return filename;
                }
                else
                {
                    return null;
                }
            }
            return filename;
        }