Exemplo n.º 1
0
        /// <summary>
        ///
        /// </summary>
        private void ContinueQueryTags()
        {
            if (mIsBusy)
            {
                return;
            }

            mIsBusy = true;
            int count = 0;

            if (mTotalPageNumber < 0)
            {
                Application.Current.Dispatcher.Invoke(new Action(() => {
                    SelectGroupTags.Clear();
                }));

                //  var vtags = new System.Collections.ObjectModel.ObservableCollection<TagViewModel>();
                mCurrentPageIndex = 0;

                var vv = DevelopServiceHelper.Helper.QueryTagByGroup(this.GroupModel.Database, this.GroupModel.FullName, mCurrentPageIndex, out mTotalPageNumber, out count, mFilters);
                if (vv != null)
                {
                    foreach (var vvv in vv)
                    {
                        TagViewModel model = new TagViewModel(vvv.Value.Item1, vvv.Value.Item2);
                        Application.Current?.Dispatcher.Invoke(new Action(() => {
                            SelectGroupTags.Add(model);
                        }));
                    }
                }
                TagCount = count;
            }
            else
            {
                if (mTotalPageNumber > mCurrentPageIndex + 1)
                {
                    mCurrentPageIndex++;
                    int totalcount = 0;

                    var vv = DevelopServiceHelper.Helper.QueryTagByGroup(this.GroupModel.Database, this.GroupModel.FullName, mCurrentPageIndex, out totalcount, out count, mFilters);
                    if (vv != null)
                    {
                        foreach (var vvv in vv)
                        {
                            Application.Current?.Dispatcher.BeginInvoke(new Action(() =>
                            {
                                TagViewModel model = new TagViewModel(vvv.Value.Item1, vvv.Value.Item2);
                                SelectGroupTags.Add(model);
                            }));
                        }
                    }

                    TagCount = count;
                }
            }

            mIsBusy = false;
        }
Exemplo n.º 2
0
        ///// <summary>
        /////
        ///// </summary>
        //private void QueryTags()
        //{
        //    var vtags = new System.Collections.ObjectModel.ObservableCollection<TagViewModel>();
        //    var vv = DevelopServiceHelper.Helper.QueryTagByGroup(this.GroupModel.Database, this.GroupModel.FullName);
        //    if (vv != null)
        //    {
        //        foreach (var vvv in vv)
        //        {
        //            Application.Current.Dispatcher.BeginInvoke(new Action(() => {
        //                TagViewModel model = new TagViewModel(vvv.Value.Item1, vvv.Value.Item2);
        //                vtags.Add(model);
        //            }));
        //        }
        //    }
        //    SelectGroupTags = vtags;
        //}


        /// <summary>
        ///
        /// </summary>
        private void RemoveTag()
        {
            int icount = 0;

            if (CurrentSelectTag != null)
            {
                int ind = mSelectGroupTags.IndexOf(CurrentSelectTag);

                List <TagViewModel> ll = new List <TagViewModel>();

                foreach (var vv in grid.SelectedItems)
                {
                    ll.Add(vv as TagViewModel);
                }

                foreach (var vvv in ll)
                {
                    if (DevelopServiceHelper.Helper.Remove(GroupModel.Database, vvv.RealTagMode.Id))
                    {
                        SelectGroupTags.Remove(CurrentSelectTag);
                        icount++;
                    }
                }


                if (icount == 0)
                {
                    if (DevelopServiceHelper.Helper.Remove(GroupModel.Database, CurrentSelectTag.RealTagMode.Id))
                    {
                        SelectGroupTags.Remove(CurrentSelectTag);
                        icount++;
                    }
                }

                if (ind < mSelectGroupTags.Count)
                {
                    CurrentSelectTag = mSelectGroupTags[ind];
                }
                else
                {
                    CurrentSelectTag = mSelectGroupTags.Last();
                }

                //if (DevelopServiceHelper.Helper.Remove(GroupModel.Database, CurrentSelectTag.RealTagMode.Id))
                //{
                //    SelectGroupTags.Remove(CurrentSelectTag);
                //}
            }
            else
            {
                foreach (var vv in SelectedCells.Select(e => e.Item).Distinct().ToArray())
                {
                    var vvt = vv as TagViewModel;
                    if (DevelopServiceHelper.Helper.Remove(GroupModel.Database, vvt.RealTagMode.Id))
                    {
                        SelectGroupTags.Remove(vvt);
                        icount++;
                    }
                }
            }

            TagCount -= icount;
        }