예제 #1
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);
        }
예제 #2
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);
                }
            }
        }
예제 #3
0
        /*****************************************\
         * Save new batch                        *
         *    -> Check validity                  *
         *    -> Suppress old batch if exists    *
         *    -> Add batch to the list of batchs *
         *    -> Remove old batch row if exist   *
         *    -> Add batch to the datagrid       *
         *    -> Clear Batch elements UCs        *
        \*****************************************/
        private void SaveButtonSpec_Click(object sender, EventArgs e)
        {
            // Check if each element is correctly, save if ok
            if (CheckBatch())
            {
                // Suppress old batch if exists
                foreach (Batch element in _BatchsList)
                {
                    if (element.Get_Name().Equals(BatchNameTextBox.Text))
                    {
                        _BatchsList.Remove(element);
                        break;
                    }
                }

                // Add batch to the list of batchs
                Batch batch = new Batch(BatchNameTextBox.Text, "Single");

                foreach (BatchElement element in _BatchElements)
                {
                    batch.AddBatchElement(element.Get_TargetPath(), element.Get_ConfigName(), element.Get_ConfigPath(),element.Get_FtpRegion());
                }

                _BatchsList.Add(batch);

                KryptonMessageBox.Show("Saved !", "Saved", MessageBoxButtons.OK, MessageBoxIcon.Information);

                // Remove old batch row if exist
                foreach (DataGridViewRow element in BatchsDataGridView.Rows)
                {
                    if (element.Cells[0].Value.Equals(BatchNameTextBox.Text))
                    {
                        BatchsDataGridView.Rows.Remove(element);
                        break;
                    }
                }

                // Add batch to the datagrid
                BatchsDataGridView.AllowUserToAddRows = true;
                DataGridViewRow row = (DataGridViewRow)BatchsDataGridView.Rows[0].Clone();
                row.Cells[0].Value = batch.Get_Name();
                BatchsDataGridView.Rows.Add(row);
                BatchsDataGridView.AllowUserToAddRows = false;

                // Clear Batch creation elements
                SplitContainer.Panel2Collapsed = true;
                SplitContainer.Panel2.Hide();
                Form form = (Form)this.Parent;
                form.Size = new System.Drawing.Size(form.Width - 300, form.Height);
                BatchNameTextBox.Text = "";
                BatchNameTextBoxMulti.Text = "";
                TutoLabel.Visible = true;
                foreach (BatchElement element in _BatchElements)
                    element.Dispose();
                _BatchElements.Clear();
                foreach (BatchElementMulti element2 in _BatchElementsMulti)
                    element2.Dispose();
                _BatchElementsMulti.Clear();

                EditToolStripButton.Enabled = true;
                AddToolStripButton.Enabled = true;
                RemoveToolStripButton.Enabled = true;
            }
        }
예제 #4
0
        /****************************************************** 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);
                }
            }
        }