private void CurrentPhaseChanged(object o, PropertyChangedEventArgs e) { if (o != null) { currentControl = (StatisticsControl)o; this.Controls.Add(currentControl); currentControl.BringToFront(); currentControl.Show(); } }
private void SurveysControl_VisibleChanged(object sender, EventArgs e) { if (!this.Visible) { if (this.currentControl != null) { this.Controls.Remove(currentControl); currentControl.Dispose(); currentControl = null; } } else { this.panelSurveysContainer.Controls.Clear(); this.loadSurveys(); } }
private void NotifyOnPropertyChanged(string propertyName) { var tmp = PropertyChanged; if (tmp != null) { if (this.viewModel.survey.host != null) { StatisticsControl statisticsControl = new StatisticsControl(this.viewModel.survey.host.id); statisticsControl.Dock = DockStyle.Fill; statisticsControl.AutoScaleMode = AutoScaleMode.None; tmp(statisticsControl, new PropertyChangedEventArgs(propertyName)); } else { MessageBox.Show("This survey is not yet hosted", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); } } }