Exemple #1
0
        /****************************************************** 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);
                }
            }
        }
Exemple #2
0
        /**************************************************************\
         * Display Batch Summary                                     *
        \**************************************************************/
        public void DisplayBatchSummary(Batch batch)
        {
            _ProcessHeaderGroupList.Clear();
            _ProcessHeaderGroupList = new List<KryptonHeaderGroup>();
            this.SummarySplitContainer1.Panel1.Controls.Clear();

            // Display the name of the batch
            KryptonHeader header = new KryptonHeader();
            header.Dock = System.Windows.Forms.DockStyle.Top;
            header.Text = "Batch : " + batch.Get_Name();
            header.Values.Description = null;
            header.Values.Image = null;

            // Display all batch elements
            if (batch.Get_BatchElements().Count > 0)
            {
                foreach (KeyValuePair<string, Tuple<string, string, string>> element in batch.Get_BatchElements())
                {
                    KryptonHeaderGroup headerGroup = new KryptonHeaderGroup();
                    ButtonSpecHeaderGroup buttonSpecHeaderGroup = new ButtonSpecHeaderGroup();
                    headerGroup.Dock = System.Windows.Forms.DockStyle.Top;
                    headerGroup.HeaderPositionSecondary = ComponentFactory.Krypton.Toolkit.VisualOrientation.Left;
                    headerGroup.ValuesPrimary.Image = null;
                    headerGroup.HeaderStylePrimary = ComponentFactory.Krypton.Toolkit.HeaderStyle.Secondary;
                    headerGroup.ValuesSecondary.Heading = "Target";
                    headerGroup.Text = element.Value.Item1;
                    buttonSpecHeaderGroup.Tag = headerGroup;
                    headerGroup.ButtonSpecs.AddRange(new ComponentFactory.Krypton.Toolkit.ButtonSpecHeaderGroup[] { buttonSpecHeaderGroup });
                    headerGroup.ButtonSpecs[0].Type = ComponentFactory.Krypton.Toolkit.PaletteButtonSpecStyle.RibbonExpand;
                    headerGroup.Size = new System.Drawing.Size(150, 23);

                    KryptonRichTextBox richTextBox = new KryptonRichTextBox();
                    richTextBox.Dock = System.Windows.Forms.DockStyle.Fill;
                    richTextBox.ReadOnly = true;
                    richTextBox.Text = element.Key + "\n\n FTP : " + element.Value.Item3;

                    headerGroup.Panel.Controls.Add(richTextBox);
                    _ProcessHeaderGroupList.Add(headerGroup);
                }
            }

            else if (batch.Get_BatchElementsMulti().Count > 0)
            {
                foreach (KeyValuePair<Tuple<string, string>, List<Tuple<string, string>>> element in batch.Get_BatchElementsMulti())
                {
                    KryptonHeaderGroup headerGroup = new KryptonHeaderGroup();
                    ButtonSpecHeaderGroup buttonSpecHeaderGroup = new ButtonSpecHeaderGroup();
                    headerGroup.Dock = System.Windows.Forms.DockStyle.Top;
                    headerGroup.HeaderPositionSecondary = ComponentFactory.Krypton.Toolkit.VisualOrientation.Left;
                    headerGroup.ValuesPrimary.Image = null;
                    headerGroup.HeaderStylePrimary = ComponentFactory.Krypton.Toolkit.HeaderStyle.Secondary;
                    headerGroup.ValuesSecondary.Heading = "Target";
                    headerGroup.Text = element.Value[0].Item1;
                    buttonSpecHeaderGroup.Tag = headerGroup;
                    headerGroup.ButtonSpecs.AddRange(new ComponentFactory.Krypton.Toolkit.ButtonSpecHeaderGroup[] { buttonSpecHeaderGroup });
                    headerGroup.ButtonSpecs[0].Type = ComponentFactory.Krypton.Toolkit.PaletteButtonSpecStyle.RibbonExpand;
                    headerGroup.Size = new System.Drawing.Size(150, 23);

                    KryptonRichTextBox richTextBox = new KryptonRichTextBox();
                    richTextBox.Dock = System.Windows.Forms.DockStyle.Fill;
                    richTextBox.ReadOnly = true;
                    richTextBox.AppendText( "FTP : " + element.Key.Item2 + "\n\n");
                    richTextBox.AppendText("Target path : " + element.Key.Item1 + "\n\n");
                    richTextBox.AppendText("Configs :\n");

                    foreach (Tuple<string, string> config in element.Value)
                        richTextBox.AppendText(config.Item1 + "\n");

                    headerGroup.Panel.Controls.Add(richTextBox);
                    _ProcessHeaderGroupList.Add(headerGroup);
                }
            }

            _ProcessHeaderGroupList.Reverse();
            foreach (KryptonHeaderGroup element in _ProcessHeaderGroupList)
                this.SummarySplitContainer1.Panel1.Controls.Add(element);

            this.SummarySplitContainer1.Panel1.Controls.Add(header);
        }
