コード例 #1
0
        private void btReplicate_Click(object sender, EventArgs e)
        {
            if (null != GridAlgorithms.CurrentRow)
            {
                ReplicateForm repl = new ReplicateForm();
                repl.ShowDialog(this);
                if (repl.DialogResult == System.Windows.Forms.DialogResult.OK)
                {
                    decimal r = repl.Selection;
                    RowBatchAlgorithm template = (RowBatchAlgorithm)GridAlgorithms.CurrentRow.DataBoundItem;
                    int i = GridAlgorithms.CurrentRow.Index + 1;
                    SortedDictionary<string, object> sorted_dict_copy;

                    while (r-- > 0)
                    {
                        sorted_dict_copy = new SortedDictionary<string, object>(template.Item2);

                        _algorithms.Insert(i, new RowBatchAlgorithm(
                                template.Item1,
                                sorted_dict_copy,
                                template.Item3,
                                template.Item4,
                                template.Item5));
                    }
                }
                repl.Dispose();
            }
        }
コード例 #2
0
        private void btReplicate_Click(object sender, EventArgs e)
        {
            try
            {
                if (null != gridAlgorithms.SelectedRows && gridAlgorithms.SelectedRows.Count > 0)
                {
                    ReplicateForm repl = new ReplicateForm();
                    repl.ShowDialog(this);
                    if (repl.DialogResult == System.Windows.Forms.DialogResult.OK)
                    {
                        decimal val_orig = repl.Selection;
                        foreach (DataGridViewRow r in gridAlgorithms.SelectedRows)
                        {
                            RowBatchFilter template = (RowBatchFilter)r.DataBoundItem;
                            int i = gridAlgorithms.CurrentRow.Index + 1;
                            SortedDictionary<string, object> sorted_dict_copy;
                            decimal val = val_orig;

                            while (val-- > 0)
                            {
                                sorted_dict_copy = new SortedDictionary<string, object>(template.Item2);

                                ((BindingList<RowBatchFilter>)gridAlgorithms.DataSource).Add(new RowBatchFilter(
                                        template.Item1,
                                        sorted_dict_copy,
                                        template.Item3,
                                        template.Item4 == null ? null : new List<MetricExecBase>(template.Item4),
                                        template.Item5));
                            }
                        }
                    }
                    repl.Dispose();
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.GetType().FullName, ex.Message);
            }
        }