Example #1
0
 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();
 }
Example #2
0
 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();
     }
 }