private async void OnSearch(IDictionary <string, string> param) { if (param == null) { param = new Dictionary <string, string>(); } var reader = new HttpDataReader(); var selectedArea = CreateSearchAreaCondition(); if (!selectedArea.Key.Equals(string.Empty)) { param.Add(selectedArea.Key, selectedArea.Value); } var selectedCategory = CreateSearchCategoryCondition(); if (!selectedCategory.Key.Equals(string.Empty)) { param.Add(selectedCategory.Key, selectedCategory.Value); } if (!string.IsNullOrWhiteSpace(this.ShopName)) { param.Add("name", this.ShopName); } if (!string.IsNullOrWhiteSpace(this.FreeWord)) { param.Add("freeword", string.Join(",", this.FreeWord.Split(',').Take(10))); } this.Rests = await new Rests(reader).Get(param); }
public MainWindowViewModel() { var reader = new HttpDataReader(); var areas = new AreaCollection(reader); Task.Run(async() => await areas.Load()) .ContinueWith(_ => this.Areas = areas.List); var prefs = new Prefs(reader); Task.Run(async() => await prefs.Load()) .ContinueWith(_ => this.Prefs = prefs.List); var areaL = new AreaLs(reader); Task.Run(async() => await areaL.Load()) .ContinueWith(_ => this.AreaLs = areaL.List); var areaM = new AreaMs(reader); Task.Run(async() => await areaM.Load()) .ContinueWith(_ => this.AreaMs = areaM.List); var areaS = new AreaSs(reader); Task.Run(async() => await areaS.Load()) .ContinueWith(_ => this.AreaSs = areaS.List); var categoryL = new CategoryLs(reader); Task.Run(async() => await categoryL.Load()) .ContinueWith(_ => this.CategoryLs = categoryL.List); var categoryS = new CategorySs(reader); Task.Run(async() => await categoryS.Load()) .ContinueWith(_ => this.CategorySs = categoryS.List); this.SearchCommand = new DelegateCommand(this.OnSearch); this.SearchConditionClearCommand = new DelegateCommand(this.OnSearchConditionClear); this.PagePreviewCommand = new DelegateCommand(this.OnPagePreview, this.CanPrevPage); this.PageNextCommand = new DelegateCommand(this.OnPageNext, this.CanNextPage); }