From 1b0de61cae184c32d58d03ea2fdaaed20bfc94e6 Mon Sep 17 00:00:00 2001 From: Kevin Pilch-Bisson Date: Sat, 8 Aug 2015 21:52:29 -0700 Subject: [PATCH] Bind the methods caption --- xunit.runner.wpf/MainWindow.xaml | 2 +- xunit.runner.wpf/ViewModel/MainViewModel.cs | 25 +++++++++++++++++---- 2 files changed, 22 insertions(+), 5 deletions(-) diff --git a/xunit.runner.wpf/MainWindow.xaml b/xunit.runner.wpf/MainWindow.xaml index ab54485..880f4ce 100644 --- a/xunit.runner.wpf/MainWindow.xaml +++ b/xunit.runner.wpf/MainWindow.xaml @@ -110,7 +110,7 @@ - diff --git a/xunit.runner.wpf/ViewModel/MainViewModel.cs b/xunit.runner.wpf/ViewModel/MainViewModel.cs index 1567f47..96b9bba 100644 --- a/xunit.runner.wpf/ViewModel/MainViewModel.cs +++ b/xunit.runner.wpf/ViewModel/MainViewModel.cs @@ -9,6 +9,7 @@ using Xunit.Abstractions; using System.Collections.Generic; using System.Collections.ObjectModel; using System.Linq; +using System.Collections.Specialized; namespace xunit.runner.wpf.ViewModel { @@ -16,22 +17,38 @@ namespace xunit.runner.wpf.ViewModel { public MainViewModel() { - ////if (IsInDesignMode) - ////{ - //// // Code runs in Blend --> create design time data. - ////} + if (IsInDesignMode) + { + this.Assemblies.Add(new TestAssemblyViewModel(@"C:\Code\TestAssembly.dll")); + this.TestCases.Add("A.B.Test()"); + } ////else ////{ //// // Code runs "for real" ////} CommandBindings = CreateCommandBindings(); + this.MethodsCaption = "Methods (0)"; + + this.TestCases.CollectionChanged += TestCases_CollectionChanged; + } + + private void TestCases_CollectionChanged(object sender, NotifyCollectionChangedEventArgs e) + { + MethodsCaption = $"Methods ({TestCases.Count})"; } public ICommand ExitCommand { get; } = new RelayCommand(OnExecuteExit); public CommandBindingCollection CommandBindings { get; } + private string methodsCaption; + public string MethodsCaption + { + get { return methodsCaption; } + private set { Set(ref methodsCaption, value); } + } + private CommandBindingCollection CreateCommandBindings() { var openBinding = new CommandBinding(ApplicationCommands.Open, OnExecuteOpen);