コード例 #1
0
        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;
        }
コード例 #2
0
		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;
		}
コード例 #3
0
ファイル: OmniSharpScript.cs プロジェクト: dykim07/vim-ide
 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;
 }
コード例 #4
0
		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;
		}
コード例 #5
0
ファイル: EditorScript.cs プロジェクト: Paccc/SharpDevelop
		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;
		}
コード例 #6
0
		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);
				}
			};
		}
コード例 #7
0
ファイル: Track.cs プロジェクト: naik899/VideoMaker
 public IClip AddVideo(string fileName, InsertPosition position, double offset, double clipStart, double clipEnd)
 {
     return AddClip(fileName, GroupMediaType.Video, position, offset, clipStart, clipEnd);
 }
コード例 #8
0
ファイル: Track.cs プロジェクト: naik899/VideoMaker
        public IClip AddImage(string name, Image image, InsertPosition position, double offset, double clipStart,
                              double clipEnd)
        {
            if (image == null) throw new ArgumentNullException("image");

            string fileName = CreateFileFromImage(image);

            return AddClip(name, fileName, GroupMediaType.Image, position, offset, clipStart, clipEnd, true);
        }
コード例 #9
0
ファイル: Track.cs プロジェクト: naik899/VideoMaker
        public IClip AddClip(string name, string fileName, GroupMediaType mediaType, InsertPosition position,
                             double offset,
                             double clipStart, double clipEnd, bool manageLifespan)
        {
            CheckMediaTypeAgainstGroup(mediaType);

            OnAddingClip();

            if ((clipEnd < 0) && (mediaType == GroupMediaType.Image))
            {
                clipEnd = DefaultImageDisplayDuration + clipStart;
            }

            long durationInUnits;

            var mediaFile = new MediaFile(fileName, manageLifespan);

            double absoluteOffset = position == InsertPosition.Absolute ? offset : Duration + offset;

            IList<IDisposable> activeAssistants = null;

            IAMTimelineSrc timelineSrc = null;

            try
            {
                activeAssistants = FetchAssistants(mediaFile);

                timelineSrc = CreateMedia(mediaFile,
                                          mediaType,
                                          TimelineBuilder.ToUnits(absoluteOffset),
                                          TimelineBuilder.ToUnits(clipStart),
                                          TimelineBuilder.ToUnits(clipEnd),
                                          out durationInUnits);
            }
            finally
            {
                DisposeOfAssistants(activeAssistants);
            }

            if (!string.IsNullOrEmpty(name))
            {
                ((IAMTimelineObj) timelineSrc).SetUserName(name);
            }

            IClip clip =
                new Clip(this, _timeline, timelineSrc, name, absoluteOffset, TimelineBuilder.ToSeconds(durationInUnits),
                         clipStart, mediaFile);

            clip.AddingEffect += clip_BeforeEffectAdded;
            clip.AddedEffect += clip_AfterEffectAdded;

            _clips.Add(clip);

            _virtualClips.AddVirtualClip(clip);

            OnAddedClip(clip);

            return clip;
        }
コード例 #10
0
        void IInsertChildViewModel.InsertChildren(IReadOnlyCollection <object> children, InsertPosition position, AddChildModifiers modifiers)
        {
            var parent = Parent as UIElementViewModel;

            if (parent == null)
            {
                throw new NotSupportedException($"{nameof(Parent)} can't be null");
            }

            var index = parent.Children.IndexOf(this);

            if (position == InsertPosition.After)
            {
                ++index;
            }
            parent.MoveChildren(children, index);
        }
コード例 #11
0
ファイル: CvInvoke.cs プロジェクト: sanglin307/UnityOpenCV
 public static extern void cvSeqPushMulti(IntPtr seq, IntPtr elements, int count, InsertPosition in_front);
