Esempio n. 1
0
        void ManageFilter_Loaded(object sender, RoutedEventArgs e)
        {
            if (_initialized)
                return;
            Filter = DataTransfer.Filter;

            if (Filter == null)
                MessageAndExit(Localization.Resources.CouldntLoadFilter);

            if (Filter.Type == FilterType.User)
                Resource.SelectedIndex = 0;
            else if (Filter.Type == FilterType.Source)
                Resource.SelectedIndex = 1;
            else if (Filter.Type == FilterType.Text)
                Resource.SelectedIndex = 2;

            FilterText.Text = Filter.Filter;

            date.Value = Filter.IsValidUntil.Date;
            time.Value = Filter.IsValidUntil;

            if (Filter.Inclusion == IncludeOrExclude.Include)
                Inclusion.SelectedIndex = 1;
            else
                Inclusion.SelectedIndex = 0;

            _initialized = true;
        }
Esempio n. 2
0
 public void AddFilter(ITweetableFilter predicate)
 {
     if (!_predicates.Contains(predicate))
     {
         _predicates.Add(predicate);
     }
 }
Esempio n. 3
0
 public void RemoveFilter(ITweetableFilter predicate)
 {
     try
     {
         _predicates.Remove(predicate);
     }
     catch
     {
     }
 }
Esempio n. 4
0
        public static ITweetableFilter SetupMute(FilterType type, string data)
        {
            if (Config.GlobalFilter == null)
                Config.GlobalFilter = new ColumnFilter();

            ITweetableFilter filter = new ITweetableFilter();
            filter.Inclusion = IncludeOrExclude.Exclude;
            filter.Type = type;
            filter.Filter = data;
            if (Config.DefaultMuteTime == TimeSpan.MaxValue)
                filter.IsValidUntil = DateTime.MaxValue;
            else
                filter.IsValidUntil = DateTime.Now + (TimeSpan)Config.DefaultMuteTime;

            Config.GlobalFilter.AddFilter(filter);
            Config.GlobalFilter = Config.GlobalFilter; // Force save.
            GlobalEvents.FireFiltersChanged(filter, new EventArgs());

            return filter;
        }
Esempio n. 5
0
        private void ApplicationBarIconButton_Click(object sender, System.EventArgs e)
        {
            ITweetableFilter filter = new ITweetableFilter();

            if (Resource.SelectedIndex == 0)
                filter.Type = FilterType.User;
            else if (Resource.SelectedIndex == 1)
                filter.Type = FilterType.Source;
            else if (Resource.SelectedIndex == 2)
                filter.Type = FilterType.Text;
            else
            {
                MessageAndExit(Localization.Resources.ErrorSavingFilter);
                return;
            }

            filter.Filter = FilterText.Text;

            filter.IsValidUntil = new DateTime(
                date.Value.Value.Year,
                date.Value.Value.Month,
                date.Value.Value.Day,
                time.Value.Value.Hour,
                time.Value.Value.Minute,
                0);

            if (Inclusion.SelectedIndex == 1)
                filter.Inclusion = IncludeOrExclude.Include;
            else
                filter.Inclusion = IncludeOrExclude.Exclude;

            DataTransfer.cFilter.RemoveFilter(Filter);
            DataTransfer.cFilter.AddFilter(filter);
            DataTransfer.Filter = filter;

            NavigationService.GoBack();
        }
Esempio n. 6
0
        private ITweetableFilter CreateNewFilter(FilterType type, string data)
        {
            if (Config.GlobalFilter == null)
                Config.GlobalFilter = new ColumnFilter();

            if (Config.DefaultMuteTime == null)
                Config.DefaultMuteTime = TimeSpan.FromHours(8);

            ITweetableFilter filter = new ITweetableFilter();
            filter.Type = type;
            filter.Filter = data;
            if (Config.DefaultMuteTime == TimeSpan.MaxValue)
                filter.IsValidUntil = DateTime.MaxValue;
            else
                filter.IsValidUntil = DateTime.Now + (TimeSpan)Config.DefaultMuteTime;
            filter.Inclusion = IncludeOrExclude.Exclude;

            Config.GlobalFilter.AddFilter(filter);
            Config.GlobalFilter = Config.GlobalFilter;

            return filter;
        }
Esempio n. 7
0
 public void RemoveFilter(ITweetableFilter predicate)
 {
     try
     {
         _predicates.Remove(predicate);
     }
     catch
     {
     }
 }
Esempio n. 8
0
 public void AddFilter(ITweetableFilter predicate)
 {
     if(!_predicates.Contains(predicate))
         _predicates.Add(predicate);
 }