|
using System;
using System.Windows.Forms;
using XmlGuiGenerator;
namespace MVCDemo
{
public class BufferView : ViewBase
{
public BufferView(BufferModel model) : base(model)
{
form=Generator.LoadForm(@"..\..\Calculator2.xml", "Buffer", this, AppMain.appForm);
model.EventPool.Subscribe("UndoStateChanged", new EventHandler(UndoStateChangeEvent));
model.EventPool.Subscribe("RedoStateChanged", new EventHandler(RedoStateChangeEvent));
}
public void OnUndo(object sender, EventArgs e)
{
eventPool.FireEvent("Undo");
}
public void OnRedo(object sender, EventArgs e)
{
eventPool.FireEvent("Redo");
}
public void UndoStateChangeEvent(object sender, EventArgs e)
{
FindControl("Undo").Enabled=((BufferModel)model).CanUndo;
FindControl("Undo").Text="Undo "+((BufferModel)model).UndoText;
}
public void RedoStateChangeEvent(object sender, EventArgs e)
{
FindControl("Redo").Enabled=((BufferModel)model).CanRedo;
FindControl("Redo").Text="Redo "+((BufferModel)model).RedoText;
}
}
}
|
By viewing downloads associated with this article you agree to the Terms of Service and the article's licence.
If a file you wish to view isn't highlighted, and is a text file (not binary), please
let us know and we'll add colourisation support for it.