Beispiel #1
0
        public static IEnumerable <Goods> Sort(this IEnumerable <Goods> collection, SortModes sort)
        {
            switch (sort)
            {
            case SortModes.PriceMinToMax:
                return(collection.OrderBy(a => a.PriceTotal.ValueMin).ThenBy(a => a.StoreOrderCount));

            case SortModes.PriceMaxToMin:
                return(collection.OrderByDescending(a => a.PriceTotal.ValueMin).ThenByDescending(a => a.StoreOrderCount));

            case SortModes.MinToMaxPieces:
                return(collection.OrderBy(a => a.UnitPrice).ThenBy(a => a.PriceTotal.ValueMin));

            case SortModes.MaxToMinPieces:
                return(collection.OrderByDescending(a => a.UnitPrice).ThenBy(a => a.PriceTotal.ValueMin));

            case SortModes.SellerRatingMinToMax:
                return(collection.OrderBy(a => a.StoreRating).ThenBy(a => a.PriceTotal.ValueMin));

            case SortModes.SellerRatingMaxToMin:
                return(collection.OrderByDescending(a => a.StoreRating).ThenBy(a => a.PriceTotal.ValueMin));

            case SortModes.NumOrdersMinToMax:
                return(collection.OrderBy(a => a.StoreOrderCount).ThenBy(a => a.PriceTotal.ValueMin));

            case SortModes.NumOrdersMaxToMin:
                return(collection.OrderByDescending(a => a.StoreOrderCount).ThenBy(a => a.PriceTotal.ValueMin));
            }
            return(collection);
        }
Beispiel #2
0
 public Settings()
 {
     GridSize  = 10;
     BlockSize = 50;
     Speed     = 30;
     sortMode  = SortModes.Ascending;
     UseFlows  = true;
 }
Beispiel #3
0
 public void SetSortMode(SortModes mode, int forceDir = 0)
 {
     if (mode == SortMode)
     {
         SortDirection = (forceDir == 0) ? (SortDirection *= -1) : forceDir;
     }
     else
     {
         SortMode      = mode;
         SortDirection = (forceDir == 0) ? 1 : forceDir;
     }
 }
 public void SetSortMode(SortModes mode, int forceDir)
 {
     if (mode == SortMode)
     {
         SortDirection = forceDir == 0 ? SortDirection *= -1 : forceDir;
     }
     else
     {
         SortMode      = mode;
         SortDirection = forceDir == 0 ? 1 : forceDir;
     }
 }
Beispiel #5
0
        private void ReParentWindow()
        {
            EditorGUILayout.BeginVertical("box");
            {
                mode = (SortModes)EditorGUILayout.EnumPopup("Mode", mode);

                EditorGUILayout.Space(3);

                sortByIndex = EditorGUILayout.Toggle("Index affect sort", sortByIndex);

                DrawModes();

                EditorGUILayout.EndVertical();

                EditorGUILayout.Space(3);
            }
            EditorGUILayout.EndVertical();
        }
Beispiel #6
0
        public static string ToFriendlyString(this SortModes sortmode)
        {
            switch (sortmode)
            {
            case SortModes.DisplayNameAtoZ:
                return("Sort mod names alphabetically");

            case SortModes.DisplayNameZtoA:
                return("Sort mod names reverse-alphabetically");

            case SortModes.DownloadsDescending:
                return("Sort by downloads descending");

            case SortModes.DownloadsAscending:
                return("Sort by downloads ascending");

            case SortModes.RecentlyUpdated:
                return("Sort by recently updated");
            }
            return("Unknown Sort");
        }
Beispiel #7
0
        public static SortModes Next(this SortModes sortmode)
        {
            switch (sortmode)
            {
            case SortModes.DisplayNameAtoZ:
                return(SortModes.DisplayNameZtoA);

            case SortModes.DisplayNameZtoA:
                return(SortModes.DownloadsDescending);

            case SortModes.DownloadsDescending:
                return(SortModes.DownloadsAscending);

            case SortModes.DownloadsAscending:
                return(SortModes.RecentlyUpdated);

            case SortModes.RecentlyUpdated:
                return(SortModes.DisplayNameAtoZ);
            }
            return(SortModes.DisplayNameAtoZ);
        }
