• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

C# Components.InfoBar类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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

示例1: ShowFileChangedWarning

		public void ShowFileChangedWarning (bool multiple)
		{
			RemoveMessageBar ();
			
			if (messageBar == null) {
				messageBar = new MonoDevelop.Components.InfoBar (MessageType.Warning);
				messageBar.SetMessageLabel (GettextCatalog.GetString (
					"<b>The file \"{0}\" has been changed outside of {1}.</b>\n" +
					"Do you want to keep your changes, or reload the file from disk?",
					EllipsizeMiddle (Document.FileName, 50), BrandingService.ApplicationName));
				
				var b1 = new Button (GettextCatalog.GetString ("_Reload from disk"));
				b1.Image = ImageService.GetImage (Gtk.Stock.Refresh, IconSize.Button);
				b1.Clicked += delegate {
					Reload ();
					view.TextEditor.GrabFocus ();
				};
				messageBar.ActionArea.Add (b1);
				
				var b2 = new Button (GettextCatalog.GetString ("_Keep changes"));
				b2.Image = ImageService.GetImage (Gtk.Stock.Cancel, IconSize.Button);
				b2.Clicked += delegate {
					RemoveMessageBar ();
					view.LastSaveTimeUtc = System.IO.File.GetLastWriteTimeUtc (view.ContentName);
					view.WorkbenchWindow.ShowNotification = false;
				};
				messageBar.ActionArea.Add (b2);

				if (multiple) {
					var b3 = new Button (GettextCatalog.GetString ("_Reload all"));
					b3.Image = ImageService.GetImage (Gtk.Stock.Cancel, IconSize.Button);
					b3.Clicked += delegate {
						FileRegistry.ReloadAllChangedFiles ();
					};
					messageBar.ActionArea.Add (b3);
	
					var b4 = new Button (GettextCatalog.GetString ("_Ignore all"));
					b4.Image = ImageService.GetImage (Gtk.Stock.Cancel, IconSize.Button);
					b4.Clicked += delegate {
						FileRegistry.IgnoreAllChangedFiles ();
					};
					messageBar.ActionArea.Add (b4);
				}
			}
			
			view.IsDirty = true;
			view.WarnOverwrite = true;
			vbox.PackStart (messageBar, false, false, CHILD_PADDING);
			vbox.ReorderChild (messageBar, 0);
			messageBar.ShowAll ();

			messageBar.QueueDraw ();
			
			view.WorkbenchWindow.ShowNotification = true;
		}
开发者ID:telebovich,项目名称:monodevelop,代码行数:55,代码来源:SourceEditorWidget.cs


示例2: ShowAutoSaveWarning

		public void ShowAutoSaveWarning (string fileName)
		{
			RemoveMessageBar ();
			TextEditor.Visible = false;
			if (messageBar == null) {
				messageBar = new MonoDevelop.Components.InfoBar (MessageType.Warning);
				messageBar.SetMessageLabel (BrandingService.BrandApplicationName (GettextCatalog.GetString (
						"<b>An autosave file has been found for this file.</b>\n" +
						"This could mean that another instance of MonoDevelop is editing this " +
						"file, or that MonoDevelop crashed with unsaved changes.\n\n" +
					    "Do you want to use the original file, or load from the autosave file?")));
				
				Button b1 = new Button (GettextCatalog.GetString("_Use original file"));
				b1.Image = ImageService.GetImage (Gtk.Stock.Refresh, IconSize.Button);
				b1.Clicked += delegate {
					try {
						AutoSave.RemoveAutoSaveFile (fileName);
						TextEditor.GrabFocus ();
						view.Load (fileName);
						view.WorkbenchWindow.Document.ReparseDocument ();
					} catch (Exception ex) {
						MessageService.ShowException (ex, "Could not remove the autosave file.");
					} finally {
						RemoveMessageBar ();
					}
				};
				messageBar.ActionArea.Add (b1);
				
				Button b2 = new Button (GettextCatalog.GetString("_Load from autosave"));
				b2.Image = ImageService.GetImage (Gtk.Stock.RevertToSaved, IconSize.Button);
				b2.Clicked += delegate {
					try {
						string content = AutoSave.LoadAutoSave (fileName);
						AutoSave.RemoveAutoSaveFile (fileName);
						TextEditor.GrabFocus ();
						view.Load (fileName);
						view.ReplaceContent (fileName, content, view.SourceEncoding);
						view.WorkbenchWindow.Document.ReparseDocument ();
						view.IsDirty = true;
					} catch (Exception ex) {
						MessageService.ShowException (ex, "Could not remove the autosave file.");
					} finally {
						RemoveMessageBar ();
					}
					
				};
				messageBar.ActionArea.Add (b2);
			}
			
			view.IsDirty = true;
			view.WarnOverwrite = true;
			vbox.PackStart (messageBar, false, false, CHILD_PADDING);
			vbox.ReorderChild (messageBar, 0);
			messageBar.ShowAll ();

			messageBar.QueueDraw ();
			
//			view.WorkbenchWindow.ShowNotification = true;
		}
