コード例 #1
0
 public void New(System.Windows.Forms.IWin32Window parentWindow)
 {
     if (connService != null)
     {
         ArrayList connList = connService.GetConnectionsOfType("FLATFILE");
         CommonUtils.FilterOutFixedWidthConnections(connList);
         if (connList.Count > 0)
         {
             using (AddComponentForm form = new AddComponentForm())
             {
                 List<ConnectionItem> connItems = new List<ConnectionItem>();
                 foreach (ConnectionManager connManager in connList)
                 {
                     connItems.Add(new ConnectionItem(connManager));
                 }
                 form.InitializeConnectionManagerList(connItems);
                 if (form.ShowDialog(parentWindow) == System.Windows.Forms.DialogResult.OK)
                 {
                     if (form.SelectedItem != null)
                     {
                         Cursor oldCursor = Cursor.Current;
                         try
                         {
                             Cursor.Current = Cursors.WaitCursor;
                             ConnectionItem connItem = form.SelectedItem;
                             ConnectionManager conn = connItem.ConnectionManager;
                             AddFileConnection(conn);
                             TransferConnectionMetadata(conn);
                         }
                         finally
                         {
                             Cursor.Current = oldCursor;
                         }
                     }
                 }
             }
         }
     }
 }
 public void New(System.Windows.Forms.IWin32Window parentWindow)
 {
     if (connService != null)
     {
         ArrayList connList = connService.GetConnectionsOfType("FLATFILE");
         CommonUtils.FilterOutFixedWidthConnections(connList);
         if (connList.Count > 0)
         {
             using (AddComponentForm form = new AddComponentForm())
             {
                 List <ConnectionItem> connItems = new List <ConnectionItem>();
                 foreach (ConnectionManager connManager in connList)
                 {
                     connItems.Add(new ConnectionItem(connManager));
                 }
                 form.InitializeConnectionManagerList(connItems);
                 if (form.ShowDialog(parentWindow) == System.Windows.Forms.DialogResult.OK)
                 {
                     if (form.SelectedItem != null)
                     {
                         Cursor oldCursor = Cursor.Current;
                         try
                         {
                             Cursor.Current = Cursors.WaitCursor;
                             ConnectionItem    connItem = form.SelectedItem;
                             ConnectionManager conn     = connItem.ConnectionManager;
                             AddFileConnection(conn);
                             TransferConnectionMetadata(conn);
                         }
                         finally
                         {
                             Cursor.Current = oldCursor;
                         }
                     }
                 }
             }
         }
     }
 }