void tree_DragDrop(object sender, System.Windows.Forms.DragEventArgs e) { System.Windows.Forms.TreeNode NewNode; if (e.Data.GetDataPresent("System.Windows.Forms.TreeNode", false)) { Point pt = ((System.Windows.Forms.TreeView)sender).PointToClient(new Point(e.X, e.Y)); if (sender != tree) { return; } TreeNode DestinationNode = ((TreeView)sender).GetNodeAt(pt); if (DestinationNode != null) { NewNode = (TreeNode)e.Data.GetData("System.Windows.Forms.TreeNode"); TreeNode parent = DestinationNode; while ((parent = parent.Parent) != null) { if (parent == NewNode) { return; } } if (DestinationNode != NewNode) { NewNode.Remove(); DestinationNode.Nodes.Add(NewNode); NewNode.EnsureVisible(); this.tree.SelectedNode = NewNode; } } } }
//TreeView AthletesTreeView = null; private void treeView_DragDropAthletes(object sender, System.Windows.Forms.DragEventArgs e) { TreeNode NewNode; if (e.Data.GetDataPresent("System.Windows.Forms.TreeNode", false)) { Point pt = ((TreeView)sender).PointToClient(new Point(e.X, e.Y)); TreeNode DestinationNode = ((TreeView)sender).GetNodeAt(pt); if (DestinationNode != null) return; NewNode = (TreeNode)e.Data.GetData("System.Windows.Forms.TreeNode"); TreeNode parentNode = NewNode.Parent; if (NewNode.Tag is Group) return; //if (DestinationNode.TreeView != NewNode.TreeView) //{ treeView2.Nodes.Add((TreeNode)NewNode.Clone()); //AthletesTreeView.Nodes.Expand(); //Remove Original Node NewNode.Remove(); //Group g = (Group)DestinationNode.Tag; Group g = (Group)parentNode.Tag; Participant p = (Participant)NewNode.Tag; Utils.RemoveUserFromGroup(g.id, p.id, g.level); // } } }
private void tvNodes_DragDrop(object sender, DragEventArgs e) { TreeNode NewNode; if (e.Data.GetDataPresent("System.Windows.Forms.TreeNode", false)) { Point pt = ((TreeView)sender).PointToClient(new Point(e.X, e.Y)); TreeNode DestinationNode = ((TreeView)sender).GetNodeAt(pt); NewNode = (TreeNode)e.Data.GetData("System.Windows.Forms.TreeNode"); int srcModel = ModelBone.GetModelIndexFromKey((int)NewNode.Tag); int srcBone = ModelBone.GetBoneIndexFromKey((int)NewNode.Tag); int dstModel = ModelBone.GetModelIndexFromKey((int)DestinationNode.Tag); int dstBone = ModelBone.GetBoneIndexFromKey((int)DestinationNode.Tag); DestinationNode.Nodes.Add((TreeNode)NewNode.Clone()); DestinationNode.Expand(); NewNode.Remove(); if (srcModel == dstModel) { if (SceneManager.Current.Models[srcModel].MoveBone(srcBone, dstBone)) { SceneManager.Current.Change(ChangeType.Move, srcBone, dstBone); } } else { SceneManager.Current.Models[dstModel].ImportBone(SceneManager.Current.Models[srcModel].Bones[srcBone], dstBone); SceneManager.Current.Models[srcModel].RemoveBone(srcBone); ReindexTree(); } } }
private void treeView_DragDropGroups(object sender, System.Windows.Forms.DragEventArgs e) { TreeNode NewNode; if (e.Data.GetDataPresent("System.Windows.Forms.TreeNode", false)) { Point pt = ((TreeView)sender).PointToClient(new Point(e.X, e.Y)); TreeNode DestinationNode = ((TreeView)sender).GetNodeAt(pt); if (DestinationNode == null) return; if (!(DestinationNode.Tag is Group)) return; NewNode = (TreeNode)e.Data.GetData("System.Windows.Forms.TreeNode"); if (NewNode.Tag is Group) return; //if (DestinationNode.TreeView != NewNode.TreeView) //{ DestinationNode.Nodes.Add((TreeNode)NewNode.Clone()); DestinationNode.Expand(); //Remove Original Node NewNode.Remove(); Group g = (Group)DestinationNode.Tag; Participant p = (Participant)NewNode.Tag; //String ii = (String)SelectSubgroupListBox.SelectedItem; int si = SelectGroupComboBox.SelectedIndex; Group mainGroup = (Group)allGroups[si]; Utils.AddUserToGroup(g.id, mainGroup.id, p.id, g.level); // } } }
public void Visit(NewNode node) { if (!scope.IsDefinedType(node.TypeId.Text, out node.StaticType)) { errors.Add(SemanticError.NotDeclaredType(node.TypeId)); } }
// The following TreeView events allow to move the TreeView items around, and for the control // to remember the new order of items. private void TvContent_DragDrop(object sender, DragEventArgs e) { TreeNode NewNode; try { if (e.Data.GetDataPresent("System.Windows.Forms.TreeNode", false)) { Point pt = ((TreeView)sender).PointToClient(new Point(e.X, e.Y)); TreeNode DestinationNode = ((TreeView)sender).GetNodeAt(pt); NewNode = (TreeNode)e.Data.GetData("System.Windows.Forms.TreeNode"); if (DestinationNode == null && tvContent.Bounds.Contains(pt)) { ((TreeView)sender).Nodes.Add((TreeNode)NewNode.Clone()); } else { DestinationNode.Nodes.Add((TreeNode)NewNode.Clone()); DestinationNode.Expand(); } //Remove Original Node NewNode.Remove(); ProjectInfo.Dirty = true; } } catch (NullReferenceException) { } }
public void Visit(NewNode node) { if (node.TypeId.Text == "Int" || node.TypeId.Text == "Bool" || node.TypeId.Text == "String") { if (node.TypeId.Text == "Int" || node.TypeId.Text == "Bool") { IC.Add(new AssignmentConstantToVariable(VariableManager.PeekVariableCounter(), 0)); } else { IC.Add(new AssignmentStringToVariable(VariableManager.PeekVariableCounter(), "")); } } else { New(node.TypeId.Text); } if (special_object_return_type) { SetReturnType(node.TypeId.Text); } }
}//afterPopulateProps() public override CswNbtNode CopyNode( bool IsNodeTemp = false, Action<CswNbtNode> OnCopy = null ) { CswNbtNode CopiedNode = _CswNbtResources.Nodes.makeNodeFromNodeTypeId( NodeTypeId, IsTemp : IsNodeTemp, OnAfterMakeNode : delegate( CswNbtNode NewNode ) { //copy each property from the old node NewNode.copyPropertyValues( Node ); //get the landing page items from the original role's welcome page and loop through them, copying each to new page //NOTE: if we ever implement non-welcome page role specific LPIs, this will need to be updated CswNbtLandingPage LandingPageBuilder = new CswNbtLandingPage( _CswNbtResources ); LandingPageData NewNodeLandingPageData = LandingPageBuilder.getWelcomePageItems( this.NodeId ); foreach(LandingPageData.LandingPageItem Item in NewNodeLandingPageData.LandingPageItems) { LandingPageBuilder.copyLandingPageItem( NewNode.NodeId.ToString(), Item ); } //copy the views to the new role _CswNbtResources.ViewSelect.copyViewsByRoleId( NodeId, NewNode.NodeId ); //if the thing that requested this copy had a callback, fire it if( null != OnCopy ) { OnCopy( NewNode ); } }, IsCopy : true ); return CopiedNode; }
private void layersTreeView_DragDrop(object sender, DragEventArgs e) { TreeNode NewNode; if (e.Data.GetDataPresent("System.Windows.Forms.TreeNode", false)) { Point pt = ((TreeView)sender).PointToClient(new Point(e.X, e.Y)); TreeNode PreviousNode = layersTreeView.GetNodeAt(pt); int index = -1; if (PreviousNode == null) { index = layersTreeView.Nodes.Count; } else { index = layersTreeView.Nodes.IndexOf(PreviousNode) + 1; } NewNode = (TreeNode)e.Data.GetData("System.Windows.Forms.TreeNode"); layersTreeView.Nodes.Insert(index, (TreeNode)NewNode.Clone()); NewNode.Remove(); renderActiveLayers(); } }
private void tvwItems_DragDrop(object sender, DragEventArgs e) { TreeNode NewNode; if (e.Data.GetDataPresent("System.Windows.Forms.TreeNode", false)) { Point pt = ((TreeView)sender).PointToClient(new Point(e.X, e.Y)); TreeNode DestinationNode = ((TreeView)sender).GetNodeAt(pt); NewNode = (TreeNode)e.Data.GetData("System.Windows.Forms.TreeNode"); if (DestinationNode != NewNode.Parent) { if (DestinationNode != null && DestinationNode.Tag != null) { DestinationNode = DestinationNode.Parent; } if (DestinationNode != null) { DestinationNode.Nodes.Add((TreeNode)NewNode.Clone()); DestinationNode.Expand(); } else { ((TreeView)sender).Nodes.Add((TreeNode)NewNode.Clone()); } NewNode.Remove(); } } }
public virtual AstNode VisitNew(NewNode n) { Visit(n.Type); Visit(n.Arguments); Visit(n.Initializers); return(n); }
public string this[string columnName] { get { if (columnName == "ActionDate") { if (string.IsNullOrEmpty(ActionDate.ToString())) { return("Action date is required"); } } if (columnName == "ActionReason") { if (string.IsNullOrEmpty(ActionReason)) { return("Action reason is required"); } } if (columnName == "ActionBy") { if (string.IsNullOrEmpty(ActionBy)) { return("Action by is required"); } } //if (columnName == "PreviousTitle") //{ // if (string.IsNullOrEmpty(PreviousTitle.ToString())) // return "Previous title is required"; //} //if (columnName == "PreviousNode") //{ // if (string.IsNullOrEmpty(PreviousNode.ToString())) // return "Previous node is required"; //} if (columnName == "NewTitle") { if (string.IsNullOrEmpty(NewTitle.ToString())) { return("New title is required"); } } if (columnName == "NewNode") { if (string.IsNullOrEmpty(NewNode.ToString())) { return("New node is required"); } } if (columnName == "Type") { if (string.IsNullOrEmpty(Type.ToString())) { return("The Type either promotion or demotion is required"); } } return(string.Empty); } }
public void LoadArrayNode(ArrayNode node, NewNode currentNode, int counter) { var key = node.Index; if (currentNode == null) { currentNode = new NewNode(); FlattenedNodes.Add(currentNode); } currentNode.AddKeyNode(node, "[" + key + "]"); foreach (var nodeValue in node.Values) { if (currentNode.HasValueNode) { var nodes = currentNode.GetNodes(); var currentNode2 = new NewNode(); foreach (var n in nodes.Take(counter)) { currentNode2.AddKeyNode(n.Key, n.Value); } currentNode2.AddKeyNode(node, "[" + key + "]"); FlattenedNodes.Add(currentNode2); currentNode = currentNode2; } if (nodeValue is ArrayNode) { var arrayNode = nodeValue as ArrayNode; LoadArrayNode(arrayNode, currentNode, counter + 1); } else if (nodeValue is KeyArrayNode) { var keyArrayNode = nodeValue as KeyArrayNode; LoadKeyArrayNode(keyArrayNode, currentNode, counter + 1); } else if (nodeValue is KeyValueNode) { var keyValueNode = nodeValue as KeyValueNode; LoadKeyValueNode(keyValueNode, currentNode, counter + 1); } else if (nodeValue is ListKeyValueNode) { var listKeyValueNode = nodeValue as ListKeyValueNode; LoadListKeyValueNode(listKeyValueNode, currentNode, counter + 1); } else if (nodeValue is ValueNode) { var valueNode = nodeValue as ValueNode; LoadValueNode(valueNode, currentNode); } else if (nodeValue == null) { var valueNode = new ValueNode(); valueNode.Value = ""; currentNode.SetValueNode(valueNode); } } }
public void Visit(NewNode newNode) { foreach (var arg in newNode.Arguments) { arg.Parent = newNode; arg.Accept(this); } }
public override ASTN VisitNew([NotNull] NewContext context) { NewNode node = new NewNode(context) { Type = new TypeNode(context, context.TYPE().GetText()) }; return(node); }
/// <summary> /// 在本地保存Xml文件 /// </summary> /// <param name="doc"></param> /// <param name="Aroottag"></param> /// <param name="Aysdh"></param> private void SaveLocalXml(DOMDocument doc, string Aroottag, string Aysdh) { try { IXMLDOMElement rootnode = doc.documentElement; IXMLDOMNode modelNode = rootnode.selectNodes(Aroottag + "/bill_body/item")[0].cloneNode(true); IXMLDOMNode NewNode; IXMLDOMNode NewSubNode; IXMLDOMNode Parentnode; IXMLDOMNode body = rootnode.selectSingleNode(Aroottag + "/bill_body"); for (int i = 0; i < body.childNodes.length; i++) { body.removeChild(body.childNodes[i]); } DataSet ds = PDParam.GetXmldata(Aysdh); if (ds != null) { for (int i = 0; i < ds.Tables[0].Rows.Count; i++) { Parentnode = rootnode.selectSingleNode(Aroottag + "/bill_body"); if (i > 0) { modelNode = rootnode.selectNodes(Aroottag + "/bill_body/item")[0].cloneNode(true); } NewNode = Parentnode.appendChild(modelNode); NewSubNode = NewNode.selectSingleNode("cinventorycode"); NewSubNode.text = ds.Tables[0].Rows[i]["wlh"].ToString(); NewSubNode = NewNode.selectSingleNode("vbatchcode"); NewSubNode.text = ds.Tables[0].Rows[i]["pch"].ToString(); NewSubNode = NewNode.selectSingleNode("vfree1"); NewSubNode.text = ds.Tables[0].Rows[i]["sx"].ToString(); NewSubNode = NewNode.selectSingleNode("naccountastnum"); NewSubNode.text = ds.Tables[0].Rows[i]["sumzcsl"].ToString(); NewSubNode = NewNode.selectSingleNode("naccountnum"); NewSubNode.text = ds.Tables[0].Rows[i]["sumzczl"].ToString(); NewSubNode = NewNode.selectSingleNode("ncheckastnum"); NewSubNode.text = ds.Tables[0].Rows[i]["sumspsl"].ToString(); NewSubNode = NewNode.selectSingleNode("nchecknum"); NewSubNode.text = ds.Tables[0].Rows[i]["sumspzl"].ToString(); } string apppathxml = "../../webinfo/xml"; string pathName = Server.MapPath(apppathxml); if (!Directory.Exists(pathName)) { Directory.CreateDirectory(pathName); } string filename = "Wms-" + Aysdh + ".xml"; doc.save(pathName + "/" + filename); } } catch { this.PrintfError("本地保存Xml文件时出现错误,请重试"); return; } }
public override ParseTree Parse(Lexer lexer, ParserState state) { int start = lexer.Position; if (type == null) { throw new Exception(); } if (state.RuntimeState.Runtime.TraceParser) { state.RuntimeState.Runtime.ParseTrace.Enter(this, lexer.CurrentSource(), "User defined node " + TypeNames.GetName(type)); } object instance = NewNode.New(state.RuntimeState, type, null); object parseMethod = MemberNode.GetMember(instance, "Parse", true); object result = CallNode.Call(state.RuntimeState, parseMethod, new object[] { lexer }); if (result == null) { result = ParseTree.Yes; } else if (result is bool) { if ((bool)result) { result = ParseTree.Yes; } else { result = ParseTree.No; } } if (state.RuntimeState.Runtime.TraceParser) { if (result == ParseTree.No) { state.RuntimeState.Runtime.ParseTrace.No(this, lexer.SourceFrom(start)); } else { state.RuntimeState.Runtime.ParseTrace.Yes(this, lexer.SourceFrom(start)); } } return((ParseTree)result); }
private void tvFormel_DragDrop(object sender, DragEventArgs e) { TreeNode NewNode; if (e.Data.GetDataPresent(typeof(TreeNode))) { Point pt = ((TreeView)sender).PointToClient(new Point(e.X, e.Y)); TreeNode DestinationNode = ((TreeView)sender).GetNodeAt(pt); NewNode = (TreeNode)e.Data.GetData("System.Windows.Forms.TreeNode"); if (DestinationNode != NewNode) { int parentGoodsID = 0; int selfGoodsID = 0; string parentFrockNumber = ""; string selfFrockNumber = ""; S_FrockStandingBook selfFrock = new S_FrockStandingBook(); SeparateString(DestinationNode.Tag.ToString(), out parentGoodsID, out parentFrockNumber); SeparateString(NewNode.Tag.ToString(), out selfGoodsID, out selfFrockNumber); selfFrock.GoodsID = selfGoodsID; selfFrock.FrockNumber = selfFrockNumber; if (parentGoodsID != 0 && parentFrockNumber != "") { selfFrock.ParentGoodsID = parentGoodsID; selfFrock.ParentFrockNumber = parentFrockNumber; } if (!m_serverFrockStandingBook.ChangeParentChildRelationships(selfFrock, out m_strErr)) { MessageDialog.ShowPromptMessage(m_strErr); return; } else { DestinationNode.Nodes.Add((TreeNode)NewNode.Clone()); DestinationNode.Expand(); //删除已经移动的节点 NewNode.Remove(); RefrshData(); } } } }
/// <summary> /// Creates a DependencyGraph containing a copy of all the dependencies in the other graph /// Throws a ArgumentNullException if OtherGraph is null. /// </summary> /// <param name="OtherGraph">The other dependency graph from which the dependencies are copied</param> public DependencyGraph(DependencyGraph OtherGraph) { if (OtherGraph == null) { throw new ArgumentNullException("Argument(s) must be non-null"); } allNodes = new Dictionary <string, DependancyNode>(); foreach (DependancyNode n in OtherGraph.allNodes.Values) { DependancyNode NewNode; if (allNodes.ContainsKey(n.ToString())) { NewNode = allNodes[n.ToString()]; } else { NewNode = new DependancyNode(n.ToString()); allNodes.Add(NewNode.ToString(), NewNode); } foreach (DependancyNode n2 in n.GetDependees().Values) { DependancyNode NewDependee; if (allNodes.ContainsKey(n2.ToString())) { NewDependee = allNodes[n2.ToString()]; } else { NewDependee = new DependancyNode(n2.ToString()); allNodes.Add(NewDependee.ToString(), NewDependee); } NewNode.AddDependee(NewDependee); } foreach (DependancyNode n2 in n.GetDependents().Values) { DependancyNode NewDependent; if (allNodes.ContainsKey(n2.ToString())) { NewDependent = allNodes[n2.ToString()]; } else { NewDependent = new DependancyNode(n2.ToString()); allNodes.Add(NewDependent.ToString(), NewDependent); } NewNode.AddDependent(NewDependent); } } }
protected CswNbtNode CopyNodeImpl(bool IsNodeTemp = false, Action <CswNbtNode> OnCopy = null) { CswNbtNode CopiedNode = _CswNbtResources.Nodes.makeNodeFromNodeTypeId(NodeTypeId, IsTemp : IsNodeTemp, OnAfterMakeNode : delegate(CswNbtNode NewNode) { NewNode.copyPropertyValues(Node); if (null != OnCopy) { OnCopy(NewNode); } }, IsCopy: true); return(CopiedNode); }
private void RenderArguments(NewNode n) { _renderer.Append("("); if (!n.Arguments.IsNullOrEmpty()) { _visitor.Visit(n.Arguments[0]); for (var i = 1; i < n.Arguments.Count; i++) { _renderer.Append(", "); _visitor.Visit(n.Arguments[i]); } } _renderer.Append(")"); }
public override CswNbtNode CopyNode(bool IsNodeTemp = false, Action <CswNbtNode> OnCopy = null) { CswNbtObjClassInspectionDesign CopiedIDNode = base.CopyNodeImpl(IsNodeTemp, delegate(CswNbtNode NewNode) { NewNode.copyPropertyValues(Node); ((CswNbtObjClassInspectionDesign)NewNode).Generator.RelatedNodeId = null; ((CswNbtObjClassInspectionDesign)NewNode).Generator.RefreshNodeName(); if (null != OnCopy) { OnCopy(NewNode); } }); return(CopiedIDNode.Node); }
/// <summary> /// Copy the Request Item /// </summary> public CswNbtPropertySetRequestItem copyNode(bool ClearRequest = true) { CswNbtPropertySetRequestItem RetCopy = _CswNbtResources.Nodes.makeNodeFromNodeTypeId(NodeTypeId, delegate(CswNbtNode NewNode) { NewNode.copyPropertyValues(Node); ((CswNbtPropertySetRequestItem)NewNode).Status.Value = Statuses.Pending; if (ClearRequest) { ((CswNbtPropertySetRequestItem)NewNode).Request.RelatedNodeId = null; } _toggleReadOnlyProps(false, NewNode); //if( PostChanges ) //{ // RetCopy.postChanges( true ); //} }); return(RetCopy); }
private void RenderInitializers(NewNode n) { if (!n.Initializers.IsNullOrEmpty()) { _renderer.Append(" {"); _renderer.IncreaseIndent(); _renderer.AppendLineAndIndent(); _visitor.Visit(n.Initializers[0]); for (var i = 1; i < n.Initializers.Count; i++) { _renderer.AppendLineAndIndent(","); _visitor.Visit(n.Initializers[i]); } _renderer.DecreaseIndent(); _renderer.AppendLineAndIndent(); _renderer.Append("}"); } }
private void treeView1_DragDrop(object sender, DragEventArgs e) { TreeNode NewNode; if (e.Data.GetDataPresent("System.Windows.Forms.TreeNode", false)) { Point pt = ((TreeView)sender).PointToClient(new Point(e.X, e.Y)); TreeNode DestinationNode = ((TreeView)sender).GetNodeAt(pt); NewNode = (TreeNode)e.Data.GetData("System.Windows.Forms.TreeNode"); if (DestinationNode.TreeView == NewNode.TreeView) { //DestinationNode.Nodes.Add((TreeNode)NewNode.Clone()); DestinationNode.Parent.Nodes.Insert(DestinationNode.Index + 1, (TreeNode)NewNode.Clone()); DestinationNode.ExpandAll(); //Remove Original Node NewNode.Remove(); } } }
public void LoadKeyValueNode(KeyValueNode node, NewNode currentNode, int counter) { string key = node.Key; if (currentNode == null) { currentNode = new NewNode(); FlattenedNodes.Add(currentNode); } currentNode.AddKeyNode(node, key); if (node.Value is ArrayNode) { var arrayNode = node.Value as ArrayNode; LoadArrayNode(arrayNode, currentNode, counter + 1); } else if (node.Value is KeyArrayNode) { var keyArrayNode = node.Value as KeyArrayNode; LoadKeyArrayNode(keyArrayNode, currentNode, counter + 1); } else if (node.Value is KeyValueNode) { var keyValueNode = node.Value as KeyValueNode; LoadKeyValueNode(keyValueNode, currentNode, counter + 1); } else if (node.Value is ListKeyValueNode) { var listKeyValueNode = node.Value as ListKeyValueNode; LoadListKeyValueNode(listKeyValueNode, currentNode, counter + 1); } else if (node.Value is ValueNode) { var valueNode = node.Value as ValueNode; LoadValueNode(valueNode, currentNode); } else if (node.Value == null) { var valueNode = new ValueNode(); valueNode.Value = ""; currentNode.SetValueNode(valueNode); } }
private void EntityView_DragDrop(object sender, DragEventArgs e) { EntityTreeNode NewNode; if (e.Data.GetDataPresent(typeof(EntityTreeNode).FullName, false)) { System.Drawing.Point pt = ((TreeView)sender).PointToClient(new System.Drawing.Point(e.X, e.Y)); EntityTreeNode DestinationNode = (EntityTreeNode)((TreeView)sender).GetNodeAt(pt); NewNode = (EntityTreeNode)e.Data.GetData(typeof(EntityTreeNode).FullName); if (DestinationNode == null) { if (NewNode.Entity.Parent != null) { NewNode.Entity.Parent.RemoveEntity(NewNode.Entity, true); NewNode.Remove(); EntityView.Nodes.Add(NewNode); } } else if (DestinationNode.TreeView == EntityView) { Entity ent = DestinationNode.Entity; do { if (NewNode.Entity == ent) { return; } ent = ent.Parent; } while (ent != null); EntityView.BeginUpdate(); NewNode.Remove(); DestinationNode.Entity.AddEntity(NewNode.Entity); DestinationNode.Nodes.Add(NewNode); DestinationNode.Expand(); EntityView.EndUpdate(); } } }
bool IParseNodeValidator.Validate(ParseNode node, CompilerOptions options, IErrorHandler errorHandler) { NewNode newNode = (NewNode)node; // TODO: This is somewhat hacky - it only looks for any type named Dictionary // rather than resolving the type and checking if its actually // System.Dictionary. // This is because validators don't have a reference to the SymbolSet. NameNode typeNode = newNode.TypeReference as NameNode; if ((typeNode != null) && (typeNode.Name.Equals("Dictionary"))) { if (newNode.Arguments != null) { Debug.Assert(newNode.Arguments is ExpressionListNode); ParseNodeList arguments = ((ExpressionListNode)newNode.Arguments).Expressions; if (arguments.Count != 0) { if (arguments.Count % 2 != 0) { errorHandler.ReportError("Missing value parameter for the last name parameter in Dictionary instantiation.", newNode.Token.Location); } for (int i = 0; i < arguments.Count; i += 2) { ParseNode nameArgumentNode = arguments[i]; if ((nameArgumentNode.NodeType != ParseNodeType.Literal) || (((LiteralNode)nameArgumentNode).Literal.LiteralType != LiteralTokenType.String)) { errorHandler.ReportError("Name parameters in Dictionary instantiation must be string literals.", nameArgumentNode.Token.Location); } } } } } return(true); }
private void treeView_DragDrop(object sender, System.Windows.Forms.DragEventArgs e) { TreeNode NewNode; if (e.Data.GetDataPresent("System.Windows.Forms.TreeNode", false)) { Point pt = ((TreeView)sender).PointToClient(new Point(e.X, e.Y)); TreeNode DestinationNode = ((TreeView)sender).GetNodeAt(pt); if (DestinationNode == null) return; NewNode = (TreeNode)e.Data.GetData("System.Windows.Forms.TreeNode"); //if (DestinationNode.TreeView != NewNode.TreeView) //{ DestinationNode.Nodes.Add((TreeNode)NewNode.Clone()); DestinationNode.Expand(); //Remove Original Node NewNode.Remove(); // } } }
bool IParseNodeValidator.Validate(ParseNode node, CompilerOptions options, IErrorHandler errorHandler) { NewNode newNode = (NewNode)node; // TODO: This is somewhat hacky - it only looks for any type named Dictionary // rather than resolving the type and checking if its actually // System.Dictionary. // This is because validators don't have a reference to the SymbolSet. NameNode typeNode = newNode.TypeReference as NameNode; if (typeNode != null && typeNode.Name.Equals("Dictionary")) { if (newNode.Arguments != null) { Debug.Assert(newNode.Arguments is ExpressionListNode); ParseNodeList arguments = ((ExpressionListNode)newNode.Arguments).Expressions; if (arguments.Count != 0) { if (arguments.Count % 2 != 0) { errorHandler.ReportNodeValidationError(DSharpStringResources.INVALID_DICTIONARY_INTIALIZATION_PARAMETER_VALUE, newNode); } for (int i = 0; i < arguments.Count; i += 2) { ParseNode nameArgumentNode = arguments[i]; if (nameArgumentNode.NodeType != ParseNodeType.Literal || ((LiteralNode)nameArgumentNode).Literal.LiteralType != LiteralTokenType.String) { errorHandler.ReportNodeValidationError(DSharpStringResources.INVALID_DICTIONARY_PARAMETER_TYPE, nameArgumentNode); } } } } } return(true); }