diff options
author | sr55 <[email protected]> | 2012-09-01 20:02:07 +0000 |
---|---|---|
committer | sr55 <[email protected]> | 2012-09-01 20:02:07 +0000 |
commit | 5fcef814d002f988699dfbde188d706f52f62082 (patch) | |
tree | e01f92e3ba180939f00a258d7fbc365ac7b01ac0 /win | |
parent | 00d5253246cdf9c10a13322c2e57898a63ff7558 (diff) |
WinGui: Only allow 1 instance of the Queue, About, Log and Preview window to be opened.
git-svn-id: svn://svn.handbrake.fr/HandBrake/trunk@4925 b64f7644-9d1e-0410-96f1-a4d463321fa5
Diffstat (limited to 'win')
-rw-r--r-- | win/CS/HandBrakeWPF/ViewModels/MainViewModel.cs | 48 |
1 files changed, 42 insertions, 6 deletions
diff --git a/win/CS/HandBrakeWPF/ViewModels/MainViewModel.cs b/win/CS/HandBrakeWPF/ViewModels/MainViewModel.cs index 340036373..59d442393 100644 --- a/win/CS/HandBrakeWPF/ViewModels/MainViewModel.cs +++ b/win/CS/HandBrakeWPF/ViewModels/MainViewModel.cs @@ -33,6 +33,7 @@ namespace HandBrakeWPF.ViewModels using HandBrakeWPF.Model;
using HandBrakeWPF.Services.Interfaces;
using HandBrakeWPF.ViewModels.Interfaces;
+ using HandBrakeWPF.Views;
using Ookii.Dialogs.Wpf;
@@ -843,7 +844,16 @@ namespace HandBrakeWPF.ViewModels /// </summary>
public void OpenAboutApplication()
{
- this.WindowManager.ShowWindow(IoC.Get<IAboutViewModel>());
+ Window window = Application.Current.Windows.Cast<Window>().FirstOrDefault(x => x.GetType() == typeof(AboutView));
+
+ if (window != null)
+ {
+ window.Activate();
+ }
+ else
+ {
+ this.WindowManager.ShowWindow(IoC.Get<IAboutViewModel>());
+ }
}
/// <summary>
@@ -859,7 +869,16 @@ namespace HandBrakeWPF.ViewModels /// </summary>
public void OpenLogWindow()
{
- this.WindowManager.ShowWindow(IoC.Get<ILogViewModel>());
+ Window window = Application.Current.Windows.Cast<Window>().FirstOrDefault(x => x.GetType() == typeof(LogView));
+
+ if (window != null)
+ {
+ window.Activate();
+ }
+ else
+ {
+ this.WindowManager.ShowWindow(IoC.Get<ILogViewModel>());
+ }
}
/// <summary>
@@ -867,7 +886,16 @@ namespace HandBrakeWPF.ViewModels /// </summary>
public void OpenQueueWindow()
{
- this.WindowManager.ShowWindow(IoC.Get<IQueueViewModel>());
+ Window window = Application.Current.Windows.Cast<Window>().FirstOrDefault(x => x.GetType() == typeof(QueueView));
+
+ if (window != null)
+ {
+ window.Activate();
+ }
+ else
+ {
+ this.WindowManager.ShowWindow(IoC.Get<IQueueViewModel>());
+ }
}
/// <summary>
@@ -875,9 +903,17 @@ namespace HandBrakeWPF.ViewModels /// </summary>
public void OpenPreviewWindow()
{
- IPreviewViewModel viewModel = IoC.Get<IPreviewViewModel>();
- this.WindowManager.ShowWindow(viewModel);
- viewModel.Task = this.CurrentTask;
+ Window window = Application.Current.Windows.Cast<Window>().FirstOrDefault(x => x.GetType() == typeof(PreviewView));
+
+ if (window != null)
+ {
+ window.Activate();
+ }
+ else
+ {
+ IPreviewViewModel viewModel = IoC.Get<IPreviewViewModel>();
+ this.WindowManager.ShowWindow(viewModel);
+ }
}
/// <summary>
|