示例#1
0
        /// <summary>
        /// Initializes a new instance of the <see cref="NewExportForm" /> class.
        /// </summary>
        public NewExportForm()
        {
            InitializeComponent();

            // Clone each item in the MainForm ListView and add it to lvDataSources.
            foreach (DataGridViewRow item in MainForm.Instance.dgvDataSources.Rows)
            {
                var ds     = (DataSource)item.Tag;
                var lvItem = new ListViewItem(ds.Name);
                lvItem.SubItems.Add(ds.Number.ToString());
                lvItem.Tag = ds;
                lvDataSources.Items.Add(lvItem);
            }

            Instance = this;
        }
示例#2
0
        /// <summary>
        /// The ButtonNewExport_Click method.
        /// </summary>
        /// <param name="sender">The <paramref name="sender"/> parameter.</param>
        /// <param name="args">The <paramref name="args"/> parameter.</param>
        private void ButtonNewExport_Click(object sender, EventArgs args)
        {
            // Show the AddSituationForm dialog.
            DialogResult result;

            using (var exportForm = new NewExportForm())
            {
                result = exportForm.ShowDialog();
            }

            // If the dialog was closed without clicking OK then skip the refresh.
            if (result != DialogResult.OK)
            {
                return;
            }

            // Refresh the items in the list view to include the newly added situation.
            lvExportManager.Items.Clear();
            PopulateExports();
            lvExportManager.Refresh();
        }