コード例 #1
0
ファイル: BatchUC.cs プロジェクト: Genjo15/Analytics-V2
        /****************************************************** 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);
                }
            }
        }
コード例 #2
0
ファイル: Navigator.cs プロジェクト: Genjo15/Analytics-V2
        /**************************************************************\
         * 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);
        }
コード例 #3
0
ファイル: Main.cs プロジェクト: Genjo15/Analytics-V2
        private void LaunchBatchSingle(Batch batch)
        {
            foreach (KeyValuePair<string, Tuple<string, string, string>> element in batch.Get_BatchElements())
            {
                /* Define paths (input, logs) */
                DirectoryInfo targetPath = new DirectoryInfo(element.Key);
                FileInfo[] inputFiles = targetPath.GetFiles();

                _InputFiles.Clear();
                foreach (FileInfo file in inputFiles)
                {
                    _InputFiles.Add(file.FullName);
                    _LogsPath = file.Directory.FullName;
                }

                /* Create a new config */
                Config config = new Config(element.Value.Item1, element.Value.Item2);

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

                _ProgressBarsList.Add(new ProgressBar(config.Get_Name(), _ProgressBarsList.Count, _AbortThreadDel));
                _Navigator.ProgressGroupBox.Panel.Controls.Add(_ProgressBarsList[_ProgressBarsList.Count - 1]);
                _LogsList.Add(new Log(config.Get_Name(), config.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();
            }
        }