当前位置: 首页>>代码示例>>C#>>正文


C# Gtk.FileFilter类代码示例

本文整理汇总了C#中Gtk.FileFilter的典型用法代码示例。如果您正苦于以下问题:C# FileFilter类的具体用法?C# FileFilter怎么用?C# FileFilter使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


FileFilter类属于Gtk命名空间,在下文中一共展示了FileFilter类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: Show

        public override WindowResponse Show()
        {
            FileChooserAction fca = FileChooserAction.Open;
            switch(DialogType)
            {
                case FileDialogType.OpenFile:
                    fca = FileChooserAction.Open;
                    break;
                case FileDialogType.SelectFolder:
                    fca = FileChooserAction.SelectFolder;
                    break;
                case FileDialogType.SaveFile:
                    fca = FileChooserAction.Save;
                    break;
            }

            fc = new FileChooserDialog(Title, null, fca, Message.GetString("Cancel"), ResponseType.Cancel, Message.GetString("Select"), ResponseType.Ok);
            fc.SetCurrentFolder(InitialDirectory);
            foreach(FileTypeFilter filter in FileTypeFilters)
            {
                FileFilter ft = new FileFilter();
                ft.Name = filter.FilterName;
                foreach(string pat in filter.Filter) ft.AddPattern("*." + pat);
                fc.AddFilter(ft);
            }
            WindowResponse resp = GtkHelper.GetResponse((ResponseType)fc.Run());
            SelectedPath = fc.Filename;
            return resp;
        }
开发者ID:ivynetca,项目名称:lapsestudio,代码行数:29,代码来源:GtkFileDialog.cs

示例2: OnTargetNMMLFileButtonClicked

        protected void OnTargetNMMLFileButtonClicked(object sender, System.EventArgs e)
        {
            Gtk.FileChooserDialog fc =
                new Gtk.FileChooserDialog ("Target NMML file", this.Toplevel as Gtk.Window, FileChooserAction.Open,
                    "Cancel", ResponseType.Cancel,
                    "Select", ResponseType.Accept);

            Gtk.FileFilter filter = new Gtk.FileFilter ();
            filter.Name = "NMML files";
            filter.AddPattern ("*.nmml");
            fc.AddFilter (filter);

            if (mProject.TargetNMMLFile != "")
            {
                fc.SetFilename (mProject.TargetNMMLFile);
            }
            else
            {
                fc.SetFilename (mProject.BaseDirectory);
            }

            if (fc.Run () == (int)ResponseType.Accept)
            {
                string path = PathHelper.ToRelativePath (fc.Filename, mProject.BaseDirectory);

                TargetNMMLFileEntry.Text = path;
            }

            fc.Destroy ();
        }
开发者ID:tjhei,项目名称:md-haxebinding,代码行数:30,代码来源:NMEProjectOptionsPanel.cs

示例3: SetFilters

	/* Private methods */

	private void SetFilters () {

		/* Video files */
		FileFilter videoFilesFilter = new FileFilter();
		videoFilesFilter.Name = Catalog.GetString("All Video Files");
		videoFilesFilter.AddMimeType("video/*");
		videoFilesFilter.AddMimeType("application/vnd.rn-realmedia"); //support for real media files (currently includes rmvb)
		videoFilesFilter.AddMimeType("application/vnd.rn-realmedia-vbr"); //this should be the real mime type for rmvb files
		dialog.AddFilter(videoFilesFilter);

		/* Audio files */
		FileFilter audioFilesFilter = new FileFilter();
		audioFilesFilter.Name = Catalog.GetString("All Audio Files");
		audioFilesFilter.AddMimeType("audio/*");
		audioFilesFilter.AddMimeType("application/ogg");
		dialog.AddFilter(audioFilesFilter);


		/* All files */
		FileFilter allFilesFilter = new FileFilter();
		allFilesFilter.Name = Catalog.GetString("All Files");
		allFilesFilter.AddPattern("*");
		dialog.AddFilter(allFilesFilter);

		/* Set active filter */
		dialog.Filter = videoFilesFilter;
	}
开发者ID:GNOME,项目名称:gnome-subtitles,代码行数:29,代码来源:VideoOpenDialog.cs

示例4: 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); 
		}
开发者ID:coler706,项目名称:mathtextrecognizer,代码行数:29,代码来源:LogSaveDialog.cs

示例5: onAddClicked

 protected void onAddClicked(object sender, System.EventArgs e)
 {
     String[] items = {};
     FileChooserDialog dialog =
         new FileChooserDialog("Open",
              null,
             FileChooserAction.Open,
             "Cancel",ResponseType.Cancel,
             "Open",ResponseType.Accept);
     dialog.SelectMultiple=true;
     FileFilter filter = new FileFilter();
     /*filter.AddPattern("*.jpg");
     filter.AddPattern("*.jpeg");
     filter.AddPattern("*.png");
     filter.AddPattern("*.svg");*/
     filter.AddMimeType("image/*");
     dialog.Filter = filter;
     if(dialog.Run()==(int)ResponseType.Accept)
     {
         items = dialog.Filenames;
     }
     dialog.Destroy();
     localfiles.LocalFiles.addItems(items);
     fillList();
 }
