private void OnCommandLoadHealth(object sender, EventArgs e) { ITeamHealthView view = base._view as ITeamHealthView; ITeamHealthModel model = base._model as ITeamHealthModel; IMainPresenter presenter = SimpleResolver.Instance.Get <IMainPresenter>(); if (SyncContext != null) { SyncContext.Post(delegate { presenter.EnableControl(false); presenter.ActivateSpinner(true); presenter.UpdateProgressInfo("Pulling health report stats..."); }, null); } Thread healthrefresh = new Thread(() => { if (!string.IsNullOrEmpty(model.AccessToken)) { this.RefreshHealth(model, presenter); if (SyncContext != null) { SyncContext.Post(delegate { // update result and update view with model. view.LoadViewHealthItems(model); presenter.UpdateProgressInfo("Health stats refreshed at [" + model.RefreshDateTime.ToString() + "]"); presenter.ActivateSpinner(false); presenter.EnableControl(true); }, null); } } }); healthrefresh.Start(); }
private void OnDataChanged(object sender, System.EventArgs e) { ITeamHealthView view = base._view as ITeamHealthView; ITeamHealthModel model = base._model as ITeamHealthModel; PresenterBase.SetModelPropertiesFromView <ITeamHealthModel, ITeamHealthView>( ref model, view ); }
protected override void UnWireViewEvents() { if (IsViewEventsWired) { ITeamHealthView view = base._view as ITeamHealthView; view.DataChanged -= OnDataChanged; view.CommandRefresh -= OnCommandLoadHealth; IsViewEventsWired = false; } }
protected override void WireViewEvents() { if (!IsViewEventsWired) { ITeamHealthView view = base._view as ITeamHealthView; view.DataChanged += OnDataChanged; view.CommandRefresh += OnCommandLoadHealth; IsViewEventsWired = true; } }
protected override void Initialize() { ITeamHealthView view = base._view as ITeamHealthView; ITeamHealthModel model = base._model as ITeamHealthModel; PresenterBase.SetViewPropertiesFromModel <ITeamHealthView, ITeamHealthModel>( ref view, model ); SyncContext.Post(delegate { view.RefreshAccessToken(); }, null); }
public TeamHealthPresenter(ITeamHealthModel model, ITeamHealthView view) : base(model, view) { }