コード例 #1
0
        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();
        }
コード例 #2
0
        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
                );
        }
コード例 #3
0
 protected override void UnWireViewEvents()
 {
     if (IsViewEventsWired)
     {
         ITeamHealthView view = base._view as ITeamHealthView;
         view.DataChanged    -= OnDataChanged;
         view.CommandRefresh -= OnCommandLoadHealth;
         IsViewEventsWired    = false;
     }
 }
コード例 #4
0
 protected override void WireViewEvents()
 {
     if (!IsViewEventsWired)
     {
         ITeamHealthView view = base._view as ITeamHealthView;
         view.DataChanged    += OnDataChanged;
         view.CommandRefresh += OnCommandLoadHealth;
         IsViewEventsWired    = true;
     }
 }
コード例 #5
0
        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);
        }
コード例 #6
0
 public TeamHealthPresenter(ITeamHealthModel model, ITeamHealthView view)
     : base(model, view)
 {
 }