コード例 #1
0
ファイル: MainListHelperVM.cs プロジェクト: RickDB/jmmclient
        public void ShowAllGroups()
        {
            try
            {
                CurrentWrapper        = null;
                CurrentWrapperIsGroup = true;
                BreadCrumbs.Clear();
                BreadCrumbs.Add(null);
                CurrentWrapperList.Clear();


                foreach (GroupFilterVM grpFilter in AllGroupFiltersDictionary.Values)
                {
                    //if (grpFilter.FilterConditions.Count == 0)
                    //	AllGroupFilter = grpFilter;
                    if (!grpFilter.GroupFilterParentId.HasValue)
                    {
                        CurrentWrapperList.Add(grpFilter);
                    }
                }
                ShowChildWrappers(AllGroupFilter);
            }
            catch (Exception ex)
            {
                Utils.ShowErrorMessage(ex);
            }
        }
コード例 #2
0
ファイル: MainListHelperVM.cs プロジェクト: ewelike23/jmm
        public void ShowAllGroups()
        {
            try
            {
                CurrentWrapper        = null;
                CurrentWrapperIsGroup = true;
                BreadCrumbs.Clear();
                BreadCrumbs.Add(null);
                CurrentWrapperList.Clear();


                AllGroupFilters.Clear();
                foreach (GroupFilterVM grpFilter in GroupFilterHelper.AllGroupFilters)
                {
                    //if (grpFilter.FilterConditions.Count == 0)
                    //	AllGroupFilter = grpFilter;
                    AllGroupFilters.Add(grpFilter);
                    CurrentWrapperList.Add(grpFilter);
                }
                ShowChildWrappers(AllGroupFilter);
            }
            catch (Exception ex)
            {
                Utils.ShowErrorMessage(ex);
            }
        }
コード例 #3
0
        private void UpdateBreadkCrumbs()
        {
            BreadCrumbs.Clear();
            var breakCrumbs = ConvertToBreadCrumbs(_nodeHistoryState);

            foreach (var breadCrumbViewmodel in breakCrumbs)
            {
                BreadCrumbs.Add(breadCrumbViewmodel);
            }
        }