コード例 #12
0
ファイル: SpriteInfoViewModel.cs プロジェクト: glepag1/stride
        void IInsertChildViewModel.InsertChildren(IReadOnlyCollection <object> children, InsertPosition position, AddChildModifiers modifiers)
        {
            string message;

            if (((IAddChildViewModel)this).CanAddChildren(children, modifiers, out message) && children.All(x => x is UFile))
            {
                Editor.ImportFiles(children.OfType <UFile>(), index);
                return;
            }

            using (var transaction = Editor.UndoRedoService.CreateTransaction())
            {
                foreach (var image in children.OfType <SpriteInfoViewModel>())
                {
                    image.Editor.RemoveImage(image.GetSpriteInfo(), image.index);
                }

                var insertIndex = position == InsertPosition.After ? index + 1 : index;
                insertIndex = MathUtil.Clamp(insertIndex, 0, Editor.Sprites.Count);

                foreach (var image in children.OfType <SpriteInfoViewModel>())
                {
                    Editor.InsertImage(image.GetSpriteInfo(), insertIndex++);
                }
                Editor.UndoRedoService.SetName(transaction, "Move images");
            }
        }
コード例 #13
0
        public void Insert(int pos, InsertPosition position, XmlTreeNode n, bool selectIt)
        {
            if (n.Node != null) {
                this.Insert(pos, position, n.Node);
            }

            int i = pos;
            if (position == InsertPosition.After) i++;
            if (parent == null) {
                view.Nodes.Insert(i, n);
            }
            else {
                parent.Nodes.Insert(i, n);
                if (selectIt && !parent.IsExpanded) {
                    parent.Expand(); // this will change image index of leaf nodes.
                }
            }
            n.Invalidate();
            if (selectIt) {
                view.SelectedNode = n;
            }
        }
コード例 #14
0
        protected override IInsertChildViewModel GetInsertTargetItem(PropertyViewItem container, Point mousePosition, out InsertPosition insertPosition)
        {
            insertPosition = InsertPosition.Before;

            var node = container.DataContext as NodeViewModel;

            if (node == null)
            {
                return(null);
            }

            object data;

            if (!node.AssociatedData.TryGetValue(CollectionData.ReorderCollectionItem, out data))
            {
                return(null);
            }

            var reorderItemViewModel = data as IReorderItemViewModel;

            if (reorderItemViewModel == null)
            {
                return(null);
            }

            if (mousePosition.Y >= 0 && mousePosition.Y <= InsertThreshold)
            {
                insertPosition = InsertPosition.Before;
                reorderItemViewModel.SetTargetNode(node);
                return(reorderItemViewModel);
            }
            if (mousePosition.Y >= container.ActualHeight - InsertThreshold && mousePosition.Y <= container.ActualHeight)
            {
                insertPosition = InsertPosition.After;
                reorderItemViewModel.SetTargetNode(node);
                return(reorderItemViewModel);
            }
            return(null);
        }
コード例 #15
0
 public IAudioVideoClipPair AddVideoWithAudio(string fileName, InsertPosition position, double offset,
                                              double clipStart, double clipEnd)
 {
     return(AddVideoWithAudio(null, fileName, position, offset, clipStart, clipEnd));
 }
コード例 #16
0
 public IClip AddAudio(string fileName, InsertPosition position, double offset, double clipStart, double clipEnd)
 {
     return(AddClip(fileName, GroupMediaType.Audio, position, offset, clipStart, clipEnd));
 }
コード例 #17
0
 public IClip AddImage(string name, string fileName, InsertPosition position, double offset, double clipStart,
                       double clipEnd)
 {
     return(AddClip(name, fileName, GroupMediaType.Image, position, offset, clipStart, clipEnd));
 }
コード例 #18
0
 public IClip AddClip(string fileName, GroupMediaType groupMediaType, InsertPosition position, double offset,
                      double clipStart, double clipEnd)
 {
     return(AddClip(null, fileName, groupMediaType, position, offset, clipStart, clipEnd));
 }
コード例 #19
0
        public IClip AddClip(string name, string fileName, GroupMediaType groupMediaType, InsertPosition position,
                             double offset, double clipStart, double clipEnd)
        {
            IGroup group = null;

            if (groupMediaType == GroupMediaType.Audio)
            {
                group = FindFirstGroupOfType(GroupType.Audio);
            }
            else
            {
                group = FindFirstGroupOfType(GroupType.Video);
            }

            if (group == null)
            {
                throw new SplicerException(
                          string.Format("No group found supporting a clip of type \"{0}\"", groupMediaType));
            }

            if (group.Tracks.Count > 0)
            {
                return(group.Tracks[0].AddClip(name, fileName, groupMediaType, position, offset, clipStart, clipEnd));
            }
            else
            {
                throw new SplicerException(
                          string.Format("No tracks found in the first group of type \"{0}\"", group.Type));
            }
        }
