protected override void Initialize(IObservable <EventPattern <WMEventArgs> > windowMessages, IObservable <bool> disabled) { var keyNotifications = windowMessages .Select <EventPattern <WMEventArgs>, KeyNotification>(e => { var a = e.EventArgs; switch (a.Message) { case WM.KEYDOWN: case WM.SYSKEYDOWN: return(new KeyDownNotification((Keys)a.WParam, this)); case WM.CHAR: case WM.SYSCHAR: return(new KeyPressNotification((char)a.WParam, this)); case WM.KEYUP: case WM.SYSKEYUP: return(new KeyUpNotification((Keys)a.WParam, this)); } return(null); } ) .OfType <KeyNotification>(); var keyboard = new Keyboard(keyNotifications); FKeyboardOut[0] = keyboard; // Subscribe to the keyboard so we can write the legacy keyboard string output FKeyboardSubscription = keyboard.KeyNotifications .OfType <KeyCodeNotification>() .Subscribe(keyNotification => { var keyCode = keyNotification.KeyCode; var keyName = LegacyKeyboardHelper.VirtualKeycodeToString(keyCode); switch (keyNotification.Kind) { case KeyNotificationKind.KeyDown: if (!FLegacyKeyStringOut.Contains(keyName)) { FLegacyKeyStringOut.Add(keyName); } break; case KeyNotificationKind.KeyUp: FLegacyKeyStringOut.Remove(keyName); break; default: break; } } ); // Create a keyboard split node for us and connect our keyboard out to its keyboard in var nodeInfo = FIOFactory.NodeInfos.First(n => n.Name == "KeyboardState" && n.Category == "System" && n.Version == "Split Legacy"); FKeyboardSplitNode = FIOFactory.CreatePlugin(nodeInfo, c => c.IOAttribute.Name == "Keyboard", c => FKeyboardOut); }
public void GetDestroyedResult(ITweet tweeto, long tweetId) { if (tweeto.IsTweetDestroyed) { FActionStatus[0] = "Tweet " + tweetId.ToString() + " has been destroyed, f*****g smashing it big time."; FLogger.Log(LogType.Debug, "Tweet " + tweetId.ToString() + " has been destroyed, f*****g smashing it big time."); FActionDone[0] = true; } else { FActionStatus[0] = "FAILED! Couldn't kill that tweet."; FLogger.Log(LogType.Debug, "FAILED! Couldn't kill that tweet."); } listTweetsPublished.Remove(tweetId.ToString()); numOfTweetsPublished = listTweetsPublished.Count; FPublishedTweetId.Remove(tweetId.ToString()); FLogger.Log(LogType.Debug, "Tweet " + tweetId.ToString() + " has been removed from published list"); }