public TreatAsJsonCommand(CustomTreeView tree, TreeViewData data) : base(data, "Treat as Json", false) { _tree = tree; data.JsonObject.CanTreatAsJson().ContinueWith((canTreatAsJsonTask) => { this.SetCanExecute(canTreatAsJsonTask.Result); }); }
/// <summary> /// Required method for Designer support - do not modify /// the contents of this method with the code editor. /// </summary> private void InitializeComponent() { this._btnCancel = new System.Windows.Forms.Button(); this._btnSend = new System.Windows.Forms.Button(); this._resourceTreeView = new JetBrains.UI.Components.CustomTreeView.CustomTreeView(); this.SuspendLayout(); // // _btnCancel // this._btnCancel.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right))); this._btnCancel.DialogResult = System.Windows.Forms.DialogResult.Cancel; this._btnCancel.FlatStyle = System.Windows.Forms.FlatStyle.System; this._btnCancel.Location = new System.Drawing.Point(352, 304); this._btnCancel.Name = "_btnCancel"; this._btnCancel.Size = new System.Drawing.Size(75, 27); this._btnCancel.TabIndex = 7; this._btnCancel.Text = "Cancel"; // // _btnSend // this._btnSend.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right))); this._btnSend.DialogResult = System.Windows.Forms.DialogResult.OK; this._btnSend.FlatStyle = System.Windows.Forms.FlatStyle.System; this._btnSend.Location = new System.Drawing.Point(268, 304); this._btnSend.Name = "_btnSend"; this._btnSend.Size = new System.Drawing.Size(75, 27); this._btnSend.TabIndex = 6; this._btnSend.Text = "Receive"; // // _resourceTreeView // this._resourceTreeView.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) | System.Windows.Forms.AnchorStyles.Left) | System.Windows.Forms.AnchorStyles.Right))); this._resourceTreeView.ImageIndex = -1; this._resourceTreeView.Location = new System.Drawing.Point(8, 8); this._resourceTreeView.Name = "_resourceTreeView"; this._resourceTreeView.NodePainter = null; this._resourceTreeView.SelectedImageIndex = -1; this._resourceTreeView.Size = new System.Drawing.Size(420, 288); this._resourceTreeView.TabIndex = 8; this._resourceTreeView.ThreeStateCheckboxes = false; // // ReceiveResourcesDialog // this.AcceptButton = this._btnSend; this.AutoScaleBaseSize = new System.Drawing.Size(5, 14); this.CancelButton = this._btnCancel; this.ClientSize = new System.Drawing.Size(440, 342); this.Controls.Add(this._resourceTreeView); this.Controls.Add(this._btnCancel); this.Controls.Add(this._btnSend); this.Name = "ReceiveResourcesDialog"; this.Text = "Receive Resources"; this.ResumeLayout(false); }
internal void SetTreeItemsSource(CustomTreeView tree) { if (_viewChildren == null) { _viewChildren = TreeViewDataFactory.CreateCollection(tree, this); } FileLogger.Assert(_viewChildren != null); FileLogger.Assert(_viewChildren.Count == 0 || _viewChildren[0].Tree == tree); tree.ItemsSource = _viewChildren; this.ApplyExpandRule(tree); }
private void CustomTreeView_SelectedItemsChanged(object sender, RoutedEventArgs e) { CustomTreeView tv = sender as CustomTreeView; label.Text = string.Empty; tv.SelectedItems.ForEach(r => { CustomTreeViewItem item = r as CustomTreeViewItem; if (item != null) { label.Text += item.Header + ";"; } }); }
void MakeTree() { var m_Root = new TreeViewItem { id = 0, depth = -1, displayName = "Root" }; int iStart = Page * PageShowCount; for (int i = 0; i < PageShowCount; i++) { var ind = iStart + i; if (ind >= LuaRes.Count) { break; } var res = LuaRes[ind]; var child = new CustomTreeViewItem(i, ind, res); m_Root.AddChild(child); } m_TreeView = CustomTreeView.Create(m_Root); }
internal void ApplyExpandRule(CustomTreeView tree) { if (_expandByRules == null) { _expandByRules = new SingularAction(tree.Dispatcher); } FileLogger.Assert(_expandByRules.Dispatcher == tree.Dispatcher); bool expandedSomething = false; _expandByRules.BeginInvoke( System.Windows.Threading.DispatcherPriority.Background, async(actionId, action) => { foreach (JsonObject jsonObj in this.AllChildren) { int?depth = jsonObj.Rules.ExpandChildren; if (depth.HasValue) { tree.ExpandToItem(jsonObj.ViewObject); tree.ExpandSubtree(jsonObj.ViewObject, depth.Value); expandedSomething = true; } if (!await action.YieldAndContinue(actionId)) { return(false); } } if (!expandedSomething) { tree.ExpandAll(this.ExpandLevelWithLessThanCount(50)); } return(true); }); }
/// <summary> /// Required method for Designer support - do not modify /// the contents of this method with the code editor. /// </summary> private void InitializeComponent() { this._btnCancel = new System.Windows.Forms.Button(); this._btnSend = new System.Windows.Forms.Button(); this._resourceTreeView = new JetBrains.UI.Components.CustomTreeView.CustomTreeView(); this.label1 = new System.Windows.Forms.Label(); this._fileLength = new System.Windows.Forms.TextBox(); this.SuspendLayout(); // // _btnCancel // this._btnCancel.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right))); this._btnCancel.DialogResult = System.Windows.Forms.DialogResult.Cancel; this._btnCancel.FlatStyle = System.Windows.Forms.FlatStyle.System; this._btnCancel.Location = new System.Drawing.Point(352, 304); this._btnCancel.Name = "_btnCancel"; this._btnCancel.Size = new System.Drawing.Size(75, 27); this._btnCancel.TabIndex = 3; this._btnCancel.Text = "Cancel"; // // _btnSend // this._btnSend.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right))); this._btnSend.DialogResult = System.Windows.Forms.DialogResult.OK; this._btnSend.FlatStyle = System.Windows.Forms.FlatStyle.System; this._btnSend.Location = new System.Drawing.Point(268, 304); this._btnSend.Name = "_btnSend"; this._btnSend.Size = new System.Drawing.Size(75, 27); this._btnSend.TabIndex = 2; this._btnSend.Text = "Create Email"; // // _resourceTreeView // this._resourceTreeView.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) | System.Windows.Forms.AnchorStyles.Left) | System.Windows.Forms.AnchorStyles.Right))); this._resourceTreeView.ImageIndex = -1; this._resourceTreeView.Location = new System.Drawing.Point(8, 8); this._resourceTreeView.Name = "_resourceTreeView"; this._resourceTreeView.NodePainter = null; this._resourceTreeView.SelectedImageIndex = -1; this._resourceTreeView.Size = new System.Drawing.Size(420, 288); this._resourceTreeView.TabIndex = 0; this._resourceTreeView.ThreeStateCheckboxes = false; // // label1 // this.label1.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left))); this.label1.FlatStyle = System.Windows.Forms.FlatStyle.System; this.label1.Location = new System.Drawing.Point(12, 312); this.label1.Name = "label1"; this.label1.Size = new System.Drawing.Size(72, 16); this.label1.TabIndex = 8; this.label1.Text = "Size in bytes:"; // // _fileLength // this._fileLength.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left))); this._fileLength.Location = new System.Drawing.Point(96, 308); this._fileLength.Name = "_fileLength"; this._fileLength.TabIndex = 1; this._fileLength.Text = ""; // // SendResourcesDialog // this.AcceptButton = this._btnSend; this.AutoScaleBaseSize = new System.Drawing.Size(5, 14); this.CancelButton = this._btnCancel; this.ClientSize = new System.Drawing.Size(440, 342); this.Controls.Add(this._resourceTreeView); this.Controls.Add(this._fileLength); this.Controls.Add(this.label1); this.Controls.Add(this._btnCancel); this.Controls.Add(this._btnSend); this.Name = "SendResourcesDialog"; this.Text = "Send Resources"; this.ResumeLayout(false); }
/// <summary> /// carica il treeview dopo una ricerca /// </summary> /// <param name="idrecord"></param> /// <param name="idparent"></param> /// <param name="livello"></param> public static CustomTreeView LoadTreeViewRicerca(CustomTreeView _TreeView, string _IdAmministrazione, string _IdRecord, string _IdParent, int _Livello, string _IdGruppo, string _IdRegistro, string _IdTitolario, string _descrizione) { try { _Livello++; string xmlStream = docsPaWS.findNodoRoot(_IdRecord, _IdParent, _Livello); XmlDocument doc = new XmlDocument(); doc.LoadXml(xmlStream); myTreeNode TreeNodo = (myTreeNode)_TreeView.Nodes[0]; XmlNode lista = doc.SelectSingleNode("NewDataSet"); if (lista.ChildNodes.Count > 0) { int indiceCiclo = 1; for (int n = 2; n <= _Livello; n++) { XmlNode liv = doc.SelectSingleNode(".//livello[text()='" + n.ToString() + "']"); XmlNode root = liv.ParentNode; string idparent = root.ChildNodes.Item(0).InnerText; string id = root.ChildNodes.Item(2).InnerText; if (findNode(idparent, TreeNodo.ChildNodes) != null) { TreeNodo = findNode(idparent, TreeNodo.ChildNodes); } //else // TreeNodo = selectNode(idparent, TreeNodo.ChildNodes); TreeNodo.Expanded = true; TreeNodo.ChildNodes.Clear(); indiceCiclo++; string xmlStream1 = UIManager.ClassificationSchemeManager.getNodeTitolario(_IdAmministrazione, idparent, _IdGruppo, _IdRegistro, _IdTitolario); myTreeNode nodoT; myTreeNode nodoFiglio; XmlDocument doc1 = new XmlDocument(); doc1.LoadXml(xmlStream1); XmlNode lista1 = doc1.SelectSingleNode("NewDataSet"); if (lista1.ChildNodes.Count > 0) { foreach (XmlNode nodo in lista1.ChildNodes) { nodoT = new myTreeNode(); nodoT.ID = nodo.SelectSingleNode("CODICE").InnerText; nodoT.Text = nodo.SelectSingleNode("CODICE").InnerText + " - " + nodo.SelectSingleNode("DESCRIZIONE").InnerText; nodoT.IDRECORD = nodo.SelectSingleNode("IDRECORD").InnerText; nodoT.PARENT = nodo.SelectSingleNode("IDPARENT").InnerText; nodoT.CODLIV = nodo.SelectSingleNode("CODLIV").InnerText; nodoT.CODICE = nodo.SelectSingleNode("CODICE").InnerText; nodoT.DESCRIZIONE = nodo.SelectSingleNode("DESCRIZIONE").InnerText; nodoT.LIVELLO = nodo.SelectSingleNode("LIVELLO").InnerText; nodoT.NUMMESICONSERVAZIONE = nodo.SelectSingleNode("NUMMESICONSERVAZIONE").InnerText; nodoT.Expanded = false; XmlNode nodoReg = nodo.SelectSingleNode("REGISTRO"); if (nodoReg != null) { nodoT.REGISTRO = nodo.SelectSingleNode("REGISTRO").InnerText; } TreeNodo.ChildNodes.Add(nodoT); if (Convert.ToInt32(nodo.SelectSingleNode("FIGLIO").InnerText) > 0) { nodoFiglio = new myTreeNode(); nodoFiglio.Expanded = true; nodoT.ChildNodes.Add(nodoFiglio); } } } } } } catch (System.Exception ex) { UIManager.AdministrationManager.DiagnosticError(ex); return(null); } return(_TreeView); }
/// <summary> /// funzione che consente il caricamento iniziale del treeview del titolario /// </summary> /// <param name="nodoxml"></param> public static CustomTreeView loadTreeView(CustomTreeView TreeTitolario, string _IdAmministrazione, string _IdParent, string _IdGruppo, string _IdRegistro, string _IdTitolario) { try { string nodoxml = UIManager.ClassificationSchemeManager.getNodeTitolario(_IdAmministrazione, _IdParent, _IdGruppo, _IdRegistro, _IdTitolario); if (TreeTitolario.Nodes.Count == 0) { TreeTitolario.Nodes.Clear(); } myTreeNode nodoT; XmlDocument doc = new XmlDocument(); doc.LoadXml(nodoxml); XmlNode lista = doc.SelectSingleNode("NewDataSet"); if (lista.ChildNodes.Count > 0) { foreach (XmlNode nodo in lista.ChildNodes) { nodoT = new myTreeNode(); nodoT.ID = nodo.SelectSingleNode("CODICE").InnerText; switch (nodo.SelectSingleNode("STATO").InnerText) { case "A": string active = Utils.Languages.GetLabelFromCode("ClassificationSchemeManagerActive", UIManager.UserManager.GetUserLanguage()); nodoT.Text = nodo.SelectSingleNode("DESCRIZIONE").InnerText + " " + active; break; case "C": DateTime dataAttivazione = Convert.ToDateTime(nodo.SelectSingleNode("DATA_ATTIVAZIONE").InnerText); DateTime dataCessazione = Convert.ToDateTime(nodo.SelectSingleNode("DATA_CESSAZIONE").InnerText); nodoT.Text = nodo.SelectSingleNode("DESCRIZIONE").InnerText + " in vigore dal " + dataAttivazione.ToString("dd/MM/yyyy") + " al " + dataCessazione.ToString("dd/MM/yyyy"); break; } nodoT.IDRECORD = nodo.SelectSingleNode("IDRECORD").InnerText; nodoT.PARENT = nodo.SelectSingleNode("IDPARENT").InnerText; nodoT.CODLIV = nodo.SelectSingleNode("CODLIV").InnerText; nodoT.CODICE = nodo.SelectSingleNode("CODICE").InnerText; nodoT.DESCRIZIONE = nodo.SelectSingleNode("DESCRIZIONE").InnerText; nodoT.LIVELLO = nodo.SelectSingleNode("LIVELLO").InnerText; if (nodo.SelectSingleNode("NUMMESICONSERVAZIONE") != null) { nodoT.NUMMESICONSERVAZIONE = nodo.SelectSingleNode("NUMMESICONSERVAZIONE").InnerText; } else { nodoT.NUMMESICONSERVAZIONE = "0"; } XmlNode nodoReg = nodo.SelectSingleNode("REGISTRO"); if (nodoReg != null) { nodoT.REGISTRO = nodo.SelectSingleNode("REGISTRO").InnerText; } TreeTitolario.Nodes.Add(nodoT); if (Convert.ToInt32(nodo.SelectSingleNode("FIGLIO").InnerText) > 0) { nodoT.Expanded = true; } } } } catch (System.Exception ex) { UIManager.AdministrationManager.DiagnosticError(ex); return(null); } return(TreeTitolario); }
public TreatAsTextCommand(CustomTreeView tree, TreeViewData data) : base(data, "Treat as text", data.JsonObject.CanTreatAsText) { _tree = tree; }