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

C# InsertPosition类代码示例

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

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



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

示例1: CreateAnchorablePane

        private static LayoutAnchorablePane CreateAnchorablePane(LayoutRoot layout, Orientation orientation,
            string paneName, InsertPosition position)
        {
            var layoutPanels = layout.Descendents().OfType<LayoutPanel>().ToArray();
            var parent = layoutPanels.FirstOrDefault(d => d != null && d.Orientation == orientation);
            if (parent == null)
            {
                parent = layoutPanels.FirstOrDefault();
                position = InsertPosition.Start;
            }
            var toolsPane = new LayoutAnchorablePane { Name = paneName };
            if (parent != null)
            {
                if (position == InsertPosition.Start)
                    parent.InsertChildAt(0, toolsPane);
                else
                    parent.Children.Add(toolsPane);
            }
            else
            {
                var layoutAnchorableFloatingWindow = new LayoutAnchorableFloatingWindow();
                toolsPane.Parent = layoutAnchorableFloatingWindow;

            }
            return toolsPane;
        }
开发者ID:julianpaulozzi,项目名称:EntityProfiler,代码行数:26,代码来源:LayoutInitializer.cs


示例2: InsertWithCursor

		public override Task InsertWithCursor (string operation, InsertPosition defaultPosition, IEnumerable<AstNode> nodes)
		{
			var tcs = new TaskCompletionSource<object> ();
			var editor = document.Editor;
			DocumentLocation loc = document.Editor.Caret.Location;
			var declaringType = document.ParsedDocument.GetInnermostTypeDefinition (loc);
			var mode = new InsertionCursorEditMode (
				editor.Parent,
				CodeGenerationService.GetInsertionPoints (document, declaringType));
			if (mode.InsertionPoints.Count == 0) {
				MessageService.ShowError (
					GettextCatalog.GetString ("No valid insertion point can be found in type '{0}'.", declaringType.Name)
				);
				return tcs.Task;
			}
			var helpWindow = new Mono.TextEditor.PopupWindow.InsertionCursorLayoutModeHelpWindow ();
			helpWindow.TransientFor = MonoDevelop.Ide.IdeApp.Workbench.RootWindow;
			helpWindow.TitleText = operation;
			mode.HelpWindow = helpWindow;
			
			switch (defaultPosition) {
			case InsertPosition.Start:
				mode.CurIndex = 0;
				break;
			case InsertPosition.End:
				mode.CurIndex = mode.InsertionPoints.Count - 1;
				break;
			case InsertPosition.Before:
				for (int i = 0; i < mode.InsertionPoints.Count; i++) {
					if (mode.InsertionPoints [i].Location < loc)
						mode.CurIndex = i;
				}
				break;
			case InsertPosition.After:
				for (int i = 0; i < mode.InsertionPoints.Count; i++) {
					if (mode.InsertionPoints [i].Location > loc) {
						mode.CurIndex = i;
						break;
					}
				}
				break;
			}
			operationsRunning++;
			mode.StartMode ();
			mode.Exited += delegate(object s, InsertionCursorEventArgs iCArgs) {
				if (iCArgs.Success) {
					foreach (var node in nodes.Reverse ()) {
						var output = OutputNode (CodeGenerationService.CalculateBodyIndentLevel (declaringType), node);
						var offset = document.Editor.LocationToOffset (iCArgs.InsertionPoint.Location);
						var delta = iCArgs.InsertionPoint.Insert (editor, output.Text);
						output.RegisterTrackedSegments (this, delta + offset);
					}
					tcs.SetResult (null);
				} else {
					Rollback ();
				}
				DisposeOnClose (); 
			};
			return tcs.Task;
		}
开发者ID:rajeshpillai,项目名称:monodevelop,代码行数:60,代码来源:MDRefactoringScript.cs


示例3: InsertWithCursor

 public override Task InsertWithCursor(string operation, InsertPosition defaultPosition, IEnumerable<AstNode> nodes)
 {
     var entity = _context.GetNode<EntityDeclaration>();
     foreach (var node in nodes)
     {
         InsertBefore(entity, node);
     }
     var tcs = new TaskCompletionSource<object>();
     tcs.SetResult(null);
     return tcs.Task;
 }
开发者ID:dykim07,项目名称:vim-ide,代码行数:11,代码来源:OmniSharpScript.cs