Beispiel #8
0
        private void GroupWindow()
        {
            EditorGUILayout.BeginVertical("box");
            {
                mode = (SortModes)EditorGUILayout.EnumPopup("Mode", mode);

                EditorGUILayout.Space(3);

                EditorGUILayout.LabelField("Group objects that start with");
                startWith = EditorGUILayout.TextArea(startWith);

                EditorGUILayout.Space(3);

                DrawModes();

                EditorGUILayout.EndVertical();

                EditorGUILayout.Space(3);
            }
            EditorGUILayout.EndVertical();
        }
        private void LoadOnDesignTime()
        {
            var credentialsList = new List <Credentials>()
            {
                new Credentials("name", "login", "password", "other")
                {
                    LastTimeUsage = DateTime.Now,
                    CreationTime  = DateTime.Today
                }
            };

            CurrentAccount = new Account()
            {
                Credentials = new CredentialsCollection(credentialsList)
            };
            AllAccountsCollectionView = new ListCollectionView(CurrentAccount.Credentials)
            {
                Filter = FilterAccountDatas
            };
            SelectedCredentials = credentialsList.First();
            CurrentSortMode     = SortModes.FirstOrDefault();
        }
 public void SetSortMode(SortModes mode)
 {
     SetSortMode(mode, 0);
 }
