Commit 2dcbe432 by liulongfei
parents c2bb96cf fcdf418f
......@@ -213,7 +213,7 @@ namespace VIZ.Package.Module
public async Task<fileUploadResult> CreateCutImageFile(Bitmap bitmap, string fileName)
{
string requestUri = string.Format("{0}UplodFile?filePath={1}", ApplicationDomainEx.MediaConfig.Url, this.Support.SelectedFolderModel.Path + "\\");
string requestUri = string.Format("{0}UplodFile?filePath={1}&isResize=false", ApplicationDomainEx.MediaConfig.Url, this.Support.SelectedFolderModel.Path + "\\");
fileUploadResult upLoadResult = await MediaResourceFileService.PostCutImage<fileUploadResult>(requestUri, bitmap, fileName);
......
......@@ -894,50 +894,66 @@ namespace VIZ.Package.Module
private async void EditImage()
{
if (selectedFileModel == null || selectedFileModel.ThumbnailBitmap == null) return;
try
{
ImageEditWindow imageEditWindow = new ImageEditWindow();
ImageEditViewModel vm = imageEditWindow.ImageCut.DataContext as ImageEditViewModel;
if (selectedFileModel == null || selectedFileModel.ThumbnailBitmap == null) return;
vm.OriginImage = vm.BitmapToBitmapImage(selectedFileModel.ThumbnailBitmap);
ImageEditWindow imageEditWindow = new ImageEditWindow();
imageEditWindow.ShowDialog();
ImageEditViewModel vm = imageEditWindow.ImageCut.DataContext as ImageEditViewModel;
if (vm.IsEnter)
{
string fileName = string.Format("{0}.png", GenerateStringID());
string url = string.Format("{0}GetFile?filePath={1}&isResize=false", ApplicationDomainEx.MediaConfig.Url, SelectedFileModel.Path);
Bitmap bp = new Bitmap(vm.CutImage);
bool flag = false;
try
var imageResult = await MediaResourceFileService.GetImage(url);
Image img = Image.FromStream(imageResult);
Bitmap bmp = new Bitmap(img);
vm.OriginImage = vm.BitmapToBitmapImage(bmp);
imageEditWindow.ShowDialog();
if (vm.IsEnter)
{
string fileName = string.Format("{0}.png", GenerateStringID());
var fileResult = await this.mediaResourceFileController.CreateCutImageFile(bp, fileName);
if (fileResult != null && fileResult.errCode == "0")
Bitmap bp = new Bitmap(vm.CutImage);
bool flag = false;
try
{
flag = true;
var fileResult = await this.mediaResourceFileController.CreateCutImageFile(bp, fileName);
if (fileResult != null && fileResult.errCode == "0")
{
flag = true;
}
else
{
flag = false;
}
}
else
catch (Exception ex)
{
flag = false;
log.Error(ex.Message);
}
}
catch (Exception ex)
{
log.Error(ex.Message);
}
if (flag)
{
if (this.SelectedFolderModel != null)
if (flag)
{
this.mediaResourceFileController.UpdateFileModels(this.SelectedFolderModel);
}
if (this.SelectedFolderModel != null)
{
this.mediaResourceFileController.UpdateFileModels(this.SelectedFolderModel);
}
}
}
}
catch (Exception ex)
{
log.Error(ex.Message);
}
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment