Skip to content

Commit

Permalink
Cache packages.
Browse files Browse the repository at this point in the history
  • Loading branch information
JohanLarsson committed Jan 28, 2017
1 parent 6fdb0db commit a33035e
Show file tree
Hide file tree
Showing 5 changed files with 33 additions and 9 deletions.
25 changes: 24 additions & 1 deletion Gu.Reactive.Demo/AsyncCommandsViewModel.cs
Original file line number Diff line number Diff line change
Expand Up @@ -10,13 +10,16 @@

public sealed class AsyncCommandsViewModel : INotifyPropertyChanged, IDisposable
{
private int delay = 500;
private readonly Condition canExecuteCondition;

private int delay = 500;
private int count;
private bool canExecute;
private bool disposed;

public AsyncCommandsViewModel()
{
this.canExecuteCondition = new Condition(this.ObservePropertyChanged(x => x.CanExecute), () => this.CanExecute);
this.AsyncCommand = new AsyncCommand(this.SimpleTask);
this.AsyncCancelableCommand = new AsyncCommand(this.CancelableTask);
this.AsyncParameterCommand = new AsyncCommand<string>(this.ParameterTask);
Expand Down Expand Up @@ -55,6 +58,25 @@ private set
}
}

public bool CanExecute
{
get
{
return this.canExecute;
}

set
{
if (value.Equals(this.canExecute))
{
return;
}

this.canExecute = value;
this.OnPropertyChanged();
}
}

public int Delay
{
get
Expand Down Expand Up @@ -87,6 +109,7 @@ public void Dispose()
this.AsyncParameterCommand.Dispose();
this.AsyncCancelableParameterCommand.Dispose();
this.AsyncThrowCommand.Dispose();
this.canExecuteCondition?.Dispose();
}

private async Task SimpleTask()
Expand Down
10 changes: 5 additions & 5 deletions Gu.Reactive.Demo/CommandsViewModel.cs
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@

public sealed class CommandsViewModel : INotifyPropertyChanged, IDisposable
{
private readonly Condition condition;
private readonly Condition canExecuteCondition;

private string executed;
private bool canExecute;
Expand All @@ -29,9 +29,9 @@ public CommandsViewModel()
this.ObservingRelayCommand = new ObservingRelayCommand(() => this.Executed = "ObservingRelayCommand", () => this.CanExecute, this.ObservePropertyChanged(x => x.CanExecute));
this.ObservingRelayCommandWithParameter = new ObservingRelayCommand<string>(x => this.Executed = "ObservingRelayCommandWithParameter: " + x, x => this.CanExecute, this.ObservePropertyChanged(x => x.CanExecute));

this.condition = new Condition(this.ObservePropertyChanged(x => x.CanExecute), () => this.CanExecute);
this.ConditionRelayCommand = new ConditionRelayCommand(() => this.Executed = "ConditionRelayCommand", this.condition);
this.ConditionRelayCommandWithParameter = new ConditionRelayCommand<string>(x => this.Executed = "ConditionRelayCommandWithParameter: " + x, this.condition);
this.canExecuteCondition = new Condition(this.ObservePropertyChanged(x => x.CanExecute), () => this.CanExecute);
this.ConditionRelayCommand = new ConditionRelayCommand(() => this.Executed = "ConditionRelayCommand", this.canExecuteCondition);
this.ConditionRelayCommandWithParameter = new ConditionRelayCommand<string>(x => this.Executed = "ConditionRelayCommandWithParameter: " + x, this.canExecuteCondition);
this.RaiseCanExecuteCommand = new RelayCommand(this.RaiseCanExecute);
this.RaiseCanExecuteOnOtherThread = new RelayCommand(() => Task.Run(() => this.RaiseCanExecute()));
this.DelayedToggleCanExecute = new RelayCommand(async () =>
Expand Down Expand Up @@ -119,7 +119,7 @@ public void Dispose()
this.ObservingRelayCommandWithParameter.Dispose();
this.ConditionRelayCommand.Dispose();
this.ConditionRelayCommandWithParameter.Dispose();
this.condition.Dispose();
this.canExecuteCondition.Dispose();
}

[NotifyPropertyChangedInvocator]
Expand Down
4 changes: 3 additions & 1 deletion Gu.Reactive.sln
Original file line number Diff line number Diff line change
@@ -1,9 +1,11 @@
Microsoft Visual Studio Solution File, Format Version 12.00

Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio 14
VisualStudioVersion = 14.0.25420.1
MinimumVisualStudioVersion = 10.0.40219.1
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = ".paket", ".paket", "{E9C570CF-F85E-4A34-B54B-86B6801E9B19}"
ProjectSection(SolutionItems) = preProject
appveyor.yml = appveyor.yml
paket.dependencies = paket.dependencies
paket.lock = paket.lock
.paket\paket.targets = .paket\paket.targets
Expand Down
2 changes: 0 additions & 2 deletions Gu.Wpf.Reactive.UiTests/AsyncCommandsWindowTests.cs
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
namespace Gu.Wpf.Reactive.UiTests
{
using System.Threading.Tasks;

using FlaUI.Core.AutomationElements;
using FlaUI.Core.AutomationElements.Infrastructure;

Expand Down
1 change: 1 addition & 0 deletions appveyor.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
version: 1.0.{build}
configuration: Release
platform: Any CPU
cache: packages -> paket.lock
build:
verbosity: minimal

0 comments on commit a33035e

Please sign in to comment.