private void browseServerFolder_Click(object sender, RoutedEventArgs e) { var dialog = new VistaFolderBrowserDialog(); var showDialog = dialog.ShowDialog(); if (showDialog.HasValue && showDialog.Value) { NoDebugOrReleaseFolder: if (!(dialog.SelectedPath.IndexOf("debug", StringComparison.OrdinalIgnoreCase) >= 0 || dialog.SelectedPath.IndexOf("release", StringComparison.OrdinalIgnoreCase) >= 0)) { MessageBoxResult result = MessageBox.Show("The selected folder should contain the authserver.exe and worldserver.exe executables and are most of the time placed inside the 'debug' or 'release' folder. Do you still wish to continue?", "Are you sure?", MessageBoxButton.YesNo, MessageBoxImage.Question); if (result != MessageBoxResult.Yes) { var showDialog2 = dialog.ShowDialog(); if (showDialog2.HasValue && showDialog2.Value) goto NoDebugOrReleaseFolder; return; } } ServerFolderTextBox.SetValue(TextBox.TextProperty, dialog.SelectedPath); } }
private void btnFolderSelect_Click(object sender, RoutedEventArgs e) { 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 ((bool)dialog.ShowDialog(this)) { umbracoFolder.Text = dialog.SelectedPath; LanguageRepository.Init(System.IO.Path.Combine(umbracoFolder.Text, @"umbraco\config\lang")); string[] languagecodes = LanguageRepository.ListLanguages(); foreach (var code in languagecodes) { Language lang = LanguageRepository.GetLanguage(code); cmbSourceLanguage.Items.Add(new ComboBoxItem() { Content = string.Format("{0} [{1}]", lang.InternationalName, lang.Id), Tag = code }); cmbDestinationLanguage.Items.Add(new ComboBoxItem() { Content = string.Format("{0} [{1}]", lang.InternationalName, lang.Id), Tag = code }); } cmbSourceLanguage.IsEnabled = true; cmbDestinationLanguage.IsEnabled = true; } }
public MainWindowViewModel() { TorrentSelected = new ReactiveCommand(); DownloadAll = new ReactiveAsyncCommand(); DeleteSelected = new ReactiveAsyncCommand(); DeleteSelected.Subscribe(new AnonymousObserver<object>(x => { App.streamza.RemoveTorrent(_selectedTorrent.id); })); DownloadAll.Subscribe(new AnonymousObserver<object>(x => { var sel = _selectedTorrent; var s = new VistaFolderBrowserDialog(); var res = s.ShowDialog(); if (!res.HasValue || res.Value != true) return; var files = App.streamza.GetTorrentFiles(sel); foreach (var file in files) { var uri = App.streamza.GetDownloadLink(file); var cl = new WebClient(); var path = Path.Combine(s.SelectedPath, file.path); if (!Directory.Exists(Path.GetDirectoryName(path))) Directory.CreateDirectory(Path.GetDirectoryName(path)); cl.DownloadFile(new Uri(uri), path); } // This probably works best when there are lots of small files; doesn't // offer any improvement when there are only a couple of large files. // TODO: Check file count and set parallelism appropriately //Parallel.ForEach(files, // new ParallelOptions { MaxDegreeOfParallelism = 4 }, // (file) => // { // var uri = App.streamza.GetDownloadLink(file); // var cl = new WebClient(); // var path = Path.Combine(s.SelectedPath, file.path); // if (!Directory.Exists(Path.GetDirectoryName(path))) // Directory.CreateDirectory(Path.GetDirectoryName(path)); // cl.DownloadFile(new Uri(uri), path); // }); })); _torrents = App.streamza.Torrents; Observable .Start(() => { Observable .Interval(TimeSpan.FromSeconds(10)) .Subscribe(i => { if (FetchingFiles) return; _torrents = App.streamza.Torrents; raisePropertyChanged("Torrents"); }); }); }
private void buttonSaveImage_Click(object sender, RoutedEventArgs e) { string message = ""; bool checkResult = checkBeforeRender(ref message); if (checkResult == false) { System.Windows.MessageBox.Show(message); return; } System.Drawing.Imaging.ImageFormat fmt = GlobalSettings.globalSaveFmt; Ookii.Dialogs.Wpf.VistaFolderBrowserDialog folderBrowserDialog = new Ookii.Dialogs.Wpf.VistaFolderBrowserDialog(); if (folderBrowserDialog.ShowDialog().Value) { string saveFolderName = folderBrowserDialog.SelectedPath; //DO image saving if (GlobalSettings.bUseUnlimitHeight) { AsynSaveSingleImage(saveFolderName, fmt); } else { AsynSaveMultiImage(saveFolderName, fmt); } System.Windows.MessageBox.Show("Image Saved!"); } }
private void BtnOpenSourceDirOnClick(object sender, RoutedEventArgs e) { var dlg = new VistaFolderBrowserDialog(); var showDialog = dlg.ShowDialog(this); if (showDialog != null && !(bool)showDialog) return; TxtSourceDir.Text = dlg.SelectedPath; }
/// <summary> /// Presents the user with a folder browser dialog. /// </summary> /// <param name="filter">Filename filter for if the OS doesn't support a folder browser.</param> /// <returns>Full path the user selected.</returns> private static string ShowFolderBrowser(string filter) { bool cancelled = false; string path = null; if (VistaFolderBrowserDialog.IsVistaFolderDialogSupported) { var dlg = new VistaFolderBrowserDialog(); cancelled = !(dlg.ShowDialog() ?? false); if (!cancelled) { path = Path.GetFullPath(dlg.SelectedPath); } } else { var dlg = new Microsoft.Win32.SaveFileDialog(); dlg.Filter = filter; dlg.FilterIndex = 1; cancelled = !(dlg.ShowDialog() ?? false); if (!cancelled) { path = Path.GetFullPath(Path.GetDirectoryName(dlg.FileName)); // Discard whatever filename they chose } } return path; }
private void BrowseSteam_Click(object sender, RoutedEventArgs e) { var dialog = new VistaFolderBrowserDialog(); if (dialog.ShowDialog() == true) { SteamDirectoryTextBox.Text = dialog.SelectedPath; } }
public void SetLocationSurfaces() { var dlg = new VistaFolderBrowserDialog(); var showDialog = dlg.ShowDialog(); if (showDialog == null || !((bool) showDialog)) return; SurfacesPath = dlg.SelectedPath; //SurfacesPath = @"B:\DEV\UIEdit\UIEdit\bin\Debug\surfaces.pck.files"; }
private void OnGotFocus([NotNull] object sender, [NotNull] RoutedEventArgs e) { var dialog = new VistaFolderBrowserDialog(); if(dialog.ShowDialog() != true) return; Model.WorkingPath = dialog.SelectedPath; }
private void edNetLogBrowserButton_Click(object sender, RoutedEventArgs e) { VistaFolderBrowserDialog vfbd = new VistaFolderBrowserDialog(); vfbd.Description = "Please select your Elite:Dangerous NetLog folder (Containing NetLog files)"; vfbd.UseDescriptionForTitle = true; if ((bool)vfbd.ShowDialog(this)) Properties.Settings.Default.NetLogPath= vfbd.SelectedPath; }
private void AddSpecificFolder(object sender, RoutedEventArgs e) { VistaFolderBrowserDialog folderDialog = new VistaFolderBrowserDialog(); bool? dialogResult = folderDialog.ShowDialog(); if (dialogResult.GetValueOrDefault(false)) { Sources.AddSpecificFolder(folderDialog.SelectedPath); } }
private void ChooseClipDirectory(object sender, RoutedEventArgs e) { VistaFolderBrowserDialog fbd = new VistaFolderBrowserDialog(); Nullable<bool> r = fbd.ShowDialog(); if (r.Value) { CurrentSession.CurrentDirectory = fbd.SelectedPath; } }
private void onSelectGameDir() { VistaFolderBrowserDialog fbd = new VistaFolderBrowserDialog(); bool? result = fbd.ShowDialog(); if (!result.HasValue || !result.Value) return; viewModel.Message.Settings.PathToGame = fbd.SelectedPath; }
/// <summary> /// Displays the folder browser dialog /// </summary> /// <param name="title"></param> /// <param name="filename"></param> public static void FolderBrowserUI(String title, out String filename) { filename = null; var dialog = new VistaFolderBrowserDialog {Description = title, UseDescriptionForTitle = true}; if (dialog.ShowDialog() == true) { filename = dialog.SelectedPath; } }
public void SetLocationInterfaces() { var dlg = new VistaFolderBrowserDialog(); var showDialog = dlg.ShowDialog(); if (showDialog == null || !((bool) showDialog)) return; InterfacesPath = dlg.SelectedPath; Properties.Settings.Default.interfaceFilePath = InterfacesPath; Properties.Settings.Default.Save(); //InterfacesPath = @"B:\DEV\UIEdit\UIEdit\bin\Debug\interfaces.pck.files"; GenerateFileList(); }
private void FolderBrowseButton_Click(object sender, RoutedEventArgs e) { var dialog = new VistaFolderBrowserDialog(); dialog.Description = "Select the folder containing your music files."; if (dialog.ShowDialog(this) == true) { Controller.Model.FolderPath = dialog.SelectedPath; } }
/// <summary> /// Handles the OnClick event of the Browse control. /// </summary> /// <param name="sender">The source of the event.</param> /// <param name="e">The <see cref="RoutedEventArgs"/> instance containing the event data.</param> /// <exception cref="System.NotImplementedException"></exception> private void Browse_OnClick(object sender, RoutedEventArgs e) { var picker = new VistaFolderBrowserDialog {SelectedPath = Settings.ExperimentDirectory, ShowNewFolderButton = true}; if (picker.ShowDialog().Value) { ExperimentFolder.Text = picker.SelectedPath; Settings.ExperimentDirectory = picker.SelectedPath; Directory.SetCurrentDirectory(Settings.ExperimentDirectory); Settings.SetPath(Settings.ExperimentDirectory); } }
private void AddSongSourceButtonClick(object sender, RoutedEventArgs e) { var dialog = new VistaFolderBrowserDialog(); dialog.ShowDialog(); if (!string.IsNullOrWhiteSpace(dialog.SelectedPath)) { ((SettingsViewModel)this.DataContext).ChangeLibrarySource(dialog.SelectedPath); } }
private void SetTorrentDirectory() { // Open folder browser VistaFolderBrowserDialog folderSel = new VistaFolderBrowserDialog(); // Add folder if valid folder selected if (folderSel.ShowDialog() == true && System.IO.Directory.Exists(folderSel.SelectedPath)) { this.GeneralSettings.TorrentDirectory = folderSel.SelectedPath; } }
private void ChangeYoutubeDownloadPath(object sender, RoutedEventArgs e) { var dialog = new VistaFolderBrowserDialog(); dialog.ShowDialog(); if (!string.IsNullOrWhiteSpace(dialog.SelectedPath)) { ((SettingsViewModel)this.DataContext).YoutubeDownloadPath = dialog.SelectedPath; } }
/* * [Obsolete("Use Common.ChooseFolder() instead")] * internal static string ChooseFolderTd() { * if (win.CommonFileDialog.IsPlatformSupported == true) { * var dialog = new win.CommonOpenFileDialog(); * dialog.IsFolderPicker = true; * win.CommonFileDialogResult result = dialog.ShowDialog(); * if (result == win.CommonFileDialogResult.Ok) { * Properties.Settings.Default.FolderPath = dialog.FileName; * return dialog.FileName.ToString(); * } * return null; * } else { * var oldDialog = new winForms.FolderBrowserDialog(); * winForms.DialogResult result = oldDialog.ShowDialog(); * if (result == winForms.DialogResult.OK) { * Properties.Settings.Default.FolderPath = oldDialog.SelectedPath.ToString(); * return oldDialog.SelectedPath.ToString(); * } * return null; * } * } */ internal static string ChooseFolder() { td.VistaFolderBrowserDialog dlg = new td.VistaFolderBrowserDialog(); dlg.Description = "Choose a destination folder..."; dlg.UseDescriptionForTitle = true; if ((bool)dlg.ShowDialog()) { Properties.Settings.Default.FolderPath = dlg.SelectedPath.ToString(); } return(null); }
private void SelectFolderButton_Click(object sender, RoutedEventArgs e) { var dialog = new Ookii.Dialogs.Wpf.VistaFolderBrowserDialog(); if (!dialog.ShowDialog(this).GetValueOrDefault()) { return; } OutputFolder = dialog.SelectedPath; outFolderPathText.Content = OutputFolder; }
public void Execute(object parameter) { VistaFolderBrowserDialog dialog = new VistaFolderBrowserDialog { Description = "Please select a folder.", UseDescriptionForTitle = true }; if (dialog.ShowDialog() == true) { viewModel.Settings.SaveLocation = dialog.SelectedPath; } }
private void FindPathClick(object sender, RoutedEventArgs e) { var dlg = new VistaFolderBrowserDialog(); if (!HistoryPath.Text.IsEmpty()) dlg.SelectedPath = HistoryPath.Text; if (dlg.ShowDialog() == true) { HistoryPath.Text = dlg.SelectedPath; } }
public void SetLocationInterfaces() { var dlg = new VistaFolderBrowserDialog(); var showDialog = dlg.ShowDialog(); if (showDialog == null || !((bool) showDialog)) return; InterfacesPath = dlg.SelectedPath; //InterfacesPath = @"B:\DEV\UIEdit\UIEdit\bin\Debug\interfaces.pck.files"; Files = new List<SourceFile>(); foreach (var file in Directory.GetFiles(InterfacesPath, "*.xml", SearchOption.AllDirectories)) { Files.Add(new SourceFile { FileName = file, ProjectPath = InterfacesPath}); } }
private void FindPathClick(object sender, RoutedEventArgs e) { var dlg = new VistaFolderBrowserDialog(); if (!SecuritiesCsv.Text.IsEmpty()) dlg.SelectedPath = SecuritiesCsv.Text; if (dlg.ShowDialog(this) == true) { SecuritiesCsv.Text = dlg.SelectedPath; } }
private void edDirBrowserButton_Click(object sender, RoutedEventArgs e) { VistaFolderBrowserDialog vfbd = new VistaFolderBrowserDialog(); vfbd.Description = "Please select your Elite:Dangerous folder (Containing the launcher executable)"; vfbd.UseDescriptionForTitle = true; if ((bool)vfbd.ShowDialog(this)) { Properties.Settings.Default.EDPath = vfbd.SelectedPath; Properties.Settings.Default.NetLogPath = vfbd.SelectedPath + @"\Products\elite-dangerous-64\Logs"; } }
private void SelectDestinationDirectory_Click(object sender, System.Windows.RoutedEventArgs e) { VistaFolderBrowserDialog dialog = new VistaFolderBrowserDialog(); dialog.Description = WPFLocalizeExtensionHelpers.GetUIString("SelectFolderForDownloads"); dialog.UseDescriptionForTitle = true; // This applies to the Vista style dialog only, not the old dialog. if ((bool)dialog.ShowDialog()) { if (!String.IsNullOrEmpty(dialog.SelectedPath)) { DestinationDirectory.Text = dialog.SelectedPath; } } }
private void BrowseButton_Click(object sender, RoutedEventArgs e) { var folderBrowser = new VistaFolderBrowserDialog() { ShowNewFolderButton = false, Description = this.Description, UseDescriptionForTitle = true }; if (folderBrowser.ShowDialog() != true) return; DirectoryPath = folderBrowser.SelectedPath; }
public static bool ShowBrowseDownloadFolder(out string selectedPath, string initialPath) { var dlg = new VistaFolderBrowserDialog(); dlg.Description = "Locate podcast download folder"; dlg.ShowNewFolderButton = true; dlg.UseDescriptionForTitle = true; dlg.SelectedPath = initialPath; if (dlg.ShowDialog(Owner) ?? false) { selectedPath = dlg.SelectedPath; return true; } selectedPath = null; return false; }
public async Task<String> ShowFolderDialog(String caption) { VistaFolderBrowserDialog dialog = new VistaFolderBrowserDialog(); dialog.Description = "Please select a folder."; dialog.UseDescriptionForTitle = true; bool? result = await Task.Run(() => dialog.ShowDialog()); if (result.HasValue && result.Value) { return dialog.SelectedPath; } else { return null; } }
private void LocationPathBtn_Click(object sender, RoutedEventArgs e) { VistaFolderBrowserDialog fbd = new VistaFolderBrowserDialog(); fbd.UseDescriptionForTitle = true; if (Directory.Exists(LocationPathBox.Text)) { fbd.SelectedPath = LocationPathBox.Text; } fbd.Description = "Choose Save Path..."; bool? result = fbd.ShowDialog(); if (result == true) { LocationPathBox.Text = fbd.SelectedPath; } }
private void selectBackupsFolder_Click(object sender, RoutedEventArgs e) { var dialog = new VistaFolderBrowserDialog { Description = WPFLocalizeExtensionHelpers.GetUIString("SelectFolderForBackups"), UseDescriptionForTitle = true }; // This applies to the Vista style dialog only, not the old dialog. var showDialog = dialog.ShowDialog(); if (showDialog != null && (bool)showDialog) { if (!String.IsNullOrEmpty(dialog.SelectedPath)) { backupsFolder.Text = dialog.SelectedPath; } } }
private void DestinationButton_Click(object sender, RoutedEventArgs e) { Ookii.Dialogs.Wpf.VistaFolderBrowserDialog dlg = new Ookii.Dialogs.Wpf.VistaFolderBrowserDialog(); dlg.ShowNewFolderButton = true; dlg.Description = "Please select a folder where you would like to save the DeepZoom images."; dlg.UseDescriptionForTitle = true; bool?dialogSuccess = dlg.ShowDialog(); if (dialogSuccess.HasValue) { if (dialogSuccess.Value) { destPath = dlg.SelectedPath; } } //Update the GUI DestinationTextBox.Text = destPath; }
private void SourceButton_Click(object sender, RoutedEventArgs e) { Ookii.Dialogs.Wpf.VistaFolderBrowserDialog dlg = new Ookii.Dialogs.Wpf.VistaFolderBrowserDialog(); dlg.ShowNewFolderButton = true; dlg.Description = "Please select a folder where your TIF images are located."; dlg.UseDescriptionForTitle = true; bool?dialogSuccess = dlg.ShowDialog(); if (dialogSuccess.HasValue) { if (dialogSuccess.Value) { sourcePath = dlg.SelectedPath; } } //Update the GUI SourceTextBox.Text = sourcePath; }
public bool SelectFolder(out string folderPath, string description = "", string directory = "", bool showNewFolderButton = false) { var fbd = new FolderBrowserDialog { Description = description, ShowNewFolderButton = showNewFolderButton }; if (!string.IsNullOrEmpty(directory)) { fbd.SelectedPath = GetDirectoryPath(directory); } bool result = fbd.ShowDialog().GetValueOrDefault(); folderPath = result ? fbd.SelectedPath : string.Empty; return(result); }