Artemis.Services.MetroDialogService.ShowOpenDialog C# (CSharp) Метод

ShowOpenDialog() публичный Метод

public ShowOpenDialog ( string &path, string defaultExt, string filter, string initialDir = null ) : bool
path string
defaultExt string
filter string
initialDir string
Результат bool
        public override bool ShowOpenDialog(out string path, string defaultExt, string filter, string initialDir = null)
        {
            if (GetActiveWindow() == null)
            {
                path = null;
                return false;
            }

            bool? res = null;
            string lPath = null;

            Execute.OnUIThread(() =>
            {
                var ofd = new OpenFileDialog
                {
                    DefaultExt = defaultExt,
                    Filter = filter
                };

                if (initialDir != null)
                    ofd.InitialDirectory = initialDir;

                res = Application.Current.MainWindow != null
                    ? ofd.ShowDialog(Application.Current.MainWindow)
                    : ofd.ShowDialog();

                if (res == true)
                    lPath = ofd.FileName;
                else
                    res = false;
            });

            path = lPath;

            return res.Value;
        }