Esempio n. 1
0
        public void Add_NavigatesToLastTracker()
        {
            var navigator = new Navigator(GetMockedTrackerFactory(), null);

            Assert.IsTrue(navigator.CurrentTracker == PossibleLocations.ElementAt(0));

            navigator.Add(null);
            Assert.IsTrue(navigator.CurrentTracker == PossibleLocations.ElementAt(1));

            navigator.Add(null);
            Assert.IsTrue(navigator.CurrentTracker == PossibleLocations.ElementAt(2));
        }
Esempio n. 2
0
        public void IsNotFirst_ReturnsTrueAfterAdd()
        {
            var navigator = new Navigator(GetMockedTrackerFactory(), null);

            navigator.Add(null);
            Assert.IsTrue(navigator.IsNotFirst());

            navigator.SkipToPrevious();
            Assert.IsFalse(navigator.IsNotFirst());

            navigator.Add(null);
            Assert.IsTrue(navigator.IsNotFirst());
        }
        private void serverDataTreeView_AfterSelect(object sender, TreeViewEventArgs e)
        {
            if (e.Node == serverDataTreeView.Nodes[0])
            {
                return;
            }

            if (_nodeSelectedByUser)
            {
                _nav.Add(e.Node);
            }
            if (!backButton.Enabled && _nav.CanGoBack)
            {
                backButton.Enabled = true;
            }

            var directories = new Stack <string>();
            var currentNode = e.Node;

            while (currentNode.Parent != null && currentNode.Parent != serverDataTreeView.Nodes[0])
            {
                directories.Push(currentNode.Parent.Text);
                currentNode = currentNode.Parent;
            }

            var directory = String.Format("/{0}/{1}", String.Join("/", directories), e.Node.Text);

            directoryTextBox.Text = directory.StartsWith("//") ? directory.Remove(0, 1) : directory;
        }
Esempio n. 4
0
        public void NavigateToPreviousTracker_IsEnabledWhenNotFirst()
        {
            var navigator = new Navigator(GetMockedTrackerFactory(), null);

            navigator.Add(null);

            Assert.IsTrue(navigator.NavigateToPreviousTracker.CanExecute(null));
        }
Esempio n. 5
0
        public void NavigateToNextTracker_IsDiabledWhenLast()
        {
            var navigator = new Navigator(GetMockedTrackerFactory(), null);

            navigator.Add(null);

            Assert.IsFalse(navigator.NavigateToNextTracker.CanExecute(null));
        }
Esempio n. 6
0
        public void SkipToPrevious_UpdatesTrackerWhenNotFirst()
        {
            var navigator = new Navigator(GetMockedTrackerFactory(), null);

            navigator.Add(null);
            navigator.SkipToPrevious();

            Assert.IsTrue(navigator.CurrentTracker == PossibleLocations.ElementAt(0));
        }
Esempio n. 7
0
        public void NavigateToPreviousTracker_IsDisabledWhenFirst()
        {
            var navigator = new Navigator(GetMockedTrackerFactory(), null);

            navigator.Add(null);
            navigator.SkipToPrevious();

            Assert.IsFalse(navigator.NavigateToPreviousTracker.CanExecute(null));
        }
Esempio n. 8
0
        public void SkipToNext_HasNoEffectWhenLast()
        {
            var navigator = new Navigator(GetMockedTrackerFactory(), null);

            navigator.Add(null);

            navigator.SkipToNext();
            Assert.IsTrue(navigator.CurrentTracker == PossibleLocations.ElementAt(1));
        }
Esempio n. 9
0
        public void NavigateToNextTracker_UpdatesTrackerWhenNotLast()
        {
            var navigator = new Navigator(GetMockedTrackerFactory(), null);

            navigator.Add(null);
            navigator.SkipToPrevious();

            navigator.NavigateToNextTracker.Execute(null);
            Assert.IsTrue(navigator.CurrentTracker == PossibleLocations.ElementAt(1));
        }
Esempio n. 10
0
        private async void serverDataTreeView_AfterSelect(object sender, TreeViewEventArgs e)
        {
            if (e.Node == serverDataTreeView.Nodes[0])
            {
                directoryTextBox.Text = "/";
                return;
            }

            if (_nodeSelectedByUser)
            {
                _nav.Add(e.Node);
            }
            if (!backButton.Enabled && _nav.CanGoBack)
            {
                backButton.Enabled = true;
            }

            var directories = new Stack <string>();
            var currentNode = e.Node;

            while (currentNode.Parent != null && currentNode.Parent != serverDataTreeView.Nodes[0])
            {
                directories.Push(currentNode.Parent.Text);
                currentNode = currentNode.Parent;
            }

            var directory = $"/{string.Join("/", directories)}/{e.Node.Text}";

            directoryTextBox.Text = directory.StartsWith("//") ? directory.Remove(0, 1) : directory;

            if (!_handledNodes.Contains(e.Node))
            {
                await LoadListAsync(directory, e.Node);

                _handledNodes.Add(e.Node);
            }

            serverDataTreeView.SelectedNode = e.Node;
            e.Node.Expand();
        }