From dc3c4d79d61bd544376e51cf754336a9442c2fb9 Mon Sep 17 00:00:00 2001 From: danwalmsley Date: Fri, 19 Feb 2016 11:29:11 +0000 Subject: [PATCH 1/2] Added open file and open folder dialogs to test app. --- .../ViewModels/MainWindowViewModel.cs | 22 +++++++++++++++++++ .../Views/MainWindow.paml | 6 +++-- 2 files changed, 26 insertions(+), 2 deletions(-) diff --git a/samples/XamlTestApplicationPcl/ViewModels/MainWindowViewModel.cs b/samples/XamlTestApplicationPcl/ViewModels/MainWindowViewModel.cs index 9ac24a622e..3ae72e138c 100644 --- a/samples/XamlTestApplicationPcl/ViewModels/MainWindowViewModel.cs +++ b/samples/XamlTestApplicationPcl/ViewModels/MainWindowViewModel.cs @@ -4,6 +4,7 @@ using System; using System.Collections.Generic; using ReactiveUI; +using Perspex.Controls; namespace XamlTestApplication.ViewModels { @@ -59,6 +60,23 @@ namespace XamlTestApplication.ViewModels CollapseNodesCommand.Subscribe(_ => ExpandNodes(false)); ExpandNodesCommand = ReactiveCommand.Create(); ExpandNodesCommand.Subscribe(_ => ExpandNodes(true)); + + OpenFileCommand = ReactiveCommand.Create(); + OpenFileCommand.Subscribe(_ => + { + var ofd = new OpenFileDialog(); + + ofd.ShowAsync(); + }); + + OpenFolderCommand = ReactiveCommand.Create(); + OpenFolderCommand.Subscribe(_ => + { + var ofd = new OpenFolderDialog(); + + ofd.ShowAsync(); + }); + } public List Items { get; } @@ -68,6 +86,10 @@ namespace XamlTestApplication.ViewModels public ReactiveCommand ExpandNodesCommand { get; } + public ReactiveCommand OpenFileCommand { get; } + + public ReactiveCommand OpenFolderCommand { get; } + public void ExpandNodes(bool expanded) { foreach (var node in Nodes) diff --git a/samples/XamlTestApplicationPcl/Views/MainWindow.paml b/samples/XamlTestApplicationPcl/Views/MainWindow.paml index cadb70edac..e5155b0b95 100644 --- a/samples/XamlTestApplicationPcl/Views/MainWindow.paml +++ b/samples/XamlTestApplicationPcl/Views/MainWindow.paml @@ -6,11 +6,13 @@ Title="Perspex Test Application" Width="800" Height="600"> - + + + - + From 08ef760431821a0982e34eb1f4f29f5da80dbd0a Mon Sep 17 00:00:00 2001 From: danwalmsley Date: Fri, 19 Feb 2016 11:33:48 +0000 Subject: [PATCH 2/2] fixed undo redo helper. --- src/Perspex.Controls/Utils/UndoRedoHelper.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/Perspex.Controls/Utils/UndoRedoHelper.cs b/src/Perspex.Controls/Utils/UndoRedoHelper.cs index 70e5921d8d..60b6839dad 100644 --- a/src/Perspex.Controls/Utils/UndoRedoHelper.cs +++ b/src/Perspex.Controls/Utils/UndoRedoHelper.cs @@ -42,7 +42,7 @@ namespace Perspex.Controls.Utils _currentNode = _currentNode.Previous; } - _host.UndoRedoState = _currentNode?.Value; + _host.UndoRedoState = _currentNode.Value; } public bool IsLastState => _currentNode.Next == null; @@ -72,7 +72,7 @@ namespace Perspex.Controls.Utils _currentNode = _currentNode.Next; } - _host.UndoRedoState = _currentNode?.Value; + _host.UndoRedoState = _currentNode.Value; } public void Snapshot()