Exemple #3
0
        private void LaunchBatchMulti(Batch batch)
        {
            foreach (KeyValuePair<Tuple<string,string>, List<Tuple<string, string>>> element in batch.Get_BatchElementsMulti())
            {
                int configCounter = 1;

                // Define paths (input, logs)
                DirectoryInfo targetPath = new DirectoryInfo(element.Key.Item1);
                FileInfo[] inputFiles = targetPath.GetFiles();

                _InputFiles.Clear();
                foreach (FileInfo file in inputFiles)
                    _InputFiles.Add(file.FullName);

                // Create Config/Instanciate launcher for each config of each batch element
                foreach (Tuple<string, string> config in element.Value)
                {
                    // Copy all inputs in a separated directory
                    if (!Directory.Exists(targetPath + "\\" + configCounter.ToString()))
                        Directory.CreateDirectory(targetPath + "\\" + configCounter.ToString());
                    foreach (String input in _InputFiles)
                        File.Copy(input, targetPath + "\\" + configCounter.ToString() + "\\" + Path.GetFileName(input), true);

                    // Redefine paths
                    DirectoryInfo specificTargetPath = new DirectoryInfo(targetPath + "\\" + configCounter.ToString());
                    FileInfo[] specificInputFiles = specificTargetPath.GetFiles();
                    List<string> specificInputs = new List<string>();
                    string specificLogPath = specificTargetPath.FullName;

                    foreach (FileInfo file in specificInputFiles)
                        specificInputs.Add(file.FullName);

                    // Create a new config
                    Config specificConfig = new Config(config.Item1, config.Item2);

                    // Create launcher and associated UC.
                    _LaunchersList.Add(new Launcher(specificConfig, PreProcessButton.Checked, ProcessButton.Checked, ControlsButton.Checked, HCButton.Checked, new List<String>(specificInputs), specificLogPath, _UpdateProgressBarDel, _UpdateRichTextBoxDel, _AddLogsGridViewDel, _DisplayConfigProcessTimeDel));

                    _ProgressBarsList.Add(new ProgressBar(specificConfig.Get_Name(), _ProgressBarsList.Count, _AbortThreadDel));
                    _Navigator.ProgressGroupBox.Panel.Controls.Add(_ProgressBarsList[_ProgressBarsList.Count - 1]);
                    _LogsList.Add(new Log(specificConfig.Get_Name(), specificConfig.Get_TargetsNumber(), PreProcessButton.Checked, ProcessButton.Checked, ControlsButton.Checked));
                    _Navigator.LogsNavigator.Pages.Insert(0, _LogsList[_LogsList.Count - 1].Get_NavigatorTab());
                    _Navigator.LogsNavigator.SelectedIndex = 0;
                    _LogsList[_LogsList.Count - 1].Get_NavigatorTab().ButtonSpecs[0].Click += new EventHandler(_Navigator.CloseLogsNavigatorTab);

                    _PoolThreads.Add(new Thread(() => _LaunchersList[_LaunchersList.Count - 1].Run(_LaunchersList.Count - 1)));
                    _PoolThreads[_PoolThreads.Count - 1].IsBackground = true;
                    _PoolThreads[_PoolThreads.Count - 1].Start();

                    configCounter++;
                }

            }
        }