示例#1
0
        private void OnOnFiltersChanged()
        {
            var count = QuickFilters.Count(x => x.IsActive);

            QuickInfo = count > 0 ? string.Format("{0} active", count) : null;
            OnFiltersChanged?.Invoke();
        }
示例#2
0
        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();
        }
示例#4
0
        private void OnRemoveQuickFilter(QuickFilterViewModel viewModel)
        {
            _viewModels.Remove(viewModel);
            _quickFilters.Remove(viewModel.Id);
            viewModel.PropertyChanged -= QuickFilterOnPropertyChanged;

            OnFilterRemoved?.Invoke();

            if (viewModel.IsActive)
            {
                OnFiltersChanged?.Invoke();
            }
        }
示例#5
0
        /// <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();
            }
        }
示例#6
0
        private void ResetFilters()
        {
            foreach (var key in ActiveFilters.Keys.ToList())
            {
                ActiveFilters[key] = false;
            }

            foreach (var button in buttons)
            {
                button.Value.On = false;
            }

            OnFiltersChanged?.Invoke();
        }
示例#7
0
        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;
            }
        }