public void EditAnalysis(AnalysisHomo analysis) { // search for any DockContentAnalysis window and close it var seq = (from view in Views where view is DockContentAnalysisEdit && analysis == (view as DockContentAnalysisEdit).Analysis select view); if (seq.Count() > 0) { seq.First().Close(); } // instantiate a form to edit analysis Form form = null; if (analysis is AnalysisCasePallet analysisCasePallet) { form = new FormNewAnalysisCasePallet(this, analysisCasePallet); } else if (analysis is AnalysisBoxCase analysisBoxCase) { form = new FormNewAnalysisBoxCase(this, analysisBoxCase); } else if (analysis is AnalysisCylinderPallet analysisCylinderPallet) { form = new FormNewAnalysisCylinderPallet(this, analysisCylinderPallet); } else if (analysis is AnalysisCylinderCase analysisCylinderCase) { form = new FormNewAnalysisCylinderCase(this, analysisCylinderCase); } else if (analysis is AnalysisPalletTruck analysisPalletTruck) { form = new FormNewAnalysisPalletTruck(this, analysisPalletTruck); } else if (analysis is AnalysisCaseTruck analysisCaseTruck) { form = new FormNewAnalysisCaseTruck(this, analysisCaseTruck); } else if (analysis is AnalysisCylinderTruck analysisCylinderTruck) { form = new FormNewAnalysisCylinderTruck(this, analysisCylinderTruck); } else if (analysis is AnalysisHCylPallet analysisHCylPallet) { form = new FormNewAnalysisHCylPallet(this, analysisHCylPallet); } else if (analysis is AnalysisHCylTruck analysisHCylTruck) { form = new FormNewAnalysisHCylTruck(this, analysisHCylTruck); } else { MessageBox.Show("Unexepected analysis type!"); return; } if (DialogResult.OK == form.ShowDialog()) { } }
public AnalysisHCylTruck CreateNewAnalysisHCylinderTruckUI() { if (!CanCreateAnalysisCylinderTruck) { return(null); } using (FormNewAnalysisHCylTruck form = new FormNewAnalysisHCylTruck(this, null)) if (DialogResult.OK == form.ShowDialog()) { } return(null); }