//自定义方法——封装下拉选择框 SelectedIndexChanged 事件代码
 //实现下拉选择框的选择的值 赋值到 数据视图控件相应的单元格中
 private void cboDgvSelectedValue(SkinComboBox myCboDgvContext, SkinDataGridView myDgv)
 {
     if (myDgv.CurrentCell != null)
     {
         myDgv.CurrentCell.Value = myCboDgvContext.Items[myCboDgvContext.SelectedIndex];
     }
 }
Esempio n. 2
0
        private async void Load(int PLC)                                                                                                                                        //加载控件信息
        {
            SkinGroupBox GroupBox_PLC      = (SkinGroupBox)(from Control pi in skinTabs[0].Controls where pi.Text == "读取/写入地址" select pi).FirstOrDefault();                     //查询要写入对象
            SkinComboBox skinCombo_PLC     = (SkinComboBox)(from Control pi in GroupBox_PLC.Controls where pi.Name == "skinComboBox13" select pi).FirstOrDefault();             //查询PLC选项菜单
            SkinComboBox skinCombo_PLC_Bit = (SkinComboBox)(from Control pi in GroupBox_PLC.Controls where pi.Name == "skinComboBox12" select pi).FirstOrDefault();             //查询PLC选项菜单
            SkinCheckBox skinCheckBox      = (SkinCheckBox)(from Control pi in GroupBox_PLC.Controls where pi.Name == "skinCheckBox1" select pi).FirstOrDefault();              //查询是否启用读写不同地址功能
            //预留功能
            SkinGroupBox GroupBox_PLC_check      = (SkinGroupBox)(from Control pi in skinTabs[0].Controls where pi.Text == "写入地址_复选" select pi).FirstOrDefault();               //查询要写入对象
            SkinComboBox skinCombo_PLC_check     = (SkinComboBox)(from Control pi in GroupBox_PLC_check.Controls where pi.Name == "skinComboBox11" select pi).FirstOrDefault(); //查询PLC选项菜单
            SkinComboBox skinCombo_PLC_Bit_check = (SkinComboBox)(from Control pi in GroupBox_PLC_check.Controls where pi.Name == "skinComboBox10" select pi).FirstOrDefault(); //查询PLC选项菜单

            switch (PLC)
            {
            case 0:                                                                                 //三菱PLC
                skinCombo_PLC     = ComboBox_Mitsubishi_PLCload(skinCombo_PLC);                     //修改对象并且返回对象
                skinCombo_PLC_Bit = SkinComboBox_Mitsubishi_BitLoad(skinCombo_PLC_Bit);             //修改对象并且返回对象
                //预留功能数据填充
                skinCombo_PLC_check     = ComboBox_Mitsubishi_PLCload(skinCombo_PLC_check);         //修改对象并且返回对象
                skinCombo_PLC_Bit_check = SkinComboBox_Mitsubishi_BitLoad(skinCombo_PLC_Bit_check); //修改对象并且返回对象
                break;
            }
            //预留功能读写不同地址
            skinCheckBox.MouseClick += skinCheckBox_MouseClick; //注册事件
            skinCheckBox_MouseClick(1, new EventArgs());        //先隐藏
        }
Esempio n. 3
0
        private void SetLevelValue(SkinComboBox skinComboBox_level)
        {
            try
            {
                if (CommonGlobalUtil.EngineUnconnectioned(this))
                {
                    return;
                }
                List <ListItem <DistributorLevelType> > levelTypes = new List <ListItem <DistributorLevelType> >();

                levelTypes.Add(new ListItem <DistributorLevelType>(JGNet.Core.Tools.EnumHelper.GetDescription(DistributorLevelType.All), DistributorLevelType.All));
                levelTypes.Add(new ListItem <DistributorLevelType>(JGNet.Core.Tools.EnumHelper.GetDescription(DistributorLevelType.LevelOne), DistributorLevelType.LevelOne));
                levelTypes.Add(new ListItem <DistributorLevelType>(JGNet.Core.Tools.EnumHelper.GetDescription(DistributorLevelType.LevelTwo), DistributorLevelType.LevelTwo));
                levelTypes.Add(new ListItem <DistributorLevelType>(JGNet.Core.Tools.EnumHelper.GetDescription(DistributorLevelType.LevelThree), DistributorLevelType.LevelThree));
                levelTypes.Add(new ListItem <DistributorLevelType>(JGNet.Core.Tools.EnumHelper.GetDescription(DistributorLevelType.LevelFour), DistributorLevelType.LevelFour));
                levelTypes.Add(new ListItem <DistributorLevelType>(JGNet.Core.Tools.EnumHelper.GetDescription(DistributorLevelType.LevelFive), DistributorLevelType.LevelFive));
                levelTypes.Add(new ListItem <DistributorLevelType>(JGNet.Core.Tools.EnumHelper.GetDescription(DistributorLevelType.LevelSix), DistributorLevelType.LevelSix));
                levelTypes.Add(new ListItem <DistributorLevelType>(JGNet.Core.Tools.EnumHelper.GetDescription(DistributorLevelType.LevelSeven), DistributorLevelType.LevelSeven));
                levelTypes.Add(new ListItem <DistributorLevelType>(JGNet.Core.Tools.EnumHelper.GetDescription(DistributorLevelType.LevelEight), DistributorLevelType.LevelEight));
                levelTypes.Add(new ListItem <DistributorLevelType>(JGNet.Core.Tools.EnumHelper.GetDescription(DistributorLevelType.LevelNine), DistributorLevelType.LevelNine));
                levelTypes.Add(new ListItem <DistributorLevelType>(JGNet.Core.Tools.EnumHelper.GetDescription(DistributorLevelType.LevelTen), DistributorLevelType.LevelTen));
                skinComboBox_level.DisplayMember = "Key";
                skinComboBox_level.ValueMember   = "Value";
                skinComboBox_level.DataSource    = levelTypes;
            }
            catch (Exception ex)
            {
                ShowError(ex);
            }
            finally
            {
                UnLockPage();
            }
        }
Esempio n. 4
0
        private void skinComboBox_Color_TextUpdate(object sender, EventArgs e)
        {
            try
            {
                List <CostumeColor> listNew = new List <CostumeColor>();
                //  skinComboBox_Brand.Items.Clear();
                SkinComboBox box = (SkinComboBox)sender;
                String       str = box.Text;
                foreach (var item in GlobalCache.CostumeColorList)
                {
                    if ((item.ID + item.Name + item.FirstCharSpell).ToUpper().Contains(str.ToUpper()))
                    {
                        listNew.Add(item);
                    }
                }

                if (listNew.Count == 0)
                {
                    listNew = GlobalCache.CostumeColorList;
                }

                box.DataSource     = listNew;
                box.Text           = str;
                box.SelectionStart = str.Length;
                box.DroppedDown    = true;//自动展开下拉框
            }
            catch (Exception ex)
            {
                GlobalUtil.ShowError(ex);
            }
        }
 private void skinComboBox_Brand_TextUpdate(object sender, EventArgs e)
 {
     try
     {
         List <Brand> listNew = new List <Brand>();
         //  skinComboBox_Brand.Items.Clear();
         SkinComboBox box = (SkinComboBox)sender;
         String       str = box.Text;
         foreach (var item in CommonGlobalCache.BrandList)
         {
             if ((item.Name + item.FirstCharSpell).ToUpper().Contains(str.ToUpper()))
             {
                 listNew.Add(item);
             }
         }
         if (String.IsNullOrEmpty(str) || listNew.Count == 0)
         {
             listNew = new List <Brand>();
             listNew.Add(new Brand()
             {
                 Name = CommonGlobalUtil.COMBOBOX_ALL, AutoID = -1
             });
             listNew.AddRange(CommonGlobalCache.BrandList);
         }
         box.DataSource    = listNew;
         box.SelectedIndex = 0;
         //box.Text = str;
         box.SelectionStart = str.Length;
         box.DroppedDown    = true;//自动展开下拉框
     }
     catch (Exception ex)
     {
         CommonGlobalUtil.ShowError(ex);
     }
 }
Esempio n. 6
0
        private void SetLogisticCompany(SkinComboBox skinTextBoxLogisticCompany)
        {
            try
            {
                if (GlobalUtil.EngineUnconnectioned(this))
                {
                    return;
                }
                List <EmExpressCompany> list = new List <EmExpressCompany>();

                list = GlobalCache.EMallServerProxy.GetEnabledEmExpressCompanys();

                if (list != null)
                {
                    skinTextBoxLogisticCompany.DisplayMember = "ExpressCompanyName";
                    skinTextBoxLogisticCompany.ValueMember   = "ExpressCompanyName";
                    skinTextBoxLogisticCompany.DataSource    = list;
                }
            }
            catch (Exception ex)
            {
                GlobalUtil.ShowError(ex);
            }
            finally
            {
                GlobalUtil.UnLockPage(this);
            }
        }
Esempio n. 7
0
 private SkinComboBox ComboBox_Mitsubishi_PLCload(SkinComboBox skinCombo) //加载PLC选项
 {
     skinCombo.Items.Clear();                                             //清除选项
     skinCombo.Items.Add("Mitsubishi FX5U -(Ethernet)");                  //添加选项
     skinCombo.SelectedIndex = 0;
     skinCombo.SelectedItem  = 0;
     return(skinCombo);//返回对象
 }
