czyzer#451
When using Remote Scripting to call Bitmap.Undo I get the following exception:
Unable to restore object state due to UndoRedoEnabled property value is false.
I've set the UndoRedoEnabled property of the Bitmap to true in the PageLoad. After each transformation I use the SaveState method. Whenever the Undo remote scripting method is called the UndoRedoEnabled boolean of the Bitmap seems to be reset to false.
Can anybody help me out, maybe I'm doing something wrong.... Here's my code behind code.
Thanks
-Rich
Unable to restore object state due to UndoRedoEnabled property value is false.
I've set the UndoRedoEnabled property of the Bitmap to true in the PageLoad. After each transformation I use the SaveState method. Whenever the Undo remote scripting method is called the UndoRedoEnabled boolean of the Bitmap seems to be reset to false.
Can anybody help me out, maybe I'm doing something wrong.... Here's my code behind code.
using System;
using System.Collections;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Web;
using System.Web.SessionState;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.HtmlControls;
using Aurigma;
using Aurigma.GraphicsMill;
using Aurigma.GraphicsMill.WebControls;
namespace TestingIt
{
/// <summary>
/// Summary description for WebForm1.
/// </summary>
public class WebForm1 : System.Web.UI.Page
{
protected Aurigma.GraphicsMill.WebControls.RectangleRubberband RectangleRubberband1;
protected System.Web.UI.WebControls.Button BtnUndo2;
protected Aurigma.GraphicsMill.WebControls.BitmapViewer BitmapViewer1;
private void Page_Load(object sender, System.EventArgs e)
{
if (!this.IsPostBack)
{
BitmapViewer1.Bitmap.UndoRedoEnabled = true;
BitmapViewer1.Bitmap.Load(Server.MapPath("/TestingIt/UploadedImages/MeltDown.jpg"));
BitmapViewer1.Bitmap.SaveState();
}
}
#region Web Form Designer generated code
override protected void OnInit(EventArgs e)
{
//
// CODEGEN: This call is required by the ASP.NET Web Form Designer.
//
InitializeComponent();
base.OnInit(e);
}
/// <summary>
/// Required method for Designer support - do not modify
/// the contents of this method with the code editor.
/// </summary>
private void InitializeComponent()
{
this.Load += new System.EventHandler(this.Page_Load);
}
#endregion
[RemoteScriptingMethod]
public void Crop(int Top, int Left, int Width, int Height)
{
BitmapViewer1.Bitmap.Transforms.Crop(Top, Left, Width, Height);
BitmapViewer1.Bitmap.SaveState();
}
[RemoteScriptingMethod]
public void Rotate(int Degrees)
{
BitmapViewer1.Bitmap.Transforms.Rotate(Degrees);
BitmapViewer1.Bitmap.SaveState();
}
[RemoteScriptingMethod]
public void AdjustBrightness(float BrightnessAmount, float ContrastAmount)
{
BitmapViewer1.Bitmap.ColorAdjustment.BrightnessContrast(BrightnessAmount,ContrastAmount);
BitmapViewer1.Bitmap.SaveState();
}
[RemoteScriptingMethod]
public void Resize(int Width, int Height)
{
BitmapViewer1.Bitmap.Transforms.Resize(Width,Height);
BitmapViewer1.Bitmap.SaveState();
}
[RemoteScriptingMethod]
public void Undo()
{
try
{
BitmapViewer1.Bitmap.Undo();
}
catch(System.Exception ex)
{
Console.WriteLine(ex.Message);
}
}
[RemoteScriptingMethod]
public void Redo()
{
BitmapViewer1.Bitmap.Redo();
}
}
}
Thanks
-Rich