public override void OnInitialize(object parameter) { _parameter = parameter as SearchOptionParameter; EitherWord = _parameter.ToReactivePropertyAsSynchronized(w => w.EitherWord).AddTo(this); IgnoreWord = _parameter.ToReactivePropertyAsSynchronized(w => w.IgnoreWord).AddTo(this); BookmarkCount = _parameter.ToReactivePropertyAsSynchronized(w => w.BookmarkCount, w => w.ToString(), int.Parse).AddTo(this); ViewCount = _parameter.ToReactivePropertyAsSynchronized(w => w.ViewCount, w => w.ToString(), int.Parse).AddTo(this); CommentCount = _parameter.ToReactivePropertyAsSynchronized(w => w.CommentCount, w => w.ToString(), int.Parse).AddTo(this); PageCount = _parameter.ToReactivePropertyAsSynchronized(w => w.PageCount, w => w.ToString(), int.Parse).AddTo(this); Height = _parameter.ToReactivePropertyAsSynchronized(w => w.Height, w => w.ToString(), int.Parse).AddTo(this); Width = _parameter.ToReactivePropertyAsSynchronized(w => w.Width, w => w.ToString(), int.Parse).AddTo(this); Tool = _parameter.ToReactivePropertyAsSynchronized(w => w.Tool).AddTo(this); TextLength = _parameter.ToReactivePropertyAsSynchronized(w => w.TextLength, w => w.ToString(), int.Parse).AddTo(this); }
public void Search(string query, SearchOptionParameter optionParameter, bool force = false) { ResultIllusts.Clear(); ResultNovels.Clear(); ResultUsers.Clear(); _query = query; _offset = ""; _count = 0; _optionParam = optionParameter; if (!string.IsNullOrWhiteSpace(_optionParam.EitherWord)) { _query += " " + string.Join(" ", _optionParam.EitherWord.Split(' ').Select(w => $"({w})")); } if (!string.IsNullOrWhiteSpace(_optionParam.IgnoreWord)) { _query += " " + string.Join(" ", _optionParam.IgnoreWord.Split(' ').Select(w => $"--{w}")); } #if !OFFLINE HasMoreItems = true; if (force) { RunHelper.RunAsync(SearchAsync); } #endif }
public override void OnInitialize(object parameter) { _parameter = parameter as SearchOptionParameter ?? new SearchOptionParameter(); ContentType = _parameter.ToReactivePropertyAsSynchronized(w => w.SearchType).AddTo(this); Target = _parameter.ToReactivePropertyAsSynchronized(w => w.Target).AddTo(this); Duration = _parameter.ToReactivePropertyAsSynchronized(w => w.Duration).AddTo(this); ContentType.Subscribe(w => { var b = w != SearchType.Novels; IsEnabledIllustMode = w == SearchType.IllustsAndManga; IsEnabledNovelMode = !IsEnabledIllustMode; if (b && (Target.Value == SearchTarget.Keyword || Target.Value == SearchTarget.Text)) { Target.Value = SearchTarget.TagPartial; } if (!b && (Target.Value == SearchTarget.TagTotal || Target.Value == SearchTarget.TitleCaption)) { Target.Value = SearchTarget.TagPartial; } }).AddTo(this); }