开发者ID:telebovich,项目名称:monodevelop,代码行数:59,代码来源:SourceEditorWidget.cs


示例3: ShowFileChangedWarning

		public void ShowFileChangedWarning ()
		{
			RemoveMessageBar ();
			
			if (messageBar == null) {
				messageBar = new MonoDevelop.Components.InfoBar (MessageType.Warning);
				messageBar.SetMessageLabel (GettextCatalog.GetString (
					"<b>The file \"{0}\" has been changed outside of MonoDevelop.</b>\n" +
					"Do you want to keep your changes, or reload the file from disk?",
					EllipsizeMiddle (Document.FileName, 50)));
				
				Button b1 = new Button (GettextCatalog.GetString("_Reload from disk"));
				b1.Image = ImageService.GetImage (Gtk.Stock.Refresh, IconSize.Button);
				b1.Clicked += new EventHandler (ClickedReload);
				messageBar.ActionArea.Add (b1);
				
				Button b2 = new Button (GettextCatalog.GetString("_Keep changes"));
				b2.Image = ImageService.GetImage (Gtk.Stock.Cancel, IconSize.Button);
				b2.Clicked += new EventHandler (ClickedIgnore);
				messageBar.ActionArea.Add (b2);
			}
			
			view.WarnOverwrite = true;
			vbox.PackStart (messageBar, false, false, CHILD_PADDING);
			vbox.ReorderChild (messageBar, 0);
			messageBar.ShowAll ();

			messageBar.QueueDraw ();
			
			view.WorkbenchWindow.ShowNotification = true;
		}
开发者ID:silk,项目名称:monodevelop,代码行数:31,代码来源:SourceEditorWidget.cs


示例4: ShowIncorretEolMarkers

		void ShowIncorretEolMarkers (string fileName, bool multiple)
		{
			RemoveMessageBar ();
			
			if (messageBar == null) {
				messageBar = new MonoDevelop.Components.InfoBar (MessageType.Warning);
				messageBar.SetMessageLabel (GettextCatalog.GetString (
					"<b>The file \"{0}\" has line endings which differ from the policy settings.</b>\n" +
					"Do you want to convert the line endings?",
					EllipsizeMiddle (Document.FileName, 50)));
				
				Button b1 = new Button (GettextCatalog.GetString ("_Convert"));
				b1.Image = ImageService.GetImage (Gtk.Stock.Refresh, IconSize.Button);
				b1.Clicked += delegate(object sender, EventArgs e) {
					ConvertLineEndings ();
					view.WorkbenchWindow.ShowNotification = false;
					RemoveMessageBar ();
					view.Save (fileName, view.SourceEncoding);
				};
				messageBar.ActionArea.Add (b1);
				
				Button b2 = new Button (GettextCatalog.GetString ("_Keep line endings"));
				b2.Image = ImageService.GetImage (Gtk.Stock.Cancel, IconSize.Button);
				b2.Clicked += delegate(object sender, EventArgs e) {
					UseIncorrectMarkers = true;
					view.WorkbenchWindow.ShowNotification = false;
					RemoveMessageBar ();
					view.Save (fileName, view.SourceEncoding);
				};
				messageBar.ActionArea.Add (b2);

				if (multiple) {
					var b3 = new Button (GettextCatalog.GetString ("_Convert all files"));
					b3.Image = ImageService.GetImage (Gtk.Stock.Cancel, IconSize.Button);
					b3.Clicked += delegate {
						FileRegistry.ConvertLineEndingsInAllFiles ();
					};
					messageBar.ActionArea.Add (b3);
	
					var b4 = new Button (GettextCatalog.GetString ("_Keep in all files"));
					b4.Image = ImageService.GetImage (Gtk.Stock.Cancel, IconSize.Button);
					b4.Clicked += delegate {
						FileRegistry.IgnoreLineEndingsInAllFiles ();
					};
					messageBar.ActionArea.Add (b4);
				}

			}
			
			vbox.PackStart (messageBar, false, false, CHILD_PADDING);
			vbox.ReorderChild (messageBar, 0);
			messageBar.ShowAll ();

			messageBar.QueueDraw ();
			view.WorkbenchWindow.ShowNotification = true;
			
			// Ensure that one file with incorret EOL markers is shown.
			var currentView = IdeApp.Workbench.ActiveDocument.PrimaryView as SourceEditorView;
			if (currentView == null || !currentView.IsDirty || !currentView.SourceEditorWidget.HasIncorrectEolMarker || currentView.SourceEditorWidget.UseIncorrectMarkers)
				view.WorkbenchWindow.SelectWindow ();
		}
