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


C# FileChooserDialog.SelectFilename方法代码示例

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


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

示例1: ConnectEventsMainWindow

		private void ConnectEventsMainWindow() {

			// ----------------------------------------------------------------------------------------------------
			m_imagemenuitemNew.Activated += delegate(object o, EventArgs args) {
				UpdateGui (m_defaultSettings);
			};

			m_imagemenuitemOpen.Activated += delegate(object o, EventArgs args) {
				Gtk.Application.Invoke(delegate {
					Gtk.FileChooserDialog fcd = new Gtk.FileChooserDialog ("Load configuration", m_mainWindow, FileChooserAction.Open,
						"_Cancel", ResponseType.Cancel,
						"_Open", ResponseType.Accept);
					fcd.LocalOnly = false;
					if(!String.IsNullOrWhiteSpace(m_currentPath)) fcd.SetFilename(m_currentPath);
					if ((Gtk.ResponseType)fcd.Run() == Gtk.ResponseType.Accept) {
						LoadSaveStateFromFile (fcd.Filename);
					}
					fcd.Destroy ();
				});
			};

			// ----------------------------------------------------------------------------------------------------
			EventHandler imagemenuItemSave = delegate(object o, EventArgs arg) {
				Gtk.Application.Invoke(delegate {
					Gtk.FileChooserDialog fcd = new Gtk.FileChooserDialog ("Save configuration to file", m_mainWindow, FileChooserAction.Save,
						"_Cancel", ResponseType.Cancel,
						"_Save", ResponseType.Accept);
					fcd.DoOverwriteConfirmation = true;
					fcd.LocalOnly = false;
					if(!String.IsNullOrWhiteSpace(m_currentPath)) fcd.SetFilename(m_currentPath);
					if ((Gtk.ResponseType)fcd.Run() == Gtk.ResponseType.Accept) {
						SaveStateToFile (fcd.Filename);
					}
					fcd.Destroy ();
				});
			};

			// ----------------------------------------------------------------------------------------------------
			m_imagemenuitemSave.Activated += imagemenuItemSave;
			m_imagemenuitemSaveAs.Activated += imagemenuItemSave;

			// ----------------------------------------------------------------------------------------------------
			m_imagemenuitemClose.Activated += delegate(object obj, EventArgs args) {
				Application.Quit ();
			};


			// ----------------------------------------------------------------------------------------------------
			m_buttonTargetLanguageChoose.Clicked += delegate(object o, EventArgs e) {
				// Open file dialog
				String[] filenames = OpenFileChooser ("Select subtitles file in target language");
				if (filenames == null)
					return;

				m_entryTargetLanguage.Text = AddFilesToEntry(m_entryTargetLanguage.Text, filenames, "Error in target language file entry field: ");
			};

			// ----------------------------------------------------------------------------------------------------
			m_buttonDirectoryChoose.Clicked += delegate(object o, EventArgs e) {

				Gtk.FileChooserDialog fcd = new Gtk.FileChooserDialog ("Select output folder", m_mainWindow, FileChooserAction.SelectFolder,
					"_Cancel", ResponseType.Cancel,
					"_Choose", ResponseType.Accept);
				fcd.DoOverwriteConfirmation = true;
				fcd.SelectMultiple = true;
				if(!String.IsNullOrWhiteSpace(m_currentPath)) fcd.SelectFilename(m_currentPath);
				if ((Gtk.ResponseType)fcd.Run () == Gtk.ResponseType.Accept) {
					m_entryOutputDirectory.Text = fcd.Filename;
					m_currentPath = fcd.Filename;
				}
				fcd.Destroy ();
			};

			// ----------------------------------------------------------------------------------------------------
			m_buttonNativeLanguageChoose.Clicked += delegate(object o, EventArgs e) {
				// Open file dialog
				String[] filenames = OpenFileChooser ("Select subtitles file in native language");
				if (filenames == null)
					return;

				m_entryNativeLanguage.Text = AddFilesToEntry(m_entryNativeLanguage.Text, filenames, "Error in native language file entry field: ");
			};

			// ----------------------------------------------------------------------------------------------------
			m_buttonVideoFileChoose.Clicked += delegate(object o, EventArgs e) {
				// Open file dialog
				String[] filenames = OpenFileChooser ("Select video files");
				if (filenames == null)
					return;

				m_entryVideoFile.Text = AddFilesToEntry(m_entryVideoFile.Text, filenames, "Error in video file entry field: ");
			};


			// ----------------------------------------------------------------------------------------------------
			m_buttonTargetLanguageOptions.Clicked += delegate(object o, EventArgs e) {
				OpenSubtitleWindow(0);
			};

			// ----------------------------------------------------------------------------------------------------
//.........这里部分代码省略.........
开发者ID:ChangSpivey,项目名称:SubtitleMemorize,代码行数:101,代码来源:Program.cs


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