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); }); }
internal void OnRemoveNGTitleKeyword(NGKeyword keywordInfo) { _NGSettings.NGVideoTitleKeywords.Remove(keywordInfo); }
internal void OnRemoveNGCommentKeyword(NGKeyword keywordInfo) { _NGSettings.NGCommentKeywords.Remove(keywordInfo); }