本文整理汇总了C#中Gtk.FileFilter.AddPattern方法的典型用法代码示例。如果您正苦于以下问题:C# FileFilter.AddPattern方法的具体用法?C# FileFilter.AddPattern怎么用?C# FileFilter.AddPattern使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Gtk.FileFilter
的用法示例。
在下文中一共展示了FileFilter.AddPattern方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: setupOpenDialog
private void setupOpenDialog() {
FileFilter filter;
Glade.XML xml = getGlade("OpenDialog.glade");
xml.Autoconnect(this);
filter = new FileFilter();
filter.Name = "All support files (*.fld, *.fld.gz, *.gat)";
filter.AddPattern("*.fld");
filter.AddPattern("*.fld.gz");
filter.AddPattern("*.gat");
openFileDialog.AddFilter(filter);
filter = new FileFilter();
filter.Name = "OpenKore Field Files (*.fld, *.fld.gz)";
filter.AddPattern("*.fld");
filter.AddPattern("*.fld.gz");
openFileDialog.AddFilter(filter);
filter = new FileFilter();
filter.Name = "Ragnarok Online Ground Files (*.gat)";
filter.AddPattern("*.gat");
openFileDialog.AddFilter(filter);
filter = new FileFilter();
filter.Name = "All Files (*)";
filter.AddPattern("*");
openFileDialog.AddFilter(filter);
openFileDialog.PreviewWidget = new FieldPreview();
openFileDialog.UpdatePreview += OnUpdatePreview;
}
示例2: DatabaseSaveDialog
private DatabaseSaveDialog(Window parent)
{
Glade.XML xml = new Glade.XML(null,"gui.glade","databaseSaveDialog",null);
xml.Autoconnect(this);
databaseSaveDialog.Icon = parent.Icon;
// Conectamos las acciones de los botones del diálogo.
databaseSaveDialog.AddActionWidget(btnSave,ResponseType.Ok);
databaseSaveDialog.AddActionWidget(btnCancel,ResponseType.Cancel);
// Añadimos los archivos de filtros soportados
FileFilter filter1=new FileFilter();
filter1.Name="Archivo XML";
filter1.AddPattern("*.xml");
filter1.AddPattern("*.XML");
FileFilter filter2=new FileFilter();
filter2.Name="Base de datos de reconocimiento";
filter2.AddPattern("*.jilfml");
filter2.AddPattern("*.JILFML");
FileFilter filter3=new FileFilter();
filter3.Name="Todos los archivos";
filter3.AddPattern("*.*");
databaseSaveDialog.AddFilter(filter2);
databaseSaveDialog.AddFilter(filter1);
databaseSaveDialog.AddFilter(filter3);
}
示例3: ShowSelectDatabaseDialog
private bool ShowSelectDatabaseDialog (out string database)
{
FileChooserDialog dlg = new FileChooserDialog (
AddinCatalog.GetString ("Open Database"), null, FileChooserAction.Open,
"gtk-cancel", ResponseType.Cancel,
"gtk-open", ResponseType.Accept
);
dlg.SelectMultiple = false;
dlg.LocalOnly = true;
dlg.Modal = true;
FileFilter filter = new FileFilter ();
filter.AddMimeType ("application/x-sqlite2");
filter.AddMimeType ("application/x-sqlite3");
filter.AddPattern ("*.db");
filter.AddPattern ("*.sqlite");
filter.Name = AddinCatalog.GetString ("SQLite databases");
FileFilter filterAll = new FileFilter ();
filterAll.AddPattern ("*");
filterAll.Name = AddinCatalog.GetString ("All files");
dlg.AddFilter (filter);
dlg.AddFilter (filterAll);
database = null;
bool result = false;
try {
if (dlg.Run () == (int)ResponseType.Accept) {
database = dlg.Filename;
result = true;
}
} finally {
dlg.Destroy ();
}
return result;
}
示例4: CreateAssemblyFilter
#pragma warning restore 0169
private FileFilter CreateAssemblyFilter () {
FileFilter fileFilter = new FileFilter ();
fileFilter.Name = "Assemblies";
fileFilter.AddPattern ("*.dll");
fileFilter.AddPattern ("*.exe");
return fileFilter;
}
示例5: GetTemplateFromDisk
public static byte[] GetTemplateFromDisk()
{
//Читаем файл документа
FileChooserDialog Chooser = new FileChooserDialog ("Выберите шаблон документа...",
null,
FileChooserAction.Open,
"Отмена", ResponseType.Cancel,
"Выбрать", ResponseType.Accept);
FileFilter Filter = new FileFilter ();
Filter.Name = "ODT документы и OTT шаблоны";
Filter.AddMimeType ("application/vnd.oasis.opendocument.text");
Filter.AddMimeType ("application/vnd.oasis.opendocument.text-template");
Filter.AddPattern ("*.odt");
Filter.AddPattern ("*.ott");
Chooser.AddFilter (Filter);
Filter = new FileFilter ();
Filter.Name = "Все файлы";
Filter.AddPattern ("*.*");
Chooser.AddFilter (Filter);
byte[] file = null;
if ((ResponseType)Chooser.Run () == ResponseType.Accept) {
Chooser.Hide ();
logger.Info ("Чтение файла...");
file = File.ReadAllBytes(Chooser.Filename);
logger.Info ("Ok");
}
Chooser.Destroy ();
return file;
}
示例6: AssemblyReferencePanel
public AssemblyReferencePanel (SelectReferenceDialog selectDialog)
{
this.selectDialog = selectDialog;
chooser = new FileChooserWidget (FileChooserAction.Open, "");
chooser.SetCurrentFolder (Environment.GetFolderPath (Environment.SpecialFolder.Personal));
chooser.SelectMultiple = true;
// this should only allow dll's and exe's
FileFilter filter = new FileFilter ();
filter.Name = GettextCatalog.GetString ("Assemblies");
filter.AddPattern ("*.[Dd][Ll][Ll]");
filter.AddPattern ("*.[Ee][Xx][Ee]");
chooser.AddFilter (filter);
chooser.FileActivated += new EventHandler (SelectReferenceDialog);
PackStart (chooser, true, true, 0);
PackStart (new Gtk.VSeparator(), false, false, 0);
VBox box = new VBox ();
Gtk.Button addButton = new Gtk.Button (Gtk.Stock.Add);
addButton.Clicked += new EventHandler(SelectReferenceDialog);
box.PackStart (addButton, false, false, 0);
PackStart (box, false, false, 0);
BorderWidth = 6;
Spacing = 6;
ShowAll();
}
示例7: LogSaveDialog
/// <summary>
/// Constructor de la clase LogSaveDialog. Crea y muestra el diálogo.
/// </summary>
public LogSaveDialog()
{
Glade.XML gxml = new Glade.XML (null,"gui.glade", "logSaveDialog", null);
gxml.Autoconnect (this);
FileFilter logFilter = new FileFilter();
logFilter.Name = "Archivo de registro";
logFilter.AddPattern("*.log");
logFilter.AddPattern("*.LOG");
FileFilter txtFilter = new FileFilter();
txtFilter.Name = "Archivo de texto";
txtFilter.AddPattern("*.txt");
txtFilter.AddPattern("*.TXT");
FileFilter allFilter = new FileFilter();
allFilter.Name = "Todos los archivos";
allFilter.AddPattern("*.*");
logSaveDialog.AddFilter(logFilter);
logSaveDialog.AddFilter(txtFilter);
logSaveDialog.AddFilter(allFilter);
logSaveDialog.AddActionWidget(btnSave,ResponseType.Ok);
logSaveDialog.AddActionWidget(btnCancel,ResponseType.Cancel);
}
示例8: GetFileFilter
public static FileFilter GetFileFilter()
{
FileFilter filter = new FileFilter();
filter.Name = "Images";
filter.AddPattern("*.png");
filter.AddPattern("*.jpg");
filter.AddPattern("*.jpeg");
return filter;
}
示例9: GetImageFilters
/// <summary>
/// Get the Image filters.
/// </summary>
/// <returns>The Image filters.</returns>
protected FileFilter GetImageFilters()
{
var _filterImage = new FileFilter();
_filterImage.Name = "Image Files";
_filterImage.AddPattern("*.jpg");
_filterImage.AddPattern("*.jpeg");
_filterImage.AddPattern("*.png");
_filterImage.AddPattern("*.bmp");
return _filterImage;
}
示例10: ImportDialog
public ImportDialog()
{
this.Build ();
FileFilter filter = new FileFilter ();
filter.Name = "Waypoint Files";
filter.AddPattern ("*.gpx");
filter.AddPattern ("*.loc");
filter.AddPattern ("*.zip");
fileWidget.AddFilter (filter);
UpdateBookMarkCombo();
}
示例11: MainWindow2
public MainWindow2()
: base(Gtk.WindowType.Toplevel)
{
this.Build();
m_app = new App();
m_app.Should += delegate(Act action) {
switch (action) {
case Act.AnalyzeHorizontal: return IsHorizontalActive;
case Act.AnalyzeVertical: return IsVerticalActive;
case Act.AnalyzeIslands: return IsIslandsActive;
case Act.Analyze: return true;
case Act.Clean: return IsCleanActive;
case Act.RemoveBackground: return IsRemoveBackgroundActive;
case Act.RefreshIslandsOutputAction: return true;
case Act.Process: return true;
}
#if DEBUG
throw new NotImplementedException(action.ToString());
#else
return false;
#endif
};
m_app.UpdateInterface += delegate(object sender, UIEventArgs e) {
var app = m_app;
switch (e.UI) {
case UI.Output: textviewOutput.Buffer.Text = app.Output; return;
case UI.ErrorMessage: ShowError(app.ErrorMessage); return;
case UI.Filename: return;
case UI.IslandEditor: islandeditor1.App = m_app; islandeditor1.QueueDraw(); return;
case UI.CompletedTask: ShowCompleted(app.Task); return;
}
#if DEBUG
throw new NotImplementedException(e.UI.ToString());
#endif
};
comboboxMode.Active = 0;
comboboxProcess.Active = 0;
islandeditor1.App = m_app;
var filter = new FileFilter();
filter.AddPattern("*.png");
filter.AddPattern("*.PNG");
filechooserbuttonOpen.AddFilter(filter);
}
示例12: OnActivated
protected override void OnActivated()
{
base.OnActivated();
Gtk.FileChooserDialog fc = new Gtk.FileChooserDialog(MainClass.Languages.Translate("chose_workspace_open"), MainClass.MainWindow, FileChooserAction.Open, "Cancel", ResponseType.Cancel, "Open", ResponseType.Accept);
FileFilter filter = new FileFilter();
filter.Name = "Workspace files";
filter.AddMimeType("Workspace file");
filter.AddPattern("*.msw");
fc.AddFilter(filter);
if (!String.IsNullOrEmpty(MainClass.Settings.LastOpenedWorkspaceDir))
fc.SetCurrentFolder(MainClass.Settings.LastOpenedWorkspaceDir);
if (fc.Run() == (int)ResponseType.Accept) {
MainClass.Settings.LastOpenedWorkspaceDir = System.IO.Path.GetDirectoryName(fc.Filename);
//CloseActualWorkspace();
Workspace.Workspace workspace = Workspace.Workspace.OpenWorkspace(fc.Filename);
if (workspace != null){
//MainClass.Settings.RecentFiles.AddWorkspace(fc.Filename,fc.Filename);
MainClass.MainWindow.ReloadWorkspace(workspace,true,true);
}
}
fc.Destroy();
}
示例13: AddFilters
/// <summary>
/// Adds the filters. Returns default extension
/// </summary>
/// <returns>The filters.</returns>
/// <param name="dialog">Dialog.</param>
private static string AddFilters(FileChooserDialog dialog)
{
string defaultExtension = "teml";
string cryptedFileExtension = "temlx";
// Add experiment files filter
FileFilter fileFilter = new FileFilter();
fileFilter.AddPattern(string.Format("*.{0}", defaultExtension));
fileFilter.Name = Mono.Unix.Catalog.GetString(string.Format("Experiment files (.{0})", defaultExtension));
dialog.AddFilter(fileFilter);
// Add experiment files filter
//TLAB-67
//here: we check if the file is crypted, if it's so we ask the user to insert a password. then we decrypt the file and check the
/// password. if the pwd is the same we contninue with the standard process, otherwise we raise and error
FileFilter fileFilterCryptedFile = new FileFilter();
fileFilterCryptedFile.AddPattern(string.Format("*.{0}", cryptedFileExtension));
fileFilterCryptedFile.Name = Mono.Unix.Catalog.GetString(string.Format("Experiment files (.{0})", cryptedFileExtension));
dialog.AddFilter(fileFilterCryptedFile);
//add another option of All files
FileFilter allFilesFilter = new FileFilter();
allFilesFilter.Name = Mono.Unix.Catalog.GetString("All files");
allFilesFilter.AddPattern("*.*");
dialog.AddFilter(allFilesFilter);
return defaultExtension;
}
示例14: OnSaveButtonClicked
protected void OnSaveButtonClicked(object sender, EventArgs e)
{
try
{
FileChooserDialog fc = new FileChooserDialog("Save Filterset", this, FileChooserAction.Save, "Cancel", ResponseType.Cancel, "Save", ResponseType.Accept);
FileFilter filter = new FileFilter();
filter.Name = "DeSERt Filterset";
filter.AddMimeType("Filterset/fis");
filter.AddPattern("*.fis");
fc.AddFilter(filter);
fc.DoOverwriteConfirmation = true;
fc.CurrentName = FiltersetnameEntry.Text.Replace(" ", "-");
if (Directory.Exists(MySettings.LastFilterDir)) { fc.SetCurrentFolder(MySettings.LastFilterDir); }
ResponseType res = (ResponseType)fc.Run();
if (res == ResponseType.Ok || res == ResponseType.Close)
{
string path;
if (!System.IO.Path.HasExtension(fc.Filename)) { path = fc.Filename + ".fis"; }
else { path = fc.Filename; }
MySettings.LastFilterDir = System.IO.Path.GetDirectoryName(fc.Filename);
MySettings.Save();
fst.Name = FiltersetnameEntry.Text;
Filterset.SaveFilterset(path, fst);
saved = true;
}
fc.Destroy();
if (res == ResponseType.Close) { this.Destroy(); }
}
catch (Exception ex) { ErrorReport.ReportError("Save Button (Create Filterset)", ex); }
}
示例15: OpenClicked
protected virtual void OpenClicked (object sender, System.EventArgs e)
{
FileChooserDialog dlg = new FileChooserDialog (
GettextCatalog.GetString ("Select Executable"), null, FileChooserAction.Open,
"gtk-cancel", ResponseType.Cancel,
"gtk-open", ResponseType.Accept
);
dlg.SelectMultiple = false;
dlg.LocalOnly = true;
dlg.Modal = true;
dlg.SetCurrentFolder (Environment.GetFolderPath (Environment.SpecialFolder.Personal));
FileFilter filterExe = new FileFilter ();
filterExe.AddPattern ("*.exe");
filterExe.Name = GettextCatalog.GetString ("Executables");
FileFilter filterAll = new FileFilter ();
filterAll.AddPattern ("*");
filterAll.Name = GettextCatalog.GetString ("All files");
dlg.AddFilter (filterExe);
dlg.AddFilter (filterAll);
if (dlg.Run () == (int)ResponseType.Accept)
entryExecutable.Text = dlg.Filename;
dlg.Destroy ();
}