public bool ShowDialog()
        {
            string ofd = null;

            if (RuntimeInformation.IsOSPlatform(OSPlatform.Windows))
            {
                FolderBrowserEx.FolderBrowserDialog dialog = new FolderBrowserEx.FolderBrowserDialog()
                {
                    Title = Title, InitialFolder = SelectedPath
                };
                dialog.ShowDialog();
                ofd = dialog.SelectedFolder;
            }
            else
            {
                ofd = TinyFileDialog.SelectFolderDialog(Title, SelectedPath);
            }

            if (!string.IsNullOrEmpty(ofd))
            {
                this.SelectedPath = ofd;
                return(true);
            }

            return(false);
        }
Ejemplo n.º 2
0
        //#region properties
        //public bool IsFolderPicker
        //{
        //    get;
        //    set;
        //}
        //#endregion properties

        protected static (bool?result, string path) OpenDialog(string filter, string extension)
        {
            var dialog = new FolderBrowserEx.FolderBrowserDialog();
            {
                DialogResult result = dialog.ShowDialog();

                return(result == DialogResult.OK ? (true, dialog.SelectedFolder) : (false, null));
            }
        }