Example #1
0
        public bool ShowDialog(string key, bool multiSelect = false)
        {
            dialogKey = key;

            if (!SelectedFilters.ContainsKey(key))
            {
                SelectedFilters.Add(key, 0);
            }

            if (SaveDialog)
            {
                var ofd = TinyFileDialog.SaveFileDialog(filters, FileName);
                if (!string.IsNullOrEmpty(ofd))
                {
                    this.FilePaths = new string[] { ofd };
                    return(true);
                }
            }
            else
            {
                var ofd = TinyFileDialog.OpenFileDialog(filters, FileName, multiSelect);
                if (!string.IsNullOrEmpty(ofd))
                {
                    this.FilePaths = ofd.Split('|');
                    return(true);
                }
            }

            return(false);
        }
        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);
        }