예제 #1
0
        public Task GoForwardAsync()
        {
            Page page = ForwardHistory.Pop();

            BackHistory.Push(page);
            return(NavigateAsync(page));
        }
예제 #2
0
        private void NavigateForward(string s)
        {
            BackHistory.Push(CurrentDirectory);
            var nextDirectory = ForwardHistory.Pop();

            Navigate(nextDirectory.Path);
        }
예제 #3
0
        private void HandleGetDirectory(IPacket packet)
        {
            Application.Current.Dispatcher.Invoke(() =>
            {
                Files.Clear();
            });

            var previousDirectory = CurrentDirectory;

            var directoryResponse = (GetDirectoryResponsePacket)packet;

            CurrentDirectory = new FileSystemEntry(directoryResponse.Name, directoryResponse.Path, 0, FileType.Directory);

            if (previousDirectory != null)
            {
                BackHistory.Push(previousDirectory);
            }

            OnPropertyChanged(() => CanGoForward);
            OnPropertyChanged(() => CanGoBackward);

            for (int i = 0; i < directoryResponse.Folders.Length; i++)
            {
                Application.Current.Dispatcher.Invoke(() =>
                {
                    Files.Add(new FileSystemEntry
                              (
                                  directoryResponse.Folders[i],
                                  System.IO.Path.Combine(CurrentDirectory.Path, directoryResponse.Folders[i]),
                                  0,
                                  FileType.Directory
                              ));
                });
            }

            for (int i = 0; i < directoryResponse.Files.Length; i++)
            {
                Application.Current.Dispatcher.Invoke(() =>
                {
                    Files.Add(new FileSystemEntry
                              (
                                  directoryResponse.Files[i],
                                  System.IO.Path.Combine(CurrentDirectory.Path, directoryResponse.Files[i]),
                                  directoryResponse.FileSizes[i],
                                  FileType.File
                              ));
                });
            }
        }
예제 #4
0
        public async Task NavigateAsync(Page page, bool animate)
        {
            Page previousPage     = (Page)Content;
            Type previousPageType = previousPage?.GetType();
            Type pageType         = page.GetType();

            if (previousPage != null)
            {
                BackHistory.Push(previousPage);
                await previousPage.OnNavigatingFromAsync(animate, pageType);
            }

            await MainWindow.Instance.ResizeAsync(page.RequestedSize);

            page.OnNavigatingTo(animate, previousPageType);
            Content = page;

            previousPage?.OnNavigatedFrom(animate, pageType);
            await page.OnNavigatedToAsync(animate, previousPageType);
        }