private void browse_Click(object sender, RoutedEventArgs e)
        {
            // Create VistaFolderBrowserDialog which allows you to select a folder with better graphic
            //implementation
            VistaFolderBrowserDialog dlg = new VistaFolderBrowserDialog();

            // Display VistaFolderBrowserDialog by calling ShowDialog method
            var result = dlg.ShowDialog();

            // Get the selected folder name and display in a TextBox
            if (result == true)
            {
                // Open folder
                string foldername = dlg.SelectedPath;
                pathBox.Text = foldername;
            }
        }
示例#2
0
        private void SelectCorrectImage(object obj)
        {
            VistaFolderBrowserDialog dlg = new VistaFolderBrowserDialog();

            if (string.IsNullOrEmpty(this.Parent.Data.CorrectImagePath))
            {
                dlg.SelectedPath = AppDomain.CurrentDomain.BaseDirectory;
            }
            else
            {
                dlg.SelectedPath = this.Parent.Data.CorrectImagePath;
            }
            if (dlg.ShowDialog() == true)
            {
                this.Parent.Data.CorrectImagePath = dlg.SelectedPath;
            }
        }
示例#3
0
        public static void SelectFFmpegFolder()
        {
            var settings = GetSettings();

            using (var dlg = new VistaFolderBrowserDialog
            {
                SelectedPath = settings.FFmpeg.FolderPath,
                UseDescriptionForTitle = true,
                Description = LanguageManager.Instance.SelectFFmpegFolder
            })
            {
                if (dlg.ShowDialog() == DialogResult.OK)
                {
                    settings.FFmpeg.FolderPath = dlg.SelectedPath;
                }
            }
        }
示例#4
0
        public static Result <string> OpenFolderDialog(string path, string title)
        {
            var dialog = new VistaFolderBrowserDialog();

            dialog.Description            = title;
            dialog.RootFolder             = Environment.SpecialFolder.InternetCache;
            dialog.UseDescriptionForTitle = true;

            var result = dialog.ShowDialog();

            if (result == true)
            {
                return(new SuccessResult <string>(dialog.SelectedPath));
            }

            return(new ErrorResult <string>(string.Empty));
        }
示例#5
0
        public string GetExistingLibraryLocation(string libraryPath, Window window = null)
        {
            var dialog = new VistaFolderBrowserDialog();

            dialog.Description            = "Please select the folder containing the library.";
            dialog.UseDescriptionForTitle = true; // This applies to the Vista style dialog only, not the old dialog.

            dialog.ShowNewFolderButton = false;
            dialog.SelectedPath        = libraryPath;

            if ((dialog.ShowDialog(window) ?? false) && dialog.SelectedPath != null)
            {
                return(dialog.SelectedPath);
            }

            return(null);
        }
示例#6
0
        /// <summary>
        /// Allows a user to select a directory.  All files matching "nuix*.log*" are located and
        /// then loaded using loadLogFiles method.
        /// </summary>
        private void menuLoadDirectory_Click(object sender, RoutedEventArgs e)
        {
            VistaFolderBrowserDialog dialog = new VistaFolderBrowserDialog();

            if (dialog.ShowDialog() == true)
            {
                string   selectedDirectory = dialog.SelectedPath;
                string[] logFiles          = System.IO.Directory.GetFiles(selectedDirectory, "nuix*.log*", System.IO.SearchOption.AllDirectories);

                // Dispose of current repo
                NuixLogRepo prev = repo;
                repo = new NuixLogRepo();
                prev.DisposeRepo();

                loadLogFiles(logFiles);
            }
        }
