本文整理汇总了C#中Ookii.Dialogs.Wpf.VistaFolderBrowserDialog.ShowDialog方法的典型用法代码示例。如果您正苦于以下问题:C# VistaFolderBrowserDialog.ShowDialog方法的具体用法?C# VistaFolderBrowserDialog.ShowDialog怎么用?C# VistaFolderBrowserDialog.ShowDialog使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Ookii.Dialogs.Wpf.VistaFolderBrowserDialog
的用法示例。
在下文中一共展示了VistaFolderBrowserDialog.ShowDialog方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: browseServerFolder_Click
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);
}
}
示例2: MainWindowViewModel
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");
});
});
}
示例3: btnFolderSelect_Click
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;
}
}
示例4: ShowFolderBrowser
/// <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;
}
示例5: BtnOpenSourceDirOnClick
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;
}
示例6: BrowseSteam_Click
private void BrowseSteam_Click(object sender, RoutedEventArgs e)
{
var dialog = new VistaFolderBrowserDialog();
if (dialog.ShowDialog() == true)
{
SteamDirectoryTextBox.Text = dialog.SelectedPath;
}
}
示例7: SetLocationSurfaces
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";
}
示例8: OnGotFocus
private void OnGotFocus([NotNull] object sender,
[NotNull] RoutedEventArgs e)
{
var dialog = new VistaFolderBrowserDialog();
if(dialog.ShowDialog() != true) return;
Model.WorkingPath = dialog.SelectedPath;
}
示例9: edNetLogBrowserButton_Click
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;
}
示例10: AddSpecificFolder
private void AddSpecificFolder(object sender, RoutedEventArgs e)
{
VistaFolderBrowserDialog folderDialog = new VistaFolderBrowserDialog();
bool? dialogResult = folderDialog.ShowDialog();
if (dialogResult.GetValueOrDefault(false))
{
Sources.AddSpecificFolder(folderDialog.SelectedPath);
}
}
示例11: onSelectGameDir
private void onSelectGameDir() {
VistaFolderBrowserDialog fbd = new VistaFolderBrowserDialog();
bool? result = fbd.ShowDialog();
if (!result.HasValue || !result.Value) return;
viewModel.Message.Settings.PathToGame = fbd.SelectedPath;
}
示例12: ChooseClipDirectory
private void ChooseClipDirectory(object sender, RoutedEventArgs e)
{
VistaFolderBrowserDialog fbd = new VistaFolderBrowserDialog();
Nullable<bool> r = fbd.ShowDialog();
if (r.Value)
{
CurrentSession.CurrentDirectory = fbd.SelectedPath;
}
}
示例13: FolderBrowserUI
/// <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;
}
}
示例14: SetLocationInterfaces
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();
}
示例15: Browse_OnClick
/// <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);
}
}