本文整理汇总了C#中SC类的典型用法代码示例。如果您正苦于以下问题:C# SC类的具体用法?C# SC怎么用?C# SC使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
SC类属于命名空间,在下文中一共展示了SC类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: SetPlugin
public override void SetPlugin(SC.Interfaces.IScPluginClient plugin)
{
if (plugin != null && plugin is SC.Interfaces.IScServerPluginClient)
this.plugin = plugin as SC.Interfaces.IScServerPluginClient;
RefreshView();
}
示例2: PluginClicked
private void PluginClicked(SC.Interfaces.IScPluginClient plugin)
{
int y = 0;
pnlContent.Controls.Clear();
SC.GUI.Utility.PluginPanelBase[] panels = null;
try
{
panels = pluginPanelLoader.GetPanels(plugin);
}
catch (Exception e)
{
SC.GUI.Utility.ErrorForm.ShowErrorForm(e);
return;
}
foreach (SC.GUI.Utility.PluginPanelBase panel in panels)
{
try
{
panel.Name = plugin.ToString() + y;
panel.Location = new Point(0, y);
y += panel.Size.Height + 10;
pnlContent.Controls.Add(panel);
panel.Show();
}
catch (Exception e)
{
SC.GUI.Utility.ErrorForm.ShowErrorForm(e);
}
}
}
示例3: _PostSystemCommand
private static void _PostSystemCommand(Window window, SC command) {
IntPtr hwnd = new WindowInteropHelper(window).Handle;
if (hwnd == IntPtr.Zero || !NativeMethods.IsWindow(hwnd)) {
return;
}
NativeMethods.PostMessage(hwnd, WM.SYSCOMMAND, new IntPtr((int)command), IntPtr.Zero);
}
示例4: CreatePluginPanel
public SC.GUI.Utility.PluginPanelBase CreatePluginPanel(SC.Interfaces.IScPluginClient plugin)
{
if (!IsPanelForPlugin(plugin))
throw new ArgumentException("This plugin panel is for a different type of plugins.");
SC.GUI.Utility.PluginPanelBase pluginpanel = Activator.CreateInstance(pluginPanelType) as SC.GUI.Utility.PluginPanelBase;
pluginpanel.SetPlugin(plugin);
return pluginpanel;
}
示例5: AttachServer
public virtual void AttachServer(SC.Interfaces.IPluginServer server)
{
if (license == null)
throw new InvalidOperationException("No license assigned.");
license.AssertValid();
this.server = server;
RestoreSettings();
}
示例6: SetPlugin
public override void SetPlugin(SC.Interfaces.IScPluginClient plugin)
{
if (plugin == null)
throw new ArgumentNullException("plugin");
else if (!(plugin is SC.Interfaces.DefaultPlugins.IManualControl))
throw new ArgumentException("plugin");
this.plugin = plugin as SC.Interfaces.DefaultPlugins.IManualControl;
RefreshView();
}
示例7: Activation
public Activation(DateTime startTime, SC.Interfaces.DefaultPlugins.DurationType durationType, SC.Interfaces.DefaultPlugins.ISCTimeSpan duration, SC.Interfaces.DefaultPlugins.ISCTimeSpan repetitionTime)
{
if (new SCTimeSpan(repetitionTime) > SCTimeSpan.Zero && new SCTimeSpan(repetitionTime) <= new SCTimeSpan(duration))
throw new ArgumentException("Repitition time must be larger than duration");
this.startTime = startTime;
this.duration = duration;
this.durationType = durationType;
this.repetitionTime = repetitionTime;
}
示例8: License
public void License(SC.Interfaces.ILicensee licensee)
{
if (RequiresLicense(licensee))
{
Guid guid = Guid.NewGuid();
while (licenses.ContainsKey(guid) || guid == Guid.Empty)
guid = Guid.NewGuid();
SC.Interfaces.LicenseRequest req = GetLicenseRequest(licensee.GetType());
string licName = req.LicenseName;
bool valid = false;
while (req != null)
{
if (licenseinfos.ContainsKey(req.LicenseName))
{
LicenseInfo info = licenseinfos[req.LicenseName];
if (!(valid = info.Count > GetUsedLicenseCount(req.LicenseName)))
{
valid = false;
break;
}
else if (info.IsValid)
{
req = null;
}
}
else
{
valid = false;
req = null;
}
}
if (valid)
{
Logger.Info("Granting license " + licName + " to " + licensee.ToString());
License lic = new License(guid, licName);
licensee.AssignLicense(lic);
licenses.Add(guid, lic);
}
else
{
Logger.Info("No license " + licName + " available for " + licensee.ToString());
licensee.AssignLicense(new License(Guid.Empty, licName));
}
}
}
示例9: OnKey
/// <summary>
/// Get input from the keyboard hook; return true if the key was handled
/// and needs to be removed from the input chain.
/// </summary>
public static bool OnKey(WM ev, VK vk, SC sc, LLKHF flags)
{
// Remember when the user touched a key for the last time
m_last_key_time = DateTime.Now;
// Do nothing if we are disabled
if (m_disabled)
{
return false;
}
int dead_key = SaveDeadKey();
bool ret = OnKeyInternal(ev, vk, sc, flags);
RestoreDeadKey(dead_key);
return ret;
}
示例10: RemoveMenu
public static void RemoveMenu(IntPtr hMenu, SC uPosition, MF uFlags)
{
if (!_RemoveMenu(hMenu, (uint)uPosition, (uint)uFlags))
{
throw new Win32Exception();
}
}
示例11: server_ProcessChanged
void server_ProcessChanged(object sender, SC.Interfaces.ProcessChangedEventArgs args)
{
doSet = true;
}
示例12: ProcessChangedEventArgs
public ProcessChangedEventArgs(SC.Interfaces.IProcess newProcess)
{
process = newProcess;
}
示例13: VkToUnicode
private static string VkToUnicode(VK vk, SC sc, byte[] keystate, LLKHF flags)
{
const int buflen = 4;
byte[] buf = new byte[2 * buflen];
int ret = NativeMethods.ToUnicode(vk, sc, keystate, buf, buflen, flags);
if (ret > 0 && ret < buflen)
{
return Encoding.Unicode.GetString(buf, 0, ret * 2);
}
return "";
}
示例14: OnKeyInternal
private static bool OnKeyInternal(WM ev, VK vk, SC sc, LLKHF flags)
{
bool is_keydown = (ev == WM.KEYDOWN || ev == WM.SYSKEYDOWN);
bool is_keyup = !is_keydown;
bool add_to_sequence = is_keydown;
bool is_capslock_hack = false;
bool compose_is_altgr = m_possible_altgr_keys.Count > 0
&& Settings.ComposeKey.Value.VirtualKey == VK.RMENU;
bool has_shift = (NativeMethods.GetKeyState(VK.SHIFT) & 0x80) != 0;
bool has_altgr = (NativeMethods.GetKeyState(VK.LCONTROL) &
NativeMethods.GetKeyState(VK.RMENU) & 0x80) != 0;
bool has_lrshift = (NativeMethods.GetKeyState(VK.LSHIFT) &
NativeMethods.GetKeyState(VK.RSHIFT) & 0x80) != 0;
bool has_capslock = NativeMethods.GetKeyState(VK.CAPITAL) != 0;
// Guess what the system would print if we weren’t interfering. If
// a printable representation exists, use that. Otherwise, default
// to its virtual key code.
Key key = VkToKey(vk, sc, flags, has_shift, has_altgr, has_capslock);
// If Caps Lock is on, and the Caps Lock hack is enabled, we check
// whether this key without Caps Lock gives a non-ASCII alphabetical
// character. If so, we replace “result” with the lowercase or
// uppercase variant of that character.
if (has_capslock && Settings.CapsLockCapitalizes.Value)
{
Key alt_key = VkToKey(vk, sc, flags, has_shift, has_altgr, false);
if (alt_key.IsPrintable() && alt_key.ToString()[0] > 0x7f)
{
string str_upper = alt_key.ToString().ToUpper();
string str_lower = alt_key.ToString().ToLower();
// Hack for German keyboards: it seems that ToUpper() does
// not properly change ß into ẞ.
if (str_lower == "ß")
str_upper = "ẞ";
if (str_upper != str_lower)
{
key = new Key(has_shift ? str_lower : str_upper);
is_capslock_hack = true;
}
}
}
// Update statistics
if (is_keydown)
{
// Update single key statistics
Stats.AddKey(key);
// Update key pair statistics if applicable
if (DateTime.Now < m_last_key_time.AddMilliseconds(2000)
&& m_last_key != null)
{
Stats.AddPair(m_last_key, key);
}
// Remember when we pressed a key for the last time
m_last_key_time = DateTime.Now;
m_last_key = key;
}
// If the special Synergy window has focus, we’re actually sending
// keystrokes to another computer; disable WinCompose.
if (m_window_is_synergy)
{
return false;
}
// If we receive a keyup for the compose key while in emulation
// mode, we’re done. Send a KeyUp event and exit emulation mode.
if (is_keyup && key == Settings.ComposeKey.Value
&& CurrentState == State.Combination)
{
Log.Debug("Combination Off");
CurrentState = State.Idle;
m_compose_counter = 0;
// If relevant, send an additional KeyUp for the opposite
// key; experience indicates that it helps unstick some
// applications such as mintty.exe.
switch (Settings.ComposeKey.Value.VirtualKey)
{
case VK.LMENU: SendKeyUp(VK.RMENU); break;
case VK.RMENU: SendKeyUp(VK.LMENU);
if (compose_is_altgr)
SendKeyUp(VK.LCONTROL);
break;
case VK.LSHIFT: SendKeyUp(VK.RSHIFT); break;
case VK.RSHIFT: SendKeyUp(VK.LSHIFT); break;
case VK.LCONTROL: SendKeyUp(VK.RCONTROL); break;
case VK.RCONTROL: SendKeyUp(VK.LCONTROL); break;
}
return false;
}
//.........这里部分代码省略.........
示例15: OnKeyInternal
private static bool OnKeyInternal(WM ev, VK vk, SC sc, LLKHF flags)
{
//CheckKeyboardLayout();
bool is_keydown = (ev == WM.KEYDOWN || ev == WM.SYSKEYDOWN);
bool is_keyup = !is_keydown;
bool is_capslock_hack = false;
bool has_shift = (NativeMethods.GetKeyState(VK.SHIFT) & 0x80) != 0;
bool has_altgr = (NativeMethods.GetKeyState(VK.LCONTROL) &
NativeMethods.GetKeyState(VK.RMENU) & 0x80) != 0;
bool has_lrshift = (NativeMethods.GetKeyState(VK.LSHIFT) &
NativeMethods.GetKeyState(VK.RSHIFT) & 0x80) != 0;
bool has_capslock = NativeMethods.GetKeyState(VK.CAPITAL) != 0;
// Guess what the system would print if we weren’t interfering. If
// a printable representation exists, use that. Otherwise, default
// to its virtual key code.
Key key = VkToKey(vk, sc, flags, has_shift, has_altgr, has_capslock);
// If Caps Lock is on, and the Caps Lock hack is enabled, we check
// whether this key without Caps Lock gives a non-ASCII alphabetical
// character. If so, we replace “result” with the lowercase or
// uppercase variant of that character.
if (has_capslock && Settings.CapsLockCapitalizes.Value)
{
Key alt_key = VkToKey(vk, sc, flags, has_shift, has_altgr, false);
if (alt_key.IsPrintable() && alt_key.ToString()[0] > 0x7f)
{
string str_upper = alt_key.ToString().ToUpper();
string str_lower = alt_key.ToString().ToLower();
if (str_upper != str_lower)
{
key = new Key(has_shift ? str_lower : str_upper);
is_capslock_hack = true;
}
}
}
// Update statistics
if (is_keydown)
{
// Update single key statistics
Stats.AddKey(key);
// Update key pair statistics if applicable
if (DateTime.Now < m_last_key_time.AddMilliseconds(2000)
&& m_last_key != null)
{
Stats.AddPair(m_last_key, key);
}
// Remember when we pressed a key for the last time
m_last_key_time = DateTime.Now;
m_last_key = key;
}
// FIXME: we don’t properly support compose keys that also normally
// print stuff, such as `.
if (key == Settings.ComposeKey.Value)
{
// If we receive a keyup for the compose key while in emulation
// mode, we’re done. Send a KeyUp event and exit emulation mode.
if (is_keyup && CurrentState == State.Combination)
{
Log.Debug("Combination Off");
CurrentState = State.Idle;
m_compose_down = false;
// If relevant, send an additional KeyUp for the opposite
// key; experience indicates that it helps unstick some
// applications such as mintty.exe.
switch (Settings.ComposeKey.Value.VirtualKey)
{
case VK.LMENU: SendKeyUp(VK.RMENU); break;
case VK.RMENU: SendKeyUp(VK.LMENU); break;
case VK.LSHIFT: SendKeyUp(VK.RSHIFT); break;
case VK.RSHIFT: SendKeyUp(VK.LSHIFT); break;
case VK.LCONTROL: SendKeyUp(VK.RCONTROL); break;
case VK.RCONTROL: SendKeyUp(VK.LCONTROL); break;
}
return false;
}
if (is_keydown && !m_compose_down)
{
// FIXME: we don't want compose + compose to disable composing,
// since there are compose sequences that use Multi_key.
switch (CurrentState)
{
case State.Sequence:
// FIXME: also, if a sequence was in progress, print it!
CurrentState = State.Idle;
m_sequence.Clear();
break;
case State.Idle:
CurrentState = State.Sequence;
// Lauch the sequence reset expiration thread
//.........这里部分代码省略.........