示例#7
0
        private void packButton_Click(object sender, EventArgs e)
        {
            string sourcePath;
            string saveFileName;

            using (var fbd = new VistaFolderBrowserDialog())
            {
                if (fbd.ShowDialog() != DialogResult.OK)
                {
                    return;
                }
                sourcePath = fbd.SelectedPath;
            }

            using (var sfd = new SaveFileDialog())
            {
                if (sfd.ShowDialog() != DialogResult.OK)
                {
                    return;
                }
                saveFileName = sfd.FileName;
            }

            GlobalExtension.UpdateProgress        = this.updateProgress;
            GlobalExtension.CurrentOperationLabel = this.currentOperationLabel;
            Thread.Sleep(100); // give Globals a chance to initialize
            GlobalExtension.ShowProgress("Packing archive ...");
            Application.DoEvents();

            try
            {
                Stopwatch sw = new Stopwatch();
                sw.Restart();
                Packer.Pack(sourcePath, saveFileName, updateSng);
                sw.Stop();
                GlobalExtension.ShowProgress("Finished packing archive (elapsed time): " + sw.Elapsed, 100);
                MessageBox.Show("Packing is complete.", MESSAGEBOX_CAPTION, MessageBoxButtons.OK, MessageBoxIcon.Information);
            }
            catch (Exception ex)
            {
                MessageBox.Show(String.Format("{0}\n{1}\n{2}", "Packing error!", ex.Message, ex.InnerException), MESSAGEBOX_CAPTION, MessageBoxButtons.OK, MessageBoxIcon.Error);
            }

            // prevents possible cross threading
            GlobalExtension.Dispose();
        }
示例#8
0
        public void ExportProjectToExcelExecute()
        {
            VistaFolderBrowserDialog dialog = new VistaFolderBrowserDialog();

            dialog.Description            = "选择存储的文件夹";
            dialog.UseDescriptionForTitle = true; // This applies to the Vista style dialog only, not the old dialog.
            dialog.ShowDialog();

            string strSelectedFolderPath = dialog.SelectedPath;

            using (new WaitCursor())
            {
                IFileService   fileService    = new SCA.BusinessLib.Utility.FileService();
                ProjectService projectService = new ProjectService();
                projectService.ExportProjectToExcel(ProjectManager.GetInstance.Project, strSelectedFolderPath, fileService);
            }
        }
示例#9
0
        public void InitCommands()
        {
            this._selectSourceFolderCommand = new RelayCommand(() =>
            {
                var dialog = new VistaFolderBrowserDialog();
                dialog.ShowNewFolderButton = true;
                dialog.ShowDialog();
                if (!string.IsNullOrWhiteSpace(dialog.SelectedPath))
                {
                    this.Set(() => this.SourceFolder, ref this._sourceFolder, dialog.SelectedPath);
                    this.Set(() => this.ParentFolder, ref this._parentFolder, Directory.GetParent(dialog.SelectedPath).FullName);
                    this.Set(() => this.FolderName, ref this._folderName, Path.GetFileName(dialog.SelectedPath) + "_Copy");
                }
            });

            this._selectParentFolderCommand = new RelayCommand(() =>
            {
                var dialog = new VistaFolderBrowserDialog();
                dialog.ShowNewFolderButton = true;
                dialog.ShowDialog();
                if (dialog.SelectedPath != null)
                {
                    this.Set(() => this.ParentFolder, ref this._parentFolder, dialog.SelectedPath);
                }
            });

            this._defaultCommand = new RelayCommand(() =>
            {
                if (string.IsNullOrWhiteSpace(this._sourceFolder))
                {
                    this.Set(() => this.FolderName, ref this._folderName, "");
                }
                else
                {
                    this.Set(() => this.FolderName, ref this._folderName,
                             Path.GetDirectoryName(_folderName) + "_HLinked");
                }
            });

            this._linkCommand = new RelayCommand(() =>
            {
                var helper = new HardLinkHelper();
                helper.HardLink(this._sourceFolder, this._parentFolder, this._folderName, 1024000);
                Process.Start("explorer.exe", Path.Combine(this._parentFolder, this._folderName));
            }, () => !string.IsNullOrWhiteSpace(this._sourceFolder) && !string.IsNullOrWhiteSpace(this._parentFolder) && !string.IsNullOrWhiteSpace(this._folderName));
        }
        public static string ModsDirectory()
        {
            VistaFolderBrowserDialog browseMods = new VistaFolderBrowserDialog()
            {
                Description            = "Please select your mods directory...",
                UseDescriptionForTitle = true
            };

            if (browseMods.ShowDialog() == DialogResult.OK)
            {
                return(browseMods.SelectedPath);
            }
            else
            {
                return(string.Empty);
            }
        }
