private void OnOnFiltersChanged() { var count = QuickFilters.Count(x => x.IsActive); QuickInfo = count > 0 ? string.Format("{0} active", count) : null; OnFiltersChanged?.Invoke(); }
protected void SendEvent(string eventName, string data) { switch (eventName) { case "update": var status = JsonConvert.DeserializeObject <Status>(data); OnUpdate?.Invoke(this, new StreamUpdateEventArgs(status)); break; case "notification": var notification = JsonConvert.DeserializeObject <Notification>(data); OnNotification?.Invoke(this, new StreamNotificationEventArgs(notification)); break; case "delete": var statusId = (data); OnDelete?.Invoke(this, new StreamDeleteEventArgs(statusId)); break; case "filters_changed": OnFiltersChanged?.Invoke(this, new StreamFiltersChangedEventArgs()); break; case "conversation": var conversation = JsonConvert.DeserializeObject <Conversation>(data); OnConversation?.Invoke(this, new StreamConversationEvenTargs(conversation)); break; } }
private void OnOnFiltersChanged() { var count = QuickFilters.Count(x => x.IsActive); if (!TimeFilters.SelectEverything) { ++count; } QuickInfo = count > 0 ? string.Format("{0} active", count) : null; OnFiltersChanged?.Invoke(); }
private void OnRemoveQuickFilter(QuickFilterViewModel viewModel) { _viewModels.Remove(viewModel); _quickFilters.Remove(viewModel.Id); viewModel.PropertyChanged -= QuickFilterOnPropertyChanged; OnFilterRemoved?.Invoke(); if (viewModel.IsActive) { OnFiltersChanged?.Invoke(); } }
/// <summary> /// Toggles On/Off the filter for the given type. /// </summary> public void ToggleFilter(IngredientType filter) { if (ActiveFilters.TryGetValue(filter, out var toggle)) { ActiveFilters[filter] = !toggle; if (buttons.TryGetValue(filter, out var button)) { button.On = !toggle; } OnFiltersChanged?.Invoke(); } }
private void ResetFilters() { foreach (var key in ActiveFilters.Keys.ToList()) { ActiveFilters[key] = false; } foreach (var button in buttons) { button.Value.On = false; } OnFiltersChanged?.Invoke(); }
private void QuickFilterOnPropertyChanged(object sender, PropertyChangedEventArgs args) { var model = sender as QuickFilterViewModel; if (model == null) { return; } switch (args.PropertyName) { case "Value": case "IsActive": case "IsInverted": case "DropType": case "MatchType": if (!_isChangingCurrentDataSource) { OnFiltersChanged?.Invoke(); } break; } }