示例4: InsertWithCursor

		public override Task<Script> InsertWithCursor(string operation, InsertPosition defaultPosition, IList<AstNode> nodes)
		{
			EntityDeclaration entity = _context.GetNode<EntityDeclaration>();
			if (entity is Accessor) {
				entity = (EntityDeclaration) entity.Parent;
			}

			foreach (var node in nodes) {
				InsertBefore(entity, node);
			}
			var tcs = new TaskCompletionSource<Script> ();
			tcs.SetResult (this);
			return tcs.Task;
		}
开发者ID:jcd-as,项目名称:omnisharp-server,代码行数:14,代码来源:OmniSharpScript.cs


示例5: InsertWithCursor

		public override Task<Script> InsertWithCursor(string operation, InsertPosition defaultPosition, IList<AstNode> nodes)
		{
			// TODO : Use undo group
			var tcs = new TaskCompletionSource<Script>();
			var loc = editor.Caret.Location;
			var currentPart = context.UnresolvedFile.GetInnermostTypeDefinition(loc);
			var insertionPoints = InsertionPoint.GetInsertionPoints(editor.Document, currentPart);
			
			if (insertionPoints.Count == 0) {
				SD.MessageService.ShowErrorFormatted("No valid insertion point can be found in type '{0}'.", currentPart.Name);
				return tcs.Task;
			}
			
			TextArea area = editor.GetService<TextArea>();
			if (area == null) return tcs.Task;
			
			var layer = new InsertionCursorLayer(area, operation, insertionPoints);
			
			switch (defaultPosition) {
				case InsertPosition.Start:
					layer.CurrentInsertionPoint = 0;
					break;
				case InsertPosition.End:
					layer.CurrentInsertionPoint = insertionPoints.Count - 1;
					break;
				case InsertPosition.Before:
					for (int i = 0; i < insertionPoints.Count; i++) {
						if (insertionPoints[i].Location < loc)
							layer.CurrentInsertionPoint = i;
					}
					break;
				case InsertPosition.After:
					for (int i = 0; i < insertionPoints.Count; i++) {
						if (insertionPoints[i].Location > loc) {
							layer.CurrentInsertionPoint = i;
							break;
						}
					}
					break;
			}
			operationsRunning++;
			InsertWithCursorOnLayer(this, layer, tcs, nodes, editor.Document);
			return tcs.Task;
		}
开发者ID:Paccc,项目名称:SharpDevelop,代码行数:44,代码来源:EditorScript.cs


示例6: InsertWithCursor

		public override void InsertWithCursor (string operation, AstNode node, InsertPosition defaultPosition)
		{
			var editor = document.Editor;
			DocumentLocation loc = document.Editor.Caret.Location;
			var mode = new InsertionCursorEditMode (editor.Parent, CodeGenerationService.GetInsertionPoints (document, document.ParsedDocument.GetInnermostTypeDefinition (loc)));
			var helpWindow = new Mono.TextEditor.PopupWindow.InsertionCursorLayoutModeHelpWindow ();
			helpWindow.TransientFor = MonoDevelop.Ide.IdeApp.Workbench.RootWindow;
			helpWindow.TitleText = operation;
			mode.HelpWindow = helpWindow;
			
			switch (defaultPosition) {
			case InsertPosition.Start:
				mode.CurIndex = 0;
				break;
			case InsertPosition.End:
				mode.CurIndex = mode.InsertionPoints.Count - 1;
				break;
			case InsertPosition.Before:
				for (int i = 0; i < mode.InsertionPoints.Count; i++) {
					if (mode.InsertionPoints [i].Location < loc)
						mode.CurIndex = i;
				}
				break;
			case InsertPosition.After:
				for (int i = 0; i < mode.InsertionPoints.Count; i++) {
					if (mode.InsertionPoints [i].Location > loc) {
						mode.CurIndex = i;
						break;
					}
				}
				break;
			}
			
			mode.StartMode ();
			mode.Exited += delegate(object s, InsertionCursorEventArgs iCArgs) {
				if (iCArgs.Success) {
					var output = OutputNode (CodeGenerationService.CalculateBodyIndentLevel (document.ParsedDocument.GetInnermostTypeDefinition (loc)), node);
					output.RegisterTrackedSegments (this, document.Editor.LocationToOffset (iCArgs.InsertionPoint.Location));
					iCArgs.InsertionPoint.Insert (editor, output.Text);
				}
			};
		}
开发者ID:gary-b,项目名称:monodevelop,代码行数:42,代码来源:MDRefactoringScript.cs


