public BatteryController(IBatteryView v, IBatteryModel m) { view = v; model = m; view.setChargeController(this); model.AttachIModelObserver((IModelBatteryObserver)view); view.ChangedProgressBar += new ViewBatteryHandler <IBatteryView>(this.viewChanged); Start(); }
public void BatteryProgressBarUpdate(IBatteryModel model, BatteryModelEventArgs e) { if (InvokeRequired) { batteryProgresBar?.BeginInvoke(new Action <IBatteryModel, BatteryModelEventArgs>(BatteryProgressBarUpdate), model, e); } else { batteryProgresBar.Value = e.ChargeLevelInt; batteryProgresBar?.Refresh(); } }