protected override void HandleButton(ButtonMessage <SubMenuKey> m) { base.HandleButton(m); // important general commands switch (m.Key) { case SubMenuKey.FileExit: // will want confirmation and preliminaries/housekeeping System.Windows.Application.Current.Shutdown(); break; case SubMenuKey.HelpTroubleshoot: Diplomat.Troubleshooter.Shoot(); break; case SubMenuKey.HelpUpgrade: if (UpgradeUri != null) { using (var p = Process.Start(UpgradeUri.ToString())) { // right } } break; } }
void HandleMenu(ButtonMessage <SubMenuKey> m) { FileInfo fi; switch (m.Key) { case SubMenuKey.ReadUserPlacement: fi = LayoutFileInfo(); InvokeRestoringPanelLayout(fi); break; case SubMenuKey.ReadDefaultPlacement: ReadDefaultLayout(); break; case SubMenuKey.SaveUserPlacement: fi = LayoutFileInfo(); InvokeSavingPanelLayout(fi); break; case SubMenuKey.SaveAsPlacement: using (var dialog = new System.Windows.Forms.SaveFileDialog()) { dialog.SetFilters(Preference.FileExtWithoutDot); dialog.FileName = Preference.ClassPrefsFileOnly <MainWindow>(layoutFileQualifier); dialog.InitialDirectory = Environment.GetFolderPath(Environment.SpecialFolder.DesktopDirectory); if (dialog.ShowDialogAndOK()) { fi = new FileInfo(dialog.FileName); InvokeSavingPanelLayout(fi); } } break; } }
public async Task SendInlineKeyBoardMessage <TChatId>(TChatId chatId, ButtonMessage message, CancellationToken cancellationToken) { using (_logger.DebugLogingScope("Sending message", nameof(SendInlineKeyBoardMessage), message.ToString())) { var chat = chatId as ChatId; await _client.SendTextMessageAsync(chat, message.Text, ParseMode.Default, replyMarkup : BuildInlineKeyBoardMarkup(message.Buttons), cancellationToken : cancellationToken); await AddCallBackGroup(message, cancellationToken); } }
private async Task AddCallBackGroup(ButtonMessage message, CancellationToken cancellationToken) { var callBack = new CallBackGroup(message.MessageCallBack); callBack.AddButtons(message.Buttons.Select(x => (x.Text, x.PressCallBack)) .ToArray()); await _callBackButtonProvider.AddCallBackGroup(callBack, cancellationToken); }
/// <summary> /// 检查按钮信息,收到则返回true /// </summary> /// <param name="message">要检查的信息</param> /// <returns>检查按钮信息,收到则返回true</returns> public static bool GetButtonMessage(ButtonMessage message) { if (buttonMessageReciver[(int)message]) { buttonMessageReciver[(int)message] = false; return(true); } return(false); }
protected virtual void SendButtonData(string name, bool value) { // send button data ButtonMessage msg = new ButtonMessage(); msg.ButtonName = name; msg.ButtonState = value; this.Client.Send(InputMsgType.ButtonPress, msg); }
protected override void HandleButton(ButtonMessage <SubMenuKey> m) { base.HandleButton(m); //Debug.WriteLine(m); switch (m.Key) { case SubMenuKey.Exit: System.Windows.Application.Current.Shutdown(); // crude break; } }
void HandleMenuCommand(ButtonMessage <ExMenuKey> m) { switch (m.Key) { case ExMenuKey.FileNew: BindExample(); break; case ExMenuKey.FileDemoKey: Abnaki.Windows.Software.Wpf.Diplomat.Notifier.Notify("You hit " + m.Key); // does not need to be in ExGrid break; } }
public async void OnButtonEvent(object sender, FaderPortButtonEventArgs evt) { if (evt.State == FaderPortButtonState.Released) { _fp.SetLight(evt.Button, FaderPortLightState.Toggle); return; } _fp.SetLight(evt.Button, FaderPortLightState.Toggle); var msg = new ButtonMessage(evt.Button, evt.State == FaderPortButtonState.Pushed, FaderPortLightState.Off); await _session.Broadcast(msg); }
public bool SendButtonMessage(string client, ButtonMessage message) { this.log.Info("Handling Touch Button message: {0}", message); if (message.Command == ButtonMessage.ButtonCommands.Tap) ProviderManager.TouchProvider.ClickButton((TouchProvider.Buttons)message.Button); else if (message.Command == ButtonMessage.ButtonCommands.DoubleTap) { ProviderManager.TouchProvider.ClickButton((TouchProvider.Buttons)message.Button); ProviderManager.TouchProvider.ClickButton((TouchProvider.Buttons)message.Button); } else if (message.Command == ButtonMessage.ButtonCommands.Hold) { this.log.Warn("HOLD on button isn't implemented yet"); } return true; }
public async Task SendReplyButtonMessage(string userName, TextWithButtonModel message, CancellationToken cancellationToken) { var user = await _userProvider.GetUser(userName, cancellationToken); if (user == null) { throw new WebApiException(HttpStatusCode.NotFound, $"user by userName not found. actual: {userName}"); } var chatId = new ChatId(user.Identifier); var buttons = message.Buttons.Select(x => new Button(x.Caption)).ToList(); var buttonMessage = new ButtonMessage(message.Text, buttons, message.CallBackData); await _messageSender.SendReplayKeyBoardMessage(chatId, buttonMessage, cancellationToken); }
protected virtual void OnReceiveButton(NetworkMessage netMsg) { ButtonMessage msg = netMsg.ReadMessage <ButtonMessage> (); if (!this._buttonState.ContainsKey(msg.ButtonName)) { this._buttonState [msg.ButtonName] = InputState.None; } if (msg.ButtonState) { this._buttonState [msg.ButtonName] |= InputState.BecomePressed; } else { this._buttonState [msg.ButtonName] |= InputState.BecomeIdle; } }
void HandleMenuCommand(ButtonMessage <ExMenuKey> m) { if (m.Checked == true) { switch (m.Key) { case ExMenuKey.OptionFlagNed: ReviseColor(Brushes.Red, Brushes.White, Brushes.Blue); break; case ExMenuKey.OptionFlagAustria: ReviseColor(Brushes.Red, Brushes.White, Brushes.Red); break; case ExMenuKey.OptionFlagBulg: ReviseColor(Brushes.White, Brushes.DarkSeaGreen, Brushes.Red); break; } } }
public void ProcessButton(ButtonMessage m) { if (m == ButtonMessage.Lock) { isLocked = true; message.Send<DoorStateMessage>(DoorStateMessage.Lock); } else if (m == ButtonMessage.Unlock) { isLocked = false; message.Send<DoorStateMessage>(DoorStateMessage.Unlock); } else if (m == ButtonMessage.Auto) { isAuto = true; message.Send<DoorStateMessage>(DoorStateMessage.Auto); } else if (m == ButtonMessage.Manual) { isAuto = false; message.Send<DoorStateMessage>(DoorStateMessage.Manual); } else if (m == ButtonMessage.Open && !isLocked) { isOpening = true; message.Send<DoorStateMessage>(DoorStateMessage.Open); } else if (m == ButtonMessage.Close && !isLocked && obstacles <= 0) { isOpening = false; message.Send<DoorStateMessage>(DoorStateMessage.Close); } }
public static extern IntPtr SendMessage(HWND hWnd, ButtonMessage Msg, int wParam, ref BUTTON_SPLITINFO splitInfo);
public static extern IntPtr SendMessage(HWND hWnd, ButtonMessage Msg, int wParam, ref BUTTON_IMAGELIST imageList);
/// <summary> /// Sends the specified message to a window or windows. The SendMessage function calls the window procedure for the specified window and does not return /// until the window procedure has processed the message. /// </summary> /// <param name="hWnd"> /// A handle to the window whose window procedure will receive the message. If this parameter is HWND_BROADCAST ((HWND)0xffff), the message is sent to /// all top-level windows in the system, including disabled or invisible unowned windows, overlapped windows, and pop-up windows; but the message is not /// sent to child windows. /// </param> /// <param name="Msg">The message to be sent.</param> /// <param name="wParam">Additional message-specific information.</param> /// <param name="imageList">Additional message-specific information.</param> /// <returns>The return value specifies the result of the message processing; it depends on the message sent.</returns> public static IntPtr SendMessage(HandleRef hWnd, ButtonMessage Msg, int wParam, ref BUTTON_IMAGELIST imageList) => User32_Gdi.SendMessage(hWnd, Msg, wParam, ref imageList);
/// <summary> /// Sends the specified message to a window or windows. The SendMessage function calls the window procedure for the specified window and does not return /// until the window procedure has processed the message. /// </summary> /// <param name="hWnd"> /// A handle to the window whose window procedure will receive the message. If this parameter is HWND_BROADCAST ((HWND)0xffff), the message is sent to /// all top-level windows in the system, including disabled or invisible unowned windows, overlapped windows, and pop-up windows; but the message is not /// sent to child windows. /// </param> /// <param name="Msg">The message to be sent.</param> /// <param name="wParam">Additional message-specific information.</param> /// <param name="splitInfo">Additional message-specific information.</param> /// <returns>The return value specifies the result of the message processing; it depends on the message sent.</returns> public static IntPtr SendMessage(HandleRef hWnd, ButtonMessage Msg, int wParam, ref BUTTON_SPLITINFO splitInfo) => User32_Gdi.SendMessage(hWnd, Msg, wParam, ref splitInfo);
/// <summary> /// 发送按钮信息 /// </summary> /// <param name="message">信息</param> public static void SendButtonMessage(ButtonMessage message) { buttonMessageReciver[(int)message] = true; }
protected override void HandleButton(ButtonMessage <ButtonKey> m) { base.HandleButton(m); Debug.WriteLine(m); }