开发者ID:ischyrus,项目名称:monodevelop,代码行数:61,代码来源:SourceEditorWidget.cs


示例5: ShowIncorretEolMarkers

		void ShowIncorretEolMarkers (string fileName, string encoding)
		{
			RemoveMessageBar ();
			
			if (messageBar == null) {
				messageBar = new MonoDevelop.Components.InfoBar (MessageType.Warning);
				messageBar.SetMessageLabel (GettextCatalog.GetString (
					"<b>The file \"{0}\" has line endings which differ from the policy settings.</b>\n" +
					"Do you want to convert the line endings?",
					EllipsizeMiddle (Document.FileName, 50)));
				
				Button b1 = new Button (GettextCatalog.GetString("_Convert"));
				b1.Image = ImageService.GetImage (Gtk.Stock.Refresh, IconSize.Button);
				b1.Clicked += delegate(object sender, EventArgs e) {
					try {
						ConvertLineEndings ();
						view.Save (fileName, encoding);
					} finally {
						RemoveMessageBar ();
						view.WorkbenchWindow.ShowNotification = false;
					}
				};
				messageBar.ActionArea.Add (b1);
				
				Button b2 = new Button (GettextCatalog.GetString("_Keep changes"));
				b2.Image = ImageService.GetImage (Gtk.Stock.Cancel, IconSize.Button);
				b2.Clicked += delegate(object sender, EventArgs e) {
					try {
						useIncorrectMarkers = true;
						view.Save (fileName, encoding);
					} finally {
						RemoveMessageBar ();
						view.WorkbenchWindow.ShowNotification = false;
					}
				};
				messageBar.ActionArea.Add (b2);
			}
			
			vbox.PackStart (messageBar, false, false, CHILD_PADDING);
			vbox.ReorderChild (messageBar, 0);
			messageBar.ShowAll ();

			messageBar.QueueDraw ();
			view.WorkbenchWindow.ShowNotification = true;
		}
开发者ID:yayanyang,项目名称:monodevelop,代码行数:45,代码来源:SourceEditorWidget.cs


示例6: RemoveMessageBar

		public void RemoveMessageBar ()
		{
			if (messageBar != null) {
				if (messageBar.Parent == vbox)
					vbox.Remove (messageBar);
				messageBar.Destroy ();
				messageBar = null;
			}
			if (!TextEditor.Visible)
				TextEditor.Visible = true;
			if (messageOverlayWindow != null) {
				messageOverlayWindow.Destroy ();
				messageOverlayWindow = null;
			}
		}
开发者ID:telebovich,项目名称:monodevelop,代码行数:15,代码来源:SourceEditorWidget.cs


示例7: RemoveMessageBar

		public void RemoveMessageBar ()
		{
			if (messageBar != null) {
				if (messageBar.Parent == vbox)
					vbox.Remove (messageBar);
				messageBar.Destroy ();
				messageBar = null;
			}
			if (!TextEditor.Visible)
				TextEditor.Visible = true;
			if (incorrectEolMessage != null) {
				RemoveOverlay (incorrectEolMessage);
				incorrectEolMessage = null;
			}
		}
开发者ID:pabloescribanoloza,项目名称:monodevelop,代码行数:15,代码来源:SourceEditorWidget.cs



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C# Components.PathEntry类代码示例发布时间:2022-05-26
下一篇:
C# Components.CellRendererImage类代码示例发布时间:2022-05-26
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap