|
using System;
using System.Windows.Forms;
using XmlGuiGenerator;
namespace MVCDemo
{
public class RegisterView : ViewBase
{
public RegisterView(RpnModel model) : base(model)
{
form=Generator.LoadForm(@"..\..\Calculator2.xml", "Registers", this, AppMain.appForm);
model.EventPool.Subscribe("X", new EventHandler(RegisterXChangeEvent));
model.EventPool.Subscribe("Y", new EventHandler(RegisterYChangeEvent));
model.EventPool.Subscribe("R3", new EventHandler(RegisterR3ChangeEvent));
model.EventPool.Subscribe("R4", new EventHandler(RegisterR4ChangeEvent));
}
private void RegisterXChangeEvent(object sender, EventArgs e)
{
FindControl("X").Text=((RpnModel)model).X;
}
private void RegisterYChangeEvent(object sender, EventArgs e)
{
FindControl("Y").Text=((RpnModel)model).Y;
}
private void RegisterR3ChangeEvent(object sender, EventArgs e)
{
FindControl("R3").Text=((RpnModel)model).R3;
}
private void RegisterR4ChangeEvent(object sender, EventArgs e)
{
FindControl("R4").Text=((RpnModel)model).R4;
}
private void LostFocusEvent(object sender, EventArgs e)
{
eventPool.FireEvent("Typing", new TypingEventArgs(FindControl("X").Text));
}
}
}
|
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.