本文整理汇总了C#中Ookii.Dialogs.Wpf.VistaFolderBrowserDialog类的典型用法代码示例。如果您正苦于以下问题:C# VistaFolderBrowserDialog类的具体用法?C# VistaFolderBrowserDialog怎么用?C# VistaFolderBrowserDialog使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
VistaFolderBrowserDialog类属于Ookii.Dialogs.Wpf命名空间,在下文中一共展示了VistaFolderBrowserDialog类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: 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;
}
}
示例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: 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);
}
}
示例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: mainForm
public mainForm()
{
try
{
finishedLoading = false;
activeOrInActiveMainForm = this;
Program.Settings = Settings.LoadSettings();
Program.Settings.DirectoryList.Initialize();
InitializeComponent();
initFilesDataGridViewCheckAllCheckBox();
foldersListBox.DataSource = Program.Settings.DirectoryList.Directories;
compileResultsDataGridView.DataSource = new List<Models.CompileCommandResult>();
folderBrowserDialog = new VistaFolderBrowserDialog();
outputFileDialog = new VistaSaveFileDialog()
{
AddExtension = true,
Filter = "*.css|*.css"
};
CheckForLessUpdates();
}
catch (Exception e)
{
ExceptionHandler.LogException(e);
}
}
示例7: BrowseSteam_Click
private void BrowseSteam_Click(object sender, RoutedEventArgs e)
{
var dialog = new VistaFolderBrowserDialog();
if (dialog.ShowDialog() == true)
{
SteamDirectoryTextBox.Text = dialog.SelectedPath;
}
}
示例8: 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";
}
示例9: OnGotFocus
private void OnGotFocus([NotNull] object sender,
[NotNull] RoutedEventArgs e)
{
var dialog = new VistaFolderBrowserDialog();
if(dialog.ShowDialog() != true) return;
Model.WorkingPath = dialog.SelectedPath;
}
示例10: 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;
}
示例11: GetPath
public object GetPath(Security security, Type dataType, object arg, DateTime? from, DateTime? to, IMarketDataDrive drive)
{
var fileName = security.GetFileName(dataType, arg, from, to, ExportType);
var dlg = new VistaSaveFileDialog
{
FileName = fileName,
RestoreDirectory = true
};
switch (ExportType)
{
case ExportTypes.Excel:
dlg.Filter = @"xlsx files (*.xlsx)|*.xlsx|All files (*.*)|*.*";
break;
case ExportTypes.Xml:
dlg.Filter = @"xml files (*.xml)|*.xml|All files (*.*)|*.*";
break;
case ExportTypes.Txt:
dlg.Filter = @"text files (*.txt)|*.txt|All files (*.*)|*.*";
break;
case ExportTypes.Sql:
{
var wnd = new DatabaseConnectionWindow();
if (wnd.ShowModal(this))
{
DatabaseConnectionCache.Instance.AddConnection(wnd.Connection);
return wnd.Connection;
}
return null;
}
case ExportTypes.Bin:
{
var wndFolder = new VistaFolderBrowserDialog();
if (drive is LocalMarketDataDrive)
wndFolder.SelectedPath = drive.Path;
return wndFolder.ShowDialog(this.GetWindow()) == true
? DriveCache.Instance.GetDrive(wndFolder.SelectedPath)
: null;
}
default:
{
new MessageBoxBuilder()
.Error()
.Owner(this)
.Text(LocalizedStrings.Str2910Params.Put(ExportType))
.Show();
return null;
}
}
return dlg.ShowDialog(this.GetWindow()) == true ? dlg.FileName : null;
}
示例12: AddSpecificFolder
private void AddSpecificFolder(object sender, RoutedEventArgs e)
{
VistaFolderBrowserDialog folderDialog = new VistaFolderBrowserDialog();
bool? dialogResult = folderDialog.ShowDialog();
if (dialogResult.GetValueOrDefault(false))
{
Sources.AddSpecificFolder(folderDialog.SelectedPath);
}
}
示例13: ChooseClipDirectory
private void ChooseClipDirectory(object sender, RoutedEventArgs e)
{
VistaFolderBrowserDialog fbd = new VistaFolderBrowserDialog();
Nullable<bool> r = fbd.ShowDialog();
if (r.Value)
{
CurrentSession.CurrentDirectory = fbd.SelectedPath;
}
}
示例14: onSelectGameDir
private void onSelectGameDir() {
VistaFolderBrowserDialog fbd = new VistaFolderBrowserDialog();
bool? result = fbd.ShowDialog();
if (!result.HasValue || !result.Value) return;
viewModel.Message.Settings.PathToGame = fbd.SelectedPath;
}
示例15: 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();
}