Esempio n. 1
0
 public SerialNumberSetting(ISerialNumberSetting iSerialNumberSetting, SerialNumberParameter parameter)
 {
     Log.Info($"传入的参数:{JsonConvert.SerializeObject(parameter)}");
     InitializeComponent();
     this._serialNumberSetting = iSerialNumberSetting;
     this._parameter           = parameter;
     this._guid             = Guid.NewGuid().ToString("N");
     cmbFormat.DataSource   = CmbDataItemFactory.GetSerialNumberFormatList();
     cmbFontSize.DataSource = CmbDataItemFactory.GetFontSizeList();
     cmbStyle.DataSource    = CmbDataItemFactory.GetFontList();
 }
Esempio n. 2
0
        /// <summary>
        /// 查询设置的参数
        /// </summary>
        /// <returns></returns>
        private SerialNumberParameter GetParameter()
        {
            var parameter = new SerialNumberParameter();

            parameter.Format         = (cmbFormat.SelectedItem as CmbDataItem)?.Name;
            parameter.Size           = int.Parse((cmbFontSize.SelectedItem as CmbDataItem)?.Name ?? "0");
            parameter.NumberInit     = (int)numberInit.Value;
            parameter.NumberInterval = (int)numberInterval.Value;
            parameter.NumberRepeat   = (int)numberRepeat.Value;
            parameter.UserControl    = this;
            return(parameter);
        }
Esempio n. 3
0
        public void SerialNumberDeal(string guid, SerialNumberParameter para)
        {
            try
            {
                Log.Info(para);
                this._id = guid;
                //查找是否存在这个组件
                var pmjData = _pmjDataList.FirstOrDefault(item => item.Id == guid);

                if (null == pmjData)
                {
                    pmjData          = new PmjData();
                    pmjData.Id       = guid;
                    pmjData.DataType = EnumPmjData.序号;
                    var label = new Label();
                    pmjData.Control    = label;
                    label.Text         = para.NumberInit.ToString(para.Format);
                    label.Name         = guid;
                    label.AutoSize     = true;
                    label.Font         = new Font(FontFamily.GenericMonospace, para.Size);
                    label.DoubleClick += SetPmjDataClick;
                    panelTest.Controls.Add(label);
                    pmjData.DataSource = para;
                    //设置可以移动
                    SetItemEvent(label);
                    _pmjDataList.Add(pmjData);
                }
                else
                {
                    var label = pmjData.Control as Label;
                    label.Text         = para.NumberInit.ToString(para.Format);
                    label.Font         = new Font(FontFamily.GenericMonospace, para.Size);
                    pmjData.DataSource = para;
                    ResetLocation(label);
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
        }