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


C# FileChooserDialog.Dispose方法代码示例

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


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

示例1: SaveReport

        /// <summary>
        /// Generate report file
        /// </summary>
        private void SaveReport()
        {
            if (tabContainer.NPages < 1)
            {
                // If there isn't any selected tab, exit
                return;
            }

            string selectedFile = "";

            Gtk.FileChooserDialog FileBox =
                new Gtk.FileChooserDialog(GlobalData.GetLanguageKeyValue("FILESAVE"),
                                          MainWindow,
                                          FileChooserAction.Save,
                                          GlobalData.GetLanguageKeyValue("BTNCANCEL"),
                                          Gtk.ResponseType.Cancel,
                                          GlobalData.GetLanguageKeyValue("BTNSAVE"),
                                          Gtk.ResponseType.Accept);

            FileBox.WindowPosition= WindowPosition.CenterOnParent;
            FileFilter filter = new FileFilter();
            filter.AddPattern("*.report");
            filter.Name = "Report file (*.report)";
            FileBox.AddFilter(filter);

            // Manage result of dialog box
            FileBox.Icon = Gdk.Pixbuf.LoadFromResource("themonospot.png");
            FileBox.SetCurrentFolder(GlobalData.bFactory.DefaultPath);
            int retFileBox = FileBox.Run();
            if ((ResponseType)retFileBox == Gtk.ResponseType.Accept)
            {
                    // path of a right file returned
                    selectedFile = FileBox.Filename.ToString();
                    FileBox.Destroy();
                    FileBox.Dispose();

            }
            else
            {
                    // nothing returned
                    FileBox.Destroy();
                    FileBox.Dispose();
                    return;
            }

            // generate report
            GlobalData.bFactory
                .SaveReportFile(fiEntity[tabContainer.Page].Video,
                                fiEntity[tabContainer.Page].Audio,
                                fiEntity[tabContainer.Page].FileName,
                                selectedFile,
                                fiEntity[tabContainer.Page].PluginUsed);

            // Message of report generated
            MessageDialog dlg = new MessageDialog(MainWindow,
                                                  DialogFlags.Modal,
                                                  MessageType.Info,
                                                  ButtonsType.Ok,
                                                  GlobalData.GetLanguageKeyValue("SAVEREPORTMSG") + "\r\n" +
                                                  fiEntity[tabContainer.Page].FileName);
            dlg.Title = GlobalData.GetLanguageKeyValue("SAVEREPORTWIN");
            dlg.Run();
            dlg.Destroy();
            return;
        }
开发者ID:armando-basile,项目名称:themonospot,代码行数:68,代码来源:MainWindowClass.cs

示例2: OpenFile

        private void OpenFile()
        {
            string selectedFile = "";

            Gtk.FileChooserDialog FileBox =
                new Gtk.FileChooserDialog(GlobalData.GetLanguageKeyValue("FILEOPEN"),
                                          MainWindow,
                                          FileChooserAction.Open,
                                          GlobalData.GetLanguageKeyValue("BTNCANCEL"),
                                          Gtk.ResponseType.Cancel,
                                          GlobalData.GetLanguageKeyValue("BTNOPEN"),
                                          Gtk.ResponseType.Accept);

            FileBox.WindowPosition= WindowPosition.CenterOnParent;
            FileFilter filter = new FileFilter();
            filter.Name = GlobalData.FileDialogExtensions;
            string[] managedExt = GlobalData.bFactory.GetManagedExtentions();

            for (int j=0; j<managedExt.Length; j++)
            {
                filter.AddPattern("*." + managedExt[j]);
            }

            FileBox.AddFilter(filter);

            // Manage result of dialog box
            FileBox.Icon = Gdk.Pixbuf.LoadFromResource("themonospot.png");
            FileBox.SetCurrentFolder(GlobalData.bFactory.DefaultPath);
            int retFileBox = FileBox.Run();
            if ((ResponseType)retFileBox == Gtk.ResponseType.Accept)
            {
                    // path of a right file returned
                    selectedFile = FileBox.Filename.ToString();
                    FileBox.Destroy();
                    FileBox.Dispose();

            }
            else
            {
                    // nothing returned
                    FileBox.Destroy();
                    FileBox.Dispose();
                    return;
            }

            if (selectedFile == "")
            {
                return;
            }

            // recall other constructor
            OpenFile(selectedFile);
        }
开发者ID:armando-basile,项目名称:themonospot,代码行数:53,代码来源:MainWindowClass.cs

