public static DistributionInfo ShowDistribution(IWin32Window wnd, string title, string label, List <Tuple <string, double, Color> > data, bool editColors, int lblColWd = -1, string extraSlider = null, double extraValue = double.NaN) { var dlg = new DistributionBox(); dlg.Init(title, label, data, extraSlider, extraValue, editColors, lblColWd); DialogResult dr = dlg.ShowDialog(wnd); DistributionInfo result = (dr == DialogResult.OK) ? new DistributionInfo(dlg.Values, dlg.Colors, dlg.ExtraValue) : null; dlg.Close(); return(result); }
private void btnReproFuncs_Click(object sender, EventArgs e) { List <double> probabilities = _settings.ReproductionFuncProbabilities; List <string> names = ReproductionFunction.FunctionNames; DistributionBox.DistributionInfo info = DistributionBox.ShowDistribution( this.Parent, "Reproduction", "Reproduction function distribution", names.Select((string name, int i) => new Tuple <string, double>(name, probabilities[i])).ToList(), 150 ); if (info != null) { Settings.ReproductionFuncProbabilities = info.Values; } }
private void btnMutationFuncs_Click(object sender, System.EventArgs e) { List <double> probabilities = _settings.MutationFunctionProbabilities; List <string> names = MutationFunction.FunctionNames; DistributionBox.DistributionInfo info = DistributionBox.ShowDistribution( this.Parent, "Mutation", "Mutation function distribution", names.Select((string name, int i) => new Tuple <string, double>(name, probabilities[i])).ToList(), 150, "Mutation temperature", _settings.MutationTemperature ); if (info != null) { Settings.MutationFunctionProbabilities = info.Values; Settings.MutationTemperature = info.ExtraValue; } }
private DistributionBox.DistributionInfo DoStatesDistributionDialog(string titleWindow, string titleHistogram, List <double> probabilities) { List <Color> colors = ((LifelikeWindow)Parent).Colors; int states = probabilities.Count(); var data = Enumerable.Range(0, states).Select( (int i) => { return(new Tuple <string, double, Color>( string.Format("State {0}", i), probabilities[i], colors[i] )); }).ToList(); return(DistributionBox.ShowDistribution( this.Parent, titleWindow, titleHistogram, data, true )); }
public static DistributionInfo ShowDistribution(IWin32Window wnd, string title, string label, List<Tuple<string, double, Color>> data, bool editColors, int lblColWd = -1, string extraSlider = null, double extraValue = double.NaN ) { var dlg = new DistributionBox(); dlg.Init(title, label, data, extraSlider, extraValue, editColors, lblColWd); DialogResult dr = dlg.ShowDialog(wnd); DistributionInfo result = (dr == DialogResult.OK) ? new DistributionInfo(dlg.Values, dlg.Colors, dlg.ExtraValue) : null; dlg.Close(); return result; }