コード例 #1
0
        private async Task GetRecords()
        {
            if (QSearch == null)
            {
                var task = Task.Run(new Action(() =>
                {
                    try
                    {
                        SetBusy(true);

                        StockList = new List <Stocky.Data.Interfaces.IDataModel>(skStock.GetStockList());
                        QSearch   = new QuickSearch(StockList);

                        SetBusy(false);
                    }
                    catch (Exception e)
                    {
                        App.Current.Dispatcher.BeginInvoke((Action) delegate
                        {
                            ExepionLogger.Logger.LogException(e);
                            ExepionLogger.Logger.Show(e);
                        });
                    }
                }
                                               ));
                await task;
            }
            else
            {
                var task = Task.Run((() =>
                {
                    try
                    {
                        SetBusy(true);

                        StockList.Clear();
                        foreach (var Item in skStock.GetStockList(SearchFilter))
                        {
                            StockList.Add(Item);
                        }
                        SetBusy(false);
                    }
                    catch (Exception e)
                    {
                        App.Current.Dispatcher.BeginInvoke((Action) delegate
                        {
                            ExepionLogger.Logger.LogException(e);
                            ExepionLogger.Logger.Show(e);
                        });
                    }
                }
                                     ));
                await task;
                await App.Current.Dispatcher.BeginInvoke((Action) delegate
                {
                    QSearch.updatelist(StockList);
                });
            }
        }
コード例 #2
0
        private async Task GetRecords()
        {
            if (QSearch == null)
            {
                var task = Task.Run(new Action(() =>
                {
                    SetBusy(true);

                    SourceList = new List <Stocky.Data.Interfaces.IDataModel>(skCategory.CategoryList());
                    QSearch    = new QuickSearch(SourceList);

                    SetBusy(false);
                }
                                               ));
                await task;
            }
            else
            {
                var task = Task.Run(new Action(() =>
                {
                    SetBusy(true);

                    SourceList.Clear();
                    foreach (var Item in skCategory.CategoryList(SearchFileter))
                    {
                        SourceList.Add(Item);
                    }

                    SetBusy(false);
                }
                                               ));
                await task;
                await App.Current.Dispatcher.BeginInvoke((Action) delegate
                {
                    QSearch.updatelist(SourceList);
                });
            }
        }