コード例 #1
0
ファイル: BatchUC.cs プロジェクト: Genjo15/Analytics-V2
        /****************************************************** MULTI MODE *******************************************************/
        private void InstanciateBatchMultiGraphical(Batch batch)
        {
            TutoLabelMulti.Visible = false;

            // Set navigator page
            Navigator.SelectedIndex = 1;

            // 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("Multi"))
            {
                BatchNameTextBoxMulti.Text = batch.Get_Name();

                foreach (KeyValuePair<Tuple<string, string>, List<Tuple<string, string>>> element in batch.Get_BatchElementsMulti())
                {
                    BatchElementMulti batchElement = new BatchElementMulti(_RegionsList);
                    batchElement.Set_TargetPathTooltip(element.Key.Item1);
                    batchElement.Set_TargetPath(element.Key.Item1);
                    batchElement.Set_FtpRegion(element.Key.Item2);
                    batchElement.FTPComboBox.Text = element.Key.Item2;

                    for (int i = 0; i < element.Value.Count; i++)
                    {
                        if (i == 0)
                        {
                            batchElement.Config.Text = element.Value[0].Item1;
                            batchElement.Get_ConfigsInfo().Add(element.Value[i].Item1, element.Value[i].Item2);
                        }
                        else
                        {
                            batchElement.TutoLabel.Visible = false;
                            batchElement.Set_IdControls(batchElement.Get_IdControls() + 1);

                            batchElement.SuppressButton.Click += SuppressButton_Click;

                            ////////////////
                            // Add graphics
                            // Label "Config"

                            KryptonLabel configLabel = new KryptonLabel();
                            configLabel.Text = "Config : ";
                            configLabel.Tag = batchElement.Get_IdControls();
                            configLabel.Location = new System.Drawing.Point(35, 86 + (batchElement.Get_AdditionalConfigsLabel().Count + 1) * 20);
                            batchElement.GroupBox.Panel.Controls.Add(configLabel);

                            // Label config name
                            Label configNameLabel = new Label();
                            configNameLabel.AutoSize = true;
                            configNameLabel.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left) | System.Windows.Forms.AnchorStyles.Right)));
                            configNameLabel.Text = element.Value[i].Item1;
                            configNameLabel.BackColor = System.Drawing.Color.Transparent;
                            configNameLabel.Font = new System.Drawing.Font("Calibri", 11.25F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
                            configNameLabel.Tag = batchElement.Get_IdControls(); ;
                            configNameLabel.Location = new System.Drawing.Point(94, 86 + (batchElement.Get_AdditionalConfigs().Count + 1) * 20);
                            batchElement.GroupBox.Panel.Controls.Add(configNameLabel);

                            // mini suppress button
                            KryptonButton button = new KryptonButton();
                            button.Tag = batchElement.Get_IdControls();
                            button.ButtonStyle = ComponentFactory.Krypton.Toolkit.ButtonStyle.LowProfile;
                            button.Location = new System.Drawing.Point(10, 88 + (batchElement.Get_AdditionalConfigs().Count + 1) * 20);
                            button.Size = new System.Drawing.Size(16, 16);
                            button.Values.Image = global::Analytics_V2.Properties.Resources.Delete2;
                            button.Click += batchElement.SuppressConfigElement;
                            batchElement.GroupBox.Panel.Controls.Add(button);

                            batchElement.Get_AdditionalConfigsLabel().Add(configLabel);
                            batchElement.Get_AdditionalConfigs().Add(configNameLabel);
                            batchElement.Get_SuppressButtons().Add(button);

                            // Add config to dictionnary
                            batchElement.Get_ConfigsInfo().Add(element.Value[i].Item1, element.Value[i].Item2);

                            batchElement.Height += 20;
                        }
                    }

                    // Add new element to the UC
                    BatchElementsGroupBoxMulti.Panel.Controls.Add(batchElement);
                    batchElement.Dock = DockStyle.Top;
                    batchElement.BringToFront();

                    _BatchElementsMulti.Add(batchElement);
                }
            }
        }
コード例 #2
0
ファイル: BatchUC.cs プロジェクト: Genjo15/Analytics-V2
        private void BatchElementsGroupoxMulti_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"))
            {
                BatchElementMulti batchElement = new BatchElementMulti(_RegionsList);
                batchElement.Config.Text = node.Text.Replace(".xml", "");
                batchElement.Get_ConfigsInfo().Add(node.Text.Replace(".xml", ""), node.FullPath);
                batchElement.SuppressButton.Click += SuppressButton_Click;
                batchElement.Set_FtpRegion("-");

                // Add new element to the UC
                BatchElementsGroupBoxMulti.Panel.Controls.Add(batchElement);
                batchElement.Dock = DockStyle.Top;
                batchElement.BringToFront();

                _BatchElementsMulti.Add(batchElement);

                TutoLabelMulti.Visible = false;
            }
        }