示例#1
0
        private void ButtonLoadClassList_Click(object sender, EventArgs e)
        {
            OpenFileDialog.FileName = "";
            OpenFileDialog.Filter   = "Lineage II AI config (ai.obj)|*.obj|All files (*.*)|*.*";
            if (OpenFileDialog.ShowDialog() == DialogResult.Cancel)
            {
                return;
            }

            string sAIFile;

            sAIFile = OpenFileDialog.FileName;


            var inFile = new System.IO.StreamReader(sAIFile, System.Text.Encoding.Default, true, 1);

            int    iTemp = 0;
            string sTemp = "";

            string[] aTemp = null;

            ProgressBar.Maximum = Conversions.ToInteger(inFile.BaseStream.Length);
            ProgressBar.Value   = 0;

            CheckedListBox.SuspendLayout();

            while (inFile.EndOfStream != true)
            {
                sTemp             = inFile.ReadLine();
                ProgressBar.Value = Conversions.ToInteger(inFile.BaseStream.Position);
                this.Update();

                if (sTemp.StartsWith("class ") == true)
                {
                    // class 1 party_private : party_private_param
                    aTemp = sTemp.Split((char)32);
                    CheckedListBox.Items.Add(aTemp[2]);
                }
            }

            ProgressBar.Value = 0;
            CheckedListBox.ResumeLayout();

            if (CheckedListBox.Items.Count > 0)
            {
                CheckBoxUseList.Enabled = true;
            }
        }
        /// <summary>
        /// Required method for Designer support - do not modify
        /// the contents of this method with the code editor.
        /// </summary>
        private void InitializeComponent()
        {
            RBV_groupBoxTitle = new GroupBox();
            checkedListBox    = new CheckedListBox();

            checkedListBox.SuspendLayout();
            RBV_groupBoxTitle.SuspendLayout();
            SuspendLayout();

            //
            // checkedListBox
            //
            checkedListBox.BackColor                  = SystemColors.Control;
            checkedListBox.CheckOnClick               = true;
            checkedListBox.Font                       = new Font("Segoe UI", 12F, FontStyle.Regular, GraphicsUnit.Point);
            checkedListBox.FormattingEnabled          = true;
            checkedListBox.ScrollAlwaysVisible        = false;
            checkedListBox.HorizontalScrollbar        = false;
            checkedListBox.MultiColumn                = true;
            checkedListBox.Name                       = "checkedListBox";
            checkedListBox.RightToLeft                = RightToLeft.No;
            checkedListBox.IntegralHeight             = false;
            checkedListBox.Dock                       = DockStyle.Fill;
            checkedListBox.Sorted                     = true;
            checkedListBox.TabIndex                   = 18;
            checkedListBox.UseCompatibleTextRendering = true;
            checkedListBox.SelectionMode              = SelectionMode.One;
            //
            // RBV_groupBoxTitle
            //
            RBV_groupBoxTitle.Controls.Add(checkedListBox);
            RBV_groupBoxTitle.Dock     = DockStyle.Fill;
            RBV_groupBoxTitle.Name     = "RBV_groupBoxTitle";
            RBV_groupBoxTitle.TabIndex = 0;
            RBV_groupBoxTitle.TabStop  = false;
            RBV_groupBoxTitle.Text     = "RBV_groupBoxTitle";


            //
            // CheckedArrayControl
            //
            AutoScaleDimensions = new SizeF(7F, 15F);
            AutoScaleMode       = AutoScaleMode.Font;
            Controls.Add(RBV_groupBoxTitle);
            Name = "CheckedArrayControl";
            Dock = DockStyle.Fill;
        }
示例#3
0
        /// <summary>
        /// Initializes objects on the Edit From with data from selected Input and Output defined by Index
        /// </summary>
        /// <param name="clbInputColumns">CheckedListBox with InputColumns</param>
        /// <param name="lbSelectedItems">ListBox with selected InputColumns</param>
        /// <param name="trvOutputColumns">TreeView with OutputColumns</param>
        /// <param name="outputColumnCreator">Delegate for OutputColumnCreator - Method providing new instance of FormOutputColumn for exiswting IDTSOutputColumns</param>
        /// <param name="propertyChangedHandler">Handler to hook to ProperrtyChanged event of FormInputColumns, FormOutput and FormOutputColum objects</param>
        /// <param name="inputIndex">Index of the input to used to populate InputColumns</param>
        /// <param name="outputIndex">Index of the output to be used to pouplate OutputColumns</param>
        public virtual void FormInitialize(CheckedListBox clbInputColumns, ListBox lbSelectedItems, TreeView trvOutputColumns, OutputColumnCreator outputColumnCreator,
                                           PropertyChangedEventHandler o_PropertyChanged, int inputIndex, int outputIndex)
        {
            try
            {
                Loading = true;
                if (clbInputColumns != null)
                {
                    clbInputColumns.SuspendLayout();
                }
                if (lbSelectedItems != null)
                {
                    lbSelectedItems.SuspendLayout();
                }
                if (trvOutputColumns != null)
                {
                    trvOutputColumns.SuspendLayout();
                }

                if (clbInputColumns != null)
                {
                    List <FormInputColumn> inputCols = GetFormInputColumns(inputIndex);

                    inputCols.ForEach(ic => clbInputColumns.Items.Add(ic, ic.IsSelected));

                    if (lbSelectedItems != null)
                    {
                        List <FormInputColumn> selectedColumns = inputCols.FindAll(ic => ic.IsSelected);
                        selectedColumns.Sort((a, b) => a.SortOrder.CompareTo(b.SortOrder));

                        lbSelectedItems.Items.AddRange(selectedColumns.ToArray());
                    }
                }

                if (trvOutputColumns != null)
                {
                    trvOutputColumns.Nodes.Clear();

                    List <FormOutput> outputs = GetFormOutputs(o_PropertyChanged);

                    foreach (FormOutput o in outputs)
                    {
                        TreeNode outputNode = new TreeNode(o.Name);
                        outputNode.Name = o.Guid.ToString();
                        outputNode.Tag  = o;

                        List <FormOutputColumn> cols = GetFormOutputColumns(o.ID, outputColumnCreator, o_PropertyChanged);

                        foreach (FormOutputColumn col in cols)
                        {
                            TreeNode outputColumnNode = new TreeNode(col.Name);
                            outputColumnNode.Name = col.Guid.ToString();

                            outputNode.Nodes.Add(outputColumnNode);
                            outputColumnNode.Tag   = col;
                            col.AssociatedTreeNode = outputColumnNode;
                        }

                        trvOutputColumns.Nodes.Add(outputNode);
                    }

                    trvOutputColumns.ExpandAll();

                    if (trvOutputColumns.Nodes.Count > 0)
                    {
                        TreeNode nd = trvOutputColumns.Nodes[0];
                        if (nd.Nodes.Count > 0)
                        {
                            trvOutputColumns.SelectedNode = nd.FirstNode;
                        }
                        else
                        {
                            trvOutputColumns.SelectedNode = nd;
                        }
                        trvOutputColumns.SelectedNode.EnsureVisible();
                    }
                }
            }
            finally
            {
                Loading = false;
                if (clbInputColumns != null)
                {
                    clbInputColumns.ResumeLayout();
                }
                if (lbSelectedItems != null)
                {
                    lbSelectedItems.ResumeLayout();
                }
                if (trvOutputColumns != null)
                {
                    trvOutputColumns.ResumeLayout();
                }
            }
        }