コード例 #20
0
        public void Initialize(XmlTreeNode newNode, XmlTreeNode target, InsertPosition position)
        {
            this.newNode = newNode;
            this.position = position;

            if (target == null) {
                this.parent = new TreeParent(this.view.TreeView, this.doc);
            } else {
                this.parent = new TreeParent(this.view, this.doc, target);
                if (position == InsertPosition.Child) {
                    if (CanHaveChildren(target)) {
                        this.parent.SetParent(target);
                    } else {
                        // if it's not an element it cannot have children!
                        this.position = InsertPosition.After;
                    }
                }
            }
            if (position == InsertPosition.Child) {
                if (target == null) {
                    // inserting at rool level
                    this.pos = this.view.TreeView.Nodes.Count;
                } else {
                    if (!CanHaveChildren(target)) {
                        this.position = InsertPosition.After;
                    }
                    if (newNode.NodeImage == NodeImage.Attribute) {
                        this.pos = this.parent.AttributeCount;
                    } else if (target != null) {
                        this.pos = target.Nodes.Count;
                    }
                }
            }
            if (this.position != InsertPosition.Child) {
                if (target.Node is XmlAttribute ^ newNode.Node is XmlAttribute) {
                    pos = this.parent.AttributeCount;
                    this.position = InsertPosition.Before;
                } else if (target != null) {
                    this.pos = target.Index;
                }
            }
        }
コード例 #21
0
        /// <summary>
        /// Move or copy a node from one place to another place in the tree.
        /// </summary>
        /// <param name="view">The MyTreeView that we are inserting into</param>
        /// <param name="source">The node that we are moving.  This node may not be in the tree
        /// and that is ok, so it might be a node that is being cut&paste from another process
        /// for example</param>
        /// <param name="target">The existing node that establishes where in the tree we want
        /// to move the source node to</param>
        /// <param name="where">The position relative to the target node (before or after)</param>
        /// <param name="copy">Whether we are moving or copying the source node</param>
        public MoveNode(XmlTreeView view, XmlTreeNode source, XmlTreeNode target, InsertPosition where, bool copy)
        {
            XmlNode sn = source.Node;
            XmlNode dn = target.Node;

            this.copy = copy;
            TreeView tv = view.TreeView;
            XmlDocument doc = view.Model.Document;
            this.view = view;
            this.sourcePosition = source.Index;

            view.Model.BeginUpdate();
            try {
                if (copy) {
                    this.wasExpanded = source.IsExpanded;
                    XmlTreeNode newSource = view.CreateTreeNode();
                    if (sn != null) {
                        sn = sn.CloneNode(true);
                        newSource.Node = sn;
                    }
                    source = newSource;
                }

                this.sourceParent = new TreeParent(tv, doc, source);
                this.tp = new TreeParent(tv, doc, target);

                // normalize destination based on source node type.
                // for example, if source is an attribute, then it can only be
                // inserted amongst attributes of another node.
                if (tp.IsRoot && where != InsertPosition.Child) {
                    if (sn is XmlAttribute)
                        throw new Exception(SR.RootLevelAttributes);
                    if (sn is XmlText || sn is XmlCDataSection)
                        throw new Exception(SR.RootLevelText);
                    if (sn is XmlElement && sn.OwnerDocument.DocumentElement != null && sn.OwnerDocument.DocumentElement != sn)
                        throw new Exception(SR.RootLevelElements);
                    if (dn is XmlDeclaration && where == InsertPosition.Before)
                        throw new Exception(SR.RootLevelBeforeXmlDecl);
                }
                if (where != InsertPosition.Child) {
                    if (sn is XmlAttribute) {
                        if (!(dn is XmlAttribute)) {
                            if (tp.AttributeCount != 0) {
                                // move target to valid location for attributes.
                                target = tp.GetChild(tp.AttributeCount - 1);
                                where = InsertPosition.After;
                            } else {
                                // append the attribute.
                                where = InsertPosition.Child;
                                target = (XmlTreeNode)target.Parent;
                            }

                        }
                    } else if (dn is XmlAttribute) {
                        if (!(sn is XmlAttribute)) {
                            int skip = tp.AttributeCount;
                            if (tp.Count > skip) {
                                // Move non-attribute down to beginning of child elements.
                                target = tp.GetChild(skip);
                                where = InsertPosition.Before;
                            } else {
                                // append the node.
                                where = InsertPosition.Child;
                                target = (XmlTreeNode)target.Parent;
                            }
                        }
                    }
                }
                this.source = source;
                this.target = target;
                this.where = where;
                this.tp = new TreeParent(tv, doc, target);

                if (where == InsertPosition.Child) {
                    this.tp.SetParent(target);
                }
            } finally {
                view.Model.EndUpdate();
            }
        }
