/****************************************************** SINGLE MODE *******************************************************/ /***********************************\ * Instanciate graphical elements * \***********************************/ private void InstanciateBatchGraphical(Batch batch) { // Set navigator page Navigator.SelectedIndex = 0; // Open creation section if (SplitContainer.Panel2Collapsed) { Form form = (Form)this.Parent; form.Size = new System.Drawing.Size(form.Width + 300, form.Height); SplitContainer.Panel2Collapsed = false; SplitContainer.Panel2.Show(); } else { BatchNameTextBox.Text = ""; BatchNameTextBoxMulti.Text = ""; foreach (BatchElement element in _BatchElements) element.Dispose(); _BatchElements.Clear(); foreach (BatchElementMulti element2 in _BatchElementsMulti) element2.Dispose(); _BatchElementsMulti.Clear(); } // Add graphical elements if (batch.Get_Type().Equals("Single")) { BatchNameTextBox.Text = batch.Get_Name(); foreach (KeyValuePair<string, Tuple<string, string, string>> element in batch.Get_BatchElements()) { BatchElement batchElement = new BatchElement(_RegionsList); batchElement.Config.Text = element.Value.Item1.Replace(".xml", ""); batchElement.Set_TargetPathTooltip(element.Key); batchElement.Set_TargetPath(element.Key); batchElement.Set_ConfigPath(element.Value.Item2); batchElement.Set_ConfigName(element.Value.Item1.Replace(".xml", "")); batchElement.Set_FtpRegion(element.Value.Item3); batchElement.FTPComboBox.SelectedItem = element.Value.Item3; batchElement.SuppressButton.Click += SuppressButton_Click; // Add new element to the UC BatchElementsGroupBox.Panel.Controls.Add(batchElement); batchElement.Dock = DockStyle.Top; batchElement.BringToFront(); _BatchElements.Add(batchElement); } } }
private void BatchElementsGroupBox_Panel_DragDrop(object sender, DragEventArgs e) { if (!e.Data.GetDataPresent(typeof(TreeNode))) return; TreeNode node = (TreeNode)e.Data.GetData(typeof(TreeNode)); if (node.ImageIndex == 2 && node.Text.Contains(".xml")) { BatchElement batchElement = new BatchElement(_RegionsList); batchElement.Config.Text = node.Text.Replace(".xml",""); batchElement.Set_ConfigPath(node.FullPath); batchElement.Set_ConfigName(node.Text.Replace(".xml", "")); batchElement.Set_FtpRegion("-"); batchElement.SuppressButton.Click += SuppressButton_Click; // Add new element to the UC BatchElementsGroupBox.Panel.Controls.Add(batchElement); batchElement.Dock = DockStyle.Top; batchElement.BringToFront(); _BatchElements.Add(batchElement); TutoLabel.Visible = false; } }