public void HandleState(SlackState state) { if (_processors.Count > 0) { _processors.First().HandleState(state); } }
protected override void OnMessage(MessageEventArgs e) { var chatStateList = JsonConvert.DeserializeObject <List <ChatState> >(e.Data); SlackState slackState = new SlackState(chatStateList); OnSlackStateChanged(this, slackState); }
private void SnoozeChat(SlackState lastSlackState, string chatName) { var snoozedChatState = new ChatState { name = chatName }; var originalChatState = lastSlackState.ReplaceChatState(snoozedChatState); _snoozedChats[chatName] = originalChatState; }
private void SnoozeChat(SlackState lastSlackState, string chatName) { var snoozedChatState = new ChatState { Id = chatName, Unread = false, Mention = false }; var originalChatState = lastSlackState.ReplaceChatState(snoozedChatState); _snoozedChannelStates[chatName] = originalChatState; }
private void ChangeSlackState(SlackState slackState) { _lastSlackState = slackState; // Change the icon and the tooltip slackTrayIcon.Text = slackState.TrayState.ToString(); using (var stream = this.GetType().Assembly.GetManifestResourceStream("SlackWindowsTray.Icons." + slackState.TrayState + ".ico")) { slackTrayIcon.Icon = new Icon(stream); } }
protected override bool HandleStateRaw(SlackState slackState) { _lastSlackState = slackState; _lastTrayState = slackState.TrayState; // Start the animation if possible and enabled var canAnimateIcon = SlackWindowsTray.Default.ToBlinkOnMention&& _lastTrayState == TrayStates.ImportantUnread; canAnimateIcon |= SlackWindowsTray.Default.ToBlinkOnUnread && _lastTrayState == TrayStates.Unread; _animationTimer.Enabled = canAnimateIcon; return true; }
private void HandleState(SlackState slackState, bool skipMyself) { var continueToNextProcessor = true; if (!skipMyself) { continueToNextProcessor = this.HandleStateRaw(slackState); } if (continueToNextProcessor && Next != null) { Next.HandleState(slackState.Clone()); } }
protected override bool HandleStateRaw(SlackState slackState) { _lastSlackState = slackState; _lastTrayState = slackState.TrayState; // Start the animation if possible and enabled var canAnimateIcon = SlackWindowsTray.Default.ToBlinkOnMention && _lastTrayState == TrayStates.ImportantUnread; canAnimateIcon |= SlackWindowsTray.Default.ToBlinkOnUnread && _lastTrayState == TrayStates.Unread; _animationTimer.Enabled = canAnimateIcon; return(true); }
protected override void OnMessage(MessageEventArgs e) { dynamic message = JsonConvert.DeserializeObject(e.Data); if (message.command == "chat-state") { var bodyString = JsonConvert.SerializeObject(message.body); var chatStateList = JsonConvert.DeserializeObject <List <ChatState> >(bodyString); SlackState slackState = new SlackState(chatStateList); OnSlackStateChanged(this, slackState); } else if (message.command == "version") { var version = Assembly.GetExecutingAssembly().GetName().Version; message.body = string.Format("{0}.{1}", version.Major, version.Minor); this.Send(JsonConvert.SerializeObject(message)); } }
protected override bool HandleStateRaw(SlackState slackState) { _lastSlackState = slackState; if (_allSnoozed) { // Don't proceed with the state change if everything is snoozed - We don't want to show anything to the user anyway return(false); } else { foreach (var chatName in _snoozedChats.Keys) { SnoozeChat(_lastSlackState, chatName); } return(true); } }
protected override bool HandleStateRaw(SlackState slackState) { _lastSlackState = slackState; if (_snoozingService.IsDndMode) { // Don't proceed with the state change if everything is snoozed - We don't want to show anything to the user anyway return false; } else { List<string> channelIds = slackState.ChatStates.Select(chatState => chatState.Id).ToList(); foreach (var channelId in channelIds) { if (_snoozingService.IsChannelSnoozed(channelId)) { SnoozeChat(slackState, channelId); } } return true; } }
protected override bool HandleStateRaw(SlackState slackState) { _lastSlackState = slackState; if (_snoozingService.IsDndMode) { // Don't proceed with the state change if everything is snoozed - We don't want to show anything to the user anyway return(false); } else { List <string> channelIds = slackState.ChatStates.Select(chatState => chatState.Id).ToList(); foreach (var channelId in channelIds) { if (_snoozingService.IsChannelSnoozed(channelId)) { SnoozeChat(slackState, channelId); } } return(true); } }
protected override void OnMessage(MessageEventArgs e) { dynamic message = JsonConvert.DeserializeObject(e.Data); if (message.command == "chat-state") { var bodyString = JsonConvert.SerializeObject(message.body); List<ChatState> chatStateList = JsonConvert.DeserializeObject<List<ChatState>>(bodyString); foreach (var state in chatStateList) { state.Name = _slakApi.SlackIdToName(state.Id); } SlackState slackState = new SlackState(chatStateList); OnSlackStateChanged(this, slackState); } else if (message.command == "version") { var version = Assembly.GetExecutingAssembly().GetName().Version; message.body = string.Format("{0}.{1}", version.Major, version.Minor); this.Send(JsonConvert.SerializeObject(message)); } }
private void SnoozeChat(SlackState lastSlackState, string chatName) { var snoozedChatState = new ChatState {Id = chatName, Unread = false, Mention = false}; var originalChatState = lastSlackState.ReplaceChatState(snoozedChatState); _snoozedChannelStates[chatName] = originalChatState; }
protected abstract bool HandleStateRaw(SlackState slackState);
protected override bool HandleStateRaw(SlackState slackState) { _callbackAction(slackState); return true; }
protected override bool HandleStateRaw(SlackState slackState) { return(true); }
private void UpdateState(SlackState state) { _lastSlackState = state; _processorsChain.HandleState(state); }
public void HandleState(SlackState slackState) { HandleState(slackState, skipMyself: false); }
protected void NextHandleState(SlackState slackState) { HandleState(slackState, skipMyself: true); }
protected override bool HandleStateRaw(SlackState slackState) { _callbackAction(slackState); return(true); }