Esempio n. 1
0
        private async void StartSearchExecute(object obj)
        {
            LoaderManager.Instance.ShowLoader();
            AbstractNode fileNode = null;

            Logger.Log("Search started");
            var res = await Task.Run(() =>
            {
                try
                {
                    string path = DirPath;
                    fileNode    = Utils.GetFileTreeByDirectoryPath(path);
                    DBManager.WriteQueryForUser(SessionManager.User, path.Replace("\\", "\\\\"));
                    return(true);
                }
                catch (Exception exception)
                {
                    Logger.Log("Search failed", exception);
                    MessageBox.Show(exception.Message);
                    return(false);
                }
            });

            LoaderManager.Instance.HideLoader();
            if (res)
            {
                TreeViewItem viewNode = BuildTreeViewItem(fileNode);
                WindowTreeView.PopulateUITree(viewNode);
            }
        }
Esempio n. 2
0
        internal void Navigate(ModesEnum mode)
        {
            switch (mode)
            {
            case ModesEnum.SignIn:
                _contentWindow.ContentControl.Content = signInView ?? (signInView = new SignInView());
                break;

            case ModesEnum.SignUp:
                _contentWindow.ContentControl.Content = signUpView ?? (signUpView = new SignUpView());
                break;

            case ModesEnum.Tree:
                _contentWindow.ContentControl.Content = windowTreeView ?? (windowTreeView = new WindowTreeView());
                break;

            case ModesEnum.Archive:
                _contentWindow.ContentControl.Content = archiveView ?? (archiveView = new ArchiveView());
                break;

            default:
                throw new ArgumentOutOfRangeException(nameof(mode), mode, null);
            }
        }