Esempio n. 8
0
 }                                                                                                                                   //返回图片属性
 public ListView_show(List <ImageList> imageLists, SkinListView skinListView, SkinComboBox skinComboBox, SkinPictureBox skinPicture) //构造函数
 {
     this.imageLists   = imageLists;
     this.skinListView = skinListView;
     this.skinComboBox = skinComboBox;
     this.skinPicture  = skinPicture;
     this.skinListView.ItemActivate             += listView_ItemActivate;             //注册选择事件
     this.skinComboBox.SelectionChangeCommitted += comboBox_SelectionChangeCommitted; //注册事件
 }
Esempio n. 9
0
        private void SetRange(SkinComboBox comboBox)
        {
            List <int> rangeList = new List <int>();

            for (int i = 1; i < 11; i++)
            {
                rangeList.Add(i * 50);
            }
            comboBox.DataSource = rangeList;
        }
        public GeckofxDetailedFrm(SkinTabControl tabControl, TaskInfoEntity taskInfoEntity)
        {
            InitializeComponent();
            comboBox            = new SkinComboBox();
            fieldsComboBox      = new SkinComboBox();
            this.tabControl     = tabControl;
            this.taskInfoEntity = taskInfoEntity;

            init();
        }
Esempio n. 11
0
 private SkinComboBox SkinComboBox_Mitsubishi_BitLoad(SkinComboBox skinCombo)
 {
     skinCombo.Items.Clear();//清除选项
     foreach (Mitsubishi_bit suit in Enum.GetValues(typeof(Mitsubishi_bit)))
     {
         skinCombo.Items.Add(suit);//添加选项
     }
     skinCombo.SelectedIndex = 0;
     skinCombo.SelectedItem  = 0;
     return(skinCombo);
 }
Esempio n. 12
0
        public GeckofxFrm(SkinTabControl tabControl, TaskInfoEntity taskInfoEntity)
        {
            InitializeComponent();
            comboBox       = new SkinComboBox();
            fieldsComboBox = new SkinComboBox();

            this.tabControl     = tabControl;
            this.taskInfoEntity = taskInfoEntity;
            dataGridViewEvent   = new DataGridViewEvent();

            init();
        }
 //自定义方法——DrawItem封装的代码
 private void cboDgvDrawItem(SkinComboBox myCboDgvContext, DrawItemEventArgs e)
 {
     try
     {
         e.DrawBackground();
         e.Graphics.DrawString(myCboDgvContext.Items[e.Index].ToString(), e.Font, Brushes.Black,
                               e.Bounds, StringFormat.GenericDefault);
     }
     catch
     {
         return;
     }
 }
Esempio n. 14
0
        private void colorComboBox1_SelectionChangeCommitted(object sender, EventArgs e)
        {
            SkinComboBox combobox = sender as SkinComboBox;

            if (combobox.SelectedItem != null)
            {
                CostumeColor color = (CostumeColor)combobox.SelectedItem;
                if (color.ID != null)
                {
                    AddColorToListView(color.Name);
                }
            }
        }