开发者ID:GustavoKatel,项目名称:mate-wallpaper-changer,代码行数:25,代码来源:View.cs

示例6: OnActivated

        protected override void OnActivated()
        {
            base.OnActivated();

            if(String.IsNullOrEmpty(MainClass.Workspace.FilePath)){
                MessageDialogs md = new MessageDialogs(MessageDialogs.DialogButtonType.Ok, MainClass.Languages.Translate("workspace_not_exist"), MainClass.Languages.Translate("please_create_workspace"), Gtk.MessageType.Error);
                md.ShowDialog();
                return;
            }

            Gtk.FileChooserDialog fc = new Gtk.FileChooserDialog(MainClass.Languages.Translate("chose_project_import"), MainClass.MainWindow, FileChooserAction.Open, "Cancel", ResponseType.Cancel, "Open", ResponseType.Accept);

            if (!String.IsNullOrEmpty(MainClass.Settings.LastOpenedImportDir))
                fc.SetCurrentFolder(MainClass.Settings.LastOpenedImportDir);

            FileFilter filter = new FileFilter();
            filter.Name = "zip files";
            filter.AddMimeType("zip file");
            filter.AddPattern("*.zip");
            fc.AddFilter(filter);

            if (fc.Run() == (int)ResponseType.Accept) {

                MainClass.Settings.LastOpenedImportDir = System.IO.Path.GetDirectoryName(fc.Filename);

                MainClass.MainWindow.ImportProject(fc.Filename,true);
            }

            fc.Destroy();
        }
开发者ID:moscrif,项目名称:ide,代码行数:30,代码来源:ImportZipProjectAction.cs

示例7: GetClip

        static void GetClip()
        {
            // TODO: Do not offer to save clip after selection and popup a clickable tooltip instead.
            FileChooserDialog fcd = new FileChooserDialog("PixClip - Save clip as...", null, FileChooserAction.Save, "Cancel", ResponseType.Cancel, "Save", ResponseType.Accept);
            FileFilter fltJpg = new FileFilter();
            fltJpg.AddMimeType("image/jpeg");
            fltJpg.Name = "JPEG image format";
            fcd.SetFilename("clip.jpg");
            fcd.SetCurrentFolder(System.Environment.GetFolderPath(System.Environment.SpecialFolder.Desktop));
            fcd.AddFilter(fltJpg);

            Console.WriteLine("main: selecting save target");
            if (fcd.Run() == (int) ResponseType.Accept) {
                // TODO: Add quality setting to options form.
                // http://library.gnome.org/devel/gdk-pixbuf/stable/gdk-pixbuf-file-saving.html
                string [] keys = {"quality"};
                string [] values = {"90"};
                pixClip.Savev(fcd.Filename, "jpeg", keys, values);
                Console.WriteLine("main: image saved");
            } else {
                Console.WriteLine("main: image save canceled");
            }
            fcd.Destroy();

            Clipboard clip = Gtk.Clipboard.Get(Atom.Intern("CLIPBOARD", false));
            clip.Image = pixClip;
            Console.WriteLine("main: image added to the clipboard");
        }
开发者ID:torvall,项目名称:pixclip-linux,代码行数:28,代码来源:Main.cs

示例8: Activated

        private void Activated(object sender, EventArgs e)
        {
            var fcd = new Gtk.FileChooserDialog (Catalog.GetString ("Open Image File"), PintaCore.Chrome.MainWindow,
                                FileChooserAction.Open, Gtk.Stock.Cancel, Gtk.ResponseType.Cancel,
                                Gtk.Stock.Open, Gtk.ResponseType.Ok);

            // Add image files filter
            FileFilter ff = new FileFilter ();
            ff.AddPixbufFormats ();
            ff.AddPattern ("*.ora");
            ff.Name = Catalog.GetString ("Image files");
            fcd.AddFilter (ff);

            FileFilter ff2 = new FileFilter ();
            ff2.Name = Catalog.GetString ("All files");
            ff2.AddPattern ("*.*");
            fcd.AddFilter (ff2);

            fcd.AlternativeButtonOrder = new int[] { (int)ResponseType.Ok, (int)ResponseType.Cancel };
            fcd.SetCurrentFolder (PintaCore.System.LastDialogDirectory);
            fcd.SelectMultiple = true;

            int response = fcd.Run ();

            if (response == (int)Gtk.ResponseType.Ok) {
                PintaCore.System.LastDialogDirectory = fcd.CurrentFolder;

                foreach (var file in fcd.Filenames)
                    if (PintaCore.Workspace.OpenFile (file))
                        RecentManager.Default.AddFull (fcd.Uri, PintaCore.System.RecentData);
            }

            fcd.Destroy ();
        }
开发者ID:rolandixor,项目名称:Pinta,代码行数:34,代码来源:OpenDocumentAction.cs