コード例 #22
0
 public virtual Task <Script> InsertWithCursor(string operation, InsertPosition defaultPosition, IList <AstNode> nodes)
 {
     throw new NotImplementedException();
 }
コード例 #23
0
 /// <summary>
 /// Insert a new element as a sibling or child of current node. This command can create
 /// new XmlTreeNodes and new XmlNodes to go with it, or it can 
 /// </summary>
 public InsertNode(XmlTreeView view)
 {
     this.view = view;
     this.newNode = view.CreateTreeNode();
     this.doc = view.Model.Document;
     this.position = InsertPosition.Child;
 }
コード例 #24
0
 public Task <Script> InsertWithCursor(string operation, InsertPosition defaultPosition, params AstNode[] nodes)
 {
     return(InsertWithCursor(operation, defaultPosition, (IList <AstNode>)nodes));
 }
コード例 #25
0
			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);
					}
				};
			}
コード例 #26
0
        protected override void ProcessGetRequestWrapped(Valis.Core.VLAccessToken accessToken, HttpContext context)
        {
            try
            {
                var            surveyId           = TryParseInt32(context, "surveyId");
                var            pageId             = TryParseInt16(context, "pageId");
                InsertPosition position           = (InsertPosition)TryParseInt16(context, "position");
                Int16?         referingQuestionId = TryParseInt16(context, "referingQuestionId", false, null);
                var            textsLanguage      = TryParseInt16(context, "textsLanguage");
                var            questionText       = TryParseString(context, "questionText");
                var            description        = TryParseString(context, "description", false);
                var            questionType       = (QuestionType)Enum.Parse(typeof(QuestionType), TryParseString(context, "questionType", true));
                var            isRequired         = TryParseBoolean(context, "isRequired");
                var            requiredMessage    = TryParseString(context, "requiredMessage", false);

                VLSurveyManager  surveyManager = VLSurveyManager.GetAnInstance(accessToken);
                VLSurveyQuestion question      = null;
                if (referingQuestionId.HasValue)
                {
                    if (position == InsertPosition.Before)
                    {
                        question = surveyManager.CreateQuestionBefore(surveyId, pageId, referingQuestionId.Value, questionType, questionText, textsLanguage);
                    }
                    else if (position == InsertPosition.After)
                    {
                        question = surveyManager.CreateQuestionAfter(surveyId, pageId, referingQuestionId.Value, questionType, questionText, textsLanguage);
                    }
                    else
                    {
                        question = surveyManager.CreateQuestion(surveyId, pageId, questionType, questionText, textsLanguage);
                    }
                }
                else
                {
                    question = surveyManager.CreateQuestion(surveyId, pageId, questionType, questionText, textsLanguage);
                }

                //Κάνουμε update γενικά πεδία
                question.Description     = description;
                question.IsRequired      = isRequired;
                question.RequiredMessage = requiredMessage;

                try
                {
                    switch (question.QuestionType)
                    {
                        #region grab and update specific properties
                    case QuestionType.SingleLine:
                    {
                        question.ValidationBehavior = (ValidationMode)TryParseByte(context, "ValidationBehavior");
                        question.ValidationField1   = TryParseString(context, "ValidationField1", false);
                        question.ValidationField2   = TryParseString(context, "ValidationField2", false);
                        question.ValidationMessage  = TryParseString(context, "ValidationMessage", false);
                    }
                    break;

                    case QuestionType.MultipleLine:
                    {
                    }
                    break;

                    case QuestionType.Integer:
                    {
                        question.ValidationBehavior = (ValidationMode)TryParseByte(context, "ValidationBehavior");
                        question.ValidationField1   = TryParseString(context, "ValidationField1", false);
                        question.ValidationField2   = TryParseString(context, "ValidationField2", false);
                        question.ValidationMessage  = TryParseString(context, "ValidationMessage", false);
                    }
                    break;

                    case QuestionType.Decimal:
                    {
                        question.ValidationBehavior = (ValidationMode)TryParseByte(context, "ValidationBehavior");
                        question.ValidationField1   = TryParseString(context, "ValidationField1", false);
                        question.ValidationField2   = TryParseString(context, "ValidationField2", false);
                        question.ValidationMessage  = TryParseString(context, "ValidationMessage", false);
                    }
                    break;

                    case QuestionType.Date:
                    {
                        question.ValidationBehavior  = (ValidationMode)TryParseByte(context, "ValidationBehavior");
                        question.UseDateTimeControls = TryParseBoolean(context, "UseDateTimeControls");
                    }
                    break;

                    case QuestionType.Time:
                    {
                    }
                    break;

                    case QuestionType.DateTime:
                    {
                    }
                    break;

                    case QuestionType.OneFromMany:
                    case QuestionType.ManyFromMany:
                    {
                        question.RandomizeOptionsSequence = TryParseBoolean(context, "Randomize");
                        question.OptionalInputBox         = TryParseBoolean(context, "AddOtherField");
                        question.OtherFieldLabel          = TryParseString(context, "OtherFieldLabel", false);
                        question.OtherFieldType           = (OtherFieldType)TryParseByte(context, "OtherFieldType", false);

                        question.ValidationBehavior = (ValidationMode)TryParseByte(context, "ValidationBehavior");
                        question.ValidationField1   = TryParseString(context, "ValidationField1", false);
                        question.ValidationField2   = TryParseString(context, "ValidationField2", false);
                        question.ValidationMessage  = TryParseString(context, "ValidationMessage", false);

                        /*
                         * Τώρα θα φτιάξουμε τα options της ερώτησης!
                         */
                        var questionChoices = TryParseString(context, "QuestionChoices");
                        var _choices        = questionChoices.Split(new char[] { '\n' }, StringSplitOptions.RemoveEmptyEntries);
                        if (_choices.Length == 0)
                        {
                            throw new VLException("You must type at least one option for this type of question!");
                        }
                        foreach (var optionText in _choices)
                        {
                            surveyManager.CreateQuestionOption(question, optionText);
                        }
                    }
                    break;

                    case QuestionType.DropDown:
                    {
                        question.RandomizeOptionsSequence = TryParseBoolean(context, "Randomize");

                        /*
                         * Τώρα θα φτιάξουμε τα options της ερώτησης!
                         */
                        var questionChoices = TryParseString(context, "QuestionChoices");
                        var _choices        = questionChoices.Split(new char[] { '\n' }, StringSplitOptions.RemoveEmptyEntries);
                        if (_choices.Length == 0)
                        {
                            throw new VLException("You must type at least one option for this type of question!");
                        }
                        foreach (var optionText in _choices)
                        {
                            surveyManager.CreateQuestionOption(question, optionText);
                        }
                    }
                    break;

                    case QuestionType.DescriptiveText:
                    {
                    }
                    break;

                    case QuestionType.Slider:
                    {
                    }
                    break;

                    case QuestionType.Range:
                    {
                        question.FrontLabelText = TryParseString(context, "FrontLabelText", false);
                        question.AfterLabelText = TryParseString(context, "AfterLabelText", false);
                        question.RangeStart     = TryParseInt32(context, "RangeStart");
                        question.RangeEnd       = TryParseInt32(context, "RangeEnd");
                    }
                    break;

                    case QuestionType.MatrixOnePerRow:
                    case QuestionType.MatrixManyPerRow:
                    {
                        question.RandomizeOptionsSequence = TryParseBoolean(context, "Randomize");


                        /*
                         * Τώρα θα φτιάξουμε τα options της ερώτησης!
                         */
                        var questionChoices = TryParseString(context, "QuestionChoices");
                        var _choices        = questionChoices.Split(new char[] { '\n' }, StringSplitOptions.RemoveEmptyEntries);
                        if (_choices.Length == 0)
                        {
                            throw new VLException("You must type at least one option for this type of question!");
                        }
                        foreach (var optionText in _choices)
                        {
                            surveyManager.CreateQuestionOption(question, optionText);
                        }

                        /*
                         * Τώρα θα φτιάξουμε τις κολώνες της ερώτησης!
                         */
                        var questionColumns = TryParseString(context, "QuestionColumns");
                        var _columns        = questionColumns.Split(new char[] { '\n' }, StringSplitOptions.RemoveEmptyEntries);
                        if (_columns.Length == 0)
                        {
                            throw new VLException("You must type at least one column for this type of question!");
                        }
                        foreach (var columnText in _columns)
                        {
                            surveyManager.CreateQuestionColumn(question.Survey, question.QuestionId, columnText);
                        }
                    }
                    break;

                    case QuestionType.MatrixManyPerRowCustom:
                    {
                    }
                    break;

                    case QuestionType.Composite:
                    {
                    }
                    break;
                        #endregion
                    }

                    question = surveyManager.UpdateQuestion(question);
                }
                catch
                {
                    /*Εάν κάτι δεν πάει καλά, διαγράφουμε την ερώτηση που πήγαμε να δημιουργήσουμε*/
                    surveyManager.DeleteQuestion(question);
                    throw;
                }



                var _question = new
                {
                    question.Survey,
                    question.QuestionId,
                    question.Page,
                    question.MasterQuestion,
                    question.DisplayOrder,
                    question.QuestionType,
                    question.CustomType,
                    question.IsRequired,
                    question.AttributeFlags,
                    question.ValidationBehavior,
                    question.RegularExpression,
                    question.TextsLanguage,

                    question.QuestionText,
                    question.Description,
                    question.HelpText,
                    question.FrontLabelText,
                    question.AfterLabelText,
                    question.InsideText,
                    question.RequiredMessage,
                    question.ValidationMessage
                };


                var response = JsonConvert.SerializeObject(_question, Formatting.None);
                context.Response.Write(response);
            }
            catch
            {
                throw;
            }
        }
