public void factorClick(Factor factor, Button factorButton) { FactorControl factorControl = new FactorControl(factor, factorButton); factorControl.PropertyChanged += FactorRemoved; factorControl.Visible = true; factorControl.Dock = System.Windows.Forms.DockStyle.Fill; factorControl.AutoScaleMode = AutoScaleMode.None; this.swichSection(factorControl); }
private void FactorRemoved(object o, PropertyChangedEventArgs e) { if (o != null) { FactorControl control = (FactorControl)o; this.panelSections.Controls.Remove(control.factorButton); this.viewModel.survey.factors.Remove(control.viewModel.factor); this.panelSectionContent.Controls.Remove(control); this.activeFactor = null; } }
private void swichSection(FactorControl section) { if (hypothesisControl != null) { this.hypothesisControl.Dispose(); this.hypothesisControl = null; } if (activeFactor != null) { this.activeFactor.Dispose(); } this.activeFactor = section; this.panelSectionContent.Controls.Add(section); }
private void buttonHypothesis_Click(object sender, EventArgs e) { if (activeFactor != null) { activeFactor.Dispose(); activeFactor = null; } if (hypothesisControl == null) { if (this.viewModel.survey.hypotheses == null) { this.viewModel.survey.hypotheses = new List <Hypothesis>(); } this.hypothesisControl = new HypothesisControl(this.viewModel.survey.hypotheses, this.viewModel.survey.factors); this.hypothesisControl.Dock = DockStyle.Fill; this.hypothesisControl.AutoScaleMode = AutoScaleMode.None; this.hypothesisControl.Show(); this.panelSectionContent.Controls.Add(hypothesisControl); } }