Skip to content

Commit

Permalink
Merge pull request #2 from NicolasConstant/DEV
Browse files Browse the repository at this point in the history
Added capability to let screen shut down
  • Loading branch information
NicolasConstant committed Feb 28, 2016
2 parents defd52f + ef8ae01 commit 5f53f38
Show file tree
Hide file tree
Showing 25 changed files with 1,009 additions and 180 deletions.
11 changes: 10 additions & 1 deletion SpotifySleepModeStopper.sln
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@

Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio 14
VisualStudioVersion = 14.0.23107.0
VisualStudioVersion = 14.0.24720.0
MinimumVisualStudioVersion = 10.0.40219.1
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Domain", "Domain", "{3D8B40CA-FF63-47A7-B987-16C32BABDA81}"
EndProject
Expand All @@ -11,6 +11,10 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "SpotifySleepModeStopper", "
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "SpotifySleepModeStopperGui", "SpotifySleepModeStopperGui\SpotifySleepModeStopperGui.csproj", "{8C0977F4-070D-4B83-A825-EDDECD812C36}"
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Tests", "Tests", "{389A2870-3198-4504-ACB6-1740086311A0}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "UnitTestProject", "UnitTestProject\UnitTestProject.csproj", "{93B5C78A-1B0C-4F73-9AF8-572D04CBAEFE}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Expand All @@ -25,12 +29,17 @@ Global
{8C0977F4-070D-4B83-A825-EDDECD812C36}.Debug|Any CPU.Build.0 = Debug|Any CPU
{8C0977F4-070D-4B83-A825-EDDECD812C36}.Release|Any CPU.ActiveCfg = Release|Any CPU
{8C0977F4-070D-4B83-A825-EDDECD812C36}.Release|Any CPU.Build.0 = Release|Any CPU
{93B5C78A-1B0C-4F73-9AF8-572D04CBAEFE}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{93B5C78A-1B0C-4F73-9AF8-572D04CBAEFE}.Debug|Any CPU.Build.0 = Debug|Any CPU
{93B5C78A-1B0C-4F73-9AF8-572D04CBAEFE}.Release|Any CPU.ActiveCfg = Release|Any CPU
{93B5C78A-1B0C-4F73-9AF8-572D04CBAEFE}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
GlobalSection(NestedProjects) = preSolution
{0EFA9F55-FD0A-4B27-B953-4B6F5213A7B5} = {3D8B40CA-FF63-47A7-B987-16C32BABDA81}
{8C0977F4-070D-4B83-A825-EDDECD812C36} = {EA773A42-7CE2-4520-936D-4B76A417252D}
{93B5C78A-1B0C-4F73-9AF8-572D04CBAEFE} = {389A2870-3198-4504-ACB6-1740086311A0}
EndGlobalSection
EndGlobal
8 changes: 8 additions & 0 deletions SpotifySleepModeStopper/Contracts/IAutoStartManager.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
namespace SpotifyTools.Contracts
{
public interface IAutoStartManager
{
bool IsAutoStartSet();
void SetAutoStart(bool enabled);
}
}
5 changes: 3 additions & 2 deletions SpotifySleepModeStopper/Contracts/IPreventSleepScreen.cs
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,8 @@ public interface IPreventSleepScreen
/// <summary>
/// Prevent screensaver, display dimming and power saving. This function wraps PInvokes on Win32 API.
/// </summary>
/// <param name="enableConstantDisplayAndPower">True to get a constant display and power - False to clear the settings</param>
void EnableConstantDisplayAndPower(bool enableConstantDisplayAndPower);
/// <param name="enableConstantPower"></param>
/// <param name="enableConstantDisplay"></param>
void EnableConstantDisplayAndPower(bool enableConstantPower, bool enableConstantDisplay);
}
}
7 changes: 7 additions & 0 deletions SpotifySleepModeStopper/Contracts/IProcessAnalyser.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
namespace SpotifyTools.Contracts
{
public interface IProcessAnalyser
{
bool IsAppRunning(string processName);
}
}
10 changes: 10 additions & 0 deletions SpotifySleepModeStopper/Contracts/ISettingsManager.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
using SpotifyTools.Tools.Model;

namespace SpotifyTools.Contracts
{
public interface ISettingsManager<T> where T : class
{
T GetConfig();
void SaveConfig(T settings);
}
}
12 changes: 12 additions & 0 deletions SpotifySleepModeStopper/Contracts/ISpotifySaveModeStopperFacade.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
namespace SpotifyTools.Contracts
{
public interface ISpotifySaveModeStopperFacade
{
void ChangeScreenSleep(bool screenRemainsEnabled);
void ChangeAutoStart(bool autoStartEnabled);
bool IsScreenSleepEnabled();
bool IsAutoStartEnabled();
void StartListening();
void StopListening();
}
}
122 changes: 0 additions & 122 deletions SpotifySleepModeStopper/Domain/SpotifySaveModeStopper.cs

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,11 +1,7 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using SpotifyTools.Contracts;

namespace SpotifyTools.Domain.AppStatesManagement
namespace SpotifyTools.DomainLayer.AppStatesManagement
{
public class AppStateReporting : IAppStatusReporting
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
using CSCore.CoreAudioAPI;
using SpotifyTools.Contracts;

namespace SpotifyTools.Domain.AudioManagement
namespace SpotifyTools.DomainLayer.AudioManagement
{
public class CsCoreSoundAnalyser : ISoundAnalyser
{
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
using SpotifyTools.Contracts;

namespace SpotifyTools.Domain.MessageManagement
namespace SpotifyTools.DomainLayer.MessageManagement
{
public class DummyMessageDisplayer : IMessageDisplayer
{
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
using System;
using SpotifyTools.Contracts;

namespace SpotifyTools.Domain.MessageManagement
namespace SpotifyTools.DomainLayer.MessageManagement
{
public class MessageDisplayer : IMessageDisplayer
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
using System.Runtime.InteropServices;
using SpotifyTools.Contracts;

namespace SpotifyTools.Domain.PowerManagement
namespace SpotifyTools.DomainLayer.PowerManagement
{
public class PowerRequestContextHandler : IPreventSleepScreen
{
Expand Down Expand Up @@ -80,10 +80,11 @@ public struct PowerRequestContextDetailed
/// <summary>
/// Prevent screensaver, display dimming and power saving. This function wraps PInvokes on Win32 API.
/// </summary>
/// <param name="enableConstantDisplayAndPower">True to get a constant display and power - False to clear the settings</param>
public void EnableConstantDisplayAndPower(bool enableConstantDisplayAndPower)
/// <param name="enableConstantDisplay"></param>
/// <param name="enableConstantPower"></param>
public void EnableConstantDisplayAndPower(bool enableConstantPower, bool enableConstantDisplay)
{
if (enableConstantDisplayAndPower)
if (enableConstantPower)
{
// Set up the diagnostic string
_powerRequestContext.Version = PowerRequestContextVersion;
Expand All @@ -96,7 +97,9 @@ public void EnableConstantDisplayAndPower(bool enableConstantDisplayAndPower)

// Set the request
PowerSetRequest(_powerRequest, PowerRequestType.PowerRequestSystemRequired);
PowerSetRequest(_powerRequest, PowerRequestType.PowerRequestDisplayRequired);

if (enableConstantDisplay)
PowerSetRequest(_powerRequest, PowerRequestType.PowerRequestDisplayRequired);
}
else
{
Expand Down
Loading

0 comments on commit 5f53f38

Please sign in to comment.