Esempio n. 15
0
        private void SetFeeType(SkinComboBox skinComboBox_FeeType, Boolean isSave = false)
        {
            List <TKeyValue <String, PfAccountType> > accountTypeList = new List <TKeyValue <string, PfAccountType> >();

            accountTypeList.Add(new TKeyValue <string, PfAccountType>(EnumHelper.GetDescription(PfAccountType.All), PfAccountType.All));
            accountTypeList.Add(new TKeyValue <string, PfAccountType>(EnumHelper.GetDescription(PfAccountType.Delivery), PfAccountType.Delivery));
            accountTypeList.Add(new TKeyValue <string, PfAccountType>(EnumHelper.GetDescription(PfAccountType.Return), PfAccountType.Return));
            accountTypeList.Add(new TKeyValue <string, PfAccountType>(EnumHelper.GetDescription(PfAccountType.Collection), PfAccountType.Collection));
            accountTypeList.Add(new TKeyValue <string, PfAccountType>(EnumHelper.GetDescription(PfAccountType.Other), PfAccountType.Other));

            skinComboBox_FeeType.DisplayMember = "Key";
            skinComboBox_FeeType.ValueMember   = "Value";
            skinComboBox_FeeType.DataSource    = accountTypeList;
        }
        /// <summary>
        /// 自定义方法——删除下拉框重复的选项
        /// </summary>
        /// <param name="cbo"></param>
        private void RemoveRepeatItem(SkinComboBox cbo)
        {
            List <string> list = new List <string>();

            foreach (string s in cbo.Items)
            {
                if (!list.Contains(s))
                {
                    list.Add(s);
                }
            }
            cbo.Items.Clear();
            foreach (string s in list)
            {
                cbo.Items.Add(s);
            }
        }
        //自定义方法——封装附加的下拉选择框
        private void cboDgvContext(SkinComboBox myCboDgvContext)
        {
            int       columnIndex = this.dgvPeople.CurrentCell.ColumnIndex;
            int       rowIndex    = this.dgvPeople.CurrentCell.RowIndex;
            Rectangle rect        = this.dgvPeople.GetCellDisplayRectangle(columnIndex, rowIndex, false);

            myCboDgvContext.Left   = rect.Left;
            myCboDgvContext.Top    = rect.Top;
            myCboDgvContext.Width  = rect.Width;
            myCboDgvContext.Height = rect.Height;
            //将单元格的内容显示为下拉列表的当前项
            string consultingRoom = this.dgvPeople.Rows[rowIndex].Cells[columnIndex].Value.ToString();
            int    index          = myCboDgvContext.Items.IndexOf(consultingRoom);

            myCboDgvContext.SelectedIndex = index;
            myCboDgvContext.Visible       = true;
        }
        private void SetFeeType(SkinComboBox skinComboBox_FeeType, Boolean isSave = false)
        {
            List <TKeyValue <String, AccountType> > accountTypeList = new List <TKeyValue <string, AccountType> >();

            if (!isSave)
            {
                accountTypeList.Add(new TKeyValue <string, AccountType>(GlobalUtil.COMBOBOX_ALL, AccountType.All));
                accountTypeList.Add(new TKeyValue <string, AccountType>("进货", AccountType.Purchase));
                accountTypeList.Add(new TKeyValue <string, AccountType>("退货", AccountType.Return));
            }
            accountTypeList.Add(new TKeyValue <string, AccountType>("采购付款", AccountType.PurchaseCollection));
            accountTypeList.Add(new TKeyValue <string, AccountType>("其他", AccountType.Other));

            skinComboBox_FeeType.DisplayMember = "Key";
            skinComboBox_FeeType.ValueMember   = "Value";
            skinComboBox_FeeType.DataSource    = accountTypeList;
        }
Esempio n. 19
0
        public static void AddSupplier(Control ctrl, SkinComboBox skinComboBox)
        {
            List <Supplier>         list    = (List <Supplier>)skinComboBox.DataSource;
            NewSupplierComboBoxForm addForm = new NewSupplierComboBoxForm(list);

            if (addForm.ShowDialog(ctrl) == DialogResult.OK)
            {
                if (list == null)
                {
                    list = new List <Supplier>();
                }
                Supplier item     = addForm.Result;
                Supplier listItem = list.Find(t => t.Name == item.Name || t.ID == item.ID);
                if (listItem == null)
                {
                    item.Enabled    = true;
                    item.CreateTime = DateTime.Now;
                    InteractResult result = GlobalCache.SupplierList_OnChange(item);
                    switch (result.ExeResult)
                    {
                    case ExeResult.Success:
                        skinComboBox.DataSource = null;
                        list.Add(item);
                        skinComboBox.DisplayMember = "Name";
                        skinComboBox.ValueMember   = "ID";
                        skinComboBox.DataSource    = list;
                        skinComboBox.SelectedIndex = list.IndexOf(item);
                        break;

                    case ExeResult.Error:
                        break;

                    default:
                        break;
                    }
                }
                else
                {
                    // this.skinComboBox_SupplierID.SelectedItem = listItem;
                }
            }
        }
Esempio n. 20
0
        private void skinComboBoxPromotionType_SelectedIndexChanged(object sender, EventArgs e)
        {
            try
            {
                SkinComboBox box = (SkinComboBox)sender;
                //if (ruleCtrl != null) {
                //    this.ruleCtrl.Hide();
                //}
                curType = (PromotionTypeEnum)box.SelectedValue;
                switch (curType)
                {
                case PromotionTypeEnum.MJ:
                    this.ruleCtrl         = mjRuleCtrl1;
                    this.ruleCtrl.Enabled = true;
                    this.discountRuleCtrl1.Hide();
                    break;

                case PromotionTypeEnum.Discount:
                    this.ruleCtrl         = discountRuleCtrl1;
                    this.ruleCtrl.Enabled = true;
                    this.mjRuleCtrl1.Hide();
                    break;

                case PromotionTypeEnum.YKJ:
                    this.ruleCtrl.Enabled = false;
                    break;

                default:
                    this.ruleCtrl         = mjRuleCtrl1;
                    this.ruleCtrl.Enabled = true;
                    this.discountRuleCtrl1.Hide();
                    break;
                }
                this.ruleCtrl.Show();
            }
            catch (Exception ex)
            {
                GlobalUtil.ShowError(ex);
            }
        }
