public async Task <ApiResponseAsync <bool> > DelNotes(ObjDTO dto) { var notes = await this._notes.DelNotes(dto.Id); await this._userRoot.CatalogItemSubstructAsync(this._appUser.UserId, notes.Notes.CalelogCode, notes.Notes.GradeCode); if (notes.HasSection() == false) { return(ApiRes.OK(true)); } List <Guid> pageAryId = new List <Guid>(); foreach (var item in notes.Sections) { if (item.HasPages() == false) { continue; } pageAryId.AddRange(item.Pages.Select(p => p.Page.Id)); } if (pageAryId.Count > 0) { await this._body.Del(pageAryId.ToArray()); await this._userRoot.DelSection(this._appUser.UserId, pageAryId.ToArray()); } return(ApiRes.OK(true)); //throw new NotImplementedException(); }
private void dataGridViewBoss_CellClick(object sender, DataGridViewCellEventArgs e) { var v = bossesPath[e.RowIndex]; ObjGame obj = new Boss(v); setObject(obj); selectedObj = new ObjDTO(obj, v); }
public async Task <ApiResponseAsync <bool> > DelSection(ObjDTO dto) { var rev = await this._notes.DelSection(dto.Id, dto.SectionId); await this._body.Del(rev?.ToArray()); await this._userRoot.DelSection(this._appUser.UserId, dto.SectionId); return(ApiRes.OK(true)); }
private void btnOpen_Click(object sender, EventArgs e) { OpenFileDialog ofd = new OpenFileDialog(); ofd.Title = "Chọn ảnh map"; ofd.Filter = "Image files (*.jpg, *.jpeg, *.jpe, *.jfif, *.png) | *.jpg; *.jpeg; *.jpe; *.jfif; *.png"; ofd.InitialDirectory = @"C:\Users\dell\Desktop\"; if (ofd.ShowDialog() == DialogResult.OK) { MyLogger.getInstance().logDebug("Open map ------------------------------------------"); String fileName = ofd.FileName.Split('.')[0]; Bitmap background = context.open(fileName); background.MakeTransparent(Color.FromArgb(255, 0, 255)); this.width_map = background.Width; this.height_map = background.Height; this.bmp_map = new Bitmap(background); int count_horizontal = this.width_map / 16; int count_vertical = this.height_map / 16; this.bmp_map = new Bitmap(background); Bitmap _bmp = CreateMapSquare(background); using (Graphics g = Graphics.FromImage(_bmp)) { for (int row = 0; row < count_vertical; row++) { for (int col = 0; col < count_horizontal; col++) { g.DrawLine(Pens.Red, new Point(col * 16, 0), new Point(col * 16, this.height_map)); } g.DrawLine(Pens.Red, new Point(0, row * 16), new Point(this.width_map, row * 16)); } } picMap.SizeMode = PictureBoxSizeMode.AutoSize; picMap.Image = _bmp; background = _bmp; RecObject recobj = new RecObject(); recobj.parse(fileName + "recs.txt"); this.recs.AddRange(recobj.Recs); EnemyObj enemyObj = new EnemyObj(); enemyObj.parse(fileName + "enemy.txt"); this.enemies.AddRange(enemyObj.Enemies); foreach (ObjGame obj in enemyObj.Enemies) { ObjDTO objDTO = new ObjDTO(obj, folderDefault + "enemy/" + obj.Name + ".png"); pushObjGame(obj.X, obj.Y, objDTO); } } }
private void dataGridViewEnemy_CellClick(object sender, DataGridViewCellEventArgs e) { int index = e.RowIndex; if (index < enemiesPath.Count) { var v = enemiesPath[e.RowIndex]; ObjGame obj = new Enemy(v); setObject(obj); selectedObj = new ObjDTO(obj, v); } }
public async Task <ApiResponseAsync <bool> > DelPage(ObjDTO dto) { var rev = await this._notes.DelPage(dto.Id, dto.SectionId, dto.PageId); await this._userRoot.DelPageAsync(this._appUser.UserId, dto.SectionId, dto.PageId); return(ApiRes.OK(rev)); //var ret = this._notes.DelSection(dto.Id, dto.SectionId); }
private void dataGridViewItems_CellClick(object sender, DataGridViewCellEventArgs e) { int index = e.RowIndex; if (index < itemsPath.Count) { var v = itemsPath[e.RowIndex]; Item obj = new Item(v, txtContainer.Text); obj.Container = txtContainer.Text; setObject(obj); selectedObj = new ObjDTO(obj, v); } }
private PictureBox pushObjGame(int x, int y, ObjDTO objDTO) { PictureBox pb = new PictureBox(); pb.Location = new Point(x, y); pb.SizeMode = PictureBoxSizeMode.AutoSize; pb.BackColor = Color.Transparent; Bitmap bmp = Utils.CreatBitmapTransparent(objDTO.ImagePath); pb.Image = bmp; pb.Click += new EventHandler(click_pb_obj); objDTO.Obj.X = x; objDTO.Obj.Y = y; picMap.Controls.Add(pb); return(pb); }