Commits

Christian Specht committed 5fbe5d4 Draft

use separate AboutWindow

Comments (0)

Files changed (7)

src/MissileSharp.Launcher/MissileSharp.Launcher.csproj

     </ApplicationDefinition>
     <Compile Include="ViewModels\BaseViewModel.cs" />
     <Compile Include="ViewModels\MessageBoxWindowViewModel.cs" />
+    <Compile Include="Views\AboutWindow.xaml.cs">
+      <DependentUpon>AboutWindow.xaml</DependentUpon>
+    </Compile>
     <Compile Include="Views\MessageBoxWindow.xaml.cs">
       <DependentUpon>MessageBoxWindow.xaml</DependentUpon>
     </Compile>
+    <Page Include="Views\AboutWindow.xaml">
+      <SubType>Designer</SubType>
+      <Generator>MSBuild:Compile</Generator>
+    </Page>
     <Page Include="Views\MainWindow.xaml">
       <Generator>MSBuild:Compile</Generator>
       <SubType>Designer</SubType>

src/MissileSharp.Launcher/ViewModels/MainWindowViewModel.cs

 using System.Windows.Input;
 using MissileSharp.Launcher.Properties;
 using MissileSharp.Launcher.Services;
+using MissileSharp.Launcher.Views;
 
 namespace MissileSharp.Launcher.ViewModels
 {
         private readonly IConfigService configService;
         private readonly IMessageService messageService;
         private readonly IShutdownService shutdownService;
+        private readonly IWindowService windowService;
 
         public ObservableCollection<string> CommandSets { get; set; }
 
             get { return new RelayCommand(this.AboutBox); }
         }
 
-        public MainWindowViewModel(ICommandCenterService commandCenterService, IConfigService configService, IMessageService messageService, IShutdownService shutdownService)
+        public MainWindowViewModel(ICommandCenterService commandCenterService, IConfigService configService, IMessageService messageService, IShutdownService shutdownService, IWindowService windowService)
         {
             this.commandCenterService = commandCenterService;
             this.configService = configService;
             this.messageService = messageService;
             this.shutdownService = shutdownService;
+            this.windowService = windowService;
 
             Initialize();
         }
 
         private void AboutBox(Object obj)
         {
-            this.messageService.ShowMessage("about");
+            var window = this.windowService.GetWindow<AboutWindow>();
+            window.ShowDialog();
         }
     }
 }

src/MissileSharp.Launcher/Views/AboutWindow.xaml

+<Controls:MetroWindow x:Class="MissileSharp.Launcher.Views.AboutWindow"
+        xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
+        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
+        xmlns:Controls="clr-namespace:MahApps.Metro.Controls;assembly=MahApps.Metro"
+        Title="AboutWindow" Height="300" Width="300">
+    <Grid>
+        
+    </Grid>
+</Controls:MetroWindow>

src/MissileSharp.Launcher/Views/AboutWindow.xaml.cs

+using MahApps.Metro.Controls;
+
+namespace MissileSharp.Launcher.Views
+{
+    /// <summary>
+    /// Interaction logic for AboutWindow.xaml
+    /// </summary>
+    public partial class AboutWindow : MetroWindow
+    {
+        public AboutWindow()
+        {
+            InitializeComponent();
+        }
+    }
+}

src/MissileSharp.Tests/Launcher/MainWindowViewModelTests.cs

         private Mock<ICommandCenterService> commandcenterservice;
         private Mock<ICommandCenter> commandcenter;
         private Mock<IMessageService> messageservice;
+        private Mock<IWindowService> windowservice;
         
         [SetUp]
         public void Setup()
             this.commandcenter.Setup(mock => mock.GetLoadedCommandSetNames()).Returns(list);
 
             this.messageservice = new Mock<IMessageService>();
+            this.windowservice = new Mock<IWindowService>();
         }
 
-        public MainWindowViewModel SetupViewModel(ICommandCenterService commandCenterService = null, IConfigService configService = null, IMessageService messageService = null, IShutdownService shutdownService = null)
+        public MainWindowViewModel SetupViewModel(ICommandCenterService commandCenterService = null, IConfigService configService = null, IMessageService messageService = null, IShutdownService shutdownService = null, IWindowService windowService = null)
         {
             if (commandCenterService == null)
             {
                 shutdownService = this.shutdownservice.Object;
             }
 
-            return new MainWindowViewModel(commandCenterService, configService, messageService, shutdownService);
+            if (windowService == null)
+            {
+                windowService = this.windowservice.Object;
+            }
+
+            return new MainWindowViewModel(commandCenterService, configService, messageService, shutdownService, windowService);
         }
 
         [Test]

src/MissileSharp.Tests/MissileSharp.Tests.csproj

       <SpecificVersion>False</SpecificVersion>
       <HintPath>..\packages\NUnit.2.6.0.12054\lib\nunit.framework.dll</HintPath>
     </Reference>
+    <Reference Include="MahApps.Metro">
+      <HintPath>..\packages\MahApps.Metro.0.10.0.0\lib\net40\MahApps.Metro.dll</HintPath>
+    </Reference>
+    <Reference Include="System.Windows.Interactivity">
+      <HintPath>..\packages\MahApps.Metro.0.10.0.0\lib\net40\System.Windows.Interactivity.dll</HintPath>
+    </Reference>
     <Reference Include="PresentationCore" />
+    <Reference Include="PresentationFramework" />
     <Reference Include="System" />
     <Reference Include="System.Core" />
+    <Reference Include="System.Xaml" />
     <Reference Include="System.Xml.Linq" />
     <Reference Include="System.Data.DataSetExtensions" />
     <Reference Include="Microsoft.CSharp" />
     <Reference Include="System.Data" />
     <Reference Include="System.Xml" />
+    <Reference Include="WindowsBase" />
   </ItemGroup>
   <ItemGroup>
     <Compile Include="..\MissileSharp\AssemblyInfoGlobal.cs">

src/MissileSharp.Tests/packages.config

 <packages>
   <package id="Moq" version="4.0.10827" />
   <package id="NUnit" version="2.6.0.12054" />
+  <package id="MahApps.Metro" version="0.10.0.0" />
 </packages>