本文整理汇总了C#中Ookii.Dialogs.Wpf.VistaOpenFileDialog.ShowDialog方法的典型用法代码示例。如果您正苦于以下问题:C# VistaOpenFileDialog.ShowDialog方法的具体用法?C# VistaOpenFileDialog.ShowDialog怎么用?C# VistaOpenFileDialog.ShowDialog使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Ookii.Dialogs.Wpf.VistaOpenFileDialog
的用法示例。
在下文中一共展示了VistaOpenFileDialog.ShowDialog方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: ChooseMapPath
void ChooseMapPath(object sender, RoutedEventArgs e) {
var ofd = new VistaOpenFileDialog();
ofd.Filter = "Symbol maps (*.map)|*.map|All Files (*.*)|*.*";
if (ofd.ShowDialog() ?? false) {
PathBox.Text = ofd.FileName;
}
}
示例2: ChooseSNKey
void ChooseSNKey(object sender, RoutedEventArgs e) {
var ofd = new VistaOpenFileDialog();
ofd.Filter = "Supported Key Files (*.snk, *.pfx)|*.snk;*.pfx|All Files (*.*)|*.*";
if (ofd.ShowDialog() ?? false) {
module.SNKeyPath = ofd.FileName;
}
}
示例3: GetFileOpenPath
public string[] GetFileOpenPath(string title, string filter)
{
if (VistaOpenFileDialog.IsVistaFileDialogSupported)
{
VistaOpenFileDialog openFileDialog = new VistaOpenFileDialog();
openFileDialog.Title = title;
openFileDialog.CheckFileExists = true;
openFileDialog.RestoreDirectory = true;
openFileDialog.Multiselect = true;
openFileDialog.Filter = filter;
if (openFileDialog.ShowDialog() == true)
return openFileDialog.FileNames;
}
else
{
Microsoft.Win32.OpenFileDialog ofd = new Microsoft.Win32.OpenFileDialog();
ofd.Title = title;
ofd.CheckFileExists = true;
ofd.RestoreDirectory = true;
ofd.Multiselect = true;
ofd.Filter = filter;
if (ofd.ShowDialog() == true)
return ofd.FileNames;
}
return null;
}
示例4: OnAddReferenceButtonClick
private void OnAddReferenceButtonClick(object sender, RoutedEventArgs e)
{
var dialog = new VistaOpenFileDialog
{
CheckFileExists = true,
Multiselect = false,
Filter = LocalizedStrings.Str1422
};
if (dialog.ShowDialog(this.GetWindow()) != true)
return;
var assembly = Assembly.ReflectionOnlyLoadFrom(dialog.FileName);
if (assembly != null)
{
_references.Add(new CodeReference
{
Name = assembly.GetName().Name,
Location = assembly.Location
});
}
else
{
new MessageBoxBuilder()
.Text(LocalizedStrings.Str1423)
.Warning()
.Owner(this)
.Show();
}
}
示例5: UnitPrefabBrowseButton_Click
private void UnitPrefabBrowseButton_Click(object sender, RoutedEventArgs e)
{
var dialog = new VistaOpenFileDialog { Filter = @"All files (*.*)|*.*" };
var showDialog = dialog.ShowDialog(Application.Current.MainWindow);
if (showDialog != null && (bool)showDialog) {
var splitPath = dialog.FileName.Split("\\"[0]);
UnitPrefabPath.Text = splitPath[splitPath.Length - 1];
}
}
示例6: BrowseButton_Click
private void BrowseButton_Click(object sender, RoutedEventArgs e)
{
var fileBrowser = new VistaOpenFileDialog
{
CheckFileExists = true,
CheckPathExists = true,
Filter = Properties.Resources.SupportedAudioFilesFilter
};
if (fileBrowser.ShowDialog() != true) return;
FilePath = fileBrowser.FileName;
}
示例7: BrowseButton_Click
private void BrowseButton_Click(object sender, RoutedEventArgs e)
{
var dialog = new VistaOpenFileDialog
{
Filter = "Executables (*.exe)|*.exe",
Multiselect = false
};
if (dialog.ShowDialog() == true)
{
ExePathTextBox.Text = dialog.FileName;
ExePath = dialog.FileName;
}
}
示例8: ChooseTargetProgramClick
private void ChooseTargetProgramClick(object sender, RoutedEventArgs eventArgs)
{
var dialog = new VistaOpenFileDialog
{
DefaultExt = ".exe",
Filter = "Executable files (.exe)|*.exe"
};
bool? result = dialog.ShowDialog();
if (result == true)
{
MainWindowData.ProgramPath = dialog.FileName;
}
}
示例9: OnApplyTemplate
public override void OnApplyTemplate()
{
base.OnApplyTemplate();
AddPlugin.Command = new RelayCommand(() => {
var ofd = new VistaOpenFileDialog();
ofd.Filter = ".NET assemblies (*.exe, *.dll)|*.exe;*.dll|All Files (*.*)|*.*";
ofd.Multiselect = true;
if (ofd.ShowDialog() ?? false) {
foreach (string plugin in ofd.FileNames) {
try {
ComponentDiscovery.LoadComponents(project.Protections, project.Packers, plugin);
project.Plugins.Add(new StringItem(plugin));
}
catch {
MessageBox.Show("Failed to load plugin '" + plugin + "'.");
}
}
}
});
RemovePlugin.Command = new RelayCommand(() => {
int selIndex = PluginPaths.SelectedIndex;
Debug.Assert(selIndex != -1);
string plugin = project.Plugins[selIndex].Item;
ComponentDiscovery.RemoveComponents(project.Protections, project.Packers, plugin);
project.Plugins.RemoveAt(selIndex);
PluginPaths.SelectedIndex = selIndex >= project.Plugins.Count ? project.Plugins.Count - 1 : selIndex;
}, () => PluginPaths.SelectedIndex != -1);
AddProbe.Command = new RelayCommand(() => {
var fbd = new VistaFolderBrowserDialog();
if (fbd.ShowDialog() ?? false)
project.ProbePaths.Add(new StringItem(fbd.SelectedPath));
});
RemoveProbe.Command = new RelayCommand(() => {
int selIndex = ProbePaths.SelectedIndex;
Debug.Assert(selIndex != -1);
project.ProbePaths.RemoveAt(selIndex);
ProbePaths.SelectedIndex = selIndex >= project.ProbePaths.Count ? project.ProbePaths.Count - 1 : selIndex;
}, () => ProbePaths.SelectedIndex != -1);
}
示例10: TryFilePath
public static bool TryFilePath(string dialogTitle, string filter, out string fileName)
{
var fileSelector = new VistaOpenFileDialog()
{
Title = dialogTitle,
Filter = filter,
Multiselect = false,
CheckFileExists = true,
DefaultExt = filter.Split('|').ElementAt(1).Replace("*", "") // It SHOULD be an extension method, so todo
};
if (fileSelector.ShowDialog() == true)
{
fileName = fileSelector.FileName;
return true;
}
else
{
fileName = string.Empty;
return false;
}
}
示例11: Browse_Click
private void Browse_Click(object sender, RoutedEventArgs e)
{
var dlg = new VistaOpenFileDialog
{
Filter = "Assembly Files (*.dll)|*.dll",
Multiselect = true,
};
if (dlg.ShowDialog(this) != true)
return;
Toc.Items.Clear();
var navigation = new Navigation
{
UrlPrefix = "http://stocksharp.com/doc/ref/",
EmptyImage = "http://stocksharp.com/images/blank.gif"
};
GenerateHtml.CssUrl = @"file:///C:/VisualStudio/Web/trunk/Site/css/style.css";
GenerateHtml.Navigation = navigation; //ToDo: переделать
GenerateHtml.IsHtmlAsDiv = false;
GenerateHtml.IsRussian = true;
var asmFiles = dlg.FileNames;
var docFiles = asmFiles
.Select(f => Path.Combine(Path.GetDirectoryName(f), Path.GetFileNameWithoutExtension(f) + ".xml"))
.Where(File.Exists)
.ToArray();
var slnDom = SolutionDom.Build("StockSharp. Описание типов", asmFiles, docFiles, Path.GetFullPath(@"..\..\..\..\..\StockSharp\trunk\Documentation\DocSandCastle\Comments\project.xml"), null, new FindOptions
{
InternalClasses = false,
UndocumentedClasses = true,
PrivateMembers = false,
UndocumentedMembers = true
});
_root = BuildPages.BuildSolution(slnDom);
BuildTree(_root, Toc.Items);
}
示例12: Import
/// <summary>
/// Import a CSV file
/// </summary>
public void Import()
{
var dialog = new VistaOpenFileDialog { Filter = "CSV files (*.csv)|*.csv", CheckFileExists = true };
dialog.ShowDialog();
string filename = dialog.FileName;
if (string.IsNullOrEmpty(filename))
{
return;
}
IDictionary<int, string> chapterMap = new Dictionary<int, string>();
try
{
var sr = new StreamReader(filename);
string csv = sr.ReadLine();
while (csv != null)
{
if (csv.Trim() != string.Empty)
{
csv = csv.Replace("\\,", "<!comma!>");
string[] contents = csv.Split(',');
int chapter;
int.TryParse(contents[0], out chapter);
chapterMap.Add(chapter, contents[1].Replace("<!comma!>", ","));
}
csv = sr.ReadLine();
}
}
catch (Exception)
{
// Do Nothing
}
// Now iterate over each chatper we have, and set it's name
foreach (ChapterMarker item in this.Chapters)
{
string chapterName;
chapterMap.TryGetValue(item.ChapterNumber, out chapterName);
item.ChapterName = chapterName;
// TODO force a fresh of this property
}
}
示例13: BrowseVlcPath
/// <summary>
/// Browse VLC Path
/// </summary>
public void BrowseVlcPath()
{
VistaOpenFileDialog dialog = new VistaOpenFileDialog { Filter = "All files (*.exe)|*.exe" };
dialog.ShowDialog();
this.VLCPath = dialog.FileName;
}
示例14: BrowseSendFileTo
/// <summary>
/// Browse - Send File To
/// </summary>
public void BrowseSendFileTo()
{
VistaOpenFileDialog dialog = new VistaOpenFileDialog { Filter = "All files (*.*)|*.*" };
dialog.ShowDialog();
this.SendFileTo = Path.GetFileNameWithoutExtension(dialog.FileName);
this.sendFileToPath = dialog.FileName;
}
示例15: Import
/// <summary>
/// Import an SRT File.
/// </summary>
public void Import()
{
VistaOpenFileDialog dialog = new VistaOpenFileDialog
{
Filter = "SRT files (*.srt)|*.srt",
CheckFileExists = true,
Multiselect = true
};
dialog.ShowDialog();
foreach (var srtFile in dialog.FileNames)
{
SubtitleTrack track = new SubtitleTrack
{
SrtFileName = Path.GetFileNameWithoutExtension(srtFile),
SrtOffset = 0,
SrtCharCode = "UTF-8",
SrtLang = "English",
SubtitleType = SubtitleType.SRT,
SrtPath = srtFile
};
this.Task.SubtitleTracks.Add(track);
}
}