コード例 #1
0
ファイル: Models.cs プロジェクト: sses7757/OnlineBookstore
        internal void Refresh(bool add = false, bool force = false)
        {
            if (!force)
            {
                switch (this.QueryType)
                {
                case ContentType.Books:
                    if (!Books.Finished)
                    {
                        return;
                    }
                    break;

                case ContentType.Billboards:
                    if (!Billboards.Finished)
                    {
                        return;
                    }
                    break;

                case ContentType.ReadLists:
                    if (!ReadLists.Finished)
                    {
                        return;
                    }
                    break;

                default:
                    return;
                }
            }

            if (add)
            {
                switch (this.QueryType)
                {
                case ContentType.Books:
                    Books.AddBooks();
                    break;

                case ContentType.Billboards:
                    Billboards.Reload(true);
                    break;

                case ContentType.ReadLists:
                    ReadLists.Reload(true);
                    break;

                default:
                    return;
                }
            }
            else
            {
                switch (this.QueryType)
                {
                case ContentType.Books:
                    _ = Books.ReloadBooks(this.ToQueryObject(), "Search result of " + this.QueryText);
                    break;

                case ContentType.Billboards:
                    Billboards.Reload(this.ToQueryObject());
                    break;

                case ContentType.ReadLists:
                    ReadLists.Reload(this.ToQueryObject());
                    break;

                default:
                    return;
                }
            }
        }