|
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using MVCPassiveModelForWinForms.Controllers;
using MVCPassiveModelForWinForms.Models;
namespace MVCPassiveModelForWinForms.Views
{
public partial class MobileView : System.Web.UI.UserControl
{
private MobileController Control;
private MobileModel Model = new MobileModel("Computer Accessories", 20, 50, 10);
protected void Page_Load(object sender, EventArgs e)
{
Control = new MobileController(Model, this);
Control.InitializedConponent(IsPostBack);
}
public int Battary { get; set; }
public int Sim { get; set; }
public int Charger { get; set; }
protected void btnUpdate_Click(object sender, EventArgs e)
{
Battary = Convert.ToInt32(txtBattary.Text.ToString());
Sim = Convert.ToInt32(txtSim.Text.ToString());
Charger = Convert.ToInt32(txtCharger.Text.ToString());
Control.RequestUpdate(this);
}
public void Update(MobileModel paramModel)
{
UpdateInterface(paramModel);
}
public void UpdateInterface(MobileModel auto)
{
if (Battary != auto.Battary)
{
lblBattary.Text = auto.Battary.ToString();
}
if (Sim != auto.Sim)
{
lblSim.Text = auto.Sim.ToString();
}
if (Charger != auto.Charger)
{
lblCharger.Text = auto.Charger.ToString();
}
}
public void InitializedView(MobileModel paramModel)
{
lblBattary.Text = paramModel.Battary.ToString();
lblSim.Text = paramModel.Sim.ToString();
lblCharger.Text = paramModel.Charger.ToString();
}
}
}
|
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.
I am in Software Development for more than 12 years. I am expert on Microsoft Platform for Web Forms, MVC, MVC Core, Web API, Desktop App, PHP etc. I am also expert on jQuery, AngularJS, Bootstrap, Font Awesome, Telerik UI, Kendo UI etc. I know BackboneJS, KnockoutJS also. I am an article writer. I have many articles in CodeProject.
Email: khademulbasher@gmail.com