示例#11
0
        private String _GetFolderBrowserDialogPath(Boolean ShowNewFolderButton = false)
        {
            VistaFolderBrowserDialog FolderBrowser = new VistaFolderBrowserDialog
            {
                Description            = LocalisedUI.FolderBrowserDescription,
                UseDescriptionForTitle = true,
                ShowNewFolderButton    = ShowNewFolderButton
            };


            if (( Boolean )FolderBrowser.ShowDialog( ))
            {
                return(FolderBrowser.SelectedPath);
            }

            return(null);
        }
        private void ShowFolderDialog(object obj)
        {
            this.IsBusy = true;

            // Old Way...!! Ugly WinForms Dialog...!!
            //var dialog = new System.Windows.Forms.FolderBrowserDialog();
            //System.Windows.Forms.DialogResult result = dialog.ShowDialog();

            // Ookii.Dialogs.Wpf Way!!
            VistaFolderBrowserDialog dialog = new VistaFolderBrowserDialog();

            dialog.ShowDialog();

            this.FolderPath = dialog.SelectedPath;

            this.IsBusy = false;
        }
示例#13
0
        private void BrowseSDKButton_Click(object sender, RoutedEventArgs e)
        {
            var pickSdkFolder = new VistaFolderBrowserDialog
            {
                Description            = "Select the nwjs SDK location.",
                UseDescriptionForTitle = true
            };
            var pickerResult = pickSdkFolder.ShowDialog();

            if (pickerResult != true)
            {
                return;
            }
            Settings.Default.SDKLocation = pickSdkFolder.SelectedPath;
            NwjsLocation.Text            = pickSdkFolder.SelectedPath;
            Settings.Default.Save();
        }
        public string OpenPath()
        {
            // Ookii.Dialogs.Wpf NuGet package required
            VistaFolderBrowserDialog dialog = new VistaFolderBrowserDialog();

            dialog.Description            = "Please select a folder.";
            dialog.UseDescriptionForTitle = true;

            if ((bool)dialog.ShowDialog())
            {
                return(dialog.SelectedPath);
            }
            else
            {
                return(null);
            }
        }
        /// <summary>
        /// Opens Browse Folder Dialog.  This method is invoked by the BrowseCommand.
        /// </summary>
        public void Browse()
        {
            var browseFolderDialog = new VistaFolderBrowserDialog
            {
                ShowNewFolderButton = true
            };

            if (Directory.Exists(PhysicalPath))
            {
                browseFolderDialog.SelectedPath = PhysicalPath;
            }
            if (browseFolderDialog.ShowDialog() == true &&
                !string.IsNullOrWhiteSpace(browseFolderDialog.SelectedPath))
            {
                PhysicalPath = browseFolderDialog.SelectedPath;
            }
        }
        protected override void InitializeCore()
        {
            base.InitializeCore();

            RegisterAddHandler <Bitmap>(path => Data.Add(TextureEncoder.Encode(Path.GetFileNameWithoutExtension(path) + ".dds",
                                                                               TextureFormat.DDS, new Bitmap(path))));

            RegisterAddHandler <Stream>(path => Data.Add(new Texture(Path.GetFileNameWithoutExtension(path) + ".dds",
                                                                     TextureFormat.DDS, File.ReadAllBytes(path))));

            RegisterCustomHandler("Add", "New texture", () =>
            {
                Data.Add(Texture.CreateDefaultTexture("New texture.dds"));
                InitializeView(true);
            });

            RegisterModelUpdateHandler(() =>
            {
                var textureDictionary = new TextureDictionary(Version);
                foreach (TextureViewNode textureAdapter in Nodes)
                {
                    textureDictionary[textureAdapter.Name] = textureAdapter.Data;
                }

                return(textureDictionary);
            });

            RegisterCustomHandler("Convert to", "Field texture archive (PS3)", () => { ConvertToFieldTextureArchive(false); });
            RegisterCustomHandler("Convert to", "Field texture archive (PS4)", () => { ConvertToFieldTextureArchive(true); });

            RegisterCustomHandler("Export", "All", () =>
            {
                var dialog = new VistaFolderBrowserDialog();
                {
                    if (dialog.ShowDialog() != true)
                    {
                        return;
                    }

                    foreach (TextureViewNode viewModel in Nodes)
                    {
                        File.WriteAllBytes(Path.Combine(dialog.SelectedPath, viewModel.Text), viewModel.Data.Data);
                    }
                }
            });
        }
        private void ShowFolderBrowserDialog()
        {
            var dialog = new VistaFolderBrowserDialog();

            dialog.Description            = "Please select a folder.";
            dialog.UseDescriptionForTitle = true; // This applies to the Vista style dialog only, not the old dialog.

            if (!VistaFolderBrowserDialog.IsVistaFolderDialogSupported)
            {
                MessageBox.Show(this, "Because you are not using Windows Vista or later, the regular folder browser dialog will be used. Please use Windows Vista to see the new dialog.", "Sample folder browser dialog");
            }

            if ((bool)dialog.ShowDialog(this))
            {
                MessageBox.Show(this, $"The selected folder was:{Environment.NewLine}{dialog.SelectedPath}", "Sample folder browser dialog");
            }
        }
