private IDockContent dockDeSerialization(string persistString) { if (persistString == typeof(TreeBuilderControl).ToString() && dockControlBuilder?.IsDisposed != false) { dockControlBuilder = new TreeBuilderControl(this); return(dockControlBuilder); } else if (persistString == typeof(ResultGrid).ToString() && dockControlGrid?.IsDisposed != false) { dockControlGrid = new ResultGrid(this); return(dockControlGrid); } else if ((persistString == XmlContentControl.GetPersistString(ContentType.FetchXML_Result) || persistString == XmlContentControl.GetPersistString(ContentType.Serialized_Result_JSON) || persistString == XmlContentControl.GetPersistString(ContentType.Serialized_Result_XML)) && dockControlFetchResult?.IsDisposed != false) { dockControlFetchResult = new XmlContentControl(ContentType.FetchXML_Result, SaveFormat.XML, this); return(dockControlFetchResult); } else if (persistString == XmlContentControl.GetPersistString(ContentType.FetchXML) && dockControlFetchXml?.IsDisposed != false) { dockControlFetchXml = new XmlContentControl(this); return(dockControlFetchXml); } else if (persistString == XmlContentControl.GetPersistString(ContentType.LayoutXML) && dockControlLayoutXml?.IsDisposed != false) { dockControlLayoutXml = new XmlContentControl(ContentType.LayoutXML, SaveFormat.None, this); return(dockControlLayoutXml); } return(null); }
/// <summary> /// Adds a new TreeNode to the parent object from the XmlNode information /// </summary> /// <param name="parentObject">Object (TreeNode or TreeView) where to add a new TreeNode</param> /// <param name="xmlNode">Xml node from the sitemap</param> /// <param name="tree">Current application form</param> /// <param name="isDisabled"> </param> public static TreeNode AddTreeViewNode(object parentObject, XmlNode xmlNode, TreeBuilderControl tree, FetchXmlBuilder fxb, int index = -1) { TreeNode node = null; if (xmlNode is XmlElement || xmlNode is XmlComment) { node = new TreeNode(xmlNode.Name); node.Name = xmlNode.Name; Dictionary <string, string> attributes = new Dictionary <string, string>(); if (xmlNode.NodeType == XmlNodeType.Comment) { attributes.Add("#comment", xmlNode.Value); node.ForeColor = System.Drawing.Color.Gray; } else if (xmlNode.Attributes != null) { foreach (XmlAttribute attr in xmlNode.Attributes) { attributes.Add(attr.Name, attr.Value); } } if (parentObject is TreeView) { ((TreeView)parentObject).Nodes.Add(node); } else if (parentObject is TreeNode) { if (index == -1) { ((TreeNode)parentObject).Nodes.Add(node); } else { ((TreeNode)parentObject).Nodes.Insert(index, node); } } else { throw new Exception("AddTreeViewNode: Unsupported control type"); } node.Tag = attributes; AddContextMenu(node, tree); foreach (XmlNode childNode in xmlNode.ChildNodes) { AddTreeViewNode(node, childNode, tree, fxb); } SetNodeText(node, fxb); } else if (xmlNode is XmlText && parentObject is TreeNode) { var treeNode = (TreeNode)parentObject; if (treeNode.Tag is Dictionary <string, string> ) { var attributes = (Dictionary <string, string>)treeNode.Tag; attributes.Add("#text", ((XmlText)xmlNode).Value); } } return(node); }
public valueControl(TreeNode node, FetchXmlBuilder fetchXmlBuilder, TreeBuilderControl tree) { InitializeComponent(); InitializeFXB(null, fetchXmlBuilder, tree, node); _attributeName = TreeNodeHelper.GetAttributeFromNode(Node.Parent, "attribute"); _entityName = TreeNodeHelper.GetAttributeFromNode(Node.Parent, "entity"); if (String.IsNullOrWhiteSpace(_entityName)) { _entityName = TreeNodeHelper.GetAttributeFromNode(Node.Parent.Parent.Parent, "name"); } else { // TODO: Entity is an alias, get the actual entity name } if (fxb.NeedToLoadEntity(_entityName)) { if (!fxb.working) { fxb.LoadEntityDetails(_entityName, RefreshValues); } } else { RefreshValues(); } }
/// <summary>Adds a context menu to a TreeNode control</summary> /// <param name="node">TreeNode where to add the context menu</param> /// <param name="tree">Current application form</param> public static void AddContextMenu(TreeNode node, TreeBuilderControl tree, QueryOptions options) { tree.addMenu.Items.Clear(); var tmplbl = tree.lblQAExpander; tree.gbQuickActions.Controls.Clear(); tree.gbQuickActions.Controls.Add(tmplbl); if (node == null && tree.tvFetch.Nodes.Count > 0) { node = tree.tvFetch.Nodes[0]; } if (node != null) { var nodecapabilities = new FetchNodeCapabilities(node.Name, true); if (nodecapabilities.Multiple) { tree.addOneMoreToolStripMenuItem.Text = "More " + nodecapabilities.Name; tree.addOneMoreToolStripMenuItem.Tag = "MORE-" + nodecapabilities.Name; AddLinkFromCapability(tree, "+" + nodecapabilities.Name, "MORE-" + nodecapabilities.Name); } if (nodecapabilities.Attributes && tree.selectAttributesToolStripMenuItem.Enabled) { AddLinkFromCapability(tree, "Select Attributes", "SelectAttributes"); } foreach (var childcapability in nodecapabilities.ChildTypes) { if (childcapability.Name == "all-attributes" && !options.ShowAllAttributes) { continue; } if (childcapability.Name == "-") { tree.addMenu.Items.Add(new ToolStripSeparator()); } else if (childcapability.Multiple || !node.Nodes.ContainsKey(childcapability.Name)) { AddMenuFromCapability(tree.addMenu, childcapability.Name); AddLinkFromCapability(tree, childcapability.Name, null, childcapability.Name == "#comment"); } } if (tree.addMenu.Items.Count == 0) { var dummy = tree.addMenu.Items.Add("nothing to add"); dummy.Enabled = false; } tree.addOneMoreToolStripMenuItem.Visible = nodecapabilities.Multiple; tree.selectAttributesToolStripMenuItem.Visible = nodecapabilities.Attributes; tree.deleteToolStripMenuItem.Enabled = nodecapabilities.Delete; tree.commentToolStripMenuItem.Enabled = nodecapabilities.Comment; tree.uncommentToolStripMenuItem.Enabled = nodecapabilities.Uncomment; node.ContextMenuStrip = tree.nodeMenu; } }
public linkEntityControl(TreeNode node, FetchXmlBuilder fetchXmlBuilder, TreeBuilderControl tree) { InitializeComponent(); BeginInit(); rbAttrIdOnly.Checked = fetchXmlBuilder.settings.LinkEntityIdAttributesOnly; rbAttrAll.Checked = !rbAttrIdOnly.Checked; InitializeFXB(null, fetchXmlBuilder, tree, node); EndInit(); RefreshAttributes(); }
public conditionControl(TreeNode node, FetchXmlBuilder fetchXmlBuilder, TreeBuilderControl tree) { InitializeComponent(); BeginInit(); txtLookup.OrganizationService = fetchXmlBuilder.Service; dlgLookup.Service = fetchXmlBuilder.Service; rbUseLookup.Checked = fetchXmlBuilder.settings.UseLookup; rbEnterGuid.Checked = !rbUseLookup.Checked; InitializeFXB(null, fetchXmlBuilder, tree, node); EndInit(); RefreshAttributes(); }
public commentControl(Dictionary <string, string> collection, TreeBuilderControl tree) : this() { if (collection != null) { collec = collection; } ControlUtils.FillControls(collec, this.Controls); controlsCheckSum = ControlUtils.ControlsChecksum(this.Controls); Saved += tree.CtrlSaved; }
public conditionControl(TreeNode node, FetchXmlBuilder fetchXmlBuilder, TreeBuilderControl tree) { InitializeComponent(); BeginInit(); valueOfSupported = fetchXmlBuilder.CDSVersion >= new Version(9, 1, 0, 19562); xrmRecord.Service = fetchXmlBuilder.Service; dlgLookup.Service = fetchXmlBuilder.Service; rbUseLookup.Checked = fetchXmlBuilder.settings.UseLookup; rbEnterGuid.Checked = !rbUseLookup.Checked; InitializeFXB(null, fetchXmlBuilder, tree, node); EndInit(); RefreshAttributes(); }
private bool ValidateForm() { if (TreeBuilderControl.IsFetchAggregate(node)) { if (string.IsNullOrWhiteSpace(txtAlias.Text)) { MessageBox.Show("Alias must be specified in aggregate queries", "Condition error", MessageBoxButtons.OK, MessageBoxIcon.Warning); //txtAlias.Focus(); return(false); } } return(true); }
public attributeControl(TreeNode Node, AttributeMetadata[] attributes, TreeBuilderControl tree) : this() { collec = (Dictionary <string, string>)Node.Tag; if (collec == null) { collec = new Dictionary <string, string>(); } node = Node; PopulateControls(Node, attributes); ControlUtils.FillControls(collec, this.Controls); controlsCheckSum = ControlUtils.ControlsChecksum(this.Controls); Saved += tree.CtrlSaved; }
public linkEntityControl(TreeNode Node, FetchXmlBuilder fetchXmlBuilder, TreeBuilderControl tree) : this() { form = fetchXmlBuilder; node = Node; collec = (Dictionary <string, string>)node.Tag; if (collec == null) { collec = new Dictionary <string, string>(); } PopulateControls(); ControlUtils.FillControls(collec, this.Controls); controlsCheckSum = ControlUtils.ControlsChecksum(this.Controls); Saved += tree.CtrlSaved; }
public orderControl(TreeNode Node, AttributeMetadata[] attributes, TreeBuilderControl tree) : this() { this.tree = tree; friendly = FetchXmlBuilder.friendlyNames; collec = (Dictionary <string, string>)Node.Tag; if (collec == null) { collec = new Dictionary <string, string>(); } PopulateControls(Node, attributes); ControlUtils.FillControls(collec, this.Controls); controlsCheckSum = ControlUtils.ControlsChecksum(this.Controls); Saved += tree.CtrlSaved; }
private static void AddLinkFromCapability(TreeBuilderControl tree, string name, string tag = null, bool alignright = false) { var link = new LinkLabel(); link.AutoSize = true; link.Dock = alignright ? DockStyle.Right : DockStyle.Left; link.TabIndex = tree.gbQuickActions.Controls.Count; link.TabStop = true; link.Text = name; link.Tag = tag ?? name; link.LinkBehavior = LinkBehavior.HoverUnderline; link.LinkClicked += tree.QuickActionLink_LinkClicked; tree.gbQuickActions.Controls.Add(link); if (!alignright) { link.BringToFront(); } }
private void PopulateControls(TreeNode node, AttributeMetadata[] attributes) { cmbAttribute.Items.Clear(); if (attributes != null) { foreach (var attribute in attributes) { AttributeItem.AddAttributeToComboBox(cmbAttribute, attribute, false, FetchXmlBuilder.friendlyNames); } } aggregate = TreeBuilderControl.IsFetchAggregate(node); cmbAggregate.Enabled = aggregate; chkGroupBy.Enabled = aggregate; if (!aggregate) { cmbAggregate.SelectedIndex = -1; chkGroupBy.Checked = false; } }
public void InitializeFXB(Dictionary <string, string> collection, FetchXmlBuilder fetchXmlBuilder, TreeBuilderControl tree, TreeNode node) { BeginInit(); fxb = fetchXmlBuilder; Node = node; Tree = tree; if (collection != null) { collec = collection; } else if (node != null) { collec = (Dictionary <string, string>)node.Tag; } original = new Dictionary <string, string>(collec); errorProvider = new ErrorProvider(this) { BlinkStyle = ErrorBlinkStyle.NeverBlink }; warningProvider = new ErrorProvider(this) { BlinkStyle = ErrorBlinkStyle.NeverBlink, Icon = WarningIcon }; infoProvider = new ErrorProvider(this) { BlinkStyle = ErrorBlinkStyle.NeverBlink, Icon = InfoIcon }; ShowHelpIcon(this, fxb?.settings?.ShowHelpLinks != false); PopulateControls(); ControlUtils.FillControls(collec, Controls, this); controlsCheckSum = ControlUtils.ControlsChecksum(Controls); Saved += tree.CtrlSaved; AttachValidatingEvent(this); ValidateControlRecursive(this); EndInit(); }
private void ResetDockLayout() { var i = 0; while (i < dockContainer.Contents.Count) { if (dockContainer.Contents[i] == dockControlBuilder) { i++; } else { dockContainer.Contents[i].DockHandler.Close(); } } settings.DockStates = new DockStates(); if (dockControlBuilder?.IsDisposed != false) { dockControlBuilder = new TreeBuilderControl(this); } dockControlBuilder.Show(dockContainer, DockState.DockLeft); }
protected override ControlValidationResult ValidateControl(Control control) { if (control == cmbAttribute) { if (string.IsNullOrWhiteSpace(cmbAttribute.Text)) { return(new ControlValidationResult(ControlValidationLevel.Error, "Attribute is required")); } if (fxb.Service != null && !cmbAttribute.Items.OfType <AttributeItem>().Any(a => a.ToString() == cmbAttribute.Text)) { return(new ControlValidationResult(ControlValidationLevel.Warning, "Attribute is not valid")); } } else if (control == txtAlias) { if (TreeBuilderControl.IsFetchAggregate(Node) && string.IsNullOrWhiteSpace(txtAlias.Text)) { return(new ControlValidationResult(ControlValidationLevel.Error, "Alias must be specified in aggregate queries")); } } return(base.ValidateControl(control)); }
protected override void PopulateControls() { var aggregate = TreeBuilderControl.IsFetchAggregate(Node); if (!aggregate) { cmbAttribute.Items.Clear(); if (attributes != null) { foreach (var attribute in attributes) { AttributeItem.AddAttributeToComboBox(cmbAttribute, attribute, false, friendly); } } } else { cmbAlias.Items.Clear(); cmbAlias.Items.Add(""); cmbAlias.Items.AddRange(GetAliases(Tree.tvFetch.Nodes[0]).ToArray()); } cmbAttribute.Enabled = !aggregate; cmbAlias.Enabled = aggregate; }
public fetchControl(Dictionary <string, string> collection, FetchXmlBuilder fetchXmlBuilder, TreeBuilderControl tree) { InitializeComponent(); InitializeFXB(collection, fetchXmlBuilder, tree, null); }
public orderControl(TreeNode node, AttributeMetadata[] attributes, FetchXmlBuilder fetchXmlBuilder, TreeBuilderControl tree) { InitializeComponent(); friendly = FetchXmlBuilder.friendlyNames; this.attributes = attributes; allattributes = fetchXmlBuilder.GetAllAttribues(node.LocalEntityName()).ToArray(); InitializeFXB(null, fetchXmlBuilder, tree, node); }
public entityControl(Dictionary <string, string> collection, FetchXmlBuilder fetchXmlBuilder, TreeBuilderControl tree) : this() { fxb = fetchXmlBuilder; if (collection != null) { collec = collection; } PopulateControls(); ControlUtils.FillControls(collec, this.Controls); controlsCheckSum = ControlUtils.ControlsChecksum(this.Controls); Saved += tree.CtrlSaved; }
public filterControl(Dictionary <string, string> collection, TreeBuilderControl tree) { InitializeComponent(); InitializeFXB(collection, null, tree, null); }
public attributeControl(TreeNode node, AttributeMetadata[] attributes, FetchXmlBuilder fetchXmlBuilder, TreeBuilderControl tree) { InitializeComponent(); this.attributes = attributes; InitializeFXB(null, fetchXmlBuilder, tree, node); }
public linkEntityControl(TreeNode node, FetchXmlBuilder fetchXmlBuilder, TreeBuilderControl tree) { InitializeComponent(); InitializeFXB(null, fetchXmlBuilder, tree, node); }