コード例 #27
0
ファイル: Script.cs プロジェクト: riviti/NRefactory
 public virtual Task InsertWithCursor(string operation, InsertPosition defaultPosition, IEnumerable<AstNode> node)
 {
     throw new NotImplementedException();
 }
コード例 #28
0
 /// <summary>
 /// Parses the specified text as HTML or XML and inserts the resulting nodes into the DOM tree at a specified position. It does not reparse the element it is being used on and thus it does not corrupt the existing elements inside the element. This, and avoiding the extra step of serialization make it much faster than direct innerHTML manipulation.
 /// </summary>
 /// <param name="position">The position relative to the element</param>
 /// <param name="text">String to be parsed as HTML or XML and inserted into the tree.</param>
 public virtual extern void InsertAdjacentHTML(InsertPosition position, string text);
コード例 #29
0
ファイル: Track.cs プロジェクト: naik899/VideoMaker
 public IClip AddClip(string fileName, GroupMediaType mediaType, InsertPosition position, double offset,
                      double clipStart, double clipEnd)
 {
     return AddClip(null, fileName, mediaType, position, offset, clipStart, clipEnd);
 }
コード例 #30
0
 public virtual Task InsertWithCursor(string operation, InsertPosition defaultPosition, IEnumerable <AstNode> node)
 {
     throw new NotImplementedException();
 }