示例#18
0
        /// <summary>
        /// Получает список файлов из каталога и записывает его в результирующий список
        /// </summary>
        /// <param name="resFileList">результирующий список</param>
        private void GetFromDirectory(out List <string> resFileList)
        {
            resFileList = new List <string>();
            VistaFolderBrowserDialog dialog = new VistaFolderBrowserDialog();

            dialog.Description            = "Выберете папку с изображениями";
            dialog.UseDescriptionForTitle = true; // This applies to the Vista style dialog only, not the old dialog.
            if (!VistaFolderBrowserDialog.IsVistaFolderDialogSupported)
            {
                MessageBox.Show("Because you are not using Windows Vista or later, the regular folder browser dialog will be used. Please use Windows Vista to see the new dialog.", "Sample folder browser dialog");
            }
            if ((bool)dialog.ShowDialog())
            {
                //добавление
                resFileList.Add(dialog.SelectedPath);
            }
        }
        private void btnRs2014Path_Click(object sender, EventArgs e)
        {
            using (var fbd = new VistaFolderBrowserDialog())
            {
                fbd.SelectedPath = general_rs2014path.Name;
                fbd.Description  = "Select Rocksmith 2014 executable root installation folder.";

                if (fbd.ShowDialog() != DialogResult.OK)
                {
                    return;
                }

                var rs2014Path = fbd.SelectedPath;
                general_rs2014path.Text = rs2014Path;
                ConfigRepository.Instance()[general_rs2014path.Name] = rs2014Path;
            }
        }
示例#20
0
        public string[] OpenFolderPanel(string title, string directory, bool multiselect)
        {
            var fd = new VistaFolderBrowserDialog();

            fd.Description            = title;
            fd.UseDescriptionForTitle = true;

            if (!string.IsNullOrEmpty(directory))
            {
                fd.SelectedPath = GetDirectoryPath(directory);
            }
            var res       = fd.ShowDialog(new WindowWrapper(GetActiveWindow()));
            var filenames = res == DialogResult.OK ? new [] { fd.SelectedPath } : new string[0];

            fd.Dispose();
            return(filenames);
        }
