private void UploadHinhAnh(FileInfo fileinfo, Boolean coDoiTenHinhAnh) { bool open = false; try { string fPath = fileinfo.ToString(); string file_name = fileinfo.Name.ToString(); if (coDoiTenHinhAnh) { //file_name = StringHelper.RandomName(15); MyForm.frmDoiTenHinh frm = new MyForm.frmDoiTenHinh(fileinfo.Name.ToString()); if (frm.ShowDialog().Equals(DialogResult.No)) { return; } else { file_name = frm.name; open = true; splashScreenManager.ShowWaitForm(); } } HinhAnh hinhanh = new HinhAnh(); hinhanh.FILE_NAME = file_name; hinhanh.IMAGE = (Bitmap)Bitmap.FromFile(fPath); switch (comboBoxEdit1.SelectedIndex) { case 0: hinhanh.MAX_SIZE = GIUNGUYEN; break; case 1: hinhanh.MAX_SIZE = LON; break; case 2: hinhanh.MAX_SIZE = VUA; break; case 3: hinhanh.MAX_SIZE = NHO; break; default: hinhanh.MAX_SIZE = GIUNGUYEN; break; } if (hinhanh.upload() > 0) { listTemp.Add(hinhanh); GalleryItem it = new GalleryItem(); it.Image = (Image)hinhanh.IMAGE; it.Tag = hinhanh.path; galleryControlImage.Gallery.Groups[0].Items.Add(it); } if(open) splashScreenManager.CloseWaitForm(); } catch (Exception ex) { Debug.WriteLine(this.Name + "->UploadHinhAnh: " + ex.Message); } }
private void UploadHinhAnh(FileInfo fileinfo, Boolean coDoiTenHinhAnh) { bool open = false; try { string fPath = fileinfo.ToString(); string file_name = fileinfo.Name.ToString(); if (coDoiTenHinhAnh) { //file_name = StringHelper.RandomName(15); MyForm.frmDoiTenHinh frm = new MyForm.frmDoiTenHinh(fileinfo.Name.ToString()); if (frm.ShowDialog().Equals(DialogResult.No)) { return; } else { file_name = frm.name; open = true; splashScreenManager.ShowWaitForm(); } } HinhAnh hinhanh = new HinhAnh(); hinhanh.FILE_NAME = file_name; hinhanh.IMAGE = (Bitmap)Bitmap.FromFile(fPath); switch (comboBoxEdit1.SelectedIndex) { case 0: hinhanh.MAX_SIZE = GIUNGUYEN; break; case 1: hinhanh.MAX_SIZE = LON; break; case 2: hinhanh.MAX_SIZE = VUA; break; case 3: hinhanh.MAX_SIZE = NHO; break; default: hinhanh.MAX_SIZE = GIUNGUYEN; break; } if (hinhanh.upload() > 0) { listTemp.Add(hinhanh); GalleryItem it = new GalleryItem(); it.Image = (Image)hinhanh.IMAGE; it.Tag = hinhanh.path; galleryControlImage.Gallery.Groups[0].Items.Add(it); } if (open) { splashScreenManager.CloseWaitForm(); } } catch (Exception ex) { Debug.WriteLine(this.Name + "->UploadHinhAnh: " + ex.Message); } }