Replace string variable check by an enum
This commit is contained in:
@@ -40,7 +40,6 @@ namespace FlaxEditor.Windows
|
|||||||
private TextBox _itemsSearchBox;
|
private TextBox _itemsSearchBox;
|
||||||
private ViewDropdown _viewDropdown;
|
private ViewDropdown _viewDropdown;
|
||||||
private SortType _sortType;
|
private SortType _sortType;
|
||||||
private string _buttonNameChecked = "Alphabetic Order";
|
|
||||||
|
|
||||||
private RootContentTreeNode _root;
|
private RootContentTreeNode _root;
|
||||||
|
|
||||||
@@ -228,7 +227,7 @@ namespace FlaxEditor.Windows
|
|||||||
foreach (var item in ((ContextMenu)control).Items)
|
foreach (var item in ((ContextMenu)control).Items)
|
||||||
{
|
{
|
||||||
if (item is ContextMenuButton button)
|
if (item is ContextMenuButton button)
|
||||||
button.Checked = _buttonNameChecked == button.Text;
|
button.Checked = _sortType == (SortType)button.Tag;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -248,12 +247,11 @@ namespace FlaxEditor.Windows
|
|||||||
|
|
||||||
private void OnSortByButtonClicked(ContextMenuButton button)
|
private void OnSortByButtonClicked(ContextMenuButton button)
|
||||||
{
|
{
|
||||||
_buttonNameChecked = button.Text;
|
switch ((SortType)button.Tag)
|
||||||
switch (button.Text)
|
|
||||||
{
|
{
|
||||||
case "Alphabetic Order": _sortType = SortType.AlphabeticOrder;
|
case SortType.AlphabeticOrder: _sortType = SortType.AlphabeticOrder;
|
||||||
break;
|
break;
|
||||||
case "Alphabetic Reverse": _sortType = SortType.AlphabeticReverse;
|
case SortType.AlphabeticReverse: _sortType = SortType.AlphabeticReverse;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
RefreshView(SelectedNode);
|
RefreshView(SelectedNode);
|
||||||
|
|||||||
Reference in New Issue
Block a user