コード例 #31
0
ファイル: Track.cs プロジェクト: naik899/VideoMaker
 public IClip AddImage(string name, string fileName, InsertPosition position, double offset, double clipStart,
                       double clipEnd)
 {
     return AddClip(name, fileName, GroupMediaType.Image, position, offset, clipStart, clipEnd);
 }
コード例 #32
0
 public Task InsertWithCursor(string operation, InsertPosition defaultPosition, params AstNode[] nodes)
 {
     return(InsertWithCursor(operation, defaultPosition, (IEnumerable <AstNode>)nodes));
 }
コード例 #33
0
ファイル: Track.cs プロジェクト: naik899/VideoMaker
 public IClip AddImage(Image image, InsertPosition position, double offset, double clipStart, double clipEnd)
 {
     return AddImage(null, image, position, offset, clipStart, clipEnd);
 }
コード例 #34
0
            /// <summary>
            /// Finds the pair of preceding and following nodes for insertion based on origin and insertion position.
            /// </summary>
            /// <param name="parent">The double linked list collection to use to insert the current node into.</param>
            /// <param name="origin">The origin node to use as a reference to insert the current node; the node will be inserted
            /// into the reference following position if none is specified.</param>
            /// <param name="preceding">The preceding node found to insert the current node after.</param>
            /// <param name="following">The following node found to insert the current node before.</param>
            /// <param name="position">The preferred insertion order to use relative to the origin node.</param>
            /// <returns>True if the correct insertion position is found; otherwise, false.</returns>
            protected override bool FindPosition(TList parent, ref TNode origin, out TNode preceding, out TNode following, ref InsertPosition position)
            {
                if (base.FindPosition(parent, ref origin, out preceding, out following, ref position) is bool isFound && origin != null)
                {
                    var reference = CompareTo(ref origin, ref preceding, ref following);
                    while (origin != null)
                    {
                        switch (reference)
                        {
                        case int last when last < 0:
                            preceding = (following = origin).DirectPrev;
                            switch (CompareTo(ref preceding, ref preceding, ref following))
                            {
                            case int next when next > 0:
                            default: origin = null; break;

                            case int next when next < 0: origin = origin.Prev; reference = next; break;
                            }
                            position = InsertPosition.Preceding;
                            break;

                        case int last when last > 0:
                            following = (preceding = origin).DirectNext;
                            switch (CompareTo(ref following, ref preceding, ref following))
                            {
                            case int next when next > 0: origin = origin.Next; reference = next; break;

                            case int next when next < 0:
                            default: origin = null; break;
                            }
                            position = InsertPosition.Following;
                            break;

                        default: origin = null; break;
                        }
                    }
                }
                return(isFound);
            }