示例#21
0
        private void ExportAllAction(object sender, EventArgs e)
        {
            using (var dialog = new VistaFolderBrowserDialog())
            {
                if (dialog.ShowDialog() != DialogResult.OK)
                {
                    return;
                }

                foreach (BvpEntryWrapper entry in Nodes)
                {
                    File.WriteAllBytes(
                        Path.Combine(dialog.SelectedPath, entry.Text),
                        entry.Resource.Data);
                }
            }
        }
示例#22
0
        private void Button_ChooseLocation_Click(object sender, RoutedEventArgs e)
        {
            var dialog = new VistaFolderBrowserDialog();

            if (Directory.Exists(TextBox_installLocation.Text) || new DirectoryInfo(TextBox_installLocation.Text).Root.Exists)
            {
                dialog.SelectedPath = TextBox_installLocation.Text;
            }
            else
            {
                dialog.SelectedPath = Environment.ExpandEnvironmentVariables(@"%ProgramFiles%");
            }
            if (dialog.ShowDialog() == true)
            {
                TextBox_installLocation.Text = dialog.SelectedPath;
            }
        }
示例#23
0
        public string PickFolder(string Current, string Description)
        {
            using (var dlg = new VistaFolderBrowserDialog
            {
                SelectedPath = Current,
                UseDescriptionForTitle = true,
                Description = Description
            })
            {
                if (dlg.ShowDialog() == DialogResult.OK)
                {
                    return(dlg.SelectedPath);
                }
            }

            return(null);
        }
        /// <summary>
        /// Displays the folder browser dialog for the current operating system.  Returns true if the user selected a folder.  Read the SelectedPath property for the selected path.
        /// </summary>
        public bool ShowDialog()
        {
            using (var folderBrowserDialog = new VistaFolderBrowserDialog()) {
                folderBrowserDialog.Description            = this.Description;
                folderBrowserDialog.ShowNewFolderButton    = this.ShowNewFolderButton;
                folderBrowserDialog.UseDescriptionForTitle = false;

                DialogResult result = folderBrowserDialog.ShowDialog();

                if (result == DialogResult.OK)
                {
                    _selectedPath = folderBrowserDialog.SelectedPath;
                    return(true);
                }
                return(false);
            }
        }
示例#25
0
        private void UnpackImagesClicked(object sender, RoutedEventArgs e)
        {
            try
            {
                var            inFile     = string.Empty;
                var            outDir     = string.Empty;
                OpenFileDialog inFileDiag = new OpenFileDialog
                {
                    Title       = "Select Luna Nights data.win file",
                    DefaultExt  = "win",
                    Filter      = "Data.win (*.win)|*.win",
                    Multiselect = false
                };
                if (inFileDiag.ShowDialog() == true)
                {
                    inFile = inFileDiag.FileName;
                }

                if (string.IsNullOrWhiteSpace(inFile))
                {
                    return;
                }

                VistaFolderBrowserDialog outDirDiag = new VistaFolderBrowserDialog()
                {
                    UseDescriptionForTitle = true,
                    Description            = "Select output folder for images"
                };
                if (outDirDiag.ShowDialog() == true)
                {
                    outDir = outDirDiag.SelectedPath;
                }

                if (string.IsNullOrWhiteSpace(inFile) || string.IsNullOrWhiteSpace(outDir))
                {
                    return;
                }

                Task.Run(() => _imagePacker.UnpackImagesFromData(inFile, outDir));
            }
            catch (Exception ex)
            {
                _syncContext.Post((s) => ErrorTracker.CurrentError = ex.Message, null);
            }
        }
