public RestorePlanViewControl() { InitializeComponent(); AttachEventHandlers(); /* * EventDispatcher dispatcher = new EventDispatcher(); * * Watcher.Subscribe((RestoreUpdateMsg msg) => * { * if (this.Model == null) * return; * * Models.RestorePlan plan = this.Model as Models.RestorePlan; * * // Only process messages that are related to the plan associated with this control. * if (msg.PlanId != plan.Id.Value) * return; * * // IMPORTANT: Always invoke from Main thread! * dispatcher.Invoke(() => { ProcessRemoteMessage(msg); }); * }); */ this.ModelChangedEvent += (sender, args) => { if (Model == null) { return; } Models.RestorePlan plan = Model as Models.RestorePlan; if (CurrentOperation != null) { CurrentOperation.Dispose(); } CurrentOperation = new RemoteOperation(DurationTimer_Tick); CurrentOperation.Status = Commands.OperationStatus.NOT_RUNNING; CurrentOperation.LastRunAt = plan.LastRunAt; CurrentOperation.LastSuccessfulRunAt = plan.LastSuccessfulRunAt; this.lblSources.Text = plan.SelectedSourcesAsDelimitedString(", ", 50, "..."); // Duplicate from RestoreOperation.cs - Sources property this.llblRunNow.Text = LBL_RUNNOW_STOPPED; this.llblRunNow.Enabled = false; this.lblStatus.Text = "Querying status...";; this.lblDuration.Text = "Unknown";; this.lblFilesTransferred.Text = "Unknown";; this.llblEditPlan.Enabled = false; this.llblDeletePlan.Enabled = false; this.lblLastRun.Text = PlanCommon.Format(CurrentOperation.LastRunAt); this.lblLastSuccessfulRun.Text = PlanCommon.Format(CurrentOperation.LastSuccessfulRunAt); this.lblTitle.Text = PlanCommon.FormatTitle(plan.Name); this.lblSchedule.Text = plan.ScheduleType.ToString(); CurrentOperation.RequestedInitialInfo = true; Provider.Handler.Send(Commands.ServerQueryPlan("restore", plan.Id.Value)); }; }