コード例 #35
0
 // 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;
 }
コード例 #36
0
 public void Add(TKey key, TValue value, InsertPosition position)
 {
     throw new NotImplementedException();
 }
コード例 #37
0
        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;
        }
コード例 #38
0
            public override void InsertWithCursor(string operation, AstNode node, InsertPosition defaultPosition)
            {
                var entity = context.GetNode <EntityDeclaration> ();

                InsertBefore(entity, node);
            }
コード例 #39
0
 public PasteCommand(XmlDocument doc, XmlTreeView view, InsertPosition position, TreeData data)
 {
     this.td = data;
     this.doc = doc;
     this.target = (XmlTreeNode)view.SelectedNode;
     if (this.target == null && view.TreeView.Nodes.Count > 0) {
         this.target = (XmlTreeNode)view.TreeView.Nodes[0];
     }
     if (this.target != null && this.target.NodeType != XmlNodeType.Element &&
         this.target.NodeType != XmlNodeType.Document) {
         position = InsertPosition.After;
     }
     this.position = position;
     this.view = view;
     if (td != null) {
         this.source = td.GetTreeNode(this.doc, this.target, this.view);
     }
 }
コード例 #40
0
        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();
            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 = 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);
        }
コード例 #41
0
 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);
         }
     }
 }
コード例 #42
0
 public InsertionBuilder(Func <TNode, int> startLineExpression, string contents, InsertPosition insertPosition = InsertPosition.Before, Func <TNode, bool>?modifyCondition = null) : base(startLineExpression, modifyCondition)
 {
     Contents       = contents;
     InsertPosition = insertPosition;
 }
コード例 #43
0
 /// <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;
 }
コード例 #44
0
ファイル: Modification.cs プロジェクト: sdzexi/AbpHelper.CLI
 public Insertion(int startLine, string contents, InsertPosition insertPosition = InsertPosition.Before) : base(startLine)
 {
     Contents       = contents;
     InsertPosition = insertPosition;
 }
