From f8286b4ec397a56e60f66c5970b9adeaeafb17ca Mon Sep 17 00:00:00 2001 From: Cesar Souza Date: Wed, 27 Nov 2013 22:57:40 +0100 Subject: [PATCH] Updating Code Analysis rules. --- .../Accord.Controls.Vision/FaceController.cs | 28 +++++++++++++++---- .../Accord.Controls.Vision/HeadController.cs | 25 ++++++++++++++--- Sources/Accord.NET.ruleset | 3 +- 3 files changed, 44 insertions(+), 12 deletions(-) diff --git a/Sources/Accord.Controls.Vision/FaceController.cs b/Sources/Accord.Controls.Vision/FaceController.cs index 33db7d6fe..b2e8b0871 100644 --- a/Sources/Accord.Controls.Vision/FaceController.cs +++ b/Sources/Accord.Controls.Vision/FaceController.cs @@ -42,7 +42,7 @@ namespace Accord.Controls.Vision /// /// public class FaceController : Component, - IDisposable, IBindableComponent, INotifyPropertyChanged + IBindableComponent, INotifyPropertyChanged { private PointF rawPosition; @@ -79,12 +79,14 @@ public ISynchronizeInvoke SynchronizingObject if (this.synchronizingObject == null && base.DesignMode) { IDesignerHost designerHost = (IDesignerHost)this.GetService(typeof(IDesignerHost)); + if (designerHost != null) { - object rootComponent = designerHost.RootComponent; - if (rootComponent != null && rootComponent is ISynchronizeInvoke) + var rootComponent = designerHost.RootComponent as ISynchronizeInvoke; + + if (rootComponent != null) { - this.synchronizingObject = (ISynchronizeInvoke)rootComponent; + this.synchronizingObject = rootComponent; } } } @@ -536,7 +538,8 @@ protected virtual void OnFaceMove(FaceEventArgs args) /// /// /// - /// The collection of objects for this . + /// The collection of + /// objects for this . /// /// [Browsable(false)] @@ -591,6 +594,19 @@ protected void OnPropertyChanged(string name) } #endregion - } + /// + /// Releases the unmanaged resources used by the + /// + /// and optionally releases the managed resources. + /// + /// + /// true to release both managed and unmanaged + /// resources; false to release only unmanaged resources. + /// + protected override void Dispose(bool disposing) + { + base.Dispose(disposing); + } + } } diff --git a/Sources/Accord.Controls.Vision/HeadController.cs b/Sources/Accord.Controls.Vision/HeadController.cs index 9f8966796..744c40076 100644 --- a/Sources/Accord.Controls.Vision/HeadController.cs +++ b/Sources/Accord.Controls.Vision/HeadController.cs @@ -44,7 +44,7 @@ namespace Accord.Controls.Vision /// /// public class HeadController : Component, - IDisposable, IBindableComponent, INotifyPropertyChanged, IVideoSource + IBindableComponent, INotifyPropertyChanged, IVideoSource { private IntRange xaxisRange; @@ -274,12 +274,14 @@ public ISynchronizeInvoke SynchronizingObject if (this.synchronizingObject == null && base.DesignMode) { IDesignerHost designerHost = (IDesignerHost)this.GetService(typeof(IDesignerHost)); + if (designerHost != null) { - object rootComponent = designerHost.RootComponent; - if (rootComponent != null && rootComponent is ISynchronizeInvoke) + var rootComponent = designerHost.RootComponent as ISynchronizeInvoke; + + if (rootComponent != null) { - this.synchronizingObject = (ISynchronizeInvoke)rootComponent; + this.synchronizingObject = rootComponent; } } } @@ -908,5 +910,20 @@ private void videoSource_PlayingFinished(object sender, ReasonToFinishPlaying re #endregion + + /// + /// Releases the unmanaged resources used by the + /// + /// and optionally releases the managed resources. + /// + /// + /// true to release both managed and unmanaged + /// resources; false to release only unmanaged resources. + /// + protected override void Dispose(bool disposing) + { + base.Dispose(disposing); + } + } } diff --git a/Sources/Accord.NET.ruleset b/Sources/Accord.NET.ruleset index 7b10b3b39..389645298 100644 --- a/Sources/Accord.NET.ruleset +++ b/Sources/Accord.NET.ruleset @@ -10,7 +10,7 @@ - + @@ -19,7 +19,6 @@ -