Пример #1
0
        public void PerformFastAction(FastAction fastAction)
        {
            if (!_mainListModel.Items.Any())
            {
                return;
            }

            var searchItemModel = _mainListModel.Items[_mainListModel.SelectedIndex];
            var targetItem      = searchItemModel.TargetItem;

            var fileItem   = targetItem as FileItem;
            var folderItem = targetItem as FolderItem;

            var path = fileItem?.FullName ?? folderItem?.FullName;

            if (string.IsNullOrWhiteSpace(path))
            {
                return;
            }

            if (fastAction == FastAction.Left)
            {
                var parentPath = Path.GetDirectoryName(path);

                if (_stack.Peek() is FileNavigationSearchFrame)
                {
                    if (!Directory.Exists(Path.GetDirectoryName(parentPath)))
                    {
                        return;
                    }

                    _stack.Push(new FileNavigationSearchFrame(Path.GetDirectoryName(parentPath), parentPath));
                }
                else
                {
                    if (!Directory.Exists(parentPath))
                    {
                        return;
                    }

                    _stack.Push(new FileNavigationSearchFrame(parentPath, path));
                }

                StackPushed?.Invoke();

                var searchResults = _stack.Peek().PerformSearch(string.Empty, _frecencyStorage);
                UpdateSearchItems(searchResults);
            }
            else if (fastAction == FastAction.Right)
            {
                if (folderItem == null)
                {
                    return;
                }

                _stack.Push(new FileNavigationSearchFrame(folderItem.FullName, null));
                StackPushed?.Invoke();

                var searchResults = _stack.Peek().PerformSearch(string.Empty, _frecencyStorage);
                UpdateSearchItems(searchResults);
            }
        }
Пример #2
0
 public FastActionIntent(FastAction fastAction)
 {
     FastAction = fastAction;
 }
Пример #3
0
 private void Awake()
 {
     thisrect     = GetComponent <RectTransform>();
     messageText  = GetComponentInChildren <TextMeshProUGUI>();
     onMessageEnd = new FastAction();
 }