Skip to content

Commit

Permalink
支持腾讯微博
Browse files Browse the repository at this point in the history
  • Loading branch information
terryso committed Jul 6, 2011
1 parent 1b6abac commit 3b50e38
Show file tree
Hide file tree
Showing 39 changed files with 1,204 additions and 841 deletions.
@@ -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
}
}
@@ -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
}
}
@@ -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
}
}
@@ -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
}
}
@@ -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
}
}

0 comments on commit 3b50e38

Please sign in to comment.