summaryrefslogtreecommitdiffstats
path: root/win/CS/HandBrakeWPF/ViewModels/ViewModelBase.cs
diff options
context:
space:
mode:
authorsr55 <[email protected]>2011-11-06 16:56:00 +0000
committersr55 <[email protected]>2011-11-06 16:56:00 +0000
commit7afefbc8814370a3c01805f693f7dfb15399453a (patch)
tree2e1140d62393623ec166553f054b016db6b76e80 /win/CS/HandBrakeWPF/ViewModels/ViewModelBase.cs
parentd986524c71c2e41ce329e9dd5f6c78cb3d6e4de2 (diff)
WinGui: (WPF) Starting to wire up bits of the main window. (Source Scan)
git-svn-id: svn://svn.handbrake.fr/HandBrake/trunk@4342 b64f7644-9d1e-0410-96f1-a4d463321fa5
Diffstat (limited to 'win/CS/HandBrakeWPF/ViewModels/ViewModelBase.cs')
-rw-r--r--win/CS/HandBrakeWPF/ViewModels/ViewModelBase.cs27
1 files changed, 27 insertions, 0 deletions
diff --git a/win/CS/HandBrakeWPF/ViewModels/ViewModelBase.cs b/win/CS/HandBrakeWPF/ViewModels/ViewModelBase.cs
index eea335d84..f9781800c 100644
--- a/win/CS/HandBrakeWPF/ViewModels/ViewModelBase.cs
+++ b/win/CS/HandBrakeWPF/ViewModels/ViewModelBase.cs
@@ -19,6 +19,11 @@ namespace HandBrakeWPF.ViewModels
public class ViewModelBase : Screen, IViewModelBase
{
/// <summary>
+ /// Backing Field to prevent the Load method being called more than once.
+ /// </summary>
+ private bool hasLoaded;
+
+ /// <summary>
/// Initializes a new instance of the <see cref="ViewModelBase"/> class.
/// </summary>
/// <param name="windowManager">
@@ -33,5 +38,27 @@ namespace HandBrakeWPF.ViewModels
/// Gets WindowManager.
/// </summary>
public IWindowManager WindowManager { get; private set; }
+
+ /// <summary>
+ /// Perform any Initialisation for this ViewModelBase.
+ /// </summary>
+ public void Load()
+ {
+ if (!hasLoaded)
+ {
+ hasLoaded = true;
+
+ // Initialise the ViewModels OnLoad method if it exists.
+ this.OnLoad();
+ }
+ }
+
+ /// <summary>
+ /// Load Method for the ViewModel
+ /// </summary>
+ public virtual void OnLoad()
+ {
+ // Impliment in the ViewModel to perform viewmodel specific code.
+ }
}
}