public NotificationsPublisherTestsFixtures() { _autoFixture = new Fixture(); EndpointInstance = new Mock <IEndpointInstance>(); MessageSession = EndpointInstance.As <IMessageSession>(); CommitmentsLogger = new Mock <ICommitmentsLogger>(); EncodingService = new Mock <IEncodingService>(); Commitment = _autoFixture.Create <Commitment>(); Sut = new NotificationsPublisher(EndpointInstance.Object, CommitmentsLogger.Object, EncodingService.Object); }
private bool OnNewShortcutPressed(KeyEventArgs e) { bool stopListening = true; var button = (YamuiButton)scrollPanel.ContentPanel.Controls["bt" + _currentItemId]; // the user presses escape to cancel the current shortcut modification if (e.KeyCode == Keys.Escape) { button.Text = Config.Instance.ShortCuts[_currentItemId]; } else if (e.KeyCode != Keys.ControlKey && e.KeyCode != Keys.ShiftKey && e.KeyCode != Keys.Menu) { var newSpec = (new ShortcutKey(e.Control, e.Alt, e.Shift, e.KeyCode)).ToString(); // don't override an existing shortcut if (Config.Instance.ShortCuts.ContainsValue(newSpec)) { UserCommunication.Notify("Sorry, this shortcut is already used by the following function :<br>" + AppliMenu.Instance.ShortcutableItemList.First(item => item.ItemSpec.Equals(newSpec)).DisplayText, MessageImg.MsgInfo, "Modifying shortcut", "Existing key", 3); return(true); } // change the shortcut in the settings if (Config.Instance.ShortCuts.ContainsKey(_currentItemId)) { Config.Instance.ShortCuts[_currentItemId] = newSpec; } else { Config.Instance.ShortCuts.Add(_currentItemId, newSpec); } // take into account the changes NotificationsPublisher.SetHooks(); button.Text = Config.Instance.ShortCuts[_currentItemId]; } else { stopListening = false; } // stop listening to button pressed if (stopListening) { _waitingInput = false; KeyboardMonitor.Instance.KeyDownByPass -= OnNewShortcutPressed; BlinkButton(button, ThemeManager.Current.ThemeAccentColor); } return(true); }
public static void ReadCurrentFileAsProgress() { if (Npp.CurrentFileInfo.IsProgress) { // reset to default lang through notepad++ Npp.CurrentLangId = Npp.CurrentLangId; Npp.CurrentFileInfo.SetAsNonProgress(); } else { Npp.CurrentFileInfo.SetAsProgress(); } NotificationsPublisher.OnNppNotification(new SCNotification((uint)NppNotif.NPPN_BUFFERACTIVATED)); // simulate buffer activated }
private void UndoButtonOnButtonPressed(object sender, EventArgs eventArgs) { _currentItemId = (string)((YamuiButtonImage)sender).Tag; if (Config.Instance.ShortCuts.ContainsKey(_currentItemId)) { Config.Instance.ShortCuts.Remove(_currentItemId); } // take into account the changes NotificationsPublisher.SetHooks(); ((YamuiButton)scrollPanel.ContentPanel.Controls["bt" + _currentItemId]).Text = (Config.Instance.ShortCuts.ContainsKey(_currentItemId)) ? Config.Instance.ShortCuts[_currentItemId] : ""; }