コード例 #1
0
ファイル: Sorting.cs プロジェクト: UB-Mannheim/hbs
        protected virtual void OnSelectedSortOrderFunctionChanged(SortOrderFunction oldSelectedSortOrderFunction,
                                                                  SortOrderFunction newSelectedSortOrderFunction)
        {
            RaisePropertyChanged("SelectedSortOrderFunction", oldSelectedSortOrderFunction, newSelectedSortOrderFunction);
            //set preferred direction for specific order function
            //block search updates while setting direction
            blockUpdateSearchSorting = true;
            switch (newSelectedSortOrderFunction.EnumValue)
            {
            case SortOrder.relevance:
            case SortOrder.date:
                IsAscendingSelected  = false;
                IsDescendingSelected = true;
                break;

            case SortOrder.title:
            case SortOrder.author:
                IsAscendingSelected  = true;
                IsDescendingSelected = false;
                break;
            }
            blockUpdateSearchSorting = false;
            //update search
            UpdateSearchSorting(newSelectedSortOrderFunction.EnumValue, SelectedSortDirection);
        }
コード例 #2
0
ファイル: InfoShieldVM.cs プロジェクト: picibird/hbs
 private void UpdateShelfContentInfo(Page page, SortOrderFunction order, SortDirection direction)
 {
     Info.Text = null;
     Info.From = null;
     Info.To   = null;
     if (page.Hits.Count > 0)
     {
         if (order.EnumValue == SortOrder.relevance)
         {
             Info.Text = HBS.Search.SearchText;
         }
         else
         {
             //get first and last valid value
             var first = page.Hits.FirstOrDefault(hit => order.HasProperty(hit));
             var last  = page.Hits.LastOrDefault(hit => order.HasProperty(hit));
             //get string representatives
             var firstString = "";
             if (first != null)
             {
                 firstString = order.GetRepresentative(first);
             }
             var lastString = "";
             if (last != null)
             {
                 lastString = order.GetRepresentative(last);
             }
             //set info properties
             Info.From = firstString;
             Info.To   = lastString;
         }
     }
     IsInfoVisible = !string.IsNullOrEmpty(Info.From) || !string.IsNullOrEmpty(Info.To);
 }
コード例 #3
0
        public static SortOrderFunction GetSingleton(SortOrder order)
        {
            SortOrderFunction func = null;

            if (!SORT_ORDER_FUNCTION_SINGELTONS.TryGetValue(order, out func))
            {
                func = new SortOrderFunction(order);
                SORT_ORDER_FUNCTION_SINGELTONS.Add(order, func);
            }
            return(func);
        }