Commits

Joel Ross committed d2e60a5

Updated packages and added a shut down event

Comments (0)

Files changed (13)

src/Core/Eventing/Events/ShutDownRequested.cs

+namespace RossCode.TrafficLight.Core.Eventing.Events
+{
+    public class ShutDownRequested : IDomainEvent { }
+}

src/Core/RossCode.TrafficLight.Core.csproj

     <Reference Include="BusyLightHIDCommunications">
       <HintPath>..\..\lib\busylight\BusyLightHIDCommunications.dll</HintPath>
     </Reference>
-    <Reference Include="CookComputing.XmlRpcV2">
-      <HintPath>..\packages\xmlrpcnet.2.5.0\lib\net20\CookComputing.XmlRpcV2.dll</HintPath>
+    <Reference Include="CookComputing.XmlRpcV2, Version=3.0.0.0, Culture=neutral, PublicKeyToken=a7d6e17aa302004d, processorArchitecture=MSIL">
+      <SpecificVersion>False</SpecificVersion>
+      <HintPath>..\packages\xmlrpcnet.3.0.0.266\lib\net20\CookComputing.XmlRpcV2.dll</HintPath>
     </Reference>
     <Reference Include="LinkLampConfiguration">
       <HintPath>..\..\lib\busylight\LinkLampConfiguration.dll</HintPath>
     </Reference>
     <Reference Include="Ninject, Version=3.0.0.0, Culture=neutral, PublicKeyToken=c7192dc5380945e7, processorArchitecture=MSIL">
       <SpecificVersion>False</SpecificVersion>
-      <HintPath>..\packages\Ninject.3.0.0.15\lib\net40\Ninject.dll</HintPath>
+      <HintPath>..\packages\Ninject.3.0.1.10\lib\net40\Ninject.dll</HintPath>
     </Reference>
     <Reference Include="System" />
     <Reference Include="System.Core">
       <RequiredTargetFramework>3.5</RequiredTargetFramework>
     </Reference>
-    <Reference Include="System.Data.SQLite, Version=1.0.79.0, Culture=neutral, PublicKeyToken=db937bc2d44ff139, processorArchitecture=x86">
+    <Reference Include="System.Data.SQLite, Version=1.0.82.0, Culture=neutral, PublicKeyToken=db937bc2d44ff139, processorArchitecture=MSIL">
       <SpecificVersion>False</SpecificVersion>
-      <HintPath>..\packages\System.Data.SQLite.1.0.79.0\lib\net40\System.Data.SQLite.dll</HintPath>
+      <HintPath>..\packages\System.Data.SQLite.1.0.82.0\lib\net40\System.Data.SQLite.dll</HintPath>
     </Reference>
-    <Reference Include="System.Data.SQLite.Linq">
-      <HintPath>..\packages\System.Data.SQLite.1.0.79.0\lib\net40\System.Data.SQLite.Linq.dll</HintPath>
+    <Reference Include="System.Data.SQLite.Linq, Version=1.0.82.0, Culture=neutral, PublicKeyToken=db937bc2d44ff139, processorArchitecture=MSIL">
+      <SpecificVersion>False</SpecificVersion>
+      <HintPath>..\packages\System.Data.SQLite.1.0.82.0\lib\net40\System.Data.SQLite.Linq.dll</HintPath>
     </Reference>
     <Reference Include="System.Xml.Linq">
       <RequiredTargetFramework>3.5</RequiredTargetFramework>
     <Compile Include="Eventing\Events\EditProjectRequested.cs" />
     <Compile Include="Eventing\Events\IndicatorsChanged.cs" />
     <Compile Include="Eventing\Events\ProjectAdded.cs" />
+    <Compile Include="Eventing\Events\ShutDownRequested.cs" />
     <Compile Include="Eventing\Handles.cs" />
     <Compile Include="Eventing\IDomainEvent.cs" />
     <Compile Include="Factories\ProjectResolverFactory.cs" />
   <ItemGroup>
     <None Include="packages.config" />
   </ItemGroup>
+  <ItemGroup>
+    <Content Include="x64\SQLite.Interop.dll">
+      <CopyToOutputDirectory>Always</CopyToOutputDirectory>
+    </Content>
+    <Content Include="x86\SQLite.Interop.dll">
+      <CopyToOutputDirectory>Always</CopyToOutputDirectory>
+    </Content>
+  </ItemGroup>
   <Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
   <Import Project="$(SolutionDir)\.nuget\nuget.targets" />
   <!-- To modify your build process, add your task inside one of the targets below and uncomment it. 

src/Core/Services/Indicators/BuildIndicatorService.cs

             this.indicatorTypeRepository = indicatorTypeRepository;
             DomainEvents.Register<IndicatorsChanged>(IndicatorsChanged);
             DomainEvents.Register<BuildStatusChanged>(BuildStatusChanged);
+            DomainEvents.Register<ShutDownRequested>(suspended => ShutDownIndicators());
         }
 
         private void BuildStatusChanged(BuildStatusChanged args)

src/Core/Services/Indicators/DelcomTrafficLightBuildStatusIndicatorService.cs

 using System;
 using System.Collections.Generic;
 using System.Text;
