Beispiel #1
0
        public Form_Config(XMLInfo x)
        {
            InitializeComponent();

            xml = x;
            xml.ReadPlayConfig(ref config, false, ref error);

            dp = new DateTimePicker();
            dp.Format = DateTimePickerFormat.Custom;
            dp.CustomFormat = "HH 时 mm 分 ss 秒";
            dp.ShowUpDown = true;
            dp.Visible = false;
            dataGridView1.Controls.Add(dp);

            cb_mode = new ComboBox();
            //cb_mode.Items.Add(PlayMode.sequencial);
            //cb_mode.Items.Add(PlayMode.random);
            cb_mode.Items.Add("顺序播放");
            cb_mode.Items.Add("随机播放");
            cb_mode.Visible = false;
            dataGridView1.Controls.Add(cb_mode);

            cb_type = new ComboBox();
            cb_type.Items.Add(ContentType.dir);
            cb_type.Items.Add(ContentType.video);
            cb_type.Items.Add(ContentType.powerpoint);
            cb_type.Visible = false;
            dataGridView1.Controls.Add(cb_type);

            nu = new NumericUpDown();
            nu.Minimum = 0;
            nu.Maximum = 600;
            nu.Visible = false;
            dataGridView1.Controls.Add(nu);

            XML2Tree();
        }
Beispiel #2
0
        public Form_Play()
        {
            InitializeComponent();

            this.Text = "宣传播放系统";
            this.axFramerControl1.Location = new Point(-500, -500);
            this.rootPath = Directory.GetCurrentDirectory();
            xml = new XMLInfo(rootPath + "\\config\\play.xml");

            string pwd, pmt; bool ebl;
            FTP.ApplicationSettings._DataPath = rootPath;
            FTP.ApplicationSettings.ReadSettings();
            FTP.ApplicationSettings.GetUser("ADPLAYER", out pwd, out interMediaPath, out pmt, out ebl);

            // 读取配置
            if (!xml.ReadPlayConfig(ref config, ref error))
            {
                MessageBox.Show("没有检测到正确的配置文件!\n\n请将检查配置文件\"config\\play.xml\"\n\n错误信息: " + error, "启动异常", MessageBoxButtons.OK, MessageBoxIcon.Stop);
                this.Close();
            }
            else
            {
                numericUpDown2.Value = config.notice.interval;

                // 播放器设置
                axWindowsMediaPlayer1.uiMode = "none";
                axWindowsMediaPlayer1.stretchToFit = true;
                axWindowsMediaPlayer1.Ctlenabled = true;
                axWindowsMediaPlayer1.settings.setMode("loop", false);// 循环

                Screen[] scr = Screen.AllScreens;
                if (scr.Length > 1)
                {
                    label8.ForeColor = Color.FromKnownColor(System.Drawing.KnownColor.ControlText);
                    comboBox_scr.Enabled = true;
                    for (int i = 0; i < scr.Length; i++)
                    {
                        comboBox_scr.Items.Add(scr[i].DeviceName);
                    }
                    if (config.scr < scr.Length) comboBox_scr.SelectedIndex = config.scr;
                }

                comboBox_idle.Items.Add(ContentType.video);
                comboBox_idle.Items.Add(ContentType.powerpoint);
                comboBox_idle.SelectedIndex = (int)(config.idle.type) - 1;
                numericUpDown_idle.Value = (decimal)config.idle.duration;
                label_idle.Text = config.idle.file;

                dateTimePicker_sleepStart.Value = config.sleep.timespan.startTime;
                dateTimePicker_sleepEnd.Value = config.sleep.timespan.endTime;
                checkBox_sleep.Checked = config.sleep.enable;
                checkBox_sleep_CheckedChanged(this, null);

                checkBox_interval.Checked = config.intermedia.enable;
                checkBox_interval_CheckedChanged(this, null);
                numericUpDown_interval.Value = config.intermedia.limit;
                numericUpDown_duration.Value = config.intermedia.duration;

                checkBox1.Checked = config.syscfg.sysDuration;
                numericUpDown1.Value = config.syscfg.duration;

                hook = new Hook();
            }

            bgWorker_RunTask = new BackgroundWorker();
            bgWorker_RunTask.WorkerReportsProgress = false;
            bgWorker_RunTask.DoWork += new DoWorkEventHandler(bgWorker_RunTask_DoWork);
            bgWorker_RunTask.RunWorkerCompleted += new RunWorkerCompletedEventHandler(bgWorker_RunTask_RunWorkerCompleted);
            bgWorker_RunTask.RunWorkerAsync();

            Form_Start start = new Form_Start();
            start.ShowDialog();
        }