private ComicList getAllComics() { ComicList comicListModel = new ComicList(); comicListModel.listOfComics = new List <Comic>(); comicListModel.listOfGenres = new List <GenreModel>(); DataLayer dl = new DataLayer(); DataTable dt = dl.getAllComics(); for (int i = 0; i < dt.Rows.Count; i++) { Comic comicModel = new Comic(); comicModel.comicID = int.Parse(dt.Rows[i]["comicID"].ToString()); comicModel.comicName = dt.Rows[i]["comicName"].ToString(); comicModel.comicGenreID = int.Parse(dt.Rows[i]["comicGenreID"].ToString()); comicModel.comicImageName = dt.Rows[i]["movieImageName"].ToString(); comicListModel.listOfComics.Add(comicModel); } DataTable dt3 = dl.getGenreNames(); for (int i = 0; i < dt3.Rows.Count; i++) { GenreModel genreModel = new GenreModel(); genreModel.genreName = dt3.Rows[i]["genreName"].ToString(); genreModel.movieGenreID = int.Parse(dt3.Rows[i]["genreID"].ToString()); comicListModel.listOfGenres.Add(genreModel); } return(comicListModel); }
public ComicWorkItem(Comic comic, ComicList owner) { this.Comic = comic; this.ThumbnailImageSource = new Uri(Thumbnail.ThumbnailPath(this.Comic)); this.owner = owner; this.owner.ComicsChanged += this.View_ComicsChanged; }
/// <summary> /// Databinded Command to add comic to list of comics /// </summary> public void AddComicExecute() { if (SelectedComic == null) { throw new PresentationException("Gelieve een strip te selecteren."); } ViewComic comic = SelectedComic; int amount = OrderAmount; ComicList.Add(new KeyValuePair <ViewComic, int>(comic, amount)); }
public IActionResult Browse(string id) { DataLayer dl = new DataLayer(); Browser browserModel = new Browser(); MovieList MovieListModel = new MovieList(); ComicList ComicListModel = new ComicList(); MovieListModel = getAllMovies(); ComicListModel = getAllComics(); browserModel.listOfComics = ComicListModel; browserModel.listOfMovies = MovieListModel; browserModel.autoPlay = MovieListModel.autoPlay; browserModel.browserContentSelection = id; //UserModel.listOfMovies = getAllMovies(); return(View("Browse", browserModel)); }
private async Task CurrentItemChanged(CancellationToken cancellationToken) { cancellationToken.ThrowIfCancellationRequested(); var comicNumberToLoad = CurrentComic.Num - _cacheSize; if (comicNumberToLoad <= 0 || ComicList.Any(x => x.Num == comicNumberToLoad)) { return; } var comic = await DownloadComicAsync(comicNumberToLoad); await Device.InvokeOnMainThreadAsync(() => { ComicList.Add(comic); }); }
private ComicList AddComics(IEnumerable <Comic> comics) { ComicList comicList = new ComicList(); List <ComicSummary> comicSummaries = new List <ComicSummary>(); comicList.available = comics.Count(); comicList.returned = comics.Count(); comicList.collectionURI = string.Empty; foreach (var item in comics) { comicSummaries.Add(new ComicSummary() { resourceURI = item.ResourceUri, name = item.Title }); } return(comicList); }
private async Task InitAsync() { try { // I don't know why this statement is slow (2 or 3 sec)... // So I moved it in my async init task. CurrentItemChangedCommand = ReactiveCommand.CreateFromTask(CurrentItemChanged); var firstModel = await DownloadComicAsync(); var tasksList = new List <Task <XkcdComic> >(); for (var i = 0; i < _cacheSize; ++i) { tasksList.Add(DownloadComicAsync(firstModel.Num - 1 - i)); } await Task.WhenAll(tasksList); await Device.InvokeOnMainThreadAsync(async() => { ComicList.Add(firstModel); foreach (var task in tasksList) { ComicList.Add(await task); } }); } catch (Exception e) { Console.WriteLine(e); } finally { IsBusy = false; } }
/// <summary> /// 动漫app由9miao社团研发,如有问题请登陆http://www.9miao.com/官网 /// </summary> /// public void ProcessRequest(HttpContext context) { string classify_type = context.Request["classify_type"]; //字母 string classify_id = context.Request["classify_id"]; //小分类id string page = context.Request["page"]; //页码 int pages = 0; int.TryParse(page, out pages); pages = pages + 1; LetterComic lc = new LetterComic(); lc.result = 1; lc.msg = "OK"; try { using ( CDBAccess cn = new CDBAccess(System.Configuration.ConfigurationSettings.AppSettings["OledbStr"])) { int check_classify_type = 0; int.TryParse(classify_type, out check_classify_type); string sql_Big = string.Empty; OleDbParameter[] ole_big = new OleDbParameter[] { }; if (classify_type != "update") { if (check_classify_type > 0) { //说明是INT型的分类 sql_Big = "select * from T0000,T0001 where C00001=C00101 and C00001=" + classify_type + " and C00004='" + classify_id + "'"; } else { //字母型 sql_Big = "select * from T0000,T0001 where C00001=C00101 and C00002 like '%" + classify_type + "%' and C00004='" + classify_id + "'"; } } else { sql_Big = "select * from T0000,T0001 where C00001=C00101 and C00004='" + classify_id + "'"; } //先验证字母 跟小分类id using (DataTable _dt = cn.ExecQuery(sql_Big)) { if (_dt.Rows.Count > 0) { string sql = string.Empty; OleDbParameter[] ole = new OleDbParameter[] { }; if (pages == 1) { //第一页 sql = "select top " + 30 + " * from T0003,T0002 where C00009=C00010 and C00008='" + classify_id + "' order by C00010 desc"; } else { //N页 sql = "select top " + 30 + " * from T0003,T0002 where C00009=C00010 and C00008='" + classify_id + "' and C00010 not in " + @"(select top " + ((pages - 1) * 1) + " C00010 from T0003,T0002 where C00009=C00010 and C00008='" + classify_id + "' order by C00010 desc)" + "order by C00010 desc"; } //进行分页寻找返回列表 using (DataTable _dtList = cn.ExecQuery(sql)) { ComicList[] cmlist = new ComicList[_dtList.Rows.Count]; for (int i = 0; i < _dtList.Rows.Count; i++) { ComicList clist = new ComicList(); clist.id = _dtList.Rows[i]["C00010"].ToString(); clist.cover = _dtList.Rows[i]["C00013"].ToString(); clist.hot_hits = _dtList.Rows[i]["C00015"].ToString(); clist.last_update_chapter_name = Coding.ToUnicode(_dtList.Rows[i]["C00012"].ToString()); clist.last_updatetime = _dtList.Rows[i]["C00014"].ToString(); clist.title = Coding.ToUnicode(_dtList.Rows[i]["C00011"].ToString()); cmlist[i] = clist; } lc.data = cmlist; } } } } } catch { } context.Response.ContentType = "text/plain"; context.Response.Write(JsonSerialize.jSerialize(lc)); }
/// <summary> /// Databinded Command to remove comic from list of comics /// </summary> public void RemoveComicExecute() { ComicList.Remove(SelectedGridComic); }