示例#26
0
        //public ApplicationSettings s = new ApplicationSettings();
        public Setup()
        {
            try
            {
                LoadSettings();
                InitializeComponent();

                modslist_combobox.AddHandler(System.Windows.Controls.Primitives.TextBoxBase.TextChangedEvent,
                                             new System.Windows.Controls.TextChangedEventHandler(modsListTextChanged));

                dotaPath                                 = ApplicationSettings.instance.dotaPath;
                dotaPathText.Text                        = ApplicationSettings.instance.dotaPath;
                dotaFolderBrowser                        = new VistaFolderBrowserDialog();
                dotaFolderBrowser.Description            = "Please select DotA 2's main folder.";
                dotaFolderBrowser.UseDescriptionForTitle = true;

                autoSave.IsChecked = ApplicationSettings.instance.autoSave;

                try
                {
                    modsList = Directory.GetDirectories(ApplicationSettings.instance.dotaPath + "\\dota_ugc\\game\\dota_addons");
                }
                catch
                {
                    InvalidDotaPath();
                }

                for (int i = 0; i < modsList.Length; i++)
                {
                    modsList[i] = modsList[i].Remove(0, modsList[i].LastIndexOf("\\") + 1);                             //Removing path. We keep folder's name.
                    modslist_combobox.Items.Add(modsList[i]);
                }
                if (ApplicationSettings.instance.currentMod == "" || ApplicationSettings.instance.currentMod == null)
                {
                    ApplicationSettings.instance.currentMod = modsList[0];
                }
                modslist_combobox.Text = ApplicationSettings.instance.currentMod;
                ApplicationSettings.instance.currentModPath = ApplicationSettings.instance.dotaPath + "\\dota_ugc\\game\\dota_addons\\" + modslist_combobox.Text;
            }
            catch (Exception e)
            {
                Console.WriteLine(e.ToString());
            }
            //modslist_combobox.Items.Add
        }
示例#27
0
        private void listBox_DoubleClick(object sender, System.EventArgs e)
        {
            ClasspathEntry entry = listBox.SelectedItem as ClasspathEntry;

            if (entry == null)
            {
                return;                // you could have double-clicked on whitespace
            }
            using (VistaFolderBrowserDialog dialog = new VistaFolderBrowserDialog())
            {
                dialog.RootFolder             = Environment.SpecialFolder.Desktop;
                dialog.UseDescriptionForTitle = true;
                dialog.Description            = TextHelper.GetString("Info.SelectClasspathDirectory");
                if (project != null)
                {
                    dialog.SelectedPath = project.GetAbsolutePath(entry.Classpath);
                    if (!Directory.Exists(dialog.SelectedPath))
                    {
                        dialog.SelectedPath = project.Directory;
                    }
                }
                else
                {
                    dialog.SelectedPath = entry.Classpath;
                }

                if (dialog.ShowDialog(this) == DialogResult.OK)
                {
                    string selectedPath = dialog.SelectedPath;
                    if (project != null)
                    {
                        if (CanBeRelative(selectedPath))
                        {
                            selectedPath = project.GetRelativePath(selectedPath);
                        }
                    }
                    if (selectedPath == entry.Classpath)
                    {
                        return;                                  // nothing to do!
                    }
                    listBox.Items[listBox.SelectedIndex] = new ClasspathEntry(selectedPath);
                    OnChanged();
                }
            }
        }