示例7: Initialize

 // Returns false if the given insertion is illegal
 public bool Initialize(XmlTreeNode n, InsertPosition position, XmlNodeType type)
 {
     this.position = position;
     this.type = type;
     XmlNode xn = null;
     this.newNode.NodeType = type;
     if (n != null) {
         this.parent = new TreeParent(view, doc, n);
         xn = n.Node;
     } else {
         position = InsertPosition.Child; ;
         xn = view.Model.Document;
         this.parent = new TreeParent(view.TreeView, view.Model.Document);
     }
     bool result = CanInsertNode(position, type, xn);
     if (result) {
         if (position == InsertPosition.Child) {
             if (xn != null) parent.SetParent(n);
             pos = parent.AttributeCount;
             if (type != XmlNodeType.Attribute)
                 pos += parent.ChildCount;
         } else {
             if (type == XmlNodeType.Attribute ^ xn is XmlAttribute) {
                 pos = this.parent.AttributeCount;
                 this.position = InsertPosition.Before;
             } else if (n != null) {
                 pos = n.Index;
             }
         }
     }
     return result;
 }
开发者ID:ic014308,项目名称:xml-notepad-for-mono,代码行数:33,代码来源:Commands.cs


示例8: InsertNode

 /// <summary>
 /// Insert an existing XmlNode into the tree and create a corresponding XmlTreeNode for it.
 /// </summary>
 /// <param name="target">Anchor point for insertion</param>
 /// <param name="position">Where to insert the new node relative to target node</param>
 /// <param name="xnode">Provided XmlNode that the new XmlTreeNode will wrap</param>
 /// <param name="selectNewNode">Whether to select the node in the tree after it's inserted.</param>
 public InsertNode(XmlTreeNode target, InsertPosition position, XmlNode xnode, bool selectNewNode, bool expandNewNode)
 {
     this.view = target.XmlTreeView;
     this.doc = this.view.Model.Document;
     this.position = position;
     this.type = xnode.NodeType;
     this.newNode = new XmlTreeNode(this.view, xnode);
     Initialize(newNode, target, position);
     this.selectNewNode = selectNewNode;
     this.expandNewNode = expandNewNode;
 }
开发者ID:ic014308,项目名称:xml-notepad-for-mono,代码行数:18,代码来源:Commands.cs


示例9: AddVideoWithAudio

 public IAudioVideoClipPair AddVideoWithAudio(string fileName, InsertPosition position, double offset,
                                              double clipStart, double clipEnd, bool shadowCopyAudio)
 {
     return AddVideoWithAudio(null, fileName, position, offset, clipStart, clipEnd, shadowCopyAudio);
 }
开发者ID:naik899,项目名称:VideoMaker,代码行数:5,代码来源:DefaultTimeline.cs


示例10: Insert

 public void Insert(int i, InsertPosition position, XmlNode n)
 {
     if (n == null) return;
     if (n.NodeType == XmlNodeType.Attribute) {
         Debug.Assert(this.xparent is XmlElement);
         XmlElement pe = (XmlElement)this.xparent;
         if (pe.Attributes != null){
             XmlNode already = pe.Attributes.GetNamedItem(n.LocalName, n.NamespaceURI);
             if (already != null){
                 throw new ApplicationException(SR.DuplicateAttribute);
             }
         }
         if (pe.Attributes != null && i < pe.Attributes.Count) {
             XmlAttribute refNode = this.xparent.Attributes[i];
             if (position == InsertPosition.After){
                 pe.Attributes.InsertAfter((XmlAttribute)n, refNode);
             } else {
                 pe.Attributes.InsertBefore((XmlAttribute)n, refNode);
             }
         } else {
             pe.Attributes.Append((XmlAttribute)n);
         }
     } else {
         i -= this.AttributeCount;
         if (this.xparent.HasChildNodes && i < this.xparent.ChildNodes.Count) {
             XmlNode refNode = this.xparent.ChildNodes[i];
             if (position == InsertPosition.After) {
                 this.xparent.InsertAfter(n, refNode);
             } else {
                 this.xparent.InsertBefore(n, refNode);
             }
         } else {
             this.xparent.AppendChild(n);
         }
     }
 }
开发者ID:ic014308,项目名称:xml-notepad-for-mono,代码行数:36,代码来源:Commands.cs


示例11: AddClip

 public IClip AddClip(string fileName, GroupMediaType mediaType, InsertPosition position, double offset,
                      double clipStart, double clipEnd)
 {
     return AddClip(null, fileName, mediaType, position, offset, clipStart, clipEnd);
 }
开发者ID:naik899,项目名称:VideoMaker,代码行数:5,代码来源:Track.cs


示例12: InsertWithCursor

 public virtual Task InsertWithCursor(string operation, InsertPosition defaultPosition, IEnumerable<AstNode> node)
 {
     throw new NotImplementedException();
 }