コード例 #45
0
ファイル: SpriteInfoViewModel.cs プロジェクト: glepag1/stride
        bool IInsertChildViewModel.CanInsertChildren(IReadOnlyCollection <object> children, InsertPosition position, AddChildModifiers modifiers, out string message)
        {
            if (((IAddChildViewModel)this).CanAddChildren(children, modifiers, out message))
            {
                return(true);
            }

            message = "Invalid object";
            foreach (var child in children)
            {
                var image = child as SpriteInfoViewModel;
                if (image == null)
                {
                    return(false);
                }
            }
            message = string.Format(position == InsertPosition.Before ? "Insert before {0}" : "Insert after {0}", Name);
            return(true);
        }
コード例 #46
0
ファイル: Script.cs プロジェクト: 0xd4d/NRefactory
		public virtual Task<Script> InsertWithCursor(string operation, InsertPosition defaultPosition, IList<AstNode> nodes)
		{
			throw new NotImplementedException();
		}
コード例 #47
0
 public override void InsertWithCursor(string operation, AstNode node, InsertPosition defaultPosition)
 {
     throw new NotImplementedException ();
 }
コード例 #48
0
ファイル: CvSeqT.cs プロジェクト: shimat/opencvsharp_2410
        /// <summary>
        /// 複数の要素をシーケンスのどちらかの端(先頭か末尾)に追加する (cvSeqPushMulti).
        /// </summary>
        /// <param name="elements">追加される要素群.</param>
        /// <param name="inFront">変更するシーケンスの端を指定するフラグ.</param>
#else
        /// <summary>
        /// Pushes several elements to the either end of sequence (cvSeqPushMulti).
        /// </summary>
        /// <param name="elements">Added elements. </param>
        /// <param name="inFront">The flags specifying the modified sequence end</param>
#endif
        public void PushMulti(T[] elements, InsertPosition inFront)
        {
            Cv.SeqPushMulti(this, elements, inFront);
        }
コード例 #49
0
		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 (); 
			};
		}
コード例 #50
0
ファイル: DefaultTimeline.cs プロジェクト: naik899/VideoMaker
 public IAudioVideoClipPair AddVideoWithAudio(string fileName, InsertPosition position, double offset,
                                              double clipStart, double clipEnd, bool shadowCopyAudio)
 {
     return AddVideoWithAudio(null, fileName, position, offset, clipStart, clipEnd, shadowCopyAudio);
 }
コード例 #51
0
ファイル: Script.cs プロジェクト: riviti/NRefactory
 public Task InsertWithCursor(string operation, InsertPosition defaultPosition, params AstNode[] nodes)
 {
     return InsertWithCursor(operation, defaultPosition, (IEnumerable<AstNode>)nodes);
 }
コード例 #52
0
        bool IInsertChildViewModel.CanInsertChildren(IReadOnlyCollection <object> children, InsertPosition position, AddChildModifiers modifiers, out string message)
        {
            message = "This UI element has no parent.";

            var parent = Parent as UIElementViewModel;

            if (parent == null || !parent.CanAddOrInsertChildrenPrivate(children, out message))
            {
                return(false);
            }

            if (children.Any(x => x == this))
            {
                message = "Cannot insert before or after one of the selected element";
                return(false);
            }
            message = $"Insert {(position == InsertPosition.Before ? "before" : "after")} {GetDropLocationName()}";
            return(true);
        }
コード例 #53
0
ファイル: Script.cs プロジェクト: 0xd4d/NRefactory
		public Task<Script> InsertWithCursor(string operation, InsertPosition defaultPosition, params AstNode[] nodes)
		{
			return InsertWithCursor(operation, defaultPosition, (IList<AstNode>)nodes);
		}
コード例 #54
0
ファイル: CvSeqT.cs プロジェクト: shimat/opencvsharp_2410
        /// <summary>
        /// 複数の要素をシーケンスのどちらかの端(先頭か末尾)から削除する (cvSeqPopMulti).
        /// </summary>
        /// <param name="count">削除される要素数.</param>
        /// <param name="inFront">変更するシーケンスの端を指定するフラグ.</param>
#else
        /// <summary>
        /// Removes several elements from the either end of sequence (cvSeqPopMulti).
        /// </summary>
        /// <param name="count">Number of elements to pop. </param>
        /// <param name="inFront">The flags specifying the modified sequence end</param>
#endif
        public T[] PopMulti(int count, InsertPosition inFront)
        {
            return(base.PopMulti <T>(count, inFront));
        }