Пример #1
0
        private void toolStripButton_ReplaceDataSource_Click(object sender, EventArgs e)
        {
            if (listView_DataSources.SelectedItems.Count < 1)
            {
                MessageBox.Show("No data source is selected", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
                return;
            }

            DataSource_Selector selector = new DataSource_Selector(listView_DataSources.SelectedItems[0].Text, true);

            if (selector.ShowDialog() != System.Windows.Forms.DialogResult.OK || selector.SourceType == null)
                return;

            DataSource source = (DataSource)Activator.CreateInstance(selector.SourceType);

            if (!source.ShowDataSourceSelector())
                return;

            source.Setup(selector.SourceName);
            DataSource.DataSources[source.SourceName] = source;
            DataSource.UpdateDataSourceInfoInUI();
        }
Пример #2
0
        private void toolStripButton_AddDataSource_Click(object sender, EventArgs e)
        {
            DataSource_Selector selector = new DataSource_Selector();

            if (selector.ShowDialog() != System.Windows.Forms.DialogResult.OK || selector.SourceType == null)
                return;

            DataSource source = (DataSource)Activator.CreateInstance(selector.SourceType);

            if (!source.ShowDataSourceSelector())
                return;

            source.Setup(selector.SourceName);
            DataSource.DataSources.Add(source.SourceName, source);
            DataSource.UpdateDataSourceInfoInUI();
        }