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


C# FileChooserDialog.Destroy方法代码示例

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


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

示例1: OpenFileButton_Clicked

        private void OpenFileButton_Clicked(object sender, EventArgs e)
        {
            var fileChooser = new FileChooserDialog("Pick a file", this.Window, FileChooserAction.Open, "Cancel", ResponseType.Cancel, "Open", ResponseType.Accept);
            fileChooser.Filter = new FileFilter();
            fileChooser.Filter.AddPattern("*.xt");
#if DEBUG
            fileChooser.SetCurrentFolder(@"c:\tmp\traces");
#endif
            var result = (ResponseType)Enum.ToObject(typeof(ResponseType), fileChooser.Run());
            switch (result)
            {
                case ResponseType.Accept:
                    var filename = fileChooser.Filename;
                    Parser parser = null;
                    fileChooser.Destroy();
                    try
                    {
                        parser = Parser.ParseFile(filename);
                    }
                    catch (Exception ex)
                    {
                        var dlg = new MessageDialog(this.Window, DialogFlags.Modal, MessageType.Error, ButtonsType.Ok, "Failed to load/parse the selected file! \r\nSome indication: " + ex.Message);
                        dlg.Run();
                    }
                    if (parser != null)
                    {
                        ShowTraces(parser);
                    }
                    break;
                case ResponseType.Cancel:
                case ResponseType.DeleteEvent:
                    fileChooser.Destroy();
                    break;
            }
        }
开发者ID:boykathemad,项目名称:xdebug-trace-viewer,代码行数:35,代码来源:MainWindow.cs

示例2: 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("save_project_export"), MainClass.MainWindow, FileChooserAction.Save, "Cancel", ResponseType.Cancel, "Save", ResponseType.Accept);

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

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

            string appname = "";
            int typ = -1;
            Gtk.TreeIter ti = new Gtk.TreeIter();
            MainClass.MainWindow.WorkspaceTree.GetSelectedFile(out appname, out typ, out ti);

            if (String.IsNullOrEmpty(appname)){
                return;
            }

            Project p = MainClass.Workspace.FindProject_byApp(appname, true);

            if(p== null){
                return;
            }

            fc.CurrentName =p.ProjectName;

            if (fc.Run() != (int)ResponseType.Accept) {
                fc.Destroy();
                return;
            }

            string name =fc.Filename;

            string ext = System.IO.Path.GetExtension(name);

            if(ext.ToLower() != ".zip")
                name = name+".zip";

            if(p!= null){
                p.Export(name,false);
                MainClass.Settings.LastOpenedExportDir = System.IO.Path.GetDirectoryName(fc.Filename);
            }
            fc.Destroy();
        }
开发者ID:moscrif,项目名称:ide,代码行数:56,代码来源:ExportZipprojectAction.cs

示例3: AskForQuizFilePath

    public string AskForQuizFilePath()
    {
        string output;

        Gtk.FileChooserDialog fc =
            new Gtk.FileChooserDialog("Choose the quiz to open",
                this,
                FileChooserAction.Open,
                "Cancel",ResponseType.Cancel,
                "Open",ResponseType.Accept);

        if (fc.Run() == (int)ResponseType.Accept)
        {
            output = fc.Filename;
        }
        else
        {
            throw new ApplicationException("Could for some reason not read the wanted file: " + fc.Filename);
        }

        //Don't forget to call Destroy() or the FileChooserDialog window won't get closed.
        fc.Destroy();

        return output;
    }
开发者ID:NTAWolf,项目名称:CSharpExamPrepper,代码行数:25,代码来源:MainWindow.cs

示例4: OpenExperimentDialog

        internal static string OpenExperimentDialog(Window parentWindow) 
        {
            var fileChooserDialog = new Gtk.FileChooserDialog(Mono.Unix.Catalog.GetString ("Open Experiment File"), 
                                                               parentWindow,
                                                               FileChooserAction.Open, 
                                                               Gtk.Stock.Cancel, 
                                                               Gtk.ResponseType.Cancel,
                                                               Gtk.Stock.Open, Gtk.ResponseType.Ok);

            fileChooserDialog.AlternativeButtonOrder = new int[] { (int)ResponseType.Ok, (int)ResponseType.Cancel };
            fileChooserDialog.SelectMultiple = false;

            AddFilters(fileChooserDialog);

            int response = fileChooserDialog.Run();

            string filename = null;
            if(response == (int)Gtk.ResponseType.Ok) 
            {
                filename = fileChooserDialog.Filename;
            }
            
            fileChooserDialog.Destroy();

            return filename;
        }
开发者ID:jira-sarec,项目名称:ICSE-2012-TraceLab,代码行数:26,代码来源:FileDialogs.cs