Esempio n. 21
0
        private void SetGiftTicket(SkinComboBox skinComboBox_giftTicket)
        {
            try
            {
                if (CommonGlobalUtil.EngineUnconnectioned(this))
                {
                    return;
                }
                List <GiftTicketTemplate> templates = CommonGlobalCache.ServerProxy.GetGiftTicketTemplates();

                skinComboBox_giftTicket.DataSource    = null;
                skinComboBox_giftTicket.DisplayMember = "DenominationAndTickDesc";
                skinComboBox_giftTicket.ValueMember   = "AutoID";
                skinComboBox_giftTicket.DataSource    = templates;
            }
            catch (Exception ex)
            {
                ShowError(ex);
            }
            finally
            {
                UnLockPage();
            }
        }
Esempio n. 22
0
        public static void SetLogisticCompany(SkinComboBox skinTextBoxLogisticCompany)
        {
            try
            {
                //  List<CostumeClass> classes = CommonGlobalCache.CostumeClassList;
                List <EmExpressCompany> list = new List <EmExpressCompany>();

                list = GlobalCache.EMallServerProxy.GetEnabledEmExpressCompanys();
                //  list.Add(new ListItem<String>("圆通快递", "yuantong"));
                //   list.Add(new CostumeClass() { BigClass = CommonGlobalUtil.COMBOBOX_ALL });
                //   list.AddRange(classes);

                if (list != null)
                {
                    skinTextBoxLogisticCompany.DisplayMember = "ExpressCompanyName";
                    skinTextBoxLogisticCompany.ValueMember   = "ExpressCompanyName";
                    skinTextBoxLogisticCompany.DataSource    = list;
                }
            }
            catch (Exception ex)
            {
                GlobalUtil.ShowError(ex);
            }
        }
Esempio n. 23
0
        private void skinComboBox_Color_TextUpdate(object sender, EventArgs e)
        {
            try
            {
                List <CostumeColor> listNew = new List <CostumeColor>();
                //  skinComboBox_Brand.Items.Clear();
                SkinComboBox        box  = (SkinComboBox)sender;
                List <CostumeColor> temp = (List <CostumeColor>)box.DataSource;
                if (temp != null && temp.Count == 0)
                {
                    box.DataSource = null;
                    return;
                }

                String str = box.Text;
                if (String.IsNullOrEmpty(str))
                {
                    listNew.AddRange(GlobalCache.CostumeColorList);
                }
                else
                {
                    foreach (var item in GlobalCache.CostumeColorList)
                    {
                        if ((item.ID + item.Name + item.FirstCharSpell).ToUpper().Contains(str.ToUpper()))
                        {
                            listNew.Add(item);
                        }
                    }
                }

                if (listNew.Count == 0)
                {
                    if (!HideEmpty)
                    {
                        listNew.Add(new CostumeColor()
                        {
                            ID   = null,
                            Name = "(无)"
                        });
                    }
                }

                if (listNew == null || listNew.Count == 0)
                {
                    box.DataSource    = null;
                    box.DisplayMember = null;
                    box.ValueMember   = null;
                }
                else
                {
                    box.DataSource    = null;
                    box.DisplayMember = "Name";
                    box.ValueMember   = "ID";
                    box.DataSource    = listNew;
                }

                box.Text           = str;
                box.SelectionStart = str.Length;
                box.DroppedDown    = true;//自动展开下拉框
                //box.Cursor = Cursors.Default;

                System.Windows.Forms.Cursor.Current = System.Windows.Forms.Cursors.Default;
                box.Cursor = System.Windows.Forms.Cursors.Default;
            }
            catch (Exception ex)
            {
                //  CommonGlobalUtil.ShowError(ex);
            }
        }
