Exemplo n.º 1
0
 /// <summary>
 ///
 /// </summary>
 /// <param name="groups"></param>
 public void InitData(Dictionary <string, string> groups)
 {
     foreach (var vv in groups.Where(e => e.Value == this.FullName))
     {
         TagGroupViewModel groupViewModel = new TagGroupViewModel()
         {
             Name = vv.Key, Database = Database
         };
         groupViewModel.Parent = this;
         this.Children.Add(groupViewModel);
     }
 }
Exemplo n.º 2
0
 /// <summary>
 ///
 /// </summary>
 /// <param name="groups"></param>
 public void InitData(List <Tuple <string, string, string> > groups)
 {
     foreach (var vv in groups.Where(e => e.Item3 == this.FullName))
     {
         string sname = vv.Item1;
         if (!string.IsNullOrEmpty(vv.Item3))
         {
             sname = sname.Substring(sname.IndexOf(vv.Item3) + vv.Item3.Length + 1);
         }
         TagGroupViewModel groupViewModel = new TagGroupViewModel()
         {
             mName = sname, Database = Database, mDescription = vv.Item2
         };
         groupViewModel.Parent = this;
         this.Children.Add(groupViewModel);
     }
 }
Exemplo n.º 3
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="parent"></param>
        /// <returns></returns>
        public bool AddGroup(string parent)
        {
            string chileName = GetNewGroupName();

            chileName = DevelopServiceHelper.Helper.AddTagGroup(this.Database, chileName, parent);
            if (!string.IsNullOrEmpty(chileName))
            {
                var vmm = new TagGroupViewModel()
                {
                    mName = chileName, Database = this.Database, Parent = this
                };
                this.Children.Add(vmm);

                if (!this.IsExpanded)
                {
                    this.IsExpanded = true;
                }
                vmm.IsSelected = true;
                vmm.IsEdit     = true;
            }
            return(true);
        }
Exemplo n.º 4
0
        ///// <summary>
        /////
        ///// </summary>
        //private void RemoveGroup()
        //{
        //    string sname = (mCurrentSelectTreeItem as TagGroupViewModel).FullName;
        //    if(DevelopServiceHelper.Helper.RemoveGroup(mDatabase,sname))
        //    {
        //        if((mCurrentSelectTreeItem as TagGroupViewModel).Parent!=null)
        //        {
        //            (mCurrentSelectTreeItem as TagGroupViewModel).Parent.Children.Remove((mCurrentSelectTreeItem as TagGroupViewModel));
        //            (mCurrentSelectTreeItem as TagGroupViewModel).Parent = null;
        //        }
        //    }
        //}

        /// <summary>
        ///
        /// </summary>
        private void QueryGroups()
        {
            Application.Current.Dispatcher.Invoke(() => {
                this.mRootTagGroupModel.Children.Clear();
            });

            var vv = DevelopServiceHelper.Helper.QueryTagGroups(this.mDatabase);

            if (vv != null)
            {
                foreach (var vvv in vv.Where(e => string.IsNullOrEmpty(e.Value)))
                {
                    Application.Current.Dispatcher.Invoke(() => {
                        TagGroupViewModel groupViewModel = new TagGroupViewModel()
                        {
                            mName = vvv.Key, Database = mDatabase
                        };
                        mRootTagGroupModel.Children.Add(groupViewModel);
                        groupViewModel.InitData(vv);
                    });
                }
            }
        }