示例9: ImageFileChooserDialog

        public ImageFileChooserDialog () : base (Catalog.GetString("Select album cover image"), FileChooserAction.Open)
        {
            AddButton (Stock.Cancel, ResponseType.Cancel);
            AddButton (Stock.Open, ResponseType.Ok);

            DefaultResponse = ResponseType.Ok;

            FileFilter filter = new FileFilter ();
            filter.Name = Catalog.GetString ("All image files");
            filter.AddMimeType ("image/jpeg");
            filter.AddMimeType ("image/png");
            AddFilter (filter);
            Filter = filter;

            filter = new FileFilter ();
            filter.Name = Catalog.GetString ("JPEG image files");
            filter.AddMimeType ("image/jpeg");
            AddFilter (filter);

            filter = new FileFilter ();
            filter.Name = Catalog.GetString ("PNG image files");
            filter.AddMimeType ("image/png");
            AddFilter (filter);

            PreviewWidget = preview;
        }
开发者ID:haugjan,项目名称:banshee-hacks,代码行数:26,代码来源:ImageFileChooserDialog.cs

示例10: FormatDescriptor

		/// <param name="displayPrefix">
		/// A descriptive name for the format, such as "OpenRaster". This will be displayed
		/// in the file dialog's filter.
		/// </param>
		/// <param name="extensions">A list of supported file extensions (for example, "jpeg" and "JPEG").</param>
		/// <param name="importer">The importer for this file format, or null if importing is not supported.</param>
		/// <param name="exporter">The exporter for this file format, or null if exporting is not supported.</param>
		public FormatDescriptor (string displayPrefix, string[] extensions,
		                         IImageImporter importer, IImageExporter exporter)
		{
			if (extensions == null || (importer == null && exporter == null)) {
				throw new ArgumentNullException ("Format descriptor is initialized incorrectly");
			}
		
			this.Extensions = extensions;
			this.Importer = importer;
			this.Exporter = exporter;
			
			FileFilter ff = new FileFilter ();
			StringBuilder formatNames = new StringBuilder ();
			
			foreach (string ext in extensions) {
				if (formatNames.Length > 0)
					formatNames.Append (", ");
				
				string wildcard = string.Format ("*.{0}", ext);
				ff.AddPattern (wildcard);
				formatNames.Append (wildcard);
			}

			ff.Name = string.Format (Catalog.GetString ("{0} image ({1})"), displayPrefix, formatNames);
			this.Filter = ff;
		}
开发者ID:msiyer,项目名称:Pinta,代码行数:33,代码来源:FormatDescriptor.cs

示例11: 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;
        }
开发者ID:QualitySolution,项目名称:QSProjects,代码行数:35,代码来源:TemplatesMain.cs

示例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();
        }
开发者ID:moscrif,项目名称:ide,代码行数:31,代码来源:OpenWorkspaceAction.cs

示例13: OnButtonLoadPhotoClicked

        protected void OnButtonLoadPhotoClicked(object sender, EventArgs e)
        {
            FileChooserDialog Chooser = new FileChooserDialog ("Выберите фото для загрузки...",
                (Window)this.Toplevel,
                FileChooserAction.Open,
                "Отмена", ResponseType.Cancel,
                "Загрузить", ResponseType.Accept);

            FileFilter Filter = new FileFilter ();
            Filter.AddPixbufFormats ();
            Filter.Name = "Все изображения";
            Chooser.AddFilter (Filter);

            if ((ResponseType)Chooser.Run () == ResponseType.Accept) {
                Chooser.Hide ();
                logger.Info ("Загрузка фотографии...");

                FileStream fs = new FileStream (Chooser.Filename, FileMode.Open, FileAccess.Read);
                if (Chooser.Filename.ToLower ().EndsWith (".jpg")) {
                    using (MemoryStream ms = new MemoryStream ()) {
                        fs.CopyTo (ms);
                        ImageFile = ms.ToArray ();
                    }
                } else {
                    logger.Info ("Конвертация в jpg ...");
                    Gdk.Pixbuf image = new Gdk.Pixbuf (fs);
                    ImageFile = image.SaveToBuffer ("jpeg");
                }
                fs.Close ();
                buttonSavePhoto.Sensitive = true;
                logger.Info ("Ok");
            }
            Chooser.Destroy ();
        }
开发者ID:QualitySolution,项目名称:QSProjects,代码行数:34,代码来源:PhotoView.cs

示例14: CreateAssemblyFilter

		#pragma warning restore 0169
		
		private FileFilter CreateAssemblyFilter () {
			FileFilter fileFilter = new FileFilter ();
			fileFilter.Name = "Assemblies";
			fileFilter.AddPattern ("*.dll");
			fileFilter.AddPattern ("*.exe");
			return fileFilter;
		}
开发者ID:JianwenSun,项目名称:mono-soc-2007,代码行数:9,代码来源:MainWindow.cs

示例15: 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);	
		}
开发者ID:coler706,项目名称:mathtextrecognizer,代码行数:31,代码来源:DatabaseSaveDialog.cs


注:本文中的Gtk.FileFilter类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。