コード例 #1
0
ファイル: QueriesControl.cs プロジェクト: mgltorsa/FeelSoft
        private void ModifyToolStripMenuItem_Click(object sender, EventArgs e)
        {
            if (currentConfiguration != null)
            {
                queryForm = new QueryConfigurationForm();
                queryForm.SetQueryConfiguration(currentConfiguration);
                DialogResult result = queryForm.ShowDialog();


                if (DialogResult.OK == result)
                {
                    currentConfiguration = queryForm.GetQueryConfiguration();
                    if (currentConfiguration.Name.Equals(((IQueryConfiguration)cbxQueries.SelectedItem).Name))
                    {
                        cbxQueries.Items.RemoveAt(cbxQueries.SelectedIndex);
                        cbxQueries.Items.Add(currentConfiguration);
                    }

                    int index = configurations.FindLastIndex(x => x != null && x.Name.Equals(currentConfiguration));
                    if (index != -1)
                    {
                        configurations.RemoveAt(index);
                        configurations.Insert(index, currentConfiguration);
                    }
                    else
                    {
                        configurations.Add(currentConfiguration);
                    }
                }
            }
            else
            {
                MessageBox.Show("Primero seleccione una configuración valida");
            }
        }
コード例 #2
0
ファイル: QueriesControl.cs プロジェクト: mgltorsa/FeelSoft
        private void BtnCreateQuery_Click(object sender, EventArgs e)
        {
            queryForm = new QueryConfigurationForm();
            DialogResult result = queryForm.ShowDialog();

            if (DialogResult.OK == result)
            {
                currentConfiguration = queryForm.GetQueryConfiguration();
                int index = configurations.FindLastIndex(x => x.Name.Equals(currentConfiguration));
                IQueryConfiguration cloneConfiguration = (IQueryConfiguration)currentConfiguration.Clone();

                configurations.Add(cloneConfiguration);


                cbxQueries.Items.Add(cloneConfiguration);

                cbxQueries.SelectedItem = cloneConfiguration;
            }
        }