コード例 #1
0
        public static string GetTextForEnum_Operator(GroupFilterOperator op)
        {
            switch (op)
            {
            case GroupFilterOperator.Equals: return(Properties.Resources.GroupFilterOperator_Equals);

            case GroupFilterOperator.NotEquals: return(Properties.Resources.GroupFilterOperator_NotEquals);

            case GroupFilterOperator.Exclude: return(Properties.Resources.GroupFilterOperator_Exclude);

            case GroupFilterOperator.Include: return(Properties.Resources.GroupFilterOperator_Include);

            case GroupFilterOperator.GreaterThan: return(Properties.Resources.GroupFilterOperator_GreaterThan);

            case GroupFilterOperator.LessThan: return(Properties.Resources.GroupFilterOperator_LessThan);

            case GroupFilterOperator.In: return(Properties.Resources.GroupFilterOperator_In);

            case GroupFilterOperator.NotIn: return(Properties.Resources.GroupFilterOperator_NotIn);

            case GroupFilterOperator.InAllEpisodes: return(Properties.Resources.GroupFilterOperator_InAllEpisodes);

            case GroupFilterOperator.NotInAllEpisodes: return(Properties.Resources.GroupFilterOperator_NotInAllEpisodes);

            case GroupFilterOperator.LastXDays: return(Properties.Resources.GroupFilterOperator_LastXDays);

            default: return(Properties.Resources.GroupFilterOperator_Equals);
            }
        }
コード例 #2
0
        public void Init(GroupFilterVM gf, GroupFilterConditionVM gfc)
        {
            groupFilter          = gf;
            groupFilterCondition = gfc;


            try
            {
                cboConditionType.Items.Clear();
                foreach (string cond in GroupFilterHelper.GetAllConditionTypes())
                {
                    cboConditionType.Items.Add(cond);
                }

                PopulateAnimeGroups();
                PopulateTags();
                PopulateCustomTags();
                PopulateVideoQuality();
                PopulateAnimeTypes();
                PopulateLanguages();

                // find the right condition
                int idx = 0;
                for (int i = 0; i < cboConditionType.Items.Count; i++)
                {
                    GroupFilterConditionType conditionTypeTemp = GroupFilterHelper.GetEnumForText_ConditionType(cboConditionType.Items[i].ToString());
                    if (conditionTypeTemp == gfc.ConditionTypeEnum)
                    {
                        idx = i;
                        break;
                    }
                }
                cboConditionType.SelectedIndex = idx;
                GroupFilterConditionType conditionType = GroupFilterHelper.GetEnumForText_ConditionType(cboConditionType.SelectedItem.ToString());

                cboConditionOperator.Items.Clear();
                foreach (string op in GroupFilterHelper.GetAllowedOperators(conditionType))
                {
                    cboConditionOperator.Items.Add(op);
                }

                cboConditionType.SelectionChanged     += new SelectionChangedEventHandler(cboConditionType_SelectionChanged);
                cboConditionOperator.SelectionChanged += new SelectionChangedEventHandler(cboConditionOperator_SelectionChanged);

                // find the right operator
                idx = 0;
                for (int i = 0; i < cboConditionOperator.Items.Count; i++)
                {
                    GroupFilterOperator opTypeTemp = GroupFilterHelper.GetEnumForText_Operator(cboConditionOperator.Items[i].ToString());
                    if (opTypeTemp == gfc.ConditionOperatorEnum)
                    {
                        idx = i;
                        break;
                    }
                }
                cboConditionOperator.SelectedIndex = idx;
                GroupFilterOperator opType = GroupFilterHelper.GetEnumForText_Operator(cboConditionOperator.Items[idx].ToString());

                // display the selected filter value
                switch (conditionType)
                {
                case GroupFilterConditionType.AirDate:
                case GroupFilterConditionType.SeriesCreatedDate:
                case GroupFilterConditionType.EpisodeAddedDate:
                case GroupFilterConditionType.EpisodeWatchedDate:
                case GroupFilterConditionType.LatestEpisodeAirDate:

                    if (opType == GroupFilterOperator.LastXDays)
                    {
                        txtParameter.Text = gfc.ConditionParameter;
                    }
                    else
                    {
                        DateTime airDate = GroupFilterHelper.GetDateFromString(gfc.ConditionParameter);
                        dpDate.SelectedDate = airDate;
                    }
                    break;

                case GroupFilterConditionType.AnimeGroup:

                    // don't display anything
                    break;

                case GroupFilterConditionType.AnimeType:
                case GroupFilterConditionType.Tag:
                case GroupFilterConditionType.CustomTags:
                case GroupFilterConditionType.ReleaseGroup:
                case GroupFilterConditionType.Studio:
                case GroupFilterConditionType.VideoQuality:
                case GroupFilterConditionType.AniDBRating:
                case GroupFilterConditionType.UserRating:
                case GroupFilterConditionType.AudioLanguage:
                case GroupFilterConditionType.SubtitleLanguage:
                case GroupFilterConditionType.Year:
                    txtParameter.Text = gfc.ConditionParameter;
                    break;
                }
            }
            catch (Exception ex)
            {
                Utils.ShowErrorMessage(ex);
            }
        }