示例#28
0
        public Dictionary_Builder()
        {
            InitializeComponent();

            // Set up "Load Folder" dialog
            VistaFolderBrowserDialog dlgLoad = new VistaFolderBrowserDialog();

            dlgLoad.Description = "Select 'Waveforms' folder";

            // Set up "Save File" dialog
            Microsoft.Win32.SaveFileDialog dlgSave = new Microsoft.Win32.SaveFileDialog();
            dlgSave.Title            = "Destination to save Waveform.Dictionary.Plots.cs";
            dlgSave.FileName         = "Waveform.Dictionary.Plots"; // Default file name
            dlgSave.DefaultExt       = ".cs";                       // Default file extension
            dlgSave.Filter           = "C# File (*.cs)|*.cs|All files (*.*)|*.*";
            dlgSave.FilterIndex      = 1;
            dlgSave.OverwritePrompt  = true;
            dlgSave.RestoreDirectory = true;

            // Set up BackgroundWorker to report process and finish output
            bgWorker.WorkerReportsProgress = true;

            bgWorker.DoWork += new DoWorkEventHandler(ProcessFolder);

            bgWorker.ProgressChanged += (s, e) =>
                                        txtOutput.AppendText(e.UserState.ToString());

            // Run the program!
            txtOutput.Clear();
            if (dlgLoad.ShowDialog() == true)
            {
                bgWorker.RunWorkerAsync(dlgLoad.SelectedPath);
            }

            bgWorker.RunWorkerCompleted += (s, e) => {
                if (dlgSave.ShowDialog() == true)
                {
                    StreamWriter outFile = new StreamWriter(dlgSave.FileName, false);
                    outFile.Write(dictOut.ToString());
                    outFile.Close();
                    txtOutput.AppendText(String.Format("\n\nOutput written to {0}\n", dlgSave.FileName));
                    txtOutput.AppendText("You may now close this program.");
                }
            };
        }
        private void ConvertOsageSkinParameters(BinaryFormat format)
        {
            var filePaths =
                ModuleImportUtilities.SelectModuleImportMultiselect <OsageSkinParameterSet>(
                    "Select file(s) to convert.");

            if (filePaths == null)
            {
                return;
            }

            using (var folderBrowserDialog = new VistaFolderBrowserDialog
            {
                Description = "Select a folder to save file(s) to.", UseDescriptionForTitle = true
            })
            {
                if (folderBrowserDialog.ShowDialog(this) != DialogResult.OK)
                {
                    return;
                }

                new Thread(() =>
                {
                    try
                    {
                        Invoke(new Action(() => Enabled = false));

                        string extension = format.IsModern() ? ".osp" : ".txt";

                        foreach (string filePath in filePaths)
                        {
                            var ospSet = BinaryFile.Load <OsageSkinParameterSet>(filePath);

                            ospSet.Format = format;
                            ospSet.Save(Path.Combine(folderBrowserDialog.SelectedPath,
                                                     Path.GetFileNameWithoutExtension(filePath) + extension));
                        }
                    }
                    finally
                    {
                        Invoke(new Action(() => Enabled = true));
                    }
                }).Start();
            }
        }
示例#30
0
        private void OnClick(object sender, RoutedEventArgs e)
        {
            var dialog = new VistaFolderBrowserDialog
            {
                Description            = "Please select a folder.",
                UseDescriptionForTitle = true,
                ShowNewFolderButton    = true,
            };

            var path = (string)GetValue(FolderName);

            dialog.SelectedPath = path;

            if ((bool)dialog.ShowDialog(null))
            {
                SetValue(FolderName, dialog.SelectedPath);
            }
        }
示例#31
0
 /// <summary>
 /// Browse output directories.
 /// </summary>
 private void BrowseOutputDirectoriesImpl()
 {
     var folderBrowser = new VistaFolderBrowserDialog();
     var result = folderBrowser.ShowDialog();
     if (result != null && result.Value)
     {
         this.OutputDirectory = folderBrowser.SelectedPath;
     }
 }
示例#32
0
        public void SelectDirectory()
        {
            var folderBrowser = new VistaFolderBrowserDialog();
            var result = folderBrowser.ShowDialog();

            if (result != null && result.Value)
            {
                InputFilePath = folderBrowser.SelectedPath;
            }

            this.AddFolderCommand.Execute(null);
        }
示例#33
0
 private void ShowFolderBrowserDialog()
 {
     VistaFolderBrowserDialog dialog = new VistaFolderBrowserDialog();
     dialog.Description = "Please select a folder.";
     dialog.UseDescriptionForTitle = true; // This applies to the Vista style dialog only, not the old dialog.
     if( !VistaFolderBrowserDialog.IsVistaFolderDialogSupported )
         MessageBox.Show(this, "Because you are not using Windows Vista or later, the regular folder browser dialog will be used. Please use Windows Vista to see the new dialog.", "Sample folder browser dialog");
     if( (bool)dialog.ShowDialog(this) )
         MessageBox.Show(this, "The selected folder was: " + dialog.SelectedPath, "Sample folder browser dialog");            
 }