/// <summary> /// Initialization /// </summary> private void initialize() { // measurements = arrow.Measurements; Control panel = HeaderControl.Object.GetHeaderControl(consumer, measurements); panelName = panel.Name; Controls.Add(panel); measurementControls = new ArrayList(); int y = panel.Height + 10; ICollection arguments = null; if (consumer is IArguments) { IArguments arg = consumer as IArguments; arguments = arg.Arguments; } else { /* if (consumer is FormulaDataConsumer) * { * arguments = ((FormulaDataConsumer)consumer).Arguments; * }*/ if (consumer is DifferentialEquationSolver) { arguments = ((DifferentialEquationSolver)consumer).Arguments; } if (consumer is VectorFormulaConsumer) { arguments = ((VectorFormulaConsumer)consumer).Arguments; } /* if (consumer is TwoParameterTable) * { * arguments = ((TwoParameterTable)consumer).Arguments; * }*/ /* if (consumer is FourierSeries) * { * arguments = new ArrayList(); * (arguments as ArrayList).Add(((FourierSeries)consumer).Argument); * }*/ /* * if (consumer is SpatialUI.MassCenterDriver) * { * arguments = ((SpatialUI.MassCenterDriver)consumer).Arguments; * }*/ if (consumer is Recursive) { Recursive r = consumer as Recursive; arguments = r.ExternalArguments; } } for (int i = 0; i < measurements.Count; i++) { IMeasurement measure = measurements[i]; Label lab = new Label(); lab.Top = y; lab.Left = 20; try { lab.Text = Measurement.GetTypeName(measure.Type); } catch { } lab.Size = new System.Drawing.Size(121, 21); y += lab.Height + 10; Controls.Add(lab); ComboBox cb = new ComboBox(); cb.Location = new System.Drawing.Point(20, y); cb.Size = new System.Drawing.Size(121, 21); foreach (char c in variables) { cb.Items.Add(c + ""); } if (consumer is DifferentialEquationSolver) { DifferentialEquationSolver s = consumer as DifferentialEquationSolver; string str = s.InputParameters; foreach (char c in str) { cb.Items.Add(c + ""); } } Label l = new Label(); extended.Add(l); l.Text = (string)measure.Name.Clone(); l.Location = new System.Drawing.Point(cb.Left + cb.Width + 10, y); l.Width = Width - 20; measurementControls.Add(new object[] { cb, measure }); Controls.Add(cb); Controls.Add(l); y = cb.Top + cb.Height + 5; if (arguments == null) { continue; } string argName = consumer.GetMeasurementsName(measurements) + "." + measure.Name; foreach (string arg in arguments) { if (arg.Length < 4) { continue; } if (arg.Substring(4).Equals(argName)) { char c = arg[0]; for (int j = 0; j < cb.Items.Count; j++) { char s = cb.Items[j].ToString()[0]; if (c == s) { cb.SelectedIndex = j; goto A; } } } } A : continue; } Width = 100; Height = y + 10; }
/// <summary> /// Constructor /// </summary> /// <param name="label"></param> public FormDiffEquation(IObjectLabel label) : this() { PanelFormula.SetResize(panelFormula); this.label = label; solver = label.Object as DifferentialEquationSolver; consumer = solver; // ArrayList comments = solver.Comments; this.SetComments(solver.Comments); numericUpDownDerivationOrder.Value = solver.DerivationOrder; first = false; string var = ""; List <string> vv = new List <string>(); foreach (char c in solver.Keys) { var += c; vv.Add(c + ""); } for (int i = 0; i < Variables.Length; i++) { char v = Variables[i]; if (var.IndexOf(v) > -1) { checkedListBoxV.Items.Add("" + v, CheckState.Checked); } else { checkedListBoxV.Items.Add("" + v, CheckState.Unchecked); } } userControlCharIntDictionary.Minimum = 1; userControlCharIntDictionary.Keys = vv; Dictionary <string, int> dder = new Dictionary <string, int>(); Dictionary <string, int> dor = solver.DerivationOrders; foreach (string key in dor.Keys) { dder[key] = dor[key] + 1; } userControlCharIntDictionary.Dictionary = dder; string str = solver.AllParameters; IList <string> l = solver.AliasNames; foreach (char c in str) { string s = c + ""; if (l.Contains(s)) { checkedListBoxP.Items.Add(s, CheckState.Checked); } else { checkedListBoxP.Items.Add(s, CheckState.Unchecked); } } int top = 0; foreach (char c in solver.Keys) { PanelFormula p = new PanelFormula("" + c, this, panelFormula.Width, 200, Variables, true, null, null); p.Left = 0; p.Top = top; top += p.Height; p.Formula = solver[c]; panelFormula.Controls.Add(p); } UpdateFormUI(); setFormulas(); fillTable(); createAndFillAliasComboBox(); }