示例3: OpenFolder

        /// <summary>
        /// Try to open all file contained in a specific
        /// folder (optional also in her subfolders)
        /// </summary>
        private void OpenFolder(bool recursive)
        {
            string selectedFolder = "";

            Gtk.FileChooserDialog FileBox =
                new Gtk.FileChooserDialog(GlobalData.GetLanguageKeyValue("FOLDEROPEN"),
                                          MainWindow,
                                          FileChooserAction.SelectFolder,
                                          GlobalData.GetLanguageKeyValue("BTNCANCEL"),
                                          Gtk.ResponseType.Cancel,
                                          GlobalData.GetLanguageKeyValue("BTNOPEN"),
                                          Gtk.ResponseType.Accept);

            FileBox.WindowPosition= WindowPosition.CenterOnParent;

            // Manage result of dialog box
            FileBox.Icon = Gdk.Pixbuf.LoadFromResource("themonospot.png");
            FileBox.SetCurrentFolder(GlobalData.bFactory.DefaultPath);
            int retFileBox = FileBox.Run();
            if ((ResponseType)retFileBox == Gtk.ResponseType.Accept)
            {
                    // path of a right file returned
                    selectedFolder = FileBox.Filename.ToString();
                    FileBox.Destroy();
                    FileBox.Dispose();

            }
            else
            {
                    // nothing returned
                    FileBox.Destroy();
                    FileBox.Dispose();
                    return;
            }

            if (selectedFolder == "")
            {
                return;
            }

            // Recall other constructor
            OpenFolder(selectedFolder, recursive);
        }
开发者ID:armando-basile,项目名称:themonospot,代码行数:47,代码来源:MainWindowClass.cs

示例4: on_open_activate

        public void on_open_activate(System.Object b, EventArgs e)
        {
            statusbar.Pop (gameStatusbarId);

                        FileChooserDialog fd = new FileChooserDialog (Catalog.GetString ("Open Game"), csboardWindow, FileChooserAction.Open);

            fd.AddButton (Stock.Close, (int) ResponseType.Close);
                        fd.AddButton (Stock.Open, (int) ResponseType.Ok);

                        if (fd.Run () == (int)ResponseType.Ok) {
                                control.OpenGame (fd.Filename);
                                control.SaveGame(App.session.Filename);
                                }
                        fd.Hide ();
                        fd.Dispose ();
        }
开发者ID:BackupTheBerlios,项目名称:csboard-svn,代码行数:16,代码来源:Window.cs

示例5: on_save_activate

        public void on_save_activate(System.Object b, EventArgs e)
        {
            FileChooserDialog fd = new FileChooserDialog (Catalog.GetString("Save Game"), csboardWindow, FileChooserAction.Save);

            fd.AddButton (Stock.Close, (int) ResponseType.Close);
                        fd.AddButton (Stock.Save, (int) ResponseType.Ok);

                        int res = fd.Run();
            fd.Hide ();

                        if (res == (int) ResponseType.Ok) {

                                        if (System.IO.File.Exists (fd.Filename)) {
                                                MessageDialog md =
                                                new MessageDialog (csboardWindow,
                                                           DialogFlags.
                                                           DestroyWithParent,
                                                           MessageType.Warning,
                                                           ButtonsType.OkCancel,
                                                           Catalog.GetString("File ") + fd.Filename +
                                                           Catalog.GetString(" already exists\n\n") +
                                                           Catalog.GetString("Do you wish to overwrite it?"));
                                                if (md.Run () == (int)ResponseType.Ok) {
                                                        control.SaveGame (fd.Filename);
                                                }
                                                md.Hide ();
                                                md.Dispose ();
                                        } else {
                                                control.SaveGame (fd.Filename);
                                        }
                                }

                        fd.Dispose ();
        }
开发者ID:BackupTheBerlios,项目名称:csboard-svn,代码行数:34,代码来源:Window.cs

示例6: OnOpenActionActivated

 protected virtual void OnOpenActionActivated(object sender, System.EventArgs e)
 {
     Gtk.FileChooserDialog fc = new Gtk.FileChooserDialog ("Open File", this, Gtk.FileChooserAction.Open, "Cancel", Gtk.ResponseType.Cancel, "Open", Gtk.ResponseType.Ok);
     int x = fc.Run ();
     if (x == (int)Gtk.ResponseType.Ok) {
         if (fc.Filename != null) {
             LoadFile (fc.Filename);
         }
     }
     fc.Visible = false;
     fc.Dispose ();
 }
开发者ID:inorton,项目名称:XamlPreviewer,代码行数:12,代码来源:MainWindow.cs