开发者ID:riviti,项目名称:NRefactory,代码行数:4,代码来源:Script.cs


示例13: InsertWithCursor

		public virtual Task<Script> InsertWithCursor(string operation, InsertPosition defaultPosition, IList<AstNode> nodes)
		{
			throw new NotImplementedException();
		}
开发者ID:0xd4d,项目名称:NRefactory,代码行数:4,代码来源:Script.cs


示例14: InsertWithCursor

			public override void InsertWithCursor (string operation, AstNode node, InsertPosition defaultPosition)
			{
				var editor = ctx.Document.Editor;
				var mode = new InsertionCursorEditMode (editor.Parent, MonoDevelop.Ide.CodeGenerationService.GetInsertionPoints (ctx.Document, ctx.Document.CompilationUnit.GetTypeAt (ctx.Location.Line, ctx.Location.Column)));
				var helpWindow = new Mono.TextEditor.PopupWindow.ModeHelpWindow ();
				helpWindow.TransientFor = MonoDevelop.Ide.IdeApp.Workbench.RootWindow;
				helpWindow.TitleText = string.Format (GettextCatalog.GetString ("<b>{0} -- Targeting</b>"), operation);
				helpWindow.Items.Add (new KeyValuePair<string, string> (GettextCatalog.GetString ("<b>Key</b>"), GettextCatalog.GetString ("<b>Behavior</b>")));
				helpWindow.Items.Add (new KeyValuePair<string, string> (GettextCatalog.GetString ("<b>Up</b>"), GettextCatalog.GetString ("Move to <b>previous</b> target point.")));
				helpWindow.Items.Add (new KeyValuePair<string, string> (GettextCatalog.GetString ("<b>Down</b>"), GettextCatalog.GetString ("Move to <b>next</b> target point.")));
				helpWindow.Items.Add (new KeyValuePair<string, string> (GettextCatalog.GetString ("<b>Enter</b>"), GettextCatalog.GetString ("<b>Accept</b> target point.")));
				helpWindow.Items.Add (new KeyValuePair<string, string> (GettextCatalog.GetString ("<b>Esc</b>"), GettextCatalog.GetString ("<b>Cancel</b> this operation.")));
				mode.HelpWindow = helpWindow;
				
				switch (defaultPosition) {
				case InsertPosition.Start:
					mode.CurIndex = 0;
					break;
				case InsertPosition.End:
					mode.CurIndex = mode.InsertionPoints.Count - 1;
					break;
				case InsertPosition.Before:
					for (int i = 0; i < mode.InsertionPoints.Count; i++) {
						if (mode.InsertionPoints [i].Location < new DocumentLocation (ctx.Location.Line, ctx.Location.Column))
							mode.CurIndex = i;
					}
					break;
				case InsertPosition.After:
					for (int i = 0; i < mode.InsertionPoints.Count; i++) {
						if (mode.InsertionPoints [i].Location > new DocumentLocation (ctx.Location.Line, ctx.Location.Column)) {
							mode.CurIndex = i;
							break;
						}
					}
					break;
				}
				
				mode.StartMode ();
				mode.Exited += delegate(object s, InsertionCursorEventArgs iCArgs) {
					if (iCArgs.Success) {
						var output = OutputNode (GetIndentLevelAt (editor.LocationToOffset (iCArgs.InsertionPoint.Location)), node);
						iCArgs.InsertionPoint.Insert (editor, output.Text);
					}
				};
			}
开发者ID:yayanyang,项目名称:monodevelop,代码行数:45,代码来源:MDRefactoringContext.cs


示例15: cvSeqPushMulti

 public static extern void cvSeqPushMulti(IntPtr seq, IntPtr elements, int count, InsertPosition in_front);
开发者ID:sanglin307,项目名称:UnityOpenCV,代码行数:1,代码来源:CvInvoke.cs


示例16: AddVideo

 public IClip AddVideo(string fileName, InsertPosition position, double offset, double clipStart, double clipEnd)
 {
     return AddClip(fileName, GroupMediaType.Video, position, offset, clipStart, clipEnd);
 }
开发者ID:naik899,项目名称:VideoMaker,代码行数:4,代码来源:Track.cs


示例17: AddImage

 public IClip AddImage(Image image, InsertPosition position, double offset, double clipStart, double clipEnd)
 {
     return AddImage(null, image, position, offset, clipStart, clipEnd);
 }
开发者ID:naik899,项目名称:VideoMaker,代码行数:4,代码来源:Track.cs


示例18: InsertWithCursor

 public override void InsertWithCursor(string operation, AstNode node, InsertPosition defaultPosition)
 {
     throw new NotImplementedException ();
 }