示例5: buttonBrowsePickTake_Clicked

		void buttonBrowsePickTake_Clicked(object sender, EventArgs e)
		{
			FileChooserDialog fc =
			new FileChooserDialog
				(
				  "Choose the file to open"
				, this
				, FileChooserAction.Open
				, "Cancel", ResponseType.Cancel
				, "Open", ResponseType.Accept
				);

			if (fc.Run() == (int)ResponseType.Accept)
			{
				int l = fc.Filename.LastIndexOf('\\') + 1;
				textBoxImageNamePickedTaken.Text = fc.Filename.Substring(l);
				
				System.IO.FileStream file = System.IO.File.OpenRead(fc.Filename);
				file.Close();
			}
			//Don't forget to call Destroy() or the FileChooserDialog window won't get closed.
			fc.Destroy();

			return;
		}
开发者ID:holisticware-admin,项目名称:HolisticWare.PR.DevUG.CKVZ.SlideShow,代码行数:25,代码来源:Screen.BrowsePickTake.cs

示例6: OpenExperimentDialog

        internal static string OpenExperimentDialog(Window parentWindow) 
        {
            var fileChooserDialog = new Gtk.FileChooserDialog(Mono.Unix.Catalog.GetString ("Open Experiment File"), 
                                                               parentWindow,
                                                               FileChooserAction.Open, 
                                                               Gtk.Stock.Cancel, 
                                                               Gtk.ResponseType.Cancel,
                                                               Gtk.Stock.Open, Gtk.ResponseType.Ok);

            fileChooserDialog.AlternativeButtonOrder = new int[] { (int)ResponseType.Ok, (int)ResponseType.Cancel };
            fileChooserDialog.SelectMultiple = false;

            // HERZUM SPRINT 4 TLAB-214
            fileChooserDialog.SetCurrentFolder(TraceLab.Core.Settings.Settings.GetSettings().DefaultExperimentsDirectory);
            // END SPRINT HERZUM 4 HERZUM 4: TLAB-214

            AddFilters(fileChooserDialog);

            int response = fileChooserDialog.Run();

            string filename = null;
            if(response == (int)Gtk.ResponseType.Ok) 
            {
                filename = fileChooserDialog.Filename;
            }
            
            fileChooserDialog.Destroy();

            return filename;
        }
开发者ID:CoEST,项目名称:TraceLab,代码行数:30,代码来源:FileDialogs.cs

示例7: OnOpenActionActivated

    protected void OnOpenActionActivated(object sender, EventArgs e)
    {
        Gtk.FileChooserDialog fc = new FileChooserDialog (
                                       "Choose image to open",
                                       this,
                                       Gtk.FileChooserAction.Open, "Cancel", ResponseType.Cancel, "Open", ResponseType.Accept);
        fc.Filter = new FileFilter();
        fc.Filter.AddPattern ("*.png");
        fc.Filter.AddPattern ("*.jpg");
        fc.Filter.AddPattern("*.jpeg");
        fc.Filter.AddPattern ("*.gif");
        fc.Filter.AddPattern("*.tiff");

        if (fc.Run() == (int)ResponseType.Accept)
        {
            System.Drawing.Image host = System.Drawing.Image.FromFile (fc.Filename);
            Bitmap hostImage = new Bitmap (host);
            MemoryStream pic = new MemoryStream ();
            hostImage.Save (pic, System.Drawing.Imaging.ImageFormat.Png);

            pic.Seek (0, SeekOrigin.Begin);
            Gdk.Pixbuf pb = new Gdk.Pixbuf (pic);
            originalImage.Pixbuf = pb;
        }
        //Don't forget to call Destroy() or the FileChooserDialog window won't get closed.
        fc.Destroy();
    }
开发者ID:rums,项目名称:bdm-steg,代码行数:27,代码来源:MainWindow.cs

示例8: Activate

		public void Activate()
		{
			object[] buttonResponses = new object[] {"Accept", ResponseType.Accept, "Cancel", ResponseType.Cancel};
			FileChooserDialog fileDialog = new FileChooserDialog("Local Studies", (Window)_mainView.GuiElement, FileChooserAction.SelectFolder, buttonResponses);
			
			int result = fileDialog.Run();
			string folder = fileDialog.Filename;
			fileDialog.Destroy();	// must manually destroy the dialog
			
			if(result == (int)ResponseType.Accept)
			{
				LocalImageLoader loader = new LocalImageLoader();
				string studyUID = loader.Load(folder);
				//if(studyUID == "" || WorkstationModel.StudyManager.StudyTree.GetStudy(studyUID) == null)
				if(studyUID == "" || ImageWorkspace.StudyManager.StudyTree.GetStudy(studyUID) == null)
				{
					//Platform.ShowMessageBox(ClearCanvas.Workstation.Model.SR.ErrorUnableToLoadStudy);
					Platform.ShowMessageBox(ClearCanvas.ImageViewer.SR.ErrorUnableToLoadStudy);
				}
				else
				{
					ImageWorkspace ws = new ImageWorkspace(studyUID);
					//WorkstationModel.WorkspaceManager.Workspaces.Add(ws);
					DesktopApplication.WorkspaceManager.Workspaces.Add(ws);
				}
			}
		}
