void RemoveRow(dsTree.TreeRow row) { var rows = dtTree.Where(r => r.ParentID == row.ID).Select(r => r).ToArray(); rows.ForEach(r => RemoveRow(r)); dtTree.RemoveTreeRow(row); }
private void uxWhere_EditValueChanged(object sender, EventArgs e) { dsTree.TreeRow row = treeTable.FindByID((int)uxWhere.EditValue); uxWhere.Properties.ContextImage = imageCollection1.Images[row.ImageID]; uxWhere.Properties.Buttons[1].Enabled = row.ParentID != 0 - 1; Filter(); }
private void uxTree_ShowingEditor(object sender, CancelEventArgs e) { dsTree.TreeRow row = (uxTree.GetDataRecordByNode(uxTree.FocusedNode) as DataRowView).Row as dsTree.TreeRow; if (row.ReadOnly || row.ParentID == 1) { e.Cancel = true; } }
private void uxWhere_ButtonClick(object sender, ButtonPressedEventArgs e) { if (e.Button.Index == 1) { dsTree.TreeRow row = treeTable.FindByID((int)uxWhere.EditValue); row = treeTable.FindByID(row.ParentID); if (row != null) { uxWhere.EditValue = row.ID; } } }
private void cmdOpenFile_ItemClick(object sender, ItemClickEventArgs e) { dsTree.TreeRow row = (uxWhere.Properties.TreeList.GetDataRecordByNode(uxWhere.Properties.TreeList.FocusedNode) as DataRowView).Row as dsTree.TreeRow; LibraryGroup group = row.Data as LibraryGroup; LibraryFile file = row.Data as LibraryFile; if (file != null) { OpenPresentation(file.FullPath); } }
private void uxTree_CellValueChanged(object sender, CellValueChangedEventArgs e) { dsTree.TreeRow row = (uxTree.GetDataRecordByNode(uxTree.FocusedNode) as DataRowView).Row as dsTree.TreeRow; if (row.Data is IFile file) { string newName = Path.ChangeExtension(e.Value as string, "pptx"); file.Rename(newName); } else if (row.Data is IGroup group) { string newName = e.Value as string; group.Rename(newName); } }
void uxTree_DoubleClick(object sender, EventArgs e) { DevExpress.XtraTreeList.TreeListHitInfo hi = uxTree.CalcHitInfo(uxTree.PointToClient(Control.MousePosition)); if (hi.Node != null) { if (hi.Node.Level == 2) { dsTree.TreeRow row = (uxTree.GetDataRecordByNode(hi.Node) as DataRowView).Row as dsTree.TreeRow; if (FileSelected != null) { FileSelected(this, new EventArgs()); } } } }
private void uxWhere_EditValueChanging(object sender, ChangingEventArgs e) { dsTree.TreeRow row = treeTable.FindByID((int)e.NewValue); if (row.ParentID != -1 && row.Data.Equals(System.DBNull.Value)) { if (ConfigureShared()) { uxWhere.Refresh(); } else { e.Cancel = true; } } }
private void Filter() { uxWhat.Properties.Buttons[(int)WhatButtons.Search].Enabled = false; Regex regEx = new Regex(uxWhat.Tag == null ? uxWhat.Text : "", RegexOptions.IgnoreCase); dsTree.TreeRow row = treeTable.FindByID((int)uxWhere.EditValue); var list = LibraryData.GetAllItems(); int n = list.Count(); if (row.ParentID == -1) { list = list.Where(item => regEx.IsMatch(item.Keywords) ); } else if (row.Data is LibraryFile) { LibraryFile file = row.Data as LibraryFile; list = list.Where(item => item.File.Group.Name == file.Group.Name && item.File.Name == file.Name && regEx.IsMatch(item.Keywords) ); } else { LibraryGroup group = row.Data as LibraryGroup; if (group != null) { list = list.Where(item => item.File.Group.FullPath == group.FullPath && regEx.IsMatch(item.Keywords) ); } else { list = Enumerable.Empty <IFileItem>(); } } uxImagesView.DataSource = list.ToList(); }
protected void InitializeTreeControl() { uxWhere.Properties.TreeList.KeyFieldName = "ID"; uxWhere.Properties.TreeList.ParentFieldName = "ParentID"; uxWhere.Properties.TreeList.ImageIndexFieldName = "ImageID"; // uxWhere.Properties.DataSource = storage.TreeTable.DefaultView; //uxWhere.Properties.DisplayMember = "Name"; uxWhere.Properties.ValueMember = "ID"; dsTree.TreeRow rowRoot = treeTable[0]; uxWhere.EditValue = rowRoot.ID; uxWhere.Properties.ContextImage = imageCollection1.Images[rowRoot.ImageID]; int cnt = Math.Min(20, treeTable.DefaultView.Count); Size sz = uxWhere.Properties.PopupFormSize; sz.Height = cnt * 28; uxWhere.Properties.PopupFormSize = sz; }
private void barManager_QueryShowPopupMenu(object sender, DevExpress.XtraBars.QueryShowPopupMenuEventArgs e) { if (e.Menu == pmList) { e.Cancel = uxImagesView.SelectedItem == null; } else if (e.Menu == pmTree) { int treeLevel = 0; dsTree.TreeRow row = null; if (uxWhere.Properties.TreeList.Selection.Count > 0) { TreeListNode node = uxWhere.Properties.TreeList.Selection[0]; treeLevel = node.Level; row = (uxWhere.Properties.TreeList.GetDataRecordByNode(node) as DataRowView).Row as dsTree.TreeRow; } else { row = treeTable.FindByID((int)uxWhere.EditValue); if (row.ParentID == -1) { treeLevel = 0; } else if (row.ParentID == 1) { treeLevel = 1; } else { treeLevel = 2; } } if (treeLevel == 0) { cmdManage.Visibility = BarItemVisibility.Always; cmdOpenFolder.Visibility = cmdOpenFile.Visibility = cmdChangeFolder.Visibility = BarItemVisibility.Never; } else if (treeLevel == 1) { bool shared = row == treeBuilder.RowShared; bool configured = !row.Data.Equals(System.DBNull.Value); cmdOpenFolder.Visibility = configured ? BarItemVisibility.Always : BarItemVisibility.Never; cmdManage.Visibility = cmdOpenFile.Visibility = BarItemVisibility.Never; cmdChangeFolder.Visibility = shared ? BarItemVisibility.Always : BarItemVisibility.Never; } else if (treeLevel == 2) { cmdOpenFolder.Visibility = cmdOpenFile.Visibility = BarItemVisibility.Always; cmdManage.Visibility = cmdChangeFolder.Visibility = BarItemVisibility.Never; } } }