Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
39 changed files
with
1,204 additions
and
841 deletions.
There are no files selected for viewing
39 changes: 20 additions & 19 deletions
39
PCRemote.Core/AbortShutdownCommand.cs → ...ote.Core/Commands/AbortShutdownCommand.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,20 +1,21 @@ | ||
#region using | ||
|
||
using System.Diagnostics; | ||
|
||
#endregion | ||
|
||
namespace PCRemote.Core | ||
{ | ||
public class AbortShutdownCommand : ICommand | ||
{ | ||
#region Implementation of ICommand | ||
|
||
public void Execute() | ||
{ | ||
Process.Start("shutdown", "-a"); | ||
} | ||
|
||
#endregion | ||
} | ||
#region using | ||
|
||
using System.Diagnostics; | ||
using PCRemote.Core.Contracts; | ||
|
||
#endregion | ||
|
||
namespace PCRemote.Core.Commands | ||
{ | ||
public class AbortShutdownCommand : ICommand | ||
{ | ||
#region Implementation of ICommand | ||
|
||
public void Execute() | ||
{ | ||
Process.Start("shutdown", "-a"); | ||
} | ||
|
||
#endregion | ||
} | ||
} |
45 changes: 23 additions & 22 deletions
45
PCRemote.Core/DarkScreenCommand.cs → PCRemote.Core/Commands/DarkScreenCommand.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,23 +1,24 @@ | ||
#region using | ||
|
||
using System.Runtime.InteropServices; | ||
|
||
#endregion | ||
|
||
namespace PCRemote.Core | ||
{ | ||
public class DarkScreenCommand : ICommand | ||
{ | ||
[DllImport("user32.dll")] | ||
static extern int SendMessage(int hWnd, int hMsg, int wParam, int lParam); | ||
|
||
#region Implementation of ICommand | ||
|
||
public void Execute() | ||
{ | ||
SendMessage(0xFFFF, 0x112, 0xF170, 2); | ||
} | ||
|
||
#endregion | ||
} | ||
#region using | ||
|
||
using System.Runtime.InteropServices; | ||
using PCRemote.Core.Contracts; | ||
|
||
#endregion | ||
|
||
namespace PCRemote.Core.Commands | ||
{ | ||
public class DarkScreenCommand : ICommand | ||
{ | ||
[DllImport("user32.dll")] | ||
static extern int SendMessage(int hWnd, int hMsg, int wParam, int lParam); | ||
|
||
#region Implementation of ICommand | ||
|
||
public void Execute() | ||
{ | ||
SendMessage(0xFFFF, 0x112, 0xF170, 2); | ||
} | ||
|
||
#endregion | ||
} | ||
} |
35 changes: 20 additions & 15 deletions
35
PCRemote.Core/LockCommand.cs → PCRemote.Core/Commands/LockCommand.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,16 +1,21 @@ | ||
using System.Diagnostics; | ||
|
||
namespace PCRemote.Core | ||
{ | ||
public class LockCommand : ICommand | ||
{ | ||
#region ICommand Members | ||
|
||
public void Execute() | ||
{ | ||
Process.Start("rundll32.exe", "user32.dll,LockWorkStation"); | ||
} | ||
|
||
#endregion | ||
} | ||
#region using | ||
|
||
using System.Diagnostics; | ||
using PCRemote.Core.Contracts; | ||
|
||
#endregion | ||
|
||
namespace PCRemote.Core.Commands | ||
{ | ||
public class LockCommand : ICommand | ||
{ | ||
#region ICommand Members | ||
|
||
public void Execute() | ||
{ | ||
Process.Start("rundll32.exe", "user32.dll,LockWorkStation"); | ||
} | ||
|
||
#endregion | ||
} | ||
} |
35 changes: 20 additions & 15 deletions
35
PCRemote.Core/LogoffCommand.cs → PCRemote.Core/Commands/LogoffCommand.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,16 +1,21 @@ | ||
using System.Diagnostics; | ||
|
||
namespace PCRemote.Core | ||
{ | ||
public class LogoffCommand : ICommand | ||
{ | ||
#region ICommand Members | ||
|
||
public void Execute() | ||
{ | ||
Process.Start("shutdown", "-l -f"); | ||
} | ||
|
||
#endregion | ||
} | ||
#region using | ||
|
||
using System.Diagnostics; | ||
using PCRemote.Core.Contracts; | ||
|
||
#endregion | ||
|
||
namespace PCRemote.Core.Commands | ||
{ | ||
public class LogoffCommand : ICommand | ||
{ | ||
#region ICommand Members | ||
|
||
public void Execute() | ||
{ | ||
Process.Start("shutdown", "-l -f"); | ||
} | ||
|
||
#endregion | ||
} | ||
} |
119 changes: 64 additions & 55 deletions
119
PCRemote.Core/MediaCommand.cs → PCRemote.Core/Commands/MediaCommand.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,56 +1,65 @@ | ||
using System; | ||
using PCRemote.Core.Utilities; | ||
|
||
namespace PCRemote.Core | ||
{ | ||
public enum MediaKey | ||
{ | ||
PlayPause = 0, | ||
Next = 1, | ||
Previous = 2, | ||
Stop = 3, | ||
VolumeUp, | ||
VolumeDown, | ||
Mute | ||
} | ||
|
||
public class MediaCommand : ICommand | ||
{ | ||
private MediaKey _mediaKey; | ||
|
||
public MediaCommand(MediaKey mediaKey) | ||
{ | ||
_mediaKey = mediaKey; | ||
} | ||
|
||
public void Execute() | ||
{ | ||
switch (_mediaKey) | ||
{ | ||
case MediaKey.PlayPause: | ||
InputUtility.Send(InputUtility.Keyboard.MediaPlayPause); | ||
break; | ||
case MediaKey.Next: | ||
InputUtility.Send(InputUtility.Keyboard.MediaNextTrack); | ||
break; | ||
case MediaKey.Previous: | ||
InputUtility.Send(InputUtility.Keyboard.MediaPreviousTrack); | ||
break; | ||
case MediaKey.Stop: | ||
InputUtility.Send(InputUtility.Keyboard.MediaStop); | ||
break; | ||
case MediaKey.VolumeUp: | ||
InputUtility.Send(InputUtility.Keyboard.VolumeUp); | ||
break; ; | ||
case MediaKey.VolumeDown: | ||
InputUtility.Send(InputUtility.Keyboard.VolumeDown); | ||
break; | ||
case MediaKey.Mute: | ||
InputUtility.Send(InputUtility.Keyboard.VolumeMute); | ||
break; | ||
default: | ||
break; | ||
} | ||
} | ||
} | ||
#region using | ||
|
||
using PCRemote.Core.Contracts; | ||
using PCRemote.Core.Utilities; | ||
|
||
#endregion | ||
|
||
namespace PCRemote.Core.Commands | ||
{ | ||
public enum MediaKey | ||
{ | ||
PlayPause = 0, | ||
Next = 1, | ||
Previous = 2, | ||
Stop = 3, | ||
VolumeUp, | ||
VolumeDown, | ||
Mute | ||
} | ||
|
||
public class MediaCommand : ICommand | ||
{ | ||
readonly MediaKey _mediaKey; | ||
|
||
public MediaCommand(MediaKey mediaKey) | ||
{ | ||
_mediaKey = mediaKey; | ||
} | ||
|
||
#region ICommand Members | ||
|
||
public void Execute() | ||
{ | ||
switch (_mediaKey) | ||
{ | ||
case MediaKey.PlayPause: | ||
InputUtility.Send(InputUtility.Keyboard.MediaPlayPause); | ||
break; | ||
case MediaKey.Next: | ||
InputUtility.Send(InputUtility.Keyboard.MediaNextTrack); | ||
break; | ||
case MediaKey.Previous: | ||
InputUtility.Send(InputUtility.Keyboard.MediaPreviousTrack); | ||
break; | ||
case MediaKey.Stop: | ||
InputUtility.Send(InputUtility.Keyboard.MediaStop); | ||
break; | ||
case MediaKey.VolumeUp: | ||
InputUtility.Send(InputUtility.Keyboard.VolumeUp); | ||
break; | ||
; | ||
case MediaKey.VolumeDown: | ||
InputUtility.Send(InputUtility.Keyboard.VolumeDown); | ||
break; | ||
case MediaKey.Mute: | ||
InputUtility.Send(InputUtility.Keyboard.VolumeMute); | ||
break; | ||
default: | ||
break; | ||
} | ||
} | ||
|
||
#endregion | ||
} | ||
} |
Oops, something went wrong.