コード例 #4
0
        //[LogExecutionTime]
        public void ShowChildWrappers(IListWrapper wrapper)
        {
            try
            {
                CurrentWrapper            = wrapper;
                CurrentWrapperIsGroup     = wrapper is VM_GroupFilter;
                CurrentListWrapperIsGroup = wrapper is VM_AnimeGroup_User;

                if (wrapper is VM_AnimeGroup_User)
                {
                    //LastAnimeGroupID = ((VM_AnimeGroup_User)wrapper).AnimeGroupID.Value;
                    Instance.CurrentOpenGroupFilter = "VM_AnimeGroup_User|" + ((VM_AnimeGroup_User)wrapper).AnimeGroupID;
                }
                if (wrapper is VM_GroupFilter)
                {
                    CurrentGroupFilter = (VM_GroupFilter)wrapper;
                    //LastGroupFilterID = ((GroupFilterVM)wrapper).GroupFilterID.Value;

                    Instance.CurrentOpenGroupFilter = "GroupFilterVM|" + ((VM_GroupFilter)wrapper).GroupFilterID;
                }
                if (wrapper is VM_AnimeSeries_User)
                {
                    CurrentSeries = (VM_AnimeSeries_User)wrapper;
                    //LastAnimeSeriesID = ((VM_AnimeSeries_User)wrapper).AnimeSeriesID.Value;

                    Instance.CurrentOpenGroupFilter = "NoGroup";
                }

                if (wrapper == null)
                {
                    Instance.CurrentOpenGroupFilter = "Init";
                }


                Application.Current.Dispatcher.Invoke(DispatcherPriority.Normal, (Action) delegate
                {
                    // update wrappers
                    // check where this wrapper sits in the heirarchy and remove anything below it
                    int pos = -1;



                    if (wrapper != null)
                    {
                        for (int i = 0; i < BreadCrumbs.Count; i++)
                        {
                            if (BreadCrumbs[i] == null)
                            {
                                continue;
                            }
                            if (wrapper is VM_GroupFilter && BreadCrumbs[i] is VM_GroupFilter)
                            {
                                VM_GroupFilter wrapObj = (VM_GroupFilter)wrapper;
                                VM_GroupFilter bcObj   = (VM_GroupFilter)BreadCrumbs[i];
                                if (wrapObj.GroupFilterName == bcObj.GroupFilterName)
                                {
                                    pos = i;
                                }
                            }
                            else if (wrapper is VM_AnimeGroup_User && BreadCrumbs[i] is VM_AnimeGroup_User)
                            {
                                VM_AnimeGroup_User wrapObj = (VM_AnimeGroup_User)wrapper;
                                VM_AnimeGroup_User bcObj   = (VM_AnimeGroup_User)BreadCrumbs[i];
                                if (wrapObj.AnimeGroupID == bcObj.AnimeGroupID)
                                {
                                    pos = i;
                                }
                            }
                            else if (wrapper is VM_AnimeSeries_User && BreadCrumbs[i] is VM_AnimeSeries_User)
                            {
                                VM_AnimeSeries_User wrapObj = (VM_AnimeSeries_User)wrapper;
                                VM_AnimeSeries_User bcObj   = (VM_AnimeSeries_User)BreadCrumbs[i];
                                if (wrapObj.AnimeSeriesID == bcObj.AnimeSeriesID)
                                {
                                    pos = i;
                                }
                            }
                            else if (wrapper is VM_AnimeEpisodeType && BreadCrumbs[i] is VM_AnimeEpisodeType)
                            {
                                VM_AnimeEpisodeType wrapObj = (VM_AnimeEpisodeType)wrapper;
                                VM_AnimeEpisodeType bcObj   = (VM_AnimeEpisodeType)BreadCrumbs[i];
                                if (wrapObj.EpisodeTypeDescription == bcObj.EpisodeTypeDescription)
                                {
                                    pos = i;
                                }
                            }
                            else if (wrapper is VM_AnimeEpisode_User && BreadCrumbs[i] is VM_AnimeEpisode_User)
                            {
                                VM_AnimeEpisode_User wrapObj = (VM_AnimeEpisode_User)wrapper;
                                VM_AnimeEpisode_User bcObj   = (VM_AnimeEpisode_User)BreadCrumbs[i];
                                if (wrapObj.AnimeEpisodeID == bcObj.AnimeEpisodeID)
                                {
                                    pos = i;
                                }
                            }
                        }
                    }
                    else
                    {
                        pos = 0;
                    }

                    if (pos > 0)
                    {
                        for (int i = BreadCrumbs.Count - 1; i >= 0; i--)
                        {
                            if (i >= pos)
                            {
                                BreadCrumbs.RemoveAt(i);
                            }
                        }
                    }
                    else if (pos == 0)
                    {
                        BreadCrumbs.Clear();
                    }


                    BreadCrumbs.Add(wrapper);

                    if (wrapper is VM_GroupFilter)
                    {
                        if (AllGroupsDictionary.Count == 0)
                        {
                            RefreshGroupsSeriesData();
                        }

                        // apply sorting
                        // get default sorting from the group filter
                    }


                    // means we are at the top level
                    if (wrapper == null)
                    {
                        CurrentWrapperList.Clear();
                        foreach (VM_GroupFilter grpFilter in AllGroupFiltersDictionary.Values
                                 .Where(a => a != null && !a.ParentGroupFilterID.HasValue).OrderBy(a => a.GroupFilterName))
                        {
                            CurrentWrapperList.Add(grpFilter);
                        }
                    }
                    else
                    {
                        CurrentWrapperList.Clear();
                        foreach (IListWrapper wp in wrapper.GetDirectChildren())
                        {
                            CurrentWrapperList.Add(wp);
                        }
                    }

                    SetGroupFilterSortingOnMainList();
                    ViewGroups.Refresh();

                    //new FilterMainListBox(ViewGroups, SearchTextBox, CurrentGroupFilter);
                });
            }
            catch (Exception ex)
            {
                Utils.ShowErrorMessage(ex);
            }
        }