コード例 #1
0
ファイル: Settings.cs プロジェクト: pheroux/RegistryMonitor
        private void saveButton_Click(object sender, EventArgs e)
        {
            if (_allowFeatureUsageLogging)
            {
                ExceptionlessClient.Default.SubmitFeatureUsage(Constants.FeatureUsages.SettingsSaved);
            }

            if (tabControl.SelectedTab == tabGeneral)
            {
                GeneralUtils.SaveGeneralSettings(_loadedSettings, CreateGeneralStruct());

                if (checkGeneralStartWithWindows.Checked)
                {
                    // Add the value in the registry so that the application runs at startup
                    rkStartup.SetValue(REGISTRY_MONITOR, Application.ExecutablePath);
                }
                else
                {
                    // Remove the value from the registry so that the application doesn't start
                    rkStartup.DeleteValue(REGISTRY_MONITOR, false);
                }
            }
            else
            {
                if (tabControl.SelectedTab == tabEnvironments)
                {
                    EnvironmentUtils.SaveCurrentEnvironment(_loadedSettings, lstEnvAllEnvironments, CreateEnvironmentStruct());
                }
                else if (tabControl.SelectedTab == tabTools)
                {
                    ToolsUtils.SaveCurrentTool(_loadedSettings, lstToolAllTools, CreateToolStruct());
                }
            }
        }
コード例 #2
0
ファイル: BaseListCtrl.cs プロジェクト: caojiaju-2017/Spider
        private void loadMenuData()
        {
            _dataList.Items.Clear();
            for (int index = 0; index < GlobalConfig.SystemMenus.Count; index++)
            {
                ServiceItem  menu = GlobalConfig.SystemMenus[index];
                ListViewItem item = new ListViewItem();
                item.Tag = menu;
                for (int inx = 0; inx < _item.ServiceItemAttrs.Count; inx++)
                {
                    ServiceItemAttribute attr = _item.ServiceItemAttrs[inx];

                    if (inx == 0)
                    {
                        item.Text = ToolsUtils.GetObjectPropertyValue <ServiceItem>(menu, attr.KName);
                        continue;
                    }

                    item.SubItems.Add(ToolsUtils.GetObjectPropertyValue <ServiceItem>(menu, attr.KName));
                }


                //item.SubItems.Add(menu.Url);
                //item.SubItems.Add(menu.PUrlId);
                //item.SubItems.Add(menu.UrlId);
                //item.SubItems.Add(menu.ImageName);
                //item.SubItems.Add(menu.Inx.ToString());
                //item.SubItems.Add((menu.IsVirtual == 0? "否":"是"));
                //item.SubItems.Add(menu.CmdString);

                _dataList.Items.Add(item);
            }
        }
コード例 #3
0
ファイル: BaseListCtrl.cs プロジェクト: caojiaju-2017/Spider
        private bool excuteDelete(ServiceItem deleProtocol, ServiceItem srvItem)
        {
            HsApply applyLogin = new HsApply(GlobalConfig.getUrlHead(), deleProtocol.CmdString);

            applyLogin.InvokeType = deleProtocol.getHttpType(OpertorType.Delete);

            for (int index = 0; index < deleProtocol.ServiceItemAttrs.Count; index++)
            {
                ServiceItemAttribute attr = deleProtocol.ServiceItemAttrs[index];

                if (attr.KName == "PreApi")
                {
                    continue;
                }
                HsParam param1 = attr.buildParam(applyLogin.InvokeType);


                param1.ParamValue = ToolsUtils.GetObjectPropertyValue <ServiceItem>(srvItem, attr.KName);

                applyLogin.addParam(param1);
            }

            HsResultData resultDat = applyLogin.excuteCommand();

            //GlobalConfig.SystemProtocols.Clear();
            if (resultDat.ErrorId == 200)
            {
                return(true);
            }
            //MessageBox.Show(resultDat.ErrorInfo);
            return(false);
        }
コード例 #4
0
    private void Update()
    {
        if (Input.GetMouseButtonDown(0))
        {
            if (ToolsUtils.CheckIsOverGui())
            {
                return;
            }
            _prevDrawPosition = new IntVector2((int)Input.mousePosition.x, (int)Input.mousePosition.y);
            _isDrawing        = true;
        }

        if (Input.GetMouseButton(0) && _isDrawing)
        {
            IntVector2 currentDrawPosition =
                new IntVector2((int)Input.mousePosition.x, (int)Input.mousePosition.y);
            currentDrawPosition.FixMousePositionForEditor(_textureSize);

            if (currentDrawPosition == _prevDrawPosition)
            {
                DrawDot(_prevDrawPosition);
            }
            else
            {
                DrawLine(_prevDrawPosition, currentDrawPosition);
                _prevDrawPosition = currentDrawPosition;
            }
        }

        if (Input.GetMouseButtonUp(0) && _isDrawing)
        {
            _isDrawing = false;
        }
    }