开发者ID:tapenjoyGame,项目名称:ILSpy,代码行数:4,代码来源:TestRefactoringContext.cs


示例19: InsertWithCursor

		public override void InsertWithCursor (string operation, InsertPosition defaultPosition, IEnumerable<AstNode> nodes, Action continuation)
		{
			var editor = context.TextEditor;
			DocumentLocation loc = context.TextEditor.Caret.Location;
			var declaringType = context.ParsedDocument.GetInnermostTypeDefinition (loc);
			var mode = new InsertionCursorEditMode (
				editor.Parent,
				CodeGenerationService.GetInsertionPoints (context.TextEditor, context.ParsedDocument, declaringType));
			if (mode.InsertionPoints.Count == 0) {
				MessageService.ShowError (
					GettextCatalog.GetString ("No valid insertion point can be found in type '{0}'.", declaringType.Name)
				);
			}
			var helpWindow = new Mono.TextEditor.PopupWindow.InsertionCursorLayoutModeHelpWindow ();
			helpWindow.TransientFor = MonoDevelop.Ide.IdeApp.Workbench.RootWindow;
			helpWindow.TitleText = operation;
			helpWindow.Shown += (s, a) => DesktopService.RemoveWindowShadow (helpWindow);
			mode.HelpWindow = helpWindow;
			
			switch (defaultPosition) {
			case InsertPosition.Start:
				mode.CurIndex = 0;
				break;
			case InsertPosition.End:
				mode.CurIndex = mode.InsertionPoints.Count - 1;
				break;
			case InsertPosition.Before:
				for (int i = 0; i < mode.InsertionPoints.Count; i++) {
					if (mode.InsertionPoints [i].Location < loc)
						mode.CurIndex = i;
				}
				break;
			case InsertPosition.After:
				for (int i = 0; i < mode.InsertionPoints.Count; i++) {
					if (mode.InsertionPoints [i].Location > loc) {
						mode.CurIndex = i;
						break;
					}
				}
				break;
			}
			operationsRunning++;
			mode.StartMode ();
			DesktopService.RemoveWindowShadow (helpWindow);
			mode.Exited += delegate(object s, InsertionCursorEventArgs iCArgs) {
				if (iCArgs.Success) {
					if (iCArgs.InsertionPoint.LineAfter == NewLineInsertion.None && 
					    iCArgs.InsertionPoint.LineBefore == NewLineInsertion.None && nodes.Count () > 1) {
						iCArgs.InsertionPoint.LineAfter = NewLineInsertion.BlankLine;
					}
					foreach (var node in nodes.Reverse ()) {
						var output = OutputNode (CodeGenerationService.CalculateBodyIndentLevel (declaringType), node);
						var offset = context.TextEditor.LocationToOffset (iCArgs.InsertionPoint.Location);
						var delta = iCArgs.InsertionPoint.Insert (editor, output.Text);
						output.RegisterTrackedSegments (this, delta + offset);
					}
					if (continuation != null)
						continuation ();
				} else {
					Rollback ();
				}
				DisposeOnClose (); 
			};
		}
开发者ID:sturmrutsturm,项目名称:monodevelop,代码行数:64,代码来源:MDRefactoringScript.cs


示例20: CanInsertNode

        private bool CanInsertNode(InsertPosition position, XmlNodeType type, XmlNode xn)
        {
            if (position == InsertPosition.Before && xn.NodeType == XmlNodeType.XmlDeclaration) {
                return false; // cannot insert anything before xml declaration.
            }
            if (position != InsertPosition.Child) {
                xn = parent.ParentNode;
            }
            XmlNodeType parentType = (xn != null) ? xn.NodeType : XmlNodeType.None;
            bool result = insertMap[(int)type][(int)parentType];

            // Check a few extra things...
            switch (type) {
                case XmlNodeType.Attribute:
                    this.requiresName = true;
                    break;
                case XmlNodeType.Element:
                    this.requiresName = true;
                    if (position != InsertPosition.Child && parent.IsRoot && parent.Document != null && parent.Document.DocumentElement != null) {
                        result = false; // don't allow multiple root elements.
                    }
                    break;
                case XmlNodeType.ProcessingInstruction:
                    this.requiresName = true;
                    break;
            }
            return result;
        }
开发者ID:ic014308,项目名称:xml-notepad-for-mono,代码行数:28,代码来源:Commands.cs



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

专题导读
上一篇:
C# Inside类代码示例发布时间:2022-05-24
下一篇:
C# InsertCommand类代码示例发布时间:2022-05-24
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

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

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

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