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


C# IViewContent.GetService方法代码示例

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


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

示例1: Init

		void Init(IViewContent view)
		{
			this.view = view;
			editable = view.GetService<IEditable>();
			textEditor = view.GetService<ITextEditor>();
			textEditorOptions = textEditor.Options;
		}
开发者ID:kristjan84,项目名称:SharpDevelop,代码行数:7,代码来源:ScriptingTextEditorViewContent.cs

示例2: SetPosition

		public static void SetPosition(IViewContent viewContent, int markerStartLine, int markerStartColumn, int markerEndLine, int markerEndColumn)
		{
			if (viewContent == null)
				return;
			ITextEditor editor = viewContent.GetService<ITextEditor>();
			if (editor != null) {
				SetPosition(editor.FileName, editor.Document, markerStartLine, markerStartColumn, markerEndLine, markerEndColumn);
			}
		}
开发者ID:nataviva,项目名称:SharpDevelop-1,代码行数:9,代码来源:CurrentLineBookmark.cs

示例3: FromWindow

		internal static Document FromWindow(IViewContent viewContent)
		{
			if (viewContent == null)
				return null;
			ITextEditor editor = viewContent.GetService(typeof(ITextEditor)) as ITextEditor;
			if (editor != null) {
				return new Document(viewContent, editor.Document);
			} else {
				return null;
			}
		}
开发者ID:Paccc,项目名称:SharpDevelop,代码行数:11,代码来源:Document.cs

示例4: Save

		internal static void Save(IViewContent content)
		{
			if (content != null && content.IsDirty) {
				var customizedCommands = content.GetService<ICustomizedCommands>();
				if (customizedCommands != null && customizedCommands.SaveCommand()) {
					return;
				}
				if (content.IsViewOnly) {
					return;
				}
				
				foreach (OpenedFile file in content.Files.ToArray()) {
					if (file.IsDirty)
						Save(file);
				}
			}
		}
开发者ID:Paccc,项目名称:SharpDevelop,代码行数:17,代码来源:FileCommands.cs

示例5: CanAttachTo

		public bool CanAttachTo(IViewContent content)
		{
			if (Path.GetExtension(content.PrimaryFileName).Equals(".xaml", StringComparison.OrdinalIgnoreCase)) {
				IEditable editable = content.GetService<IEditable>();
				if (editable != null) {
					try {
						XmlTextReader r = new XmlTextReader(editable.CreateSnapshot().CreateReader());
						r.XmlResolver = null;
						r.WhitespaceHandling = WhitespaceHandling.None;
						while (r.NodeType != XmlNodeType.Element && r.Read());
						if (r.LocalName == "ResourceDictionary" || r.LocalName == "Application" || r.LocalName == "Activity")
							return false;
					} catch (XmlException) {
						return true;
					}
					return true;
				}
			}
			return false;
		}
开发者ID:Paccc,项目名称:SharpDevelop,代码行数:20,代码来源:WpfDisplayBinding.cs

示例6: CanAttachTo

		public bool CanAttachTo(IViewContent viewContent)
		{
			ITextEditor textEditor = viewContent.GetService<ITextEditor>();
			if (textEditor == null)
				return false;
			FileName fileName = viewContent.PrimaryFileName;
			if (fileName == null)
				return false;
			
			var parsedFile = SD.ParserService.ParseFile(fileName, textEditor.Document);
			var compilation = SD.ParserService.GetCompilationForFile(fileName);
			return IsDesignable(parsedFile, compilation);
		}
开发者ID:2594636985,项目名称:SharpDevelop,代码行数:13,代码来源:SecondaryDisplayBinding.cs

示例7: GetText

		string GetText(IViewContent view)
		{
			ITextEditor textEditor = view.GetService<ITextEditor>();
			return textEditor.Document.Text;
		}
开发者ID:2594636985,项目名称:SharpDevelop,代码行数:5,代码来源:TypeScriptWorkbenchMonitor.cs

示例8: ShowCodeCoverage

		static void ShowCodeCoverage(IViewContent view)
		{
			ITextEditor textEditor = view.GetService<ITextEditor>();
			if (textEditor != null && view.PrimaryFileName != null) {
				ShowCodeCoverage(textEditor, view.PrimaryFileName);
			}
		}
开发者ID:2594636985,项目名称:SharpDevelop,代码行数:7,代码来源:CodeCoverageService.cs

示例9: LoadViewContentMemento

		void LoadViewContentMemento(IViewContent viewContent)
		{
			IMementoCapable mementoCapable = viewContent.GetService<IMementoCapable>();
			if (mementoCapable != null && LoadDocumentProperties) {
				if (viewContent.PrimaryFileName == null)
					return;
				
				try {
					string key = GetMementoKeyName(viewContent);
					LoggingService.Debug("Trying to restore memento of '" + viewContent.ToString() + "' from key '" + key + "'");
					
					mementoCapable.SetMemento(this.LoadOrCreateViewContentMementos().NestedProperties(key));
				} catch (Exception e) {
					MessageService.ShowException(e, "Can't get/set memento");
				}
			}
		}
开发者ID:ratoy,项目名称:SharpDevelop,代码行数:17,代码来源:WpfWorkbench.cs

示例10: StoreMemento

		/// <summary>
		/// Stores the memento for the view content.
		/// Such mementos are automatically loaded in ShowView().
		/// </summary>
		public void StoreMemento(IViewContent viewContent)
		{
			IMementoCapable mementoCapable = viewContent.GetService<IMementoCapable>();
			if (mementoCapable != null && LoadDocumentProperties) {
				if (viewContent.PrimaryFileName == null)
					return;
				
				string key = GetMementoKeyName(viewContent);
				LoggingService.Debug("Saving memento of '" + viewContent.ToString() + "' to key '" + key + "'");
				
				Properties memento = mementoCapable.CreateMemento();
				Properties p = this.LoadOrCreateViewContentMementos();
				p.SetNestedProperties(key, memento);
				FileUtility.ObservedSave(new NamedFileOperationDelegate(p.Save), this.ViewContentMementosFileName, FileErrorPolicy.Inform);
			}
		}
开发者ID:ratoy,项目名称:SharpDevelop,代码行数:20,代码来源:WpfWorkbench.cs

示例11: IsViewTextEditorProvider

		bool IsViewTextEditorProvider(IViewContent view)
		{
			return view.GetService<ITextEditor>() != null;
		}
开发者ID:Paccc,项目名称:SharpDevelop,代码行数:4,代码来源:WixDialogDesignerDisplayBinding.cs

示例12: GetMemento

 static Properties GetMemento(IViewContent viewContent)
 {
     IMementoCapable mementoCapable = viewContent.GetService<IMementoCapable>();
     if (mementoCapable == null) {
         return null;
     } else {
         return mementoCapable.CreateMemento();
     }
 }
开发者ID:fanyjie,项目名称:SharpDevelop,代码行数:9,代码来源:OpenedFile.cs


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