Ejemplo n.º 1
0
        private void CbScanDataType_SelectedIndexChanged(object sender, EventArgs e)
        {
            MetroToolTip1.SetToolTip(CbScanDataType, "Scan Data Type.");

            int i = CbScanDataType.SelectedIndex;

            if (i < 0)
            {
                return;
            }

            if (i < _host.SearchTypes.Count)
            {
                MetroToolTip1.SetToolTip(CbScanDataType, _cbScanDataTypeToolTips[(ISearchType)(CbScanDataType.SelectedItem as CBItem).Plugin]);
            }

            if (_isUserInput)
            {
                // Update parameters
                if (CbScanMethod.SelectedIndex >= 0)
                {
                    UpdateParameters((ISearchMethod)(CbScanMethod.SelectedItem as CBItem).Plugin, (ISearchType)(CbScanDataType.SelectedItem as CBItem).Plugin);
                }

                _isUserInput = false;
                UpdateSearchMethods((ISearchType)(CbScanDataType.SelectedItem as CBItem).Plugin);
                _isUserInput = true;
            }

            this.ResultBox.Type = (ISearchType)(CbScanDataType.SelectedItem as CBItem).Plugin;
        }
Ejemplo n.º 2
0
        // Populate parameters panel with the required UserControls
        private void UpdateParameters(ISearchMethod method, ISearchType type)
        {
            UserControl ctrl;

            MetroFramework.Controls.MetroLabel label;
            Point initPoint = new Point(12, 4);

            SplitContainer2.Panel2.SuspendLayout();
            SplitContainer2.Panel2.Enabled = false;
            SplitContainer2.Panel2.Controls.Clear();

            if (method.Params != null)
            {
                foreach (Types.SearchParam param in method.Params)
                {
                    // Get the UserControl
                    if (param.process)
                    {
                        ctrl = GetTypeEditor(param.name, type.ParamType);
                    }
                    else
                    {
                        ctrl = GetTypeEditor(param.name, param.type);
                    }

                    if (ctrl == null)
                    {
                        MessageBox.Show("Failed to create UserControl type editor for parameter " + param.name + " of type " + (param.process ? type.ParamType : param.type));
                        continue;
                    }

                    label = new MetroFramework.Controls.MetroLabel()
                    {
                        Theme = MetroFramework.MetroThemeStyle.Light,
                        UseCustomBackColor = true,
                        BackColor          = Color.Transparent,
                        Text     = param.name,
                        Location = new Point(initPoint.X, initPoint.Y),
                        Tag      = ctrl
                    };
                    label.Top += (ctrl.Height - label.Height) / 2;
                    MetroToolTip1.SetToolTip(label, param.description);

                    ctrl.Name     = param.name;
                    ctrl.Location = new Point(initPoint.X + label.Width + 5, initPoint.Y);
                    ctrl.Width    = SplitContainer2.Panel2.Width - ctrl.Left - 4;

                    initPoint.Y += ctrl.Height + 6;

                    SplitContainer2.Panel2.Controls.Add(label);
                    SplitContainer2.Panel2.Controls.Add(ctrl);
                }
            }


            // Adjust controls
            SplitContainer1.SplitterDistance = 110 + initPoint.Y + 5;
            SplitContainer2.SplitterDistance = 110;

            SplitContainer2.Panel2.Enabled = true;
            SplitContainer2.Panel2.ResumeLayout(true);
        }
Ejemplo n.º 3
0
 //##################################
 public void ShowToolTip(Control control, string caption)
 {
     MetroToolTip1.SetToolTip(control, $"  {caption}  ");
 }