// insert session either before or after current session public void InsertSession(InsertLocation loc) { // if session = 0 and after, insert at 1 // if session = 0 and before, insert at 0 if (loc == InsertLocation.after) { Session++; } sessions.Insert(control.Session, new Session(newSessionName(), directory)); Screen = 0; }
public void AddMenuItem(UUID agentID, string title, InsertLocation location, UserMode mode, CustomMenuHandler handler) { if (!m_menuItems.ContainsKey(agentID)) { m_menuItems[agentID] = new List <MenuItemData>(); } m_menuItems[agentID].Add(new MenuItemData() { Title = title, AgentID = agentID, Location = location, Mode = mode, Handler = handler }); }
public void Insert(Card card, InsertLocation insertLocation) { switch (insertLocation) { case InsertLocation.Bottom: _Cards.Add(card); break; case InsertLocation.Top: _Cards.Insert(0, card); break; } }
/// <summary> /// Inserts a query at a location /// </summary> /// <param name="locationType"></param> public void InsertQuery(InsertLocation locationType) { QueryDatabaseModel item = SelectedIndexes[0]; var location = FindIndex(item); switch (locationType) { case InsertLocation.After: if (location.main + 1 > QueryLists.Count) { QueryLists.Add(new List <QueryDatabaseModel>() { new QueryDatabaseModel() }); } else { QueryLists.Insert(location.main + 1, new List <QueryDatabaseModel>() { new QueryDatabaseModel() }); } break; case InsertLocation.Before: QueryLists.Insert(location.main, new List <QueryDatabaseModel>() { new QueryDatabaseModel() }); break; case InsertLocation.Into: QueryDatabaseModel value = new QueryDatabaseModel(); value.AddLastBracer(); if (QueryLists[location.main].Count == 1) { QueryLists[location.main][0].AddFirstBracer(); } else { QueryLists[location.main][QueryLists[location.main].Count - 1].RemoveLastBracer(); } QueryLists[location.main].Add(value); break; } }
/// <summary> /// Inserts the given instructions at the desired location. /// </summary> /// <param name="md"></param> /// <param name="location"></param> /// <param name="target"></param> /// <param name="instructions"></param> public static void Insert(this MethodDefinition md, InsertLocation location, Instruction target, params Instruction[] instructions) { var ilp = md.Body.GetILProcessor(); if (location == InsertLocation.Start) { foreach (var i in instructions) { ilp.InsertBefore(target, i); } } else { foreach (var i in instructions.Reverse()) { ilp.InsertAfter(target, i); } } md.OptimizeBranches(); }
/// <summary> /// Insert the specified key/data pair into the database. /// </summary> /// <param name="pair">The key/data pair to be inserted</param> /// <param name="loc"> /// If the key already exists in the database and no duplicate sort /// function has been specified, specify whether the inserted data item /// is added as the first or the last of the data items for that key. /// </param> public new void Add(KeyValuePair <DatabaseEntry, DatabaseEntry> pair, InsertLocation loc) { base.Add(pair, loc); }
public void AddMenuItem(UUID agentID, string title, InsertLocation location, UserMode mode, CustomMenuHandler handler) { if (!m_menuItems.ContainsKey(agentID)) m_menuItems[agentID] = new List<MenuItemData>(); m_menuItems[agentID].Add(new MenuItemData() { Title = title, AgentID = agentID, Location = location, Mode = mode, Handler = handler }); }
public void AddMenuItem(string title, InsertLocation location, UserMode mode, CustomMenuHandler handler) { AddMenuItem(UUID.Zero, title, location, mode, handler); }
/// <summary> /// Insert the data element as a duplicate element of the key to which /// the cursor refers. /// </summary> /// <param name="data">The data element to insert</param> /// <param name="loc"> /// Specify whether to insert the data item immediately before or /// immediately after the cursor's current position. /// </param> public new void Insert(DatabaseEntry data, InsertLocation loc) { base.Insert(data, loc); }
private void treeViewIff_DragDrop(object sender, DragEventArgs e) { if ((this.m_IFFFile != null) && (!this.m_IFFFile.IsDataTable) && (this.m_TreeNodeDragSource != null)) { if (this.m_TreeNodeDropTarget != null) { IFFFile.IFFNode draggedIFFNode = FindIFFNode(this.m_TreeNodeDragSource); IFFFile.IFFNode droppedIFFNode = FindIFFNode(this.m_TreeNodeDropTarget); this.m_TreeNodeDragSource.Remove(); draggedIFFNode.Parent.Children.Remove(draggedIFFNode); Int32 index = ((this.m_InsertPosition == InsertLocation.Above) ? this.m_TreeNodeDropTarget.Index : this.m_TreeNodeDropTarget.Index + 1); if ((index) == this.m_TreeNodeDropTarget.Parent.Nodes.Count) { this.m_TreeNodeDropTarget.Parent.Nodes.Add(this.m_TreeNodeDragSource); droppedIFFNode.Parent.Children.Add(draggedIFFNode); draggedIFFNode.Parent = droppedIFFNode.Parent; } else { this.m_TreeNodeDropTarget.Parent.Nodes.Insert(index, this.m_TreeNodeDragSource); droppedIFFNode.Parent.Children.Insert(index, draggedIFFNode); draggedIFFNode.Parent = droppedIFFNode.Parent; } this.HasChanges = true; } } this.m_TreeNodeDragSource = null; this.m_InsertPosition = InsertLocation.Above; this.m_TreeNodeDropTarget = null; this.m_MarkerPosition = InsertLocation.Above; this.m_TreeNodeHover = null; this.m_HoverStart = DateTime.Now; Cursor = Cursors.Default; this.treeViewIff.Refresh(); }
// insert session either before or after current session public void InsertSession(InsertLocation loc) { // if session = 0 and after, insert at 1 // if session = 0 and before, insert at 0 if (loc == InsertLocation.after){ Session++; } sessions.Insert(control.Session, new Session(newSessionName(),directory)); Screen = 0; }
/// <summary> /// Inserts the given instructions at the desired location. /// </summary> /// <param name="md"></param> /// <param name="location"></param> /// <param name="target"></param> /// <param name="instructions"></param> public static void Insert(this MethodDefinition md, InsertLocation location, Instruction target, params Instruction[] instructions) { var ilp = md.Body.GetILProcessor(); if (location == InsertLocation.Start) { foreach (var i in instructions) ilp.InsertBefore(target, i); } else { foreach (var i in instructions.Reverse()) ilp.InsertAfter(target, i); } md.OptimizeBranches(); }
/// <summary> /// Inserts the given instructions at the desired location. /// </summary> /// <param name="md"></param> /// <param name="location"></param> /// <param name="instructions"></param> public static void Insert(this MethodDefinition md, InsertLocation location, params Instruction[] instructions) { if (location == InsertLocation.Start) md.InsertStart(instructions); else md.InsertEnd(instructions); md.OptimizeBranches(); }
/// <summary> /// Inserts a span. /// </summary> /// <exception cref="ArgumentOutOfRangeException"> /// Thrown when one or more arguments are outside the required range. /// </exception> /// <param name="spanIndex"> /// Zero-based index of the span. /// </param> /// <param name="loc"> /// The location. /// </param> /// <param name="spanType"> /// Type of the span. /// </param> private void InsertSpan(int spanIndex, InsertLocation loc, SpanType spanType) { string orientationSizeName; string orientationSpanName; if (spanType == SpanType.Row) { orientationSizeName = "Height"; orientationSpanName = "Row"; } else { orientationSizeName = "Width"; orientationSpanName = "Column"; } string orientationDefinition = String.Format("{0}Definition", orientationSpanName); string orientationDefinitions = String.Format("Grid.{0}s", orientationDefinition); XmlNode definitionNodeCollection = (from XmlNode x in this.UsersXamlDocument.ChildNodes[0].ChildNodes where x.Name == orientationDefinitions select x).First(); XmlNode spanDefinitionWhiteSpaceNode = null; var spanDefinifitionNodesWithoutWhiteSpace = new List <XmlNode>(); foreach (XmlNode node in definitionNodeCollection.ChildNodes) { if (node.NodeType != XmlNodeType.Whitespace && node.NodeType != XmlNodeType.Comment) { spanDefinifitionNodesWithoutWhiteSpace.Add(node); } else { spanDefinitionWhiteSpaceNode = node.CloneNode(true); } } List <RowDefinition> rowDefinitions = null; List <ColumnDefinition> columnDefintions = null; XmlElement newSpanElement = null; if (spanType == SpanType.Row) { this.GetSpanDefinitions(out rowDefinitions); newSpanElement = this.UsersXamlDocument.CreateNode(XmlNodeType.Element, "", orientationDefinition, string.Empty) as XmlElement; newSpanElement.SetAttribute(orientationSizeName, this.ParseGridDefinitionLength(rowDefinitions[spanIndex].Height)); } else { this.GetSpanDefinitions(out columnDefintions); newSpanElement = this.UsersXamlDocument.CreateNode(XmlNodeType.Element, "", orientationDefinition, string.Empty) as XmlElement; newSpanElement.SetAttribute(orientationSizeName, this.ParseGridDefinitionLength(columnDefintions[spanIndex].Width)); } newSpanElement.SetAttribute("Tag", "New"); if (loc == InsertLocation.Before) { definitionNodeCollection.InsertBefore(newSpanElement, spanDefinifitionNodesWithoutWhiteSpace[spanIndex]); if (spanDefinitionWhiteSpaceNode != null) { definitionNodeCollection.InsertBefore(spanDefinitionWhiteSpaceNode, spanDefinifitionNodesWithoutWhiteSpace[spanIndex]); } this.IncrementRowOrColumnOnOrAfter(spanIndex, 1, spanType); } else if (loc == InsertLocation.After) { definitionNodeCollection.InsertAfter(newSpanElement, spanDefinifitionNodesWithoutWhiteSpace[spanIndex]); if (spanDefinitionWhiteSpaceNode != null) { definitionNodeCollection.InsertAfter(spanDefinitionWhiteSpaceNode, spanDefinifitionNodesWithoutWhiteSpace[spanIndex]); } this.IncrementRowOrColumnOnOrAfter(spanIndex + 1, 1, spanType); } else { throw new ArgumentOutOfRangeException("loc", loc, "The value passed in was not programmed."); } this.BuildGrid(); }
private void treeViewIff_DragOver(object sender, DragEventArgs e) { if ((this.m_IFFFile != null) && (e.Data.GetDataPresent(typeof(TreeNode))) && (e.AllowedEffect == DragDropEffects.Move)) { TreeNode treeNode = this.treeViewIff.GetNodeAt(this.treeViewIff.PointToClient(new Point(e.X, e.Y))); if (treeNode != null) { if (treeNode == this.m_TreeNodeDragSource) { e.Effect = DragDropEffects.None; return; } Point cursorPosition = this.treeViewIff.PointToClient(Cursor.Position); InsertLocation insertPosition = InsertLocation.Above; if (cursorPosition.Y > (treeNode.Bounds.Top + (treeNode.Bounds.Height / 2))) { insertPosition = InsertLocation.Below; } if ((this.m_TreeNodeHover != treeNode) || (this.m_MarkerPosition != insertPosition) || ((new TimeSpan(DateTime.Now.Ticks - this.m_HoverStart.Ticks).TotalMilliseconds > SystemInformation.MenuShowDelay) && (treeNode.Nodes.Count > 0) && (!treeNode.IsExpanded))) { Int32 delta = this.treeViewIff.Height - cursorPosition.Y; if ((delta < (this.treeViewIff.Height / 2)) && (delta > 0)) { if (treeNode.NextVisibleNode != null) { treeNode.NextVisibleNode.EnsureVisible(); } } else if ((delta > (this.treeViewIff.Height / 2)) && (delta < this.treeViewIff.Height)) { if (treeNode.PrevVisibleNode != null) { treeNode.PrevVisibleNode.EnsureVisible(); } } this.m_TreeNodeHover = treeNode; this.m_MarkerPosition = insertPosition; e.Effect = DragDropEffects.Move; if ((this.m_TreeNodeHover.Nodes.Count > 0) && (!this.m_TreeNodeHover.IsExpanded) && (new TimeSpan(DateTime.Now.Ticks - this.m_HoverStart.Ticks).TotalMilliseconds > SystemInformation.MenuShowDelay)) { this.m_TreeNodeHover.Expand(); } this.treeViewIff.Refresh(); this.m_TreeNodeDropTarget = treeNode; this.m_InsertPosition = insertPosition; Int32 insertPositionVertical = treeNode.Bounds.Top; Int32 insertPositionLeft = treeNode.Bounds.Left; Int32 insertPositionRight = ((treeNode.PrevVisibleNode != null) ? Math.Max(treeNode.Bounds.Right, treeNode.PrevVisibleNode.Bounds.Right) : treeNode.Bounds.Right); if (insertPosition == InsertLocation.Below) { insertPositionVertical = treeNode.Bounds.Bottom; if ((treeNode.NextVisibleNode != null) && (treeNode.NextVisibleNode.Level > treeNode.Level)) { insertPositionLeft = treeNode.NextVisibleNode.Bounds.Left; this.m_InsertPosition = InsertLocation.Above; this.m_TreeNodeDropTarget = treeNode.NextVisibleNode; } insertPositionRight = ((treeNode.NextVisibleNode != null) ? Math.Max(treeNode.Bounds.Right, treeNode.NextVisibleNode.Bounds.Right) : treeNode.Bounds.Right); } if ((this.m_TreeNodeDragSource == this.m_TreeNodeDropTarget) || (IsChildOf(this.m_TreeNodeDragSource, this.m_TreeNodeDropTarget))) { e.Effect = DragDropEffects.None; if (this.m_TreeNodeHover != null) { this.m_TreeNodeHover = null; this.treeViewIff.Refresh(); } this.m_HoverStart = DateTime.Now; return; } Graphics graphics = this.treeViewIff.CreateGraphics(); graphics.FillPolygon(Brushes.Black, new Point[] { new Point(insertPositionLeft - 4, insertPositionVertical - 5), new Point(insertPositionLeft, insertPositionVertical - 1), new Point(insertPositionLeft, insertPositionVertical), new Point(insertPositionLeft - 4, insertPositionVertical + 4) }); graphics.DrawLine(new Pen(Brushes.Black, 2), new Point(insertPositionLeft, insertPositionVertical), new Point(insertPositionRight, insertPositionVertical)); graphics.FillPolygon(Brushes.Black, new Point[] { new Point(insertPositionRight + 4, insertPositionVertical - 5), new Point(insertPositionRight, insertPositionVertical - 1), new Point(insertPositionRight, insertPositionVertical), new Point(insertPositionRight + 4, insertPositionVertical + 4) }); this.m_HoverStart = DateTime.Now; } } else { e.Effect = DragDropEffects.None; if (this.m_TreeNodeHover != null) { this.m_TreeNodeHover = null; this.treeViewIff.Refresh(); } } } }
/// <summary> /// Insert the specified key/data pair into the database. /// </summary> /// <param name="pair">The key/data pair to be inserted</param> /// <param name="loc"> /// If the key already exists in the database and no duplicate sort /// function has been specified, specify whether the inserted data item /// is added as the first or the last of the data items for that key. /// </param> public new void Add(KeyValuePair<DatabaseEntry, DatabaseEntry> pair, InsertLocation loc) { base.Add(pair, loc); }
private void treeViewIff_ItemDrag(object sender, ItemDragEventArgs e) { if ((this.m_IFFFile != null) && (!this.m_IFFFile.IsDataTable)) { this.m_TreeNodeDragSource = (TreeNode)e.Item; if (this.treeViewIff.DoDragDrop((TreeNode)e.Item, DragDropEffects.Move) == DragDropEffects.None) { this.m_TreeNodeDragSource = null; this.m_InsertPosition = InsertLocation.Above; this.m_TreeNodeDropTarget = null; this.m_MarkerPosition = InsertLocation.Above; this.m_TreeNodeHover = null; this.m_HoverStart = DateTime.Now; Cursor = Cursors.Default; this.treeViewIff.Refresh(); } } }