Пример #1
0
 /// <summary>
 /// 将占位符替换
 /// </summary>
 /// <param name="text"></param>
 /// <returns></returns>
 private string ParseText(string text, IMovieShowList.MovieShow movie)
 {
     //欢迎光临,$hallName,$movieName,$beginTime的电影已经开始了
     if (text.Contains("$HallName"))
     {
         text = text.Replace("$HallName", movie.Room);
     }
     if (text.Contains("$MovieName"))
     {
         text = text.Replace("$MovieName", movie.Name);
     }
     if (text.Contains("$BeginTime"))
     {
         text = text.Replace("$BeginTime", movie.BeginTime);
     }
     return(text);
 }
Пример #2
0
        private void timer2_Tick(object sender, EventArgs e)
        {
            if (player.playState == WMPLib.WMPPlayState.wmppsStopped || player.playState == WMPLib.WMPPlayState.wmppsUndefined || player.playState == WMPLib.WMPPlayState.wmppsReady)
            {
                if (count <= AllField.PlayCount)
                {
                    //开始播放
                    StartPlay(CellTime);
                    count++;
                }
                else
                {
                    player.Ctlcontrols.stop();
                    PlayState = false;
                    //检查现在时间是否已经过了播报时间了
                    //得到当前的播放列表
                    List <IMovieShowList.MovieShow> list = new List <MovieShow>(blList);
                    //获取当前时间加10分钟
                    //string nowTime = DateTime.Now.AddMinutes(setJson.Time).ToString("HH:mm");
                    string nowTime = DateTime.Now.AddMinutes(AllField.AdvanceTime).ToString("HH:mm");


                    //查看是否有当前需要播报的
                    //查看当前的时间中是否有需要播报的
                    IMovieShowList.MovieShow movie = list.SingleOrDefault(x => x.BeginTime == nowTime);


                    //因为现在正在播报当前的,而且已经播报完了指定的次数
                    //所以当前的不用播报了
                    if (movie == null)
                    {
                        //让计时器1启动
                        timer1.Enabled = true;
                        //回复计数
                        count = 1;
                        //让计时器2停止
                        timer2.Enabled = false;
                    }
                }
            }
        }
Пример #3
0
        private void timer1_Tick(object sender, EventArgs e)
        {
            if (player.playState == WMPLib.WMPPlayState.wmppsStopped || player.playState == WMPLib.WMPPlayState.wmppsUndefined || player.playState == WMPLib.WMPPlayState.wmppsReady)
            {
                PlayState = false;
            }

            //获得当前时间往后推10分钟

            //使用  HH:mm 进行格式化
            // string now = DateTime.Now.AddMinutes(setJson.Time).ToString("HH:mm");
            string now = DateTime.Now.AddMinutes(AllField.AdvanceTime).ToString("HH:mm");


            //获取数据
            List <IMovieShowList.MovieShow> list = new List <MovieShow>(blList);

            //查看是否有当前需要播报的

            IMovieShowList.MovieShow movie = list.SingleOrDefault(x => x.BeginTime == now);

            if (movie != null)
            {
                //将本计时器暂停
                timer1.Enabled = false;


                //获取模板信息
                string text = fmTxt;

                CellTime = movie.BeginTime;

                // StartPlay(time);
                //读取文件夹里的文件读取
                // PalyVoiceOffline(movie);


                //将计时器2启动起来
                timer2.Enabled = true;
            }
        }