Ejemplo n.º 1
0
        public void SendProgram(int ledId, Program program, TextStyle style = null)
        {
            //客户端发送的节目
            if (program.ID == 0 && !string.IsNullOrEmpty(program.ClientID))
            {
                ProgramManager.Save(program);
            }
            //客户端发送的节目默认为无限次播放,没有截至时间
            var schedule = new Schedule
            {
                LEDIDs = new int[] { ledId },
                BeginTime = DateTime.Now,
                PlayMode = PlayMode.立即开始,
                ProgramID = program.ID,
            };
            ScheduleManager.Save(schedule);

            if (style != null)
            {
                var led = LEDManager.GetModel(ledId);
                led.CustomStyle = style;
                LEDManager.Save(led);
            }
        }
Ejemplo n.º 2
0
 public LEDScreen()
 {
     Style = new TextStyle { FontSize = 12, FontFamily = FontFamily.宋体 };
     VirtualID = -1;
 }
Ejemplo n.º 3
0
        private void btnOK_Click(object sender, EventArgs e)
        {
            var model = new TextStyle();
            model.FontFamily = StringHelper.ToEnum<Model.FontFamily>(cbxFontFamily.Text);
            model.FontSize = StringHelper.ToInt(txtFontSize.Text);
            if (model.FontSize == 0)
            {
                txtFontSize.Focus();
                return;
            }
            model.TextAlignment = StringHelper.ToEnum<Model.TextAlignment>(cbxTextAlignment.Text);
            model.TextAnimation = StringHelper.ToEnum<Model.TextAnimation>(cbxTextAnimation.Text);
            model.IsHold = cbxIsHold.Checked;

            Dictionary<string, object> data = null;

            if (File.Exists(_configPath))
            {
                data = JsonConvert.DeserializeObject<Dictionary<string, object>>(File.ReadAllText(_configPath));
            }
            if (data == null)
            {
                data = new Dictionary<string, object>();
            }
            var key = GetConfigKey(_ledId);
            if (data.ContainsKey(key))
            {
                data[key] = model;
            }
            else
            {
                data.Add(key, model);
            }
            var json = JsonConvert.SerializeObject(data);
            File.WriteAllText(_configPath, json);

            this.DialogResult = System.Windows.Forms.DialogResult.OK;
            this.Close();
        }