-using Microsoft.Win32;
 using RossCode.TrafficLight.Core.Domain;
 using RossCode.TrafficLight.Core.Eventing;
 using RossCode.TrafficLight.Core.Eventing.Events;
     public class DelcomTrafficLightBuildStatusIndicatorService  : IBuildStatusIndicatorService, IDisposable
     {
         private uint deviceHandle;
-        private BuildStatus currentBuildStatus;
 
-        private IDictionary<BuildStatus, Action> setBuildStatus;
+        private readonly IDictionary<BuildStatus, Action> setBuildStatus;
 
         public DelcomTrafficLightBuildStatusIndicatorService()
         {
                 deviceHandle = Delcom.DelcomOpenDevice(deviceName, 0);
                 SetBuildStatus(currentStatus);
                 DomainEvents.Register<BuildStatusChanged>(Handle);
-
-                SystemEvents.PowerModeChanged += PowerModeChanged;
             } 
             catch { }
         }
 
-        private void PowerModeChanged(object sender, PowerModeChangedEventArgs e)
-        {
-            if (e.Mode == PowerModes.Suspend)
-            {
-                ClearDisplayState();
-            }
-        }
-
         public void SetBuildStatus(BuildStatus buildStatus)
         {
-            currentBuildStatus = buildStatus;
             ClearDisplayState();
             setBuildStatus[buildStatus]();
         }
             Stop();
         }
 
-        public void Handle(BuildStatusChanged arg)
+        private void Handle(BuildStatusChanged arg)
         {
             SetBuildStatus(arg.Status);
         }

src/Core/packages.config

 <?xml version="1.0" encoding="utf-8"?>
 <packages>
   <package id="MigratorDotNet" version="0.9.0.33276" />
-  <package id="Ninject" version="3.0.0.15" />
-  <package id="System.Data.SQLite" version="1.0.79.0" />
-  <package id="xmlrpcnet" version="2.5.0" targetFramework="net40" />
+  <package id="Ninject" version="3.0.1.10" targetFramework="net40" />
+  <package id="System.Data.SQLite" version="1.0.82.0" targetFramework="net40" />
+  <package id="xmlrpcnet" version="3.0.0.266" targetFramework="net40" />
 </packages>

src/Core/x64/SQLite.Interop.dll

Binary file added.

src/Core/x86/SQLite.Interop.dll

Binary file added.

src/Tests/RossCode.TrafficLight.Tests.csproj

       <SpecificVersion>False</SpecificVersion>
       <HintPath>..\packages\Moq.4.0.10827\lib\NET40\Moq.dll</HintPath>
     </Reference>
-    <Reference Include="nunit.framework, Version=2.6.1.12217, Culture=neutral, PublicKeyToken=96d09a1eb7f44a77, processorArchitecture=MSIL">
+    <Reference Include="nunit.framework, Version=2.6.2.12296, Culture=neutral, PublicKeyToken=96d09a1eb7f44a77, processorArchitecture=MSIL">
       <SpecificVersion>False</SpecificVersion>
-      <HintPath>..\packages\NUnit.2.6.1\lib\nunit.framework.dll</HintPath>
+      <HintPath>..\packages\NUnit.2.6.2\lib\nunit.framework.dll</HintPath>
     </Reference>
     <Reference Include="System" />
     <Reference Include="System.Core">

src/Tests/packages.config

 <?xml version="1.0" encoding="utf-8"?>
 <packages>
   <package id="Moq" version="4.0.10827" />
-  <package id="NUnit" version="2.6.1" targetFramework="net40" />
+  <package id="NUnit" version="2.6.2" targetFramework="net40" />
 </packages>

src/UI/RossCode.TrafficLight.UI.csproj

   <ItemGroup>
     <Reference Include="Ninject, Version=3.0.0.0, Culture=neutral, PublicKeyToken=c7192dc5380945e7, processorArchitecture=MSIL">
       <SpecificVersion>False</SpecificVersion>
-      <HintPath>..\packages\Ninject.3.0.0.15\lib\net40\Ninject.dll</HintPath>
+      <HintPath>..\packages\Ninject.3.0.1.10\lib\net40\Ninject.dll</HintPath>
     </Reference>
     <Reference Include="System" />
     <Reference Include="System.Core">

src/UI/TrafficLightApplicationContext.cs

 using System;
 using System.Collections.Generic;
 using System.Windows.Forms;
+using Microsoft.Win32;
 using RossCode.TrafficLight.Core;
 using RossCode.TrafficLight.Core.Domain;
 using RossCode.TrafficLight.Core.Eventing;
             DomainEvents.Register<BuildStatusChanged>(ChangeBuildStatus);
             DomainEvents.Register<EditProjectRequested>(EditProject);
 
+            SystemEvents.PowerModeChanged += (sender, args) =>
+                {
+                    if (args.Mode == PowerModes.Suspend)
+                    {
+                        DomainEvents.Raise(new ShutDownRequested());
+                    }
+                };
+            SystemEvents.SessionEnded += (sender, args) => DomainEvents.Raise(new ShutDownRequested());
+
             this.projectMonitorService.StartMonitoring();
 		}
 

src/UI/app.config

     <assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
       <dependentAssembly>
         <assemblyIdentity name="System.Data.SQLite" publicKeyToken="db937bc2d44ff139" culture="neutral" />
-        <bindingRedirect oldVersion="0.0.0.0-1.0.79.0" newVersion="1.0.79.0" />
+        <bindingRedirect oldVersion="0.0.0.0-1.0.82.0" newVersion="1.0.82.0" />
       </dependentAssembly>
     </assemblyBinding>
   </runtime>

src/UI/packages.config

 <?xml version="1.0" encoding="utf-8"?>
 <packages>
-  <package id="Ninject" version="3.0.0.15" />
+  <package id="Ninject" version="3.0.1.10" targetFramework="net40" />
 </packages>