/// <summary> /// 播放首页 /// </summary> public void playIndex() { try { //记时清零 pageCountDic[PAGE_INDEX] = 0; //先关闭第三个弹出页面 AcceptForm.sendCmdMessage("close detail"); //显示要求的窗体 mainWindow.Show(); //隐藏地球页面显示 googleEarth.Hide(); //开始倒计时 DispatcherTimer dt = new DispatcherTimer(); dt.Interval = TimeSpan.FromSeconds(1); dt.Tick += new EventHandler(delegate(object sender, EventArgs e) { LogUtil.debug("start play index"); //如果中断操作时间小于设置的值,则不处理自动播放动作 if (isPause && DateTime.Now.Subtract(pauseTime).TotalSeconds < 10) { LogUtil.debug("首页播放被中断,中断操作停止时间为:" + pauseTime); hiddenAllOverlay(); return; } else { LogUtil.debug("中断失效,解析播放"); isPause = false; } //没人工终端则进行页面记时 pageCountDic[PAGE_INDEX] = pageCountDic[PAGE_INDEX] + 1; //播放时间到则播放下一个页面 if (pageCountDic[PAGE_INDEX] >= pagePlaytimeDic[PAGE_INDEX]) { LogUtil.debug("进入地球"); //进入地球 enterEarth(); //停止定时器 dt.Stop(); } });//调用函数 dt.Start(); } catch (Exception ee) { LogUtil.error("playIndex error:" + ee.StackTrace); } }
/// <summary> /// 清理释放资源 /// </summary> public void clear() { try { googleEarth.RealseGEHandler(); googleEarth.Close(); googleEarth = null; mainWindow.Close(); mainWindow = null; af.clear(); af.Close(); af = null; } catch (Exception ee) { LogUtil.error("clear error:" + ee.StackTrace); } }
private void loadAcceptForm(ControlCenter cc) { af = new AcceptForm(cc); af.Hide(); }
/// <summary> /// 记时播放电站详细页面 /// </summary> /// <param name="plantId"></param> private void playDetail(string plantId, string plantName) { try { googleEarth.isStopHotFlash = false; //googleEarth.flashPlant(plantName); isColseDetail = false; int tiptime = int.Parse(plantmap[plantId].tipInterval); //记时清零 pageCountDic[PAGE_DETAIL] = 0; //弹出气泡 googleEarth.showFeature(plantName); //开始倒计时 DispatcherTimer dtd = new DispatcherTimer(); dtd.Interval = TimeSpan.FromSeconds(1); dtd.Tick += new EventHandler(delegate(object sender, EventArgs e) { //如果中断操作时间小于设置的值,则不处理自动播放动作 if (isPause && DateTime.Now.Subtract(pauseTime).TotalSeconds < 10) { hiddenAllOverlay(); return; } else { if (isPause) { isColseDetail = true; } ; isPause = false; } //2秒后才弹出详细页面 if (pageCountDic[PAGE_DETAIL] == tiptime) { AcceptForm.sendCmdMessage("open-" + plantId);//打开详细页面 googleEarth.hiddenAllFeature(); } //2秒后才弹出详细页面 //if (pageCountDic[PAGE_DETAIL] == 5) //{ //googleEarth.hiddenAllFeature(); //} pageCountDic[PAGE_DETAIL] = pageCountDic[PAGE_DETAIL] + 1; //播放时间到则播放下一个热点.记时有误差,取消这种方式 //if (isColseDetail || pageCountDic[PAGE_DETAIL] >= pagePlaytimeDic[PAGE_DETAIL] + 5) if (isColseDetail) { googleEarth.isStopHotFlash = true; playEarth(); //停止定时器 dtd.Stop(); } });//调用函数 dtd.Start(); } catch (Exception ee) { LogUtil.debug("详细页面 error:" + ee.StackTrace); } }
int curPlantIndex = 0;//当前热点下标 private void playEarth() { try { //显示的窗体 googleEarth.Show(); //隐藏首页页面显示 mainWindow.Hide(); //googleEarth.Control.Width = (int)googleEarth.ActualWidth; //googleEarth.Control.Height = (int)googleEarth.ActualHeight; //googleEarth.host.Width = googleEarth.ActualWidth; //googleEarth.host.Height = googleEarth.ActualHeight; //googleEarth.hiddenAllFeature(); //首先将地球有小转动到大 //然后开始捉个热点播放 //如果播放完了那么开始播放首页 if (curPlantIndex >= tmpHotPlants.Count()) { //重置播放下标 curPlantIndex = 0; //开始播放首页 playIndex(); //退出播放地球方法 return; } //播放当前热点 //根据当前下标取得当前播放电站 PlantInfoVo plant = tmpHotPlants[curPlantIndex]; //先关闭详细 AcceptForm.sendCmdMessage("close detail");// double h = 0; try { h = double.Parse(plant.height); } catch (Exception e) { Console.WriteLine(e.Message); h = 19800000; } //先飞到合肥 googleEarth.flyEarth(117.27, 31.86, h, 0.3); int yanchis = 0; //延迟后面动作 DispatcherTimer dtn = new DispatcherTimer(); dtn.Interval = TimeSpan.FromSeconds(1); dtn.Tick += new EventHandler(delegate(object sender, EventArgs e) { //如果中断操作时间小于设置的值,则不处理自动播放动作 if (isPause && DateTime.Now.Subtract(pauseTime).TotalSeconds < 10) { LogUtil.debug("轮播详细页面 中断:" + pauseTime); hiddenAllOverlay(); return; } else { isPause = false; } yanchis++; if (yanchis == 1) { dtn.Stop(); yanchis = 0; //影藏所有图层 hiddenAllOverlay(); //再飞到当前热点 googleEarth.flyEarth(plant.Longitude, plant.latitude, double.Parse(fly_range), 1);//3000000 //播放电站详细页面 playDetail(plant.plantId, plant.plantName); LogUtil.debug("轮播详细页面:" + plant.plantId + plant.plantName); } });//调用函数 dtn.Start(); //置下一个热点 curPlantIndex++; } catch (Exception ee) { LogUtil.error("播放详细页面 error:" + ee.StackTrace); } }
public void start() { try { LogUtil.debug("start http server"); using (HttpListener listerner = new HttpListener()) { listerner.AuthenticationSchemes = AuthenticationSchemes.Anonymous;//指定身份验证 Anonymous匿名访问18. listerner.Prefixes.Add("http://localhost:8111/web/"); if (listerner.IsListening) { listerner.Stop(); } listerner.Start(); Console.WriteLine("WebServer Start Successed......."); while (!isStop) { //等待请求连接26. //没有请求则GetContext处于阻塞状态27. HttpListenerContext ctx = listerner.GetContext(); ctx.Response.StatusCode = 200;//设置返回给客服端http状态代码29. string plantId = ctx.Request.QueryString["plantId"]; string plantName = ctx.Request.QueryString["plantName"]; if (plantId != null) { LogUtil.debug("http server accept plantId:" + plantId); } //使用Writer输出http响应代码38. using (StreamWriter writer = new StreamWriter(ctx.Response.OutputStream)) { Console.WriteLine("hello"); writer.WriteLine("<html><head><title>The WebServer Test</title></head><body>"); writer.WriteLine("<div style=\"height:20px;color:blue;text-align:center;\"><p> hello {0}</p></div>", plantId); writer.WriteLine("<ul>"); foreach (string header in ctx.Request.Headers.Keys) { writer.WriteLine("<li><b>{0}:</b>{1}</li>", header, ctx.Request.Headers[header]); } writer.WriteLine("</ul>"); writer.WriteLine("</body></html>"); writer.Close(); ctx.Response.Close(); } ControlCenter.pauseTime = DateTime.Now; ControlCenter.isPause = true; LogUtil.debug("manualopen plant:" + plantId); AcceptForm.sendCmdMessage("manualopen-" + plantId);//打开详细页面 } } } catch (Exception ee) { LogUtil.error("start http server error:" + ee.StackTrace); } }