Beispiel #11
0
        public override void OnInitialize()
        {
            UIElement uIElement = new UIElement();

            uIElement.Width.Set(0f, 0.8f);
            uIElement.MaxWidth.Set(600f, 0f);
            uIElement.Top.Set(220f, 0f);
            uIElement.Height.Set(-220f, 1f);
            uIElement.HAlign = 0.5f;
            UIPanel uIPanel = new UIPanel();

            uIPanel.Width.Set(0f, 1f);
            uIPanel.Height.Set(-110f, 1f);
            uIPanel.BackgroundColor = new Color(33, 43, 79) * 0.8f;
            uIPanel.PaddingTop      = 0f;
            uIElement.Append(uIPanel);
            modListAll = new UIList();
            modList    = new UIList();
            modList.Width.Set(-25f, 1f);
            modList.Height.Set(-50f, 1f);
            modList.Top.Set(50f, 0f);
            modList.ListPadding = 5f;
            uIPanel.Append(modList);
            UIScrollbar uIScrollbar = new UIScrollbar();

            uIScrollbar.SetView(100f, 1000f);
            uIScrollbar.Height.Set(-50f, 1f);
            uIScrollbar.Top.Set(50f, 0f);
            uIScrollbar.HAlign = 1f;
            uIPanel.Append(uIScrollbar);
            modList.SetScrollbar(uIScrollbar);
            uITextPanel        = new UITextPanel <string>("Mod Browser", 0.8f, true);
            uITextPanel.HAlign = 0.5f;
            uITextPanel.Top.Set(-35f, 0f);
            uITextPanel.SetPadding(15f);
            uITextPanel.BackgroundColor = new Color(73, 94, 171);
            uIElement.Append(uITextPanel);
            reloadButton = new UITextPanel <string>("Loading...", 1f, false);
            reloadButton.Width.Set(-10f, 0.5f);
            reloadButton.Height.Set(25f, 0f);
            reloadButton.VAlign = 1f;
            reloadButton.Top.Set(-65f, 0f);
            reloadButton.OnMouseOver += UICommon.FadedMouseOver;
            reloadButton.OnMouseOut  += UICommon.FadedMouseOut;
            reloadButton.OnClick     += ReloadList;
            uIElement.Append(reloadButton);
            UITextPanel <string> backButton = new UITextPanel <string>("Back", 1f, false);

            backButton.Width.Set(-10f, 0.5f);
            backButton.Height.Set(25f, 0f);
            backButton.VAlign = 1f;
            backButton.Top.Set(-20f, 0f);
            backButton.OnMouseOver += UICommon.FadedMouseOver;
            backButton.OnMouseOut  += UICommon.FadedMouseOut;
            backButton.OnClick     += BackClick;
            uIElement.Append(backButton);
            base.Append(uIElement);
            UIElement uIElement2 = new UIElement();

            uIElement2.Width.Set(0f, 1f);
            uIElement2.Height.Set(32f, 0f);
            uIElement2.Top.Set(10f, 0f);
            Texture2D    texture = Texture2D.FromStream(Main.instance.GraphicsDevice, Assembly.GetExecutingAssembly().GetManifestResourceStream("Terraria.ModLoader.UI.UIModBrowserIcons.png"));
            UICycleImage uIToggleImage;

            for (int j = 0; j < 2; j++)
            {
                if (j == 0)
                {
                    uIToggleImage = new UICycleImage(texture, 5, 32, 32, 0, 0);
                    uIToggleImage.setCurrentState((int)sortMode);
                    uIToggleImage.OnClick += (a, b) =>
                    {
                        sortMode = sortMode.Next();
                        SortList();
                    };
                }
                else
                {
                    uIToggleImage = new UICycleImage(texture, 3, 32, 32, 34, 0);
                    uIToggleImage.setCurrentState((int)updateFilterMode);
                    uIToggleImage.OnClick += (a, b) =>
                    {
                        updateFilterMode = updateFilterMode.Next();
                        SortList();
                    };
                }
                uIToggleImage.Left.Set((float)(j * 36 + 8), 0f);
                _categoryButtons.Add(uIToggleImage);
                uIElement2.Append(uIToggleImage);
            }
            filterTextBox = new UIInputTextField("Type to search");
            filterTextBox.Top.Set(5, 0f);
            filterTextBox.Left.Set(-150, 1f);
            filterTextBox.OnTextChange += (sender, e) => SortList();
            uIElement2.Append(filterTextBox);
            UICycleImage SearchFilterToggle = new UICycleImage(texture, 2, 32, 32, 68, 0);

            SearchFilterToggle.setCurrentState((int)searchFilterMode);
            SearchFilterToggle.OnClick += (a, b) =>
            {
                searchFilterMode = searchFilterMode.Next();
                SortList();
            };
            SearchFilterToggle.Left.Set(545f, 0f);
            _categoryButtons.Add(SearchFilterToggle);
            uIElement2.Append(SearchFilterToggle);
            uIPanel.Append(uIElement2);

            PopulateModBrowser();
        }
Beispiel #12
0
 public QueryBuilder AddSortMode(SortMode sortMode)
 {
     SortModes.Add(sortMode);
     return(this);
 }
Beispiel #13
0
 public ProxyFilterQuery(ProxyFilter filter, Guid sessionGuid, SortModes sortMode)
 {
     _proxyFilter = filter;
     _sessionGuid = sessionGuid;
     _sortMode    = sortMode;
 }
Beispiel #14
0
 /// <summary>
 /// Initializes a new instance of a <see cref="OrderByField"/>.
 /// </summary>
 /// <param name="name">The Field Name</param>
 /// <param name="tableAlias">The Table Alias</param>
 /// <param name="sortMode">The Sorting Mode (Ascending or Descending)</param>
 public OrderByField(string name, string tableAlias, SortModes sortMode) : base(name)
 {
     TableAlias = tableAlias;
     SortMode   = sortMode;
 }
Beispiel #15
0
 /// <summary>
 /// Initializes a new instance of a <see cref="OrderByField"/>.
 /// </summary>
 /// <param name="name">The Field Name</param>
 /// <param name="sortMode">The Sorting Mode (Ascending or Descending)</param>
 public OrderByField(string name, SortModes sortMode) : this(name, "", sortMode)
 {
 }