Ejemplo n.º 1
0
        public void Deal(string guid, TimeSettingParameter parameter)
        {
            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         = DateTime.Now.ToString(parameter.Format);
                label.AutoSize     = true;
                label.Name         = guid;
                label.Font         = new Font(FontFamily.GenericMonospace, parameter.Size);
                label.DoubleClick += SetPmjDataClick;
                panelTest.Controls.Add(label);
                pmjData.DataSource = parameter;
                //设置可以移动
                SetItemEvent(label);
                _pmjDataList.Add(pmjData);
            }
            else
            {
                var label = pmjData.Control as Label;
                label.Text         = DateTime.Now.ToString(parameter.Format);
                label.Font         = new Font(FontFamily.GenericMonospace, parameter.Size);
                pmjData.DataSource = parameter;
                ResetLocation(label);
            }
        }
Ejemplo n.º 2
0
 public TimeSetting(ITimeSetting timeSetting, TimeSettingParameter parameter)
 {
     InitializeComponent();
     //样式
     this._guid             = Guid.NewGuid().ToString("N");
     this._timeSetting      = timeSetting;
     this._format           = parameter.Format;
     this._size             = parameter.Size;
     cmbStyle.DataSource    = CmbDataItemFactory.GetTimeStyleList();
     cmdFont.DataSource     = CmbDataItemFactory.GetFontList();
     cmbFontSize.DataSource = CmbDataItemFactory.GetFontSizeList();
 }