Esempio n. 24
0
        private void SkinComboBox_TextUpdate(object sender, EventArgs e)
        {
            try
            {
                List <Supplier> listNew = new List <Supplier>();
                //  skinComboBox_Brand.Items.Clear();
                SkinComboBox    box       = (SkinComboBox)sender;
                List <Supplier> boxSource = box.DataSource as List <Supplier>;
                str = box.Text;
                List <Supplier> brandList = CommonGlobalCache.SupplierList.FindAll(t => t.Enabled == true);
                if (brandList != null)
                {
                    foreach (var item in brandList)
                    {
                        if ((item.Name + item.FirstCharSpell).ToUpper().Contains(str.ToUpper()))
                        {
                            listNew.Add(item);
                        }
                    }
                }



                //品牌下拉框:输入内容没有先列出开头为这个内容的品牌;输入品牌文字数为3个以上的,跳至“所有”,没有列出输入的品牌
                listNew.Sort((x, y) =>
                {
                    int xi = x.Name.ToUpper().IndexOf(str.ToUpper()) + x.FirstCharSpell.ToUpper().IndexOf(str.ToUpper());
                    int yi = y.Name.ToUpper().IndexOf(str.ToUpper()) + y.FirstCharSpell.ToUpper().IndexOf(str.ToUpper());
                    return(xi.CompareTo(yi));
                });

                if (String.IsNullOrEmpty(str) && !hideAll)
                {
                    listNew = new List <Supplier>();
                    listNew.Add(new Supplier()
                    {
                        Name = CommonGlobalUtil.COMBOBOX_ALL, ID = null, Enabled = true
                    });
                    if (brandList != null)
                    {
                        listNew.AddRange(brandList);
                    }
                }

                //box.TextUpdate -= skinComboBox_Brand_TextUpdate;
                // box.SelectedIndex = -1;
                //box.TextUpdate += skinComboBox_Brand_TextUpdate;

                box.DataSource = null;
                //this.skinComboBox.DisplayMember = "Name";
                //this.skinComboBox.ValueMember = "ID";
                if (listNew.Count > 0)
                {
                    if (isEnabledList)
                    {
                        listNew = listNew.FindAll(t => t.Enabled);
                    }
                    //this.skinComboBox.DisplayMember = "Name";
                    //this.skinComboBox.ValueMember = "ID";
                    box.DisplayMember = "Name";
                    box.ValueMember   = "ID";
                    box.DataSource    = listNew;
                    //box.SelectedIndex = -1;
                    //box.Text = str;
                }
                else
                {
                    Supplier nullSuplier = new Supplier();
                    nullSuplier.Name = null;
                    nullSuplier.ID   = null;
                    listNew.Add(nullSuplier);
                    box.DisplayMember = "Name";
                    box.ValueMember   = "ID";
                    box.DataSource    = listNew;
                }


                box.Text           = str;
                box.SelectionStart = str.Length;

                //  box.DropDownStyle = ComboBoxStyle.DropDownList;
                box.DroppedDown = true;//自动展开下拉框

                box.Select(box.Text.Length, 0);
                //this.Cursor = Cursors.Default;

                System.Windows.Forms.Cursor.Current = System.Windows.Forms.Cursors.Default;
                box.Cursor = System.Windows.Forms.Cursors.Default;
            }
            catch (Exception ex)
            {
                //输入找不到就不报错了

                //   CommonGlobalUtil.ShowError(ex);
            }
        }
Esempio n. 25
0
        public void RenderConditionFinish(int index)
        {
            string condition = cmdShell.Condition;

            string[] items = condition.Split(';');
            if (items.Length >= index)
            {
                string[]              arrs = items[index - 1].Split(',');
                ConditionItem         ci = null;
                SpringBootMonitorItem spring = null;
                TomcatMonitorItem     tomcat = null;
                NginxMonitorItem      nginx = null;
                string       uuid = "", itemUuid = "";
                int          itemIndex = 0;
                SkinComboBox combo     = null;
                if (index == 1)
                {
                    combo = scb_condition1;
                }
                else if (index == 2)
                {
                    combo = scb_condition2;
                }
                else if (index == 3)
                {
                    combo = scb_condition3;
                }
                foreach (var item in combo.Items)
                {
                    ci = (ConditionItem)item;
                    if (ci.Index == 0)
                    {
                        spring    = (SpringBootMonitorItem)ci.Item;
                        uuid      = spring.Uuid;
                        itemIndex = spring.Index;
                    }
                    else if (ci.Index == 1)
                    {
                        tomcat    = (TomcatMonitorItem)ci.Item;
                        uuid      = spring.Uuid;
                        itemIndex = spring.Index;
                    }
                    else if (ci.Index == 2)
                    {
                        nginx     = (NginxMonitorItem)ci.Item;
                        uuid      = spring.Uuid;
                        itemIndex = spring.Index;
                    }

                    if (index == 1)
                    {
                        itemUuid = arrs[0];
                    }
                    else
                    {
                        itemUuid = arrs[0].Substring(1);
                    }
                    if (uuid == itemUuid)
                    {
                        combo.SelectedItem = item;
                        InitConditionStatus(index, itemIndex);
                        break;
                    }
                }
                // ========================
                if (index == 1)
                {
                    scb_status1.SelectedIndex = arrs[1] == "Y" ? 1 : 0;
                    if (items.Length >= 2)
                    {
                        if (items[index].Substring(0, 1) == "&")
                        {
                            rb_q1.Checked = true;
                        }
                        else
                        {
                            rb_h1.Checked = true;
                        }
                        InitCondition(2, new RenderFinishDelegate(RenderConditionFinish));
                    }
                }
                else if (index == 2)
                {
                    scb_status2.SelectedIndex = arrs[1] == "Y" ? 1 : 0;
                    if (items.Length >= 3)
                    {
                        if (items[index].Substring(0, 1) == "&")
                        {
                            rb_q2.Checked = true;
                        }
                        else
                        {
                            rb_h2.Checked = true;
                        }
                        InitCondition(3, new RenderFinishDelegate(RenderConditionFinish));
                    }
                }
                else if (index == 3)
                {
                    scb_status3.SelectedIndex = arrs[1] == "Y" ? 1 : 0;
                }
            }
        }