示例7: OnSaveAsActionActivated

 protected virtual void OnSaveAsActionActivated(object sender, System.EventArgs e)
 {
     Gtk.FileChooserDialog fc = new Gtk.FileChooserDialog ("Save Xaml File", this, Gtk.FileChooserAction.Save, "Cancel", Gtk.ResponseType.Cancel, "Save", Gtk.ResponseType.Ok);
     int x = fc.Run ();
     if (x == (int)Gtk.ResponseType.Ok) {
         if (fc.Filename != null) {
             StreamWriter sw = new StreamWriter (fc.Filename);
             filename = fc.Filename;
             sw.Write (sb.Text);
             sw.Close ();
             statusbar1.Push (0, "Saved..");
         }
     }
     fc.Visible = false;
     fc.Dispose ();
 }
开发者ID:inorton,项目名称:XamlPreviewer,代码行数:16,代码来源:MainWindow.cs

示例8: openLibFile

 private void openLibFile(object s, EventArgs e)
 {
     FileChooserDialog fcd = new FileChooserDialog("Open Library File...", this, FileChooserAction.Open);
     fcd.TransientFor = this;
     fcd.AddButton(Stock.Cancel, ResponseType.Cancel);
     fcd.AddButton(Stock.Ok, ResponseType.Ok);
     FileFilter ff = new FileFilter();
     ff.Name = "Dynamic Link Library (.dll,.exe)";
     ff.AddPattern(@"*.dll");
     ff.AddPattern(@"*.exe");
     fcd.AddFilter(ff);
     int result = fcd.Run();
     fcd.HideAll();
     if(result == (int)ResponseType.Ok) {
         ss.ConnectAlgorithmLibrary(fcd.Filename);
     }
     fcd.Dispose();
 }
开发者ID:KommuSoft,项目名称:ParVis,代码行数:18,代码来源:DisplayWindow.cs

示例9: openConfigFile

 private void openConfigFile(object s, EventArgs e)
 {
     FileChooserDialog fcd = new FileChooserDialog("Open Config File...", this, FileChooserAction.Open);
     fcd.TransientFor = this;
     fcd.AddButton(Stock.Cancel, ResponseType.Cancel);
     fcd.AddButton(Stock.Ok, ResponseType.Ok);
     FileFilter ff = new FileFilter();
     ff.Name = "Config file (.xml)";
     ff.AddMimeType("text/xml");
     ff.AddMimeType("application/xml");
     fcd.AddFilter(ff);
     int result = fcd.Run();
     fcd.HideAll();
     if(result == (int)ResponseType.Ok) {
         try {
             ss.ReadConfigFile(fcd.Filename);
             this.sr = ss.Simulator.CollectResults();
             this.bs.SetMinCurrentMax(1, 1, this.sr.ChapterCount);
             this.bpsp.SimulatorResult = sr;
         }
         catch(Exception ex) {
             Console.Error.WriteLine(ex);
             MessageDialog md = new MessageDialog(this, DialogFlags.DestroyWithParent, MessageType.Error, ButtonsType.Ok, true, ex.Message);
             md.Run();
             md.Destroy();
         }
         this.bpsp.Reload();
     }
     fcd.Dispose();
 }
开发者ID:KommuSoft,项目名称:ParVis,代码行数:30,代码来源:DisplayWindow.cs

示例10: ChooseFileToSave

		/// <summary>
		/// Choose file to save contacts.
		/// </summary>
		private string ChooseFileToSave(string dialogTitle)
		{
			string fileToSave = "";
			
			// New dialog to save sim contacts on file 
			Gtk.FileChooserDialog FileBox = new Gtk.FileChooserDialog(dialogTitle, 
			                                MainWindow,
			                                FileChooserAction.Save, 
			                                GlobalObjUI.LMan.GetString("cancellbl"), Gtk.ResponseType.Cancel,
                                            GlobalObjUI.LMan.GetString("savelbl"), Gtk.ResponseType.Accept);
			
			// Filter for using only monosim files
			Gtk.FileFilter myFilter = new Gtk.FileFilter(); 
			myFilter.AddPattern("*.monosim");
			myFilter.Name = "monosim files";
			FileBox.AddFilter(myFilter);
			
			// Manage result of dialog box
			FileBox.Icon = Gdk.Pixbuf.LoadFromResource("monosim.png");
			int retFileBox = FileBox.Run();
			if ((ResponseType)retFileBox == Gtk.ResponseType.Accept)
			{	
				// path of a right file returned
				fileToSave = FileBox.Filename;
				
				string chkfile = fileToSave.PadLeft(9).ToLower();
				if (chkfile.Substring(chkfile.Length-8) != ".monosim")
				{
					fileToSave += ".monosim";
				}
				
				FileBox.Destroy();
				FileBox.Dispose();				
			}
			else
			{
				// nothing returned				
				FileBox.Destroy();
				FileBox.Dispose();
				return "";
			}
			
			return fileToSave;
		}