コード例 #3
0
        private void EvaluateConditionsAndOperators()
        {
            if (cboConditionType.SelectedItem == null || cboConditionOperator.SelectedItem == null)
            {
                return;
            }

            GroupFilterConditionType conditionType = GroupFilterHelper.GetEnumForText_ConditionType(cboConditionType.SelectedItem.ToString());
            GroupFilterOperator      opType        = GroupFilterHelper.GetEnumForText_Operator(cboConditionOperator.SelectedItem.ToString());

            IsParameterDate             = false;
            IsParameterAnimeGroup       = false;
            IsParameterAnimeType        = false;
            IsParameterText             = false;
            IsParameterInNotIn          = false;
            IsParameterTag              = false;
            IsParameterCustomTag        = false;
            IsParameterRating           = false;
            IsParameterLastXDays        = false;
            IsParameterVideoQuality     = false;
            IsParameterAudioLanguage    = false;
            IsParameterSubtitleLanguage = false;
            IsParameterInteger          = false;

            switch (conditionType)
            {
            case GroupFilterConditionType.AirDate:
            case GroupFilterConditionType.SeriesCreatedDate:
            case GroupFilterConditionType.EpisodeAddedDate:
            case GroupFilterConditionType.EpisodeWatchedDate:
            case GroupFilterConditionType.LatestEpisodeAirDate:
                if (opType == GroupFilterOperator.LastXDays)
                {
                    IsParameterLastXDays = true;
                    IsParameterText      = true;
                }
                else
                {
                    IsParameterDate = true;
                }
                break;

            case GroupFilterConditionType.AnimeGroup:
                IsParameterAnimeGroup = true;
                break;

            case GroupFilterConditionType.AnimeType:
                IsParameterAnimeType = true; break;

            case GroupFilterConditionType.ReleaseGroup:
            case GroupFilterConditionType.Studio:
                IsParameterInNotIn = true; break;

            case GroupFilterConditionType.Tag:
                IsParameterInNotIn = true;
                IsParameterTag     = true;
                break;

            case GroupFilterConditionType.CustomTags:
                IsParameterInNotIn   = true;
                IsParameterCustomTag = true;
                break;

            case GroupFilterConditionType.AudioLanguage:
                IsParameterInNotIn       = true;
                IsParameterAudioLanguage = true;
                break;

            case GroupFilterConditionType.SubtitleLanguage:
                IsParameterInNotIn          = true;
                IsParameterSubtitleLanguage = true;
                break;

            case GroupFilterConditionType.Year:
                IsParameterInNotIn = true;
                break;

            case GroupFilterConditionType.VideoQuality:
                IsParameterInNotIn      = true;
                IsParameterVideoQuality = true;
                break;

            case GroupFilterConditionType.AniDBRating:
            case GroupFilterConditionType.UserRating:
                IsParameterText   = true;
                IsParameterRating = true;
                break;

            case GroupFilterConditionType.EpisodeCount:
                IsParameterText    = true;
                IsParameterInteger = true;
                break;
            }
        }
コード例 #4
0
        public static string GetTextForEnum_Operator(GroupFilterOperator op)
        {
            switch (op)
            {
                case GroupFilterOperator.Equals: return Properties.Resources.GroupFilterOperator_Equals;
                case GroupFilterOperator.NotEquals: return Properties.Resources.GroupFilterOperator_NotEquals;
                case GroupFilterOperator.Exclude: return Properties.Resources.GroupFilterOperator_Exclude;
                case GroupFilterOperator.Include: return Properties.Resources.GroupFilterOperator_Include;
                case GroupFilterOperator.GreaterThan: return Properties.Resources.GroupFilterOperator_GreaterThan;
                case GroupFilterOperator.LessThan: return Properties.Resources.GroupFilterOperator_LessThan;
                case GroupFilterOperator.In: return Properties.Resources.GroupFilterOperator_In;
                case GroupFilterOperator.NotIn: return Properties.Resources.GroupFilterOperator_NotIn;
                case GroupFilterOperator.InAllEpisodes: return Properties.Resources.GroupFilterOperator_InAllEpisodes;
                case GroupFilterOperator.NotInAllEpisodes: return Properties.Resources.GroupFilterOperator_NotInAllEpisodes;
                case GroupFilterOperator.LastXDays: return Properties.Resources.GroupFilterOperator_LastXDays;

                default: return Properties.Resources.GroupFilterOperator_Equals;
            }
        }