Esempio n. 26
0
        private void skinComboBox_TextUpdate(object sender, EventArgs e)
        {
            try
            {
                List <PfCustomer> listNew = new List <PfCustomer>();
                //  skinComboBox_Brand.Items.Clear();
                SkinComboBox      box  = (SkinComboBox)sender;
                List <PfCustomer> temp = (List <PfCustomer>)box.DataSource;
                if (temp != null && temp.Count == 0)
                {
                    List <PfCustomer> tempList = new List <PfCustomer>();
                    tempList[0].ID    = null;
                    tempList[0].Name  = null;
                    box.DisplayMember = "Name";
                    box.ValueMember   = "ID";
                    box.DataSource    = tempList;
                    return;
                }

                String str = box.Text;
                curSelectStr = str;

                List <PfCustomer> pfCustomerList = PfCustomerCache.PfCustomerList;
                if (pfCustomerList != null && CustomerTypeValue != -1)
                {
                    pfCustomerList = pfCustomerList.FindAll(t => t.CustomerType == CustomerTypeValue);
                }

                if (String.IsNullOrEmpty(str))
                {
                    if (!hideAll)
                    {
                        listNew.Add(new PfCustomer()
                        {
                            Name           = CommonGlobalUtil.COMBOBOX_ALL,
                            FirstCharSpell = DisplayUtil.GetPYString(CommonGlobalUtil.COMBOBOX_ALL),
                            ID             = null
                        });
                    }
                    if (isEnableList)
                    {
                        listNew.AddRange(pfCustomerList?.FindAll(t => t.Enabled));
                    }
                    else
                    {
                        listNew.AddRange(pfCustomerList);
                    }
                }
                else
                {
                    if (!hideAll)
                    {
                        listNew.Add(new PfCustomer()
                        {
                            Name           = CommonGlobalUtil.COMBOBOX_ALL,
                            FirstCharSpell = DisplayUtil.GetPYString(CommonGlobalUtil.COMBOBOX_ALL),
                            ID             = null
                        });
                    }
                    List <PfCustomer> list = new List <PfCustomer>();
                    if (isEnableList)
                    {
                        list.AddRange(pfCustomerList?.FindAll(t => t.Enabled));
                    }
                    else
                    {
                        list.AddRange(pfCustomerList);
                    }

                    foreach (var item in list)
                    {
                        if ((item.FirstCharSpell).ToUpper().Contains(str.ToUpper()) || (item.ID).ToUpper().Contains(str.ToUpper()) || (item.Name).ToUpper().Contains(str.ToUpper()))
                        {
                            listNew.Add(item);
                        }
                    }
                }

                if (listNew.Count == 0)
                {
                    if (!HideEmpty)
                    {
                        listNew.Add(new PfCustomer()
                        {
                            ID             = null,
                            Name           = "(无)",
                            FirstCharSpell = DisplayUtil.GetPYString("(无)")
                        });
                    }
                }

                //box.DataSource = null;
                if (isEnableList)
                {
                    listNew = listNew.FindAll(t => t.Enabled);
                }

                if (listNew == null || listNew.Count == 0)
                {
                    List <PfCustomer> tempList = new List <PfCustomer>();
                    PfCustomer        firstPC  = new PfCustomer();
                    firstPC.ID   = null;
                    firstPC.Name = null;
                    tempList.Add(firstPC);
                    box.DisplayMember = "Name";
                    box.ValueMember   = "ID";
                    box.DataSource    = tempList;
                }
                else
                {
                    List <PfCustomer> PfList = new List <PfCustomer>();

                    if (!hideAll && this.Text == "")
                    {
                        PfList.Add(new PfCustomer()
                        {
                            Name           = CommonGlobalUtil.COMBOBOX_ALL,
                            FirstCharSpell = DisplayUtil.GetPYString(CommonGlobalUtil.COMBOBOX_ALL),
                            ID             = null
                        });
                    }
                    PfList.AddRange(listNew);
                    box.DisplayMember = "Name";
                    box.ValueMember   = "ID";
                    box.DataSource    = PfList;
                }
                box.DroppedDown = true;//自动展开下拉框
                box.Text        = str;
                curSelectStr    = str;
                //box.sele = str;
                box.Select(box.Text.Length, 0);
                //滚动到控件光标处
                // box.ScrollToCaret();
                //box.SelectionStart = str.Length;
                // box.Cursor = Cursors.Default;

                System.Windows.Forms.Cursor.Current = System.Windows.Forms.Cursors.Default;
                box.Cursor = System.Windows.Forms.Cursors.Default;
            }
            catch (Exception ex)
            {
                //  CommonGlobalUtil.ShowError(ex);
            }
        }