コード例 #5
0
        public object getInputValue(string kname)
        {
            for (int index = 0; index < this.Controls.Count; index++)
            {
                Control ctrl = this.Controls[index];

                if (ctrl.Tag == null)
                {
                    continue;
                }

                ServiceItemAttribute attr = ctrl.Tag as ServiceItemAttribute;

                if (attr.KName == kname)
                {
                    if (ctrl is TextBox)
                    {
                        return(((TextBox)ctrl).Text);
                    }
                    else if (ctrl is RadioButton)
                    {
                        RadioButton rbt = (RadioButton)ctrl;
                        if (rbt.Checked)
                        {
                            return(rbt.Text == "是" ? 1 : 0);
                        }
                        continue;
                    }
                    else if (ctrl is ComboBox)
                    {
                        ComboBox rbt = (ComboBox)ctrl;

                        object selObj = rbt.SelectedItem;

                        if (selObj == null)
                        {
                            return(null);
                        }

                        return(ToolsUtils.getObjectId(selObj));
                    }
                }
            }

            return(null);
        }
コード例 #6
0
        private void initCtrl()
        {
            int labWidth   = 100;
            int ctrlHeight = 20;
            int xSep       = 40;
            int rowSep     = 25;

            for (int index = 0; index < SrvItem.ServiceItemAttrs.Count; index++)
            {
                ServiceItemAttribute attr = SrvItem.ServiceItemAttrs[index];

                Label lab = new Label();
                lab.Text     = attr.KAlias;
                lab.Font     = new System.Drawing.Font("宋体", 12);
                lab.Location = new Point(xSep, index * (rowSep + 20));
                lab.Size     = new Size(labWidth, ctrlHeight);
                this.Controls.Add(lab);


                if (attr.SelObjects == null || attr.SelObjects == "")
                {
                    TextBox box = new TextBox();
                    box.Name     = attr.KName;
                    box.Font     = new Font("宋体", 10);
                    box.Location = new Point(xSep + labWidth + xSep, index * (rowSep + 20));
                    box.Size     = new Size(150, ctrlHeight);

                    if (OperType == OpertorType.Modi)
                    {
                        box.Text = ToolsUtils.GetObjectPropertyValue <ServiceItem>(SrvItem, attr.KName);
                    }
                    this.Controls.Add(box);

                    box.Tag = attr;
                }
                else
                {
                    string selString = attr.SelObjects.ToString();

                    if (selString.Contains("{") && selString.Contains("}"))
                    {
                        selString = selString.Replace("{", "");
                        selString = selString.Replace("}", "");
                        RadioButton rbtn1 = new RadioButton();
                        rbtn1.Text     = selString.Split(':')[0].ToString();
                        rbtn1.Font     = new Font("宋体", 10);
                        rbtn1.Location = new Point(lab.Location.X + lab.Width + xSep, index * (rowSep + 20));
                        rbtn1.Size     = new Size(50, ctrlHeight);
                        rbtn1.Tag      = attr;
                        this.Controls.Add(rbtn1);



                        RadioButton rbtn2 = new RadioButton();
                        rbtn2.Text     = selString.Split(':')[1].ToString();
                        rbtn2.Font     = new Font("宋体", 10);
                        rbtn2.Location = new Point(rbtn1.Location.X + rbtn1.Width + 5, index * (rowSep + 20));
                        rbtn2.Size     = new Size(50, ctrlHeight);
                        this.Controls.Add(rbtn2);
                    }
                    else if (selString.Contains("$"))
                    {
                        ComboBox cbBox = new ComboBox();
                        cbBox.Name     = attr.KName;
                        cbBox.Font     = new Font("宋体", 10);
                        cbBox.Location = new Point(xSep + labWidth + xSep, index * (rowSep + 20));
                        cbBox.Size     = new Size(150, ctrlHeight);
                        cbBox.Tag      = attr;
                        string AttrName = selString.Replace("$", "");
                        cbBox.DataSource = ToolsUtils.GetStaticAttribute(AttrName);
                        this.Controls.Add(cbBox);

                        if (OperType == OpertorType.Modi)
                        {
                            string code = ToolsUtils.GetObjectPropertyValue <ServiceItem>(SrvItem, attr.KName);

                            for (int inx = 0; inx < ((List <object>)cbBox.DataSource).Count; inx++)
                            {
                                object itemObj = ((List <object>)cbBox.DataSource)[inx];

                                string itemCode = ToolsUtils.getObjectId(itemObj);

                                if (code == itemCode)
                                {
                                    cbBox.SelectedIndex = inx;
                                }
                            }
                        }
                    }
                }
            }
        }