开发者ID:cyberthrone,项目名称:monosim,代码行数:47,代码来源:MainWindowClass.cs

示例11: OpenContactsFile

		private void OpenContactsFile()
		{
			GlobalObjUI.ContactsFilePath = "";
			
			// New dialog for select contacts file 
			Gtk.FileChooserDialog FileBox = new Gtk.FileChooserDialog(GlobalObjUI.LMan.GetString("openfileact"), 
			                                MainWindow,
			                                FileChooserAction.Open, 
			                                GlobalObjUI.LMan.GetString("cancellbl"), Gtk.ResponseType.Cancel,
                                            GlobalObjUI.LMan.GetString("openlbl"), Gtk.ResponseType.Accept);
			
			// Filter for using only monosim files
			Gtk.FileFilter myFilter = new Gtk.FileFilter(); 
			myFilter.AddPattern("*.monosim");
			myFilter.Name = "monosim files";
			FileBox.AddFilter(myFilter);
			
			// Manage result of dialog box
			FileBox.Icon = Gdk.Pixbuf.LoadFromResource("monosim.png");
			int retFileBox = FileBox.Run();
			if ((ResponseType)retFileBox == Gtk.ResponseType.Accept)
			{	
				// path of a right file returned
				GlobalObjUI.ContactsFilePath = FileBox.Filename;
				
				FileBox.Destroy();
				FileBox.Dispose();				
			}
			else
			{
				// nothing returned				
				FileBox.Destroy();
				FileBox.Dispose();
				return;
			}
			
			
			// Update gui
			UpdateFileControls(false);			
			lstFileContacts.Clear();
			MainClass.GtkWait();
			
			try
			{
				GlobalObjUI.FileContacts = new Contacts();
				StreamReader sr = new StreamReader(GlobalObjUI.ContactsFilePath);
				string descRow = sr.ReadLine();			
				string phoneRow = "";
				while (!sr.EndOfStream)
				{
					phoneRow = sr.ReadLine();
					// check for right values
					if (descRow.Trim() != "" && phoneRow.Trim() != "")
					{
						GlobalObjUI.FileContacts.SimContacts.Add(new Contact(descRow, phoneRow));
					}
					
					// read new contact description
					descRow = sr.ReadLine();
				}
				sr.Close();
				sr.Dispose();
				sr = null;			
				
			}
			catch (Exception Ex)
			{
				log.Error("MainWindowClass::OpenContactsFile: " + Ex.Message + "\r\n" + Ex.StackTrace);
				MainClass.ShowMessage(MainWindow, "ERROR", Ex.Message, MessageType.Error);
				return;
			}
			
			// loop to append data readed from file
			foreach(Contact cnt in GlobalObjUI.FileContacts.SimContacts)
			{
				lstFileContacts.AppendValues(new string[]{cnt.Description, cnt.PhoneNumber});
			}
			
			UpdateFileControls(true);
			
		}
开发者ID:cyberthrone,项目名称:monosim,代码行数:81,代码来源:MainWindowClass.cs

示例12: OpenCommandFile

        /// <summary>
        /// Open command file
        /// </summary>
        private void OpenCommandFile()
        {
            // New dialog for select command file
            Gtk.FileChooserDialog FileBox =
                new Gtk.FileChooserDialog(GlobalObj.LMan.GetString("selectfile"),
                                          MainWindow,
                                          FileChooserAction.Open,
                                          GlobalObj.LMan.GetString("cancellbl"),
                                          Gtk.ResponseType.Cancel,
                                          GlobalObj.LMan.GetString("openlbl"),
                                          Gtk.ResponseType.Accept);

            // Filter to use only comex files
            Gtk.FileFilter myFilter = new Gtk.FileFilter();
            myFilter.AddPattern("*.comex");
            myFilter.Name = "comex project files (*.comex)";
            FileBox.AddFilter(myFilter);

            // Manage result of dialog box
            FileBox.Icon = Gdk.Pixbuf.LoadFromResource("comex_256.png");
            int retFileBox = FileBox.Run();
            if ((ResponseType)retFileBox == Gtk.ResponseType.Accept)
            {
                // path of a right file returned
                commandFilePath = FileBox.Filename;
                commandFileName = System.IO.Path.GetFileNameWithoutExtension(commandFilePath);
                log.Debug("file selected: " + commandFilePath);

                UpdateGuiForCommandFile();

                FileBox.Destroy();
                FileBox.Dispose();
            }
            else
            {
                // nothing returned
                FileBox.Destroy();
                FileBox.Dispose();
                return;
            }
        }
开发者ID:koradeh,项目名称:comex-project,代码行数:44,代码来源:MainWindowClass.cs


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