private void ProviderAddButton_Click(object sender, EventArgs e)
 {
     ProviderAddDialog dialog = new ProviderAddDialog(IsFirst: true);
     if (dialog.ShowDialog() != DialogResult.OK) return;
     Data.Provider P = dialog.Provider;
     Data.ProviderCollection.AddProvider(P);
     LoadData();
 }
 private void ProviderChangeButton_Click(object sender, EventArgs e)
 {
     if (ListProviders.SelectedItems.Count != 1) return;
     var item = ListProviders.SelectedItems[0];
     var index = ListProviders.SelectedIndices[0];
     var provider = item.Tag as Data.Provider;
     ProviderAddDialog dialog = new ProviderAddDialog(provider.Name, provider.TemplateName, false);
     if (dialog.ShowDialog() != DialogResult.OK) return;
     provider.Name = dialog.Name;
     LoadData();
     ListProviders.Items[index].Selected = true;
 }
 private void ProviderCopyButton_Click(object sender, EventArgs e)
 {
     if (ListProviders.SelectedItems.Count != 1) return;
     ProviderAddDialog dialog = new ProviderAddDialog(IsFirst: true);
     if (dialog.ShowDialog() != DialogResult.OK) return;
     var item = ListProviders.SelectedItems[0];
     var index = ListProviders.SelectedIndices[0];
     var provider = item.Tag as Data.Provider;
     Data.Provider _p = provider.Clone(dialog.Provider.Name, dialog.Provider.TemplateName);
     Data.ProviderCollection.AddProvider(_p);
     LoadData();
 }