Esempio n. 1
0
 void Selected_Parent(Ad_TreeViewItem obj)
 {
     try
     {
         Ad_TreeViewItem Ad_Parent = obj.Ad_Parent;
         if (Ad_Parent != null)
         {
             bool isAllChecked = true;
             foreach (var item in Ad_Parent.Ad_Children)
             {
                 if (!item.Is_Checked)
                 {
                     isAllChecked = false;
                 }
             }
             if (isAllChecked)
             {
                 Ad_Parent.Is_Checked = true;
             }
         }
     }
     catch (Exception ex)
     {
         LogManage.WriteLog(this.GetType(), ex);
     }
     finally
     {
     }
 }
Esempio n. 2
0
 void UnCheck_Item_ByShare(Ad_TreeViewItem obj)
 {
     try
     {
         if (obj.ad == "cn")
         {
             Ad_ListViewItem ad_ListViewItem = obj.Ad_ListViewItem;
             if (ad_ListViewItem != null)
             {
                 if (Ad_ListViewCollection.Contains(ad_ListViewItem))
                 {
                     Ad_ListViewCollection.Remove(ad_ListViewItem);
                 }
             }
         }
         else
         {
             foreach (var item in obj.Ad_Children)
             {
                 UnCheck_Item_ByShare(item);
                 item.Is_Checked = false;
             }
         }
     }
     catch (Exception ex)
     {
         LogManage.WriteLog(this.GetType(), ex);
     }
     finally
     {
     }
 }
Esempio n. 3
0
        public void TreeChildInit(Ad_TreeViewItem ad_TreeViewItem)
        {
            try
            {
                if (string.IsNullOrEmpty(ad_TreeViewItem.path))
                {
                    return;
                }

                string dicParameters = SpaceHelper.GetParameters_Path(SpaceType, SpaceCodeEnterEntity.GetAd_Tree, ad_TreeViewItem.path);
                ModelManage.Space_Service.Function_Invoke(SpaceCodeEnterEntity.GetAd_Tree, dicParameters,
                                                          SpaceCodeEnterEntity.LoginUserName, SpaceCodeEnterEntity.WebLoginPassword,
                                                          SpaceCodeEnterEntity.UserDomain, new Action <Dictionary <string, object> >((dicResult) =>
                {
                    this.Dispatcher.BeginInvoke(new Action(() =>
                    {
                        string json = Convert.ToString(dicResult[SpaceCodeEnterEntity.Collection]);
                        List <Ad_TreeViewItem> adEntityList = JsonManage.JsonToEntity <Ad_TreeViewItem>(json, ',');
                        if (adEntityList.Count > 0)
                        {
                            ad_TreeViewItem.Ad_Children = new ObservableCollection <Ad_TreeViewItem>();
                            foreach (var item in adEntityList)
                            {
                                item.Style = Share_Item_Style;
                                //(this.Ad_Root as TreeViewItem).Items.Add(item);
                                ad_TreeViewItem.Ad_Children.Add(item);

                                string loginName = item.loginname;
                                if (!string.IsNullOrEmpty(loginName) && loginName.Contains("\\"))
                                {
                                    item.loginname = loginName.Substring(loginName.LastIndexOf("\\") + 1);
                                }

                                item.Ad_Parent = ad_TreeViewItem;
                                TreeChildInit(item);
                            }
                        }
                    }));
                }));
            }
            catch (Exception ex)
            {
                LogManage.WriteLog(this.GetType(), ex);
            }
            finally
            {
            }
        }
Esempio n. 4
0
        private void Check_CallBack(Ad_TreeViewItem obj)
        {
            try
            {
                this.Check_Item_ByShare(obj);

                this.Selected_Parent(obj);
            }
            catch (Exception ex)
            {
                LogManage.WriteLog(this.GetType(), ex);
            }
            finally
            {
            }
        }
Esempio n. 5
0
 void Cancel_Selected_Parent(Ad_TreeViewItem obj)
 {
     try
     {
         Ad_TreeViewItem Ad_Parent = obj.Ad_Parent;
         if (Ad_Parent != null)
         {
             Ad_Parent.Is_Checked = false;
         }
     }
     catch (Exception ex)
     {
         LogManage.WriteLog(this.GetType(), ex);
     }
     finally
     {
     }
 }
Esempio n. 6
0
        void Check_Item_ByShare(Ad_TreeViewItem obj)
        {
            try
            {
                if (obj.ad == "cn")
                {
                    if (obj.Ad_ListViewItem != null && Ad_ListViewCollection.Contains(obj.Ad_ListViewItem))
                    {
                        return;
                    }
                    else
                    {
                        Ad_ListViewItem item = new Ad_ListViewItem();
                        item.name      = obj.name;
                        item.path      = obj.path;
                        item.Style     = Ad_ListViewItem_Style;
                        item.loginname = obj.loginname;


                        obj.Ad_ListViewItem  = item;
                        item.Ad_TreeViewItem = obj;
                        Ad_ListViewCollection.Add(item);
                    }
                }
                else if (obj.ad == "ou")
                {
                    foreach (var item in obj.Ad_Children)
                    {
                        Check_Item_ByShare(item);
                        item.Is_Checked = true;
                    }
                }
            }
            catch (Exception ex)
            {
                LogManage.WriteLog(this.GetType(), ex);
            }
            finally
            {
            }
        }
Esempio n. 7
0
 private void Item_Cancel_CallBack(Ad_ListViewItem obj)
 {
     try
     {
         if (Ad_ListViewCollection.Contains(obj))
         {
             Ad_ListViewCollection.Remove(obj);
         }
         Ad_TreeViewItem ad_TreeViewItem = obj.Ad_TreeViewItem;
         if (ad_TreeViewItem != null)
         {
             ad_TreeViewItem.Is_Checked = false;
             this.Cancel_Selected_Parent(ad_TreeViewItem);
         }
     }
     catch (Exception ex)
     {
         LogManage.WriteLog(this.GetType(), ex);
     }
     finally
     {
     }
 }