本文整理汇总了C#中SelectFileDialog.AddAllFilesFilter方法的典型用法代码示例。如果您正苦于以下问题:C# SelectFileDialog.AddAllFilesFilter方法的具体用法?C# SelectFileDialog.AddAllFilesFilter怎么用?C# SelectFileDialog.AddAllFilesFilter使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类SelectFileDialog
的用法示例。
在下文中一共展示了SelectFileDialog.AddAllFilesFilter方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Add
public void Add ()
{
var project = (DotNetProject) CurrentNode.GetParentDataItem (typeof(DotNetProject), true);
var dlg = new SelectFileDialog (GettextCatalog.GetString ("Select Native Library"), Gtk.FileChooserAction.Open);
dlg.SelectMultiple = true;
dlg.AddAllFilesFilter ();
//FIXME: add more filters, amke correct for platform
dlg.AddFilter (GettextCatalog.GetString ("Static Library"), ".a");
if (!dlg.Run ())
return;
foreach (var file in dlg.SelectedFiles) {
var item = new NativeReference (file);
project.Items.Add (item);
}
IdeApp.ProjectOperations.Save (project);
}
示例2: AddSolutionItem
public SolutionItem AddSolutionItem (SolutionFolder parentFolder)
{
SolutionItem res = null;
var dlg = new SelectFileDialog () {
Action = Gtk.FileChooserAction.Open,
CurrentFolder = parentFolder.BaseDirectory,
SelectMultiple = false,
};
dlg.AddAllFilesFilter ();
dlg.DefaultFilter = dlg.AddFilter (GettextCatalog.GetString ("Project Files"), "*.*proj", "*.mdp");
if (dlg.Run ()) {
try {
res = AddSolutionItem (parentFolder, dlg.SelectedFile);
} catch (Exception ex) {
MessageService.ShowException (ex, GettextCatalog.GetString ("The file '{0}' could not be loaded.", dlg.SelectedFile));
}
}
if (res != null)
IdeApp.Workspace.Save ();
return res;
}
示例3: AddWorkspaceItem
public WorkspaceItem AddWorkspaceItem (Workspace parentWorkspace)
{
WorkspaceItem res = null;
var dlg = new SelectFileDialog () {
Action = Gtk.FileChooserAction.Open,
CurrentFolder = parentWorkspace.BaseDirectory,
SelectMultiple = false,
};
dlg.AddAllFilesFilter ();
dlg.DefaultFilter = dlg.AddFilter (GettextCatalog.GetString ("Solution Files"), "*.mds", "*.sln");
if (dlg.Run ()) {
try {
res = AddWorkspaceItem (parentWorkspace, dlg.SelectedFile);
} catch (Exception ex) {
MessageService.ShowException (ex, GettextCatalog.GetString ("The file '{0}' could not be loaded.", dlg.SelectedFile));
}
}
return res;
}
示例4: AddSolutionItem
public SolutionItem AddSolutionItem (SolutionFolder parentFolder)
{
SolutionItem res = null;
var dlg = new SelectFileDialog () {
Action = Gtk.FileChooserAction.Open,
CurrentFolder = parentFolder.BaseDirectory,
SelectMultiple = false,
};
dlg.AddAllFilesFilter ();
dlg.DefaultFilter = dlg.AddFilter (GettextCatalog.GetString ("Project Files"), "*.*proj");
if (dlg.Run ()) {
if (!Services.ProjectService.IsSolutionItemFile (dlg.SelectedFile)) {
MessageService.ShowMessage (GettextCatalog.GetString ("The file '{0}' is not a known project file format.", dlg.SelectedFile));
return res;
}
if (SolutionContainsProject (parentFolder, dlg.SelectedFile)) {
MessageService.ShowMessage (GettextCatalog.GetString ("The project '{0}' has already been added.", Path.GetFileNameWithoutExtension (dlg.SelectedFile)));
return res;
}
try {
res = AddSolutionItem (parentFolder, dlg.SelectedFile);
} catch (Exception ex) {
MessageService.ShowError (GettextCatalog.GetString ("The file '{0}' could not be loaded.", dlg.SelectedFile), ex);
}
}
if (res != null)
IdeApp.Workspace.Save ();
return res;
}
示例5: AddWorkspaceItem
public async Task<WorkspaceItem> AddWorkspaceItem (Workspace parentWorkspace)
{
WorkspaceItem res = null;
var dlg = new SelectFileDialog () {
Action = FileChooserAction.Open,
CurrentFolder = parentWorkspace.BaseDirectory,
SelectMultiple = false,
};
dlg.AddAllFilesFilter ();
dlg.DefaultFilter = dlg.AddFilter (GettextCatalog.GetString ("Solution Files"), "*.mds", "*.sln");
if (dlg.Run ()) {
try {
if (WorkspaceContainsWorkspaceItem (parentWorkspace, dlg.SelectedFile)) {
MessageService.ShowMessage (GettextCatalog.GetString ("The workspace already contains '{0}'.", Path.GetFileNameWithoutExtension (dlg.SelectedFile)));
return res;
}
res = await AddWorkspaceItem (parentWorkspace, dlg.SelectedFile);
} catch (Exception ex) {
MessageService.ShowError (GettextCatalog.GetString ("The file '{0}' could not be loaded.", dlg.SelectedFile), ex);
}
}
return res;
}
示例6: BrowseForSchemaFile
/// <summary>Allows the user to browse the file system for a schema.</summary>
/// <returns>The schema filename the user selected; otherwise null.</returns>
public static string BrowseForSchemaFile ()
{
var dlg = new SelectFileDialog (GettextCatalog.GetString ("Select XML Schema"));
dlg.AddFilter (new SelectFileDialogFilter (
GettextCatalog.GetString ("XML Files"),
new string[] { "*.xsd" },
new string[] { "text/xml", "application/xml" }
));
dlg.AddAllFilesFilter ();
if (dlg.Run ())
return dlg.SelectedFile;
return null;
}
示例7: BrowseForStylesheetFile
/// <summary>Allows the user to browse the file system for a stylesheet.</summary>
/// <returns>The stylesheet filename the user selected; otherwise null.</returns>
public static string BrowseForStylesheetFile ()
{
var dlg = new SelectFileDialog (GettextCatalog.GetString ("Select XSLT Stylesheet")) {
TransientFor = IdeApp.Workbench.RootWindow,
};
dlg.AddFilter (new SelectFileDialogFilter (
GettextCatalog.GetString ("XML Files"),
new string[] { "*.xml" },
new string[] { "text/xml", "application/xml" }
));
dlg.AddFilter (new SelectFileDialogFilter(
GettextCatalog.GetString ("XSL Files"),
new string[] { "*.xslt", "*.xsl" },
new string[] { "text/x-xslt" }
));
dlg.AddAllFilesFilter ();
if (dlg.Run ())
return dlg.SelectedFile;
return null;
}
示例8: BrowseForSchemaFile
/// <summary>Allows the user to browse the file system for a schema.</summary>
/// <returns>The schema filename the user selected; otherwise null.</returns>
public static string BrowseForSchemaFile ()
{
var dlg = new SelectFileDialog (GettextCatalog.GetString ("Select XML Schema")) {
TransientFor = IdeApp.Workbench.RootWindow,
};
dlg.AddFilter (new SelectFileDialogFilter (GettextCatalog.GetString ("XML Files"), "*.xsd") {
MimeTypes = { "text/xml", "application/xml" },
});
dlg.AddAllFilesFilter ();
if (dlg.Run ())
return dlg.SelectedFile;
return null;
}