开发者ID:nhannd,项目名称:Xian,代码行数:27,代码来源:StudyCentreTool.cs

示例9: 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

示例10: loadBatchPoints

        //Will load in multiple files, or a folder of files which will be matched against
        //loaded templates
        public static List<Tuple<string, List<PointD>>> loadBatchPoints()
        {
            List<Tuple<string,List<PointD>>> result = new List<Tuple<string,List<PointD>>> ();

            //Setup of dialog and limiting it to only XML files
            FileChooserDialog fileChooser = new FileChooserDialog ("Open Files", null, FileChooserAction.Open);
            fileChooser.AddButton (Stock.Cancel, ResponseType.Cancel);
            fileChooser.AddButton (Stock.Open, ResponseType.Ok);

            fileChooser.Filter = new FileFilter ();
            fileChooser.Filter.AddPattern ("*.xml");

            string tmp = System.IO.Directory.GetCurrentDirectory();
            string newTmp = tmp + "/../../Gestures/RecordedDataPoints/";
            fileChooser.SetCurrentFolder (newTmp);

            fileChooser.SelectMultiple = true;

            ResponseType retVal = (ResponseType)fileChooser.Run ();

            if (retVal == ResponseType.Ok) {
                foreach (string file in fileChooser.Filenames) {
                    result.Add (XMLParser.BatchLoadPoints (file));
                }
            }

            fileChooser.Destroy ();
            return result;
        }
开发者ID:justingruber,项目名称:Protractor,代码行数:31,代码来源:CustomFunctions.cs

示例11: OnButtonClicked

    protected void OnButtonClicked(object sender, EventArgs e)
    {
        if (sender == button1)
        {

            Gtk.FileChooserDialog dialog = new Gtk.FileChooserDialog ("Choose item...", this, FileChooserAction.Open, "Cancel",  ResponseType.Cancel, "Insert Spacer",  ResponseType.None, "Add", ResponseType.Accept);

            Gtk.Alignment align = new Alignment (1, 0, 0, 1);
            Gtk.Frame frame = new Frame ("Position");
            Gtk.HBox hbox = new HBox (false, 4);

            RadioButton rbRight;
            rbRight = new RadioButton ("Right");
            hbox.PackEnd(rbRight, false, false, 1);
            hbox.PackEnd(new RadioButton (rbRight, "Left"), false, false, 1);

            frame.Add (hbox);
            align.Add (frame);
            align.ShowAll ();
            dialog.ExtraWidget = align;

            ResponseType response = (ResponseType)dialog.Run ();
            if (response == ResponseType.Accept) {
                RunCommand ("defaults write com.apple.dock " + GetAlign(dialog.ExtraWidget) + " -array-add '<dict><key>tile-data</key><dict><key>file-data</key><dict><key>_CFURLString</key><string>" + dialog.Filename + "</string><key>_CFURLStringType</key><integer>0</integer></dict></dict></dict>' && /bin/sleep 1 &&/usr/bin/killall Dock");
            } else if (response == ResponseType.None) {
                RunCommand ("defaults write com.apple.dock " + GetAlign(dialog.ExtraWidget) + " -array-add '{tile-data={}; tile-type=\"spacer-tile\";}' && /bin/sleep 1 &&/usr/bin/killall Dock");
            }
            dialog.Destroy ();

        }
    }
开发者ID:Eun,项目名称:AddAnyDock,代码行数:31,代码来源:MainWindow.cs

示例12: Execute

        public override bool Execute()
        {
            Image image = null;
              if (File.Exists(_path))
            {
              image = Image.Load(RunMode.Noninteractive, _path, _path);
            }
              else
            {
              var choose = new FileChooserDialog("Open...",
                         null,
                         FileChooserAction.Open,
                         "Cancel", ResponseType.Cancel,
                         "Open", ResponseType.Accept);
              if (choose.Run() == (int) ResponseType.Accept)
            {
              string fileName = choose.Filename;
              image = Image.Load(RunMode.Noninteractive, fileName, fileName);
            };
              choose.Destroy();
            }

              if (image != null)
            {
              image.CleanAll();
              ActiveDisplay = new Display(image);
              ActiveImage = image;
              return true;
            }

              return false;
        }
开发者ID:unhammer,项目名称:gimp-sharp,代码行数:32,代码来源:OpenEvent.cs

示例13: 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

示例14: 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

示例15: 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


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