Пример #1
0
        public NGKeywordViewModel(NGKeyword ngTitleInfo, Action <NGKeyword> onRemoveAction)
        {
            NGKeywordInfo   = ngTitleInfo;
            _OnRemoveAction = onRemoveAction;

            Label    = NGKeywordInfo.Keyword;
            TestText = new ReactiveProperty <string>(NGKeywordInfo.TestText);
            Keyword  = new ReactiveProperty <string>(NGKeywordInfo.Keyword);

            TestText.Subscribe(x =>
            {
                NGKeywordInfo.TestText = x;
            });

            Keyword.Subscribe(x =>
            {
                NGKeywordInfo.Keyword = x;
            });

            IsValidKeyword =
                Observable.CombineLatest(
                    TestText,
                    Keyword
                    )
                .Where(x => x[0].Length > 0)
                .Select(x =>
            {
                var result = -1 != TestText.Value.IndexOf(Keyword.Value);
                return(result);
            })
                .ToReactiveProperty();

            IsInvalidKeyword = IsValidKeyword.Select(x => !x)
                               .ToReactiveProperty();

            RemoveCommand = new DelegateCommand(() =>
            {
                _OnRemoveAction(this.NGKeywordInfo);
            });
        }
Пример #2
0
 internal void OnRemoveNGTitleKeyword(NGKeyword keywordInfo)
 {
     _NGSettings.NGVideoTitleKeywords.Remove(keywordInfo);
 }
Пример #3
0
 internal void OnRemoveNGCommentKeyword(NGKeyword keywordInfo)
 {
     _NGSettings.NGCommentKeywords.Remove(keywordInfo);
 }