private static void buildTree(TreeViewObject currentTree, List <Application> dt) { if (currentTree != null && currentTree.application.AppFuncID != 0) { currentTree.items = new List <TreeViewObject>(); var results = (from h in dt where h.PAppFuncID == currentTree.application.AppFuncID select h); foreach (var item in results) { Application application = new Application(); application.AppFunctions = item.AppFunctions; application.Badge = item.Badge; application.IsLongTile = item.IsLongTile; application.AppFuncID = item.AppFuncID; application.IconPath = item.IconPath; application.LandingPageURL = item.LandingPageURL; application.PAppFuncID = item.PAppFuncID; application.Idx = item.Idx; application.AppTitle = item.AppTitle.Replace("|n|", ""); application.AppDesc = item.AppDesc; application.ColorSchema = item.ColorSchema; application.Colors = string.IsNullOrEmpty(item.ColorSchema) ? null : item.ColorSchema.Split(';'); application.NotDisplayed = item.NotDisplayed; application.FuncType = item.FuncType; application.IsShow = item.IsShow; var tree = new TreeViewObject() { application = application }; buildTree(tree, dt); currentTree.items.Add(tree); } } }
private List <TreeViewObject> buildTreeApplication(List <Application> application, string userName, long?Role) { CacheUser cacheUser = LVCacheHelper.GetCacheUser(userName); if (cacheUser == null) { return(null); } int indexs = 1; var roleList = cacheUser.roleList.Where(x => x.RoleID == Role).FirstOrDefault();; if (roleList != null) { foreach (var item in application) { foreach (var app in roleList.application) { item.IsShow = app.AppFuncID == item.AppFuncID ? true : false; if (item.IsShow == true) { break; } } } } var parent = application.Where(x => x.PAppFuncID == null).ToList(); List <TreeViewObject> treeParent = new List <TreeViewObject>(); foreach (var item in parent) { Application applications = new Application(); applications.AppFunctions = item.AppFunctions; applications.Badge = item.Badge; applications.IsLongTile = item.IsLongTile; applications.AppFuncID = item.AppFuncID; applications.IconPath = item.IconPath; applications.LandingPageURL = item.LandingPageURL; applications.PAppFuncID = item.PAppFuncID; applications.Idx = item.Idx; applications.AppTitle = item.AppTitle.Replace("|n|", ""); applications.AppDesc = item.AppDesc; applications.ColorSchema = item.ColorSchema; applications.Colors = string.IsNullOrEmpty(item.ColorSchema) ? null : item.ColorSchema.Split(';'); applications.NotDisplayed = item.NotDisplayed; applications.FuncType = item.FuncType; var trs = new TreeViewObject() { application = applications }; buildTree(trs, application); trs.dataindex = indexs; treeParent.Add(trs); indexs++; } return(treeParent); }
private void DeleteObject(TreeViewObject treeViewObject) { if (_MainView.ConfirmMessage("delete " + treeViewObject.GetName(), "Are you sure you want to delete " + treeViewObject.GetName() + "?")) { treeViewObject.DeleteTreeViewObject(); if (treeViewObject is Procescell) { Procescell cell = treeViewObject as Procescell; Procescells.Remove(cell); } } }
public void Store() { ImagesKey = new Dictionary <string, Image>(); for (int i = 0; i < treeView.Images.Count; i++) { var key = treeView.Images.Keys[i]; Image image = treeView.Images[i]; if (!ImagesKey.Keys.Contains(key)) { ImagesKey.Add(key, image); } } RootObject = treeView.RootObject; }
private void DeleteClick(TreeViewObject obj) { if (_View.ConfirmMessage("delete " + obj.GetName(), "Are you sure you want to delete " + obj.GetName() + "?")) { try { if (obj != null) { obj.DeleteTreeViewObject(); } } catch (NotImplementedException e) { e.ToString(); _View.ShowMessage("This functionality has not been implemented yet."); } } }