Esempio n. 27
0
        private void skinComboBox_Brand_TextUpdate(object sender, EventArgs e)
        {
            SkinComboBox box = null;

            try
            {
                List <Brand> listNew = new List <Brand>();
                //  skinComboBox_Brand.Items.Clear();

                box = (SkinComboBox)sender;

                List <Brand> boxSource = box.DataSource as List <Brand>;
                if (boxSource != null && boxSource.Count == 0)
                {
                    List <Brand> nullList = new List <Brand>();
                    Brand        b        = new Brand();
                    b.AutoID = -2;
                    b.Name   = "";
                    nullList.Add(b);
                    box.DisplayMember = "Name";
                    box.ValueMember   = "AutoID";
                    box.DataSource    = nullList;
                    // box.Cursor = Cursors.Default;

                    /* box.DisplayMember = null;
                     * box.ValueMember =null;
                     * box.DataSource = null;*/
                    return;
                }
                String str = box.Text;
                SelectStr = box.Text;
                // List<Brand> brandList = CommonGlobalCache.BrandList.FindAll(t=>t.IsDisable=true);
                List <Brand> brandList = null;
                InteractResult <List <Brand> > result = CommonGlobalCache.ServerProxy.GetEnableBrands();
                if (result.ExeResult == ExeResult.Success)
                {
                    brandList = result.Data;
                }
                if (!String.IsNullOrEmpty(SupplierID))
                {
                    brandList = brandList?.FindAll(t => t.SupplierID == SupplierID);
                }

                if (brandList != null)
                {
                    foreach (var item in brandList)
                    {
                        if ((item.Name + item.FirstCharSpell).ToUpper().Contains(str.ToUpper()))
                        {
                            listNew.Add(item);
                        }
                    }
                }



                //品牌下拉框:输入内容没有先列出开头为这个内容的品牌;输入品牌文字数为3个以上的,跳至“所有”,没有列出输入的品牌
                listNew.Sort((x, y) =>
                {
                    int xi = x.Name.ToUpper().IndexOf(str.ToUpper()) + x.FirstCharSpell.ToUpper().IndexOf(str.ToUpper());
                    int yi = y.Name.ToUpper().IndexOf(str.ToUpper()) + y.FirstCharSpell.ToUpper().IndexOf(str.ToUpper());
                    return(xi.CompareTo(yi));
                });

                if (String.IsNullOrEmpty(str) && showAll)
                {
                    listNew = new List <Brand>();
                    listNew.Add(new Brand()
                    {
                        Name = CommonGlobalUtil.COMBOBOX_ALL, AutoID = -1
                    });
                    if (brandList != null)
                    {
                        listNew.AddRange(brandList);
                    }
                }

                //box.TextUpdate -= skinComboBox_Brand_TextUpdate;
                //box.SelectedIndex = 0;
                //box.TextUpdate += skinComboBox_Brand_TextUpdate;

                //box.SelectedIndexChanged -= box.SelectedIndexChanged;

                //更新的時候不要觸發SelectedIndexChanged
                if (listNew == null || listNew.Count == 0)
                {
                    /*box.DataSource=new List<Brand>();
                     * box.DisplayMember = "Name"; ;
                     * box.ValueMember = "AutoID";*/

                    List <Brand> nullList = new List <Brand>();
                    Brand        b        = new Brand();
                    b.AutoID = -2;
                    b.Name   = "";
                    nullList.Add(b);
                    box.DisplayMember = "Name";
                    box.ValueMember   = "AutoID";

                    //box.DisplayMember = "Name"; ;
                    //box.ValueMember = "AutoID";
                    box.DataSource = nullList;
                }
                else
                {
                    box.DisplayMember = "Name";
                    box.ValueMember   = "AutoID";
                    box.DataSource    = listNew;
                }

                box.Text           = str;
                SelectStr          = str;
                box.SelectionStart = str.Length;
                //  box.DropDownStyle = ComboBoxStyle.DropDownList;
                box.DroppedDown = true;//自动展开下拉框

                //   box.Cursor = Cursors.Default;
                System.Windows.Forms.Cursor.Current = System.Windows.Forms.Cursors.Default;
                box.Cursor = System.Windows.Forms.Cursors.Default;
                // Console.CursorVisible = true;
            }
            catch (Exception ex)
            {
                //输入找不到就不报错了
                // box.Cursor = Cursors.Default;
                // CommonGlobalUtil.ShowError(ex);
            }
        }