From bcb821bcbd2d9401cfc223df6ae9ac493b4a3c7a Mon Sep 17 00:00:00 2001 From: Antony Male Date: Sat, 29 Nov 2014 18:11:13 +0000 Subject: [PATCH] Stylistic changes --- Stylet/EventAggregator.cs | 8 ++------ Stylet/LabelledValue.cs | 5 ++++- Stylet/PropertyChangedExtensions.cs | 2 -- Stylet/WindowManager.cs | 2 +- 4 files changed, 7 insertions(+), 10 deletions(-) diff --git a/Stylet/EventAggregator.cs b/Stylet/EventAggregator.cs index 00c654b..2ec06c7 100644 --- a/Stylet/EventAggregator.cs +++ b/Stylet/EventAggregator.cs @@ -95,12 +95,8 @@ namespace Stylet lock (this.handlersLock) { var existingHandler = this.handlers.FirstOrDefault(x => x.IsHandlerForInstance(handler)); - if (existingHandler != null) - { - if (existingHandler.UnsubscribeFromChannels(channels)) // Handles default topic appropriately - this.handlers.Remove(existingHandler); - } - + if (existingHandler != null && existingHandler.UnsubscribeFromChannels(channels)) // Handles default topic appropriately + this.handlers.Remove(existingHandler); } } diff --git a/Stylet/LabelledValue.cs b/Stylet/LabelledValue.cs index 94e45c8..3daefeb 100644 --- a/Stylet/LabelledValue.cs +++ b/Stylet/LabelledValue.cs @@ -54,7 +54,10 @@ namespace Stylet /// true if the current object is equal to the other parameter; otherwise, false. public bool Equals(LabelledValue other) { - return other == null ? false : this.Label == other.Label && EqualityComparer.Default.Equals(this.Value, other.Value); + if (other == null) + return false; + + return this.Label == other.Label && EqualityComparer.Default.Equals(this.Value, other.Value); } /// diff --git a/Stylet/PropertyChangedExtensions.cs b/Stylet/PropertyChangedExtensions.cs index 100f74f..9e653d2 100644 --- a/Stylet/PropertyChangedExtensions.cs +++ b/Stylet/PropertyChangedExtensions.cs @@ -61,9 +61,7 @@ namespace Stylet { INotifyPropertyChanged inpc; if (this.inpc.TryGetTarget(out inpc)) - { inpc.PropertyChanged -= handler; - } } } diff --git a/Stylet/WindowManager.cs b/Stylet/WindowManager.cs index ab1b214..7ec0a5e 100644 --- a/Stylet/WindowManager.cs +++ b/Stylet/WindowManager.cs @@ -141,7 +141,7 @@ namespace Stylet window.StateChanged += WindowStateChanged; } - void WindowStateChanged(object sender, EventArgs e) + private void WindowStateChanged(object sender, EventArgs e) { switch (this.window.WindowState) {