diff --git a/Artemis/Artemis/App.config b/Artemis/Artemis/App.config
index 152e20a95..c92565735 100644
--- a/Artemis/Artemis/App.config
+++ b/Artemis/Artemis/App.config
@@ -216,6 +216,14 @@
+
+
+
+
+
+
+
+
diff --git a/Artemis/Artemis/App.xaml b/Artemis/Artemis/App.xaml
index c80f295e0..0fe50d3fd 100644
--- a/Artemis/Artemis/App.xaml
+++ b/Artemis/Artemis/App.xaml
@@ -3,12 +3,12 @@
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:local="clr-namespace:Artemis"
DispatcherUnhandledException="Application_DispatcherUnhandledException"
- Startup="Application_Startup">
+ ShutdownMode="OnExplicitShutdown">
-
+
diff --git a/Artemis/Artemis/Artemis.csproj b/Artemis/Artemis/Artemis.csproj
index 2d029036a..8bd373750 100644
--- a/Artemis/Artemis/Artemis.csproj
+++ b/Artemis/Artemis/Artemis.csproj
@@ -77,10 +77,18 @@
logo.ico
+
+ ..\packages\Autofac.3.5.2\lib\net40\Autofac.dll
+ True
+
..\packages\Caliburn.Micro.Core.2.0.2\lib\net45\Caliburn.Micro.dll
True
+
+ ..\packages\Caliburn.Micro.AutofacBootstrap.2.0.8\lib\net40\Caliburn.Micro.Autofac.dll
+ True
+
..\packages\Caliburn.Micro.2.0.2\lib\net45\Caliburn.Micro.Platform.dll
True
@@ -93,6 +101,10 @@
..\packages\CUE.NET.1.0.0\lib\net45\CUE.NET.dll
True
+
+ ..\packages\Hardcodet.NotifyIcon.Wpf.1.0.5\lib\net451\Hardcodet.Wpf.TaskbarNotification.dll
+ True
+
..\packages\log4net.2.0.5\lib\net45-full\log4net.dll
True
@@ -278,6 +290,7 @@
+
EffectsView.xaml
@@ -320,6 +333,9 @@
ShellView.xaml
+
+ SystemTrayView.xaml
+
@@ -362,6 +378,7 @@
+
SettingsSingleFileGenerator
@@ -437,6 +454,10 @@
Designer
MSBuild:Compile
+
+ Designer
+ MSBuild:Compile
+
@@ -447,7 +468,9 @@
PreserveNewest
-
+
+ PreserveNewest
+
diff --git a/Artemis/Artemis/ArtemisBootstrapper.cs b/Artemis/Artemis/ArtemisBootstrapper.cs
index acea28cf2..36a84f7ce 100644
--- a/Artemis/Artemis/ArtemisBootstrapper.cs
+++ b/Artemis/Artemis/ArtemisBootstrapper.cs
@@ -1,19 +1,31 @@
using System.Windows;
using Artemis.ViewModels;
+using Autofac;
using Caliburn.Micro;
+using Caliburn.Micro.Autofac;
namespace Artemis
{
- public class ArtemisBootstrapper : BootstrapperBase
+ public class ArtemisBootstrapper : AutofacBootstrapper
{
public ArtemisBootstrapper()
{
Initialize();
}
+ protected override void ConfigureContainer(ContainerBuilder builder)
+ {
+ base.ConfigureContainer(builder);
+
+ // create a window manager instance to be used by everyone asking for one (including Caliburn.Micro)
+ builder.RegisterInstance(new WindowManager());
+ builder.RegisterType();
+ builder.RegisterType();
+ }
+
protected override void OnStartup(object sender, StartupEventArgs e)
{
- DisplayRootViewFor();
+ DisplayRootViewFor();
}
}
}
\ No newline at end of file
diff --git a/Artemis/Artemis/ViewModels/ShellViewModel.cs b/Artemis/Artemis/ViewModels/ShellViewModel.cs
index 3b39d06a3..8eb34c9ae 100644
--- a/Artemis/Artemis/ViewModels/ShellViewModel.cs
+++ b/Artemis/Artemis/ViewModels/ShellViewModel.cs
@@ -7,7 +7,7 @@ using Caliburn.Micro;
namespace Artemis.ViewModels
{
- internal sealed class ShellViewModel : Conductor.Collection.OneActive
+ public sealed class ShellViewModel : Conductor.Collection.OneActive
{
public ShellViewModel()
{
diff --git a/Artemis/Artemis/ViewModels/SystemTrayViewModel.cs b/Artemis/Artemis/ViewModels/SystemTrayViewModel.cs
new file mode 100644
index 000000000..9eec157ee
--- /dev/null
+++ b/Artemis/Artemis/ViewModels/SystemTrayViewModel.cs
@@ -0,0 +1,61 @@
+using System.Windows;
+using Caliburn.Micro;
+
+namespace Artemis.ViewModels
+{
+ public class SystemTrayViewModel : Screen
+ {
+ private readonly ShellViewModel _shellViewModel;
+
+ private readonly IWindowManager _windowManager;
+ /*
+ * NOTE: In this sample the system tray view-model doesn't receive any notification
+ * when the other window gets closed by pressing the top right 'x'.
+ * Thus no property notification is invoked, and system tray context-menu appears
+ * out of sync, still allowing 'Hide' and disabling 'Show'.
+ * Given the purpose of the sample - integrating Caliburn.Micro with WPF NotifyIcon -
+ * sync'ing the two view-models is not of interest here.
+ * */
+
+ public SystemTrayViewModel(IWindowManager windowManager, ShellViewModel shellViewModel)
+ {
+ _windowManager = windowManager;
+ _shellViewModel = shellViewModel;
+ }
+
+ public bool CanShowWindow => !_shellViewModel.IsActive;
+
+ public bool CanHideWindow => _shellViewModel.IsActive;
+
+ protected override void OnActivate()
+ {
+ base.OnActivate();
+
+ NotifyOfPropertyChange(() => CanShowWindow);
+ NotifyOfPropertyChange(() => CanHideWindow);
+ }
+
+ public void ShowWindow()
+ {
+ // manually show the next window view-model
+ _windowManager.ShowWindow(_shellViewModel);
+
+ NotifyOfPropertyChange(() => CanShowWindow);
+ NotifyOfPropertyChange(() => CanHideWindow);
+ }
+
+ public void HideWindow()
+ {
+ _shellViewModel.TryClose();
+
+ NotifyOfPropertyChange(() => CanShowWindow);
+ NotifyOfPropertyChange(() => CanHideWindow);
+ }
+
+ public void ExitApplication()
+ {
+ _shellViewModel.MainModel.ShutdownEffects();
+ Application.Current.Shutdown();
+ }
+ }
+}
\ No newline at end of file
diff --git a/Artemis/Artemis/Views/ShellView.xaml b/Artemis/Artemis/Views/ShellView.xaml
index 0a7fce3bb..a640ce61d 100644
--- a/Artemis/Artemis/Views/ShellView.xaml
+++ b/Artemis/Artemis/Views/ShellView.xaml
@@ -6,7 +6,6 @@
xmlns:Controls="clr-namespace:MahApps.Metro.Controls;assembly=MahApps.Metro"
xmlns:cal="http://www.caliburnproject.org"
mc:Ignorable="d"
- cal:Message.Attach="[Event Closing] = [Action OnClose($eventArgs)]"
Title="Artemis" Height="670" Width="690"
MinWidth="500" MinHeight="400"
GlowBrush="{DynamicResource AccentColorBrush}">
diff --git a/Artemis/Artemis/Views/SystemTrayView.xaml b/Artemis/Artemis/Views/SystemTrayView.xaml
new file mode 100644
index 000000000..5e77f05d0
--- /dev/null
+++ b/Artemis/Artemis/Views/SystemTrayView.xaml
@@ -0,0 +1,44 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ View + ViewModel started from bootstrapper. This should not be visible.
+
+
+
\ No newline at end of file
diff --git a/Artemis/Artemis/Views/SystemTrayView.xaml.cs b/Artemis/Artemis/Views/SystemTrayView.xaml.cs
new file mode 100644
index 000000000..26cc6aebf
--- /dev/null
+++ b/Artemis/Artemis/Views/SystemTrayView.xaml.cs
@@ -0,0 +1,27 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+using System.Windows;
+using System.Windows.Controls;
+using System.Windows.Data;
+using System.Windows.Documents;
+using System.Windows.Input;
+using System.Windows.Media;
+using System.Windows.Media.Imaging;
+using System.Windows.Shapes;
+
+namespace Artemis.Views
+{
+ ///
+ /// Interaction logic for SystemTrayView.xaml
+ ///
+ public partial class SystemTrayView : Window
+ {
+ public SystemTrayView()
+ {
+ InitializeComponent();
+ }
+ }
+}
diff --git a/Artemis/Artemis/logo-disabled.ico b/Artemis/Artemis/logo-disabled.ico
new file mode 100644
index 000000000..da8f0f275
Binary files /dev/null and b/Artemis/Artemis/logo-disabled.ico differ
diff --git a/Artemis/Artemis/logo.ico b/Artemis/Artemis/logo.ico
index 0bfeff565..e3f35618e 100644
Binary files a/Artemis/Artemis/logo.ico and b/Artemis/Artemis/logo.ico differ
diff --git a/Artemis/Artemis/packages.config b/Artemis/Artemis/packages.config
index a5c9f9351..fa7dbeeb8 100644
--- a/Artemis/Artemis/packages.config
+++ b/Artemis/Artemis/packages.config
@@ -1,10 +1,13 @@
+
+
+