/// <summary> /// 程序初始化 /// </summary> private void Initialize() { try { //if (!InspectKit.Inspect(SysConfigHelper.readerNode("Inspect")))//对比失败 //{ // //打开主页面 // MainWindow mainWindow = new MainWindow(); // mainWindow.Show(); // MainWindow.Margin = new Thickness(-10, -8, -12, -10); // FormStop stop = new FormStop(); // stop.Margin = new Thickness(0, 0, 0, 0); // MainWindow.Content = stop; // return; //} //北岸公馆读卡器注册表 SysBLL.RunBat(System.AppDomain.CurrentDomain.BaseDirectory + "\\BeiAnGGOcx\\00010001\\wyzh.bat"); SysBLL.RunBat(System.AppDomain.CurrentDomain.BaseDirectory + "\\BeiAnGGOcx\\00010001\\0001.bat"); //物业2 SysBLL.RunBat(System.AppDomain.CurrentDomain.BaseDirectory + "\\perp2\\prop2.bat"); //SysBLL.RunBat(System.AppDomain.CurrentDomain.BaseDirectory + "\\BeiAnGGOcx\\wyzh.bat"); //是否需要启动其他程序 bool startUpOtherProject = Convert.ToBoolean(SysConfigHelper.readerNode("startUpOtherApp")); if (startUpOtherProject) { StartUpApp(SysConfigHelper.readerNode("startUpOtherAppPath")); } //关闭广告屏 killGcMp4(); //获取缴费页面提示 SysBLL.payPromptInfo = PayPromptAccess.queryPayPrompt(null); SysBLL.ShowCursor(SysBLL.IsShowCursor); //设置桌面背景 SysBLL.setImagePage(); //天气查询状态 SysBLL.WeatherQuerystate = 1; //禁止用户插卡 MachCardBLL.CancelWaitCard(); //初始化发送设备状态时间 SysBLL.SendDeviceStatuTime = DateTime.Now; if (SysBLL.IsTest.Equals("正式")) { //广告ID GCResourceAccess.adv_id = GcManage.ReadGCID(); //指令id SystemOrderAccess.id = ComputerBLL.ReadOrderID(); } else { //广告ID GCResourceAccess.adv_id = SysConfigHelper.readerNode("GcAdv_id"); //指令id SystemOrderAccess.id = SysConfigHelper.readerNode("sysOrderId"); } //电动读卡器如果有卡则吞卡 //MachCardBLL.swallowCard(); } catch (Exception ex) { logger("error:程序初始化异常:" + ex.Message); } }
/// <summary> /// 外部配置文件广告文件处理 /// </summary> private void ExternalHandle() { try { //广告ID文件是否存在 GcManage.GCIdFileIsExits(); //更新更新程序 updateApp(); //广告是否更新成功 GcManage.GCStateIdFileIsExits(); //视频广告是否存在,并复制到D盘 GcManage.GcMp4FileIsExists(); //首页轮播图是否存在,并复制到D盘 GcManage.GcMainImgFileIsExists(); //左侧轮播图路径是否存在,并复制到D盘 GcManage.GcLeftImgFileIsExists(); //音量文件是否存在 GcManage.YinliangFileIsExits(); //服务器命令ID文件是否存在 ComputerBLL.OrderIDFileIsExits(); //更新程序是否启动缴费程序 resgitIsExits(); //视频声音10% GcManage.WriteYinliangValue("5"); } catch (Exception ex) { logger("error:文件初始化:" + ex.Message + ex.InnerException); } }
//Load事件 private void UserControl_Loaded(object sender, RoutedEventArgs e) { volumeTxt.Text = GcManage.readYinliangValue(); lklTxt.Text = SysStateParam.lklSignInfo; wtTxt.Text = SysStateParam.wtSignInfo; onlineTxt.Text = "正在查询..."; new Thread(delegate() { onlineTxt.Dispatcher.Invoke(new isOnlineDelegate(isOnline), onlineTxt, new TerminalAccess().isOnline()); }).Start(); }
private void Button_Click_2(object sender, RoutedEventArgs e) { int volume = Convert.ToInt32(volumeTxt.Text); if (volume >= 50) { volumeTxt.Text = "50"; return; } volume++; volumeTxt.Text = volume.ToString(); GcManage.WriteYinliangValue(volumeTxt.Text); }
private void UserControl_Loaded(object sender, RoutedEventArgs e) { //load(); try { count = 1; if (File.Exists("D://payMedia//leftImg//" + GcManage.gcType + "//" + GcManage.getImgMaxPath("D://payMedia//leftImg//" + GcManage.gcType) + "//" + count + ".png")) { this.listBoxPic.Source = new BitmapImage(new Uri("D://payMedia//leftImg//" + GcManage.gcType + "//" + GcManage.getImgMaxPath("D://payMedia//leftImg//" + GcManage.gcType) + "//" + count + ".png", UriKind.Absolute)); } tempImage = listBoxPic; timer.Start(); }catch (Exception ex) { log.Write("error:PictureChangeUserControl" + ex.Message + ex.InnerException); } }
/// <summary> /// 初始化轮播图 /// </summary> private void IniPic() { try { //this.listBoxPic.ItemsSource = null; List <PicClass> pic = new List <PicClass>(); for (int i = 1; i <= 6; i++) { if (System.IO.File.Exists(GcManage.mainImgPath + "//" + GcManage.getImgMaxPath(GcManage.mainImgPath) + "//" + i + ".png")) { pic.Add(new PicClass() { Image = string.Format(GcManage.mainImgPath + "//" + GcManage.getImgMaxPath(GcManage.mainImgPath) + "//" + i + ".png"), Site = i.ToString() }); } } listBoxPic.Dispatcher.Invoke(new setListbBoxNullDelegate(setListbBoxNull), listBoxPic, pic); }catch (Exception ex) { log.Write("error:PictureChangeUserControl:IniPic:" + ex.Message); } }
private void timer_Tick(object sender, EventArgs e) { try { if (File.Exists("D://payMedia//leftImg//" + GcManage.gcType + "//" + GcManage.getImgMaxPath("D://payMedia//leftImg//" + GcManage.gcType) + "//" + count + ".png")) { this.listBoxPic.Source = new BitmapImage(new Uri("D://payMedia//leftImg//" + GcManage.gcType + "//" + GcManage.getImgMaxPath("D://payMedia//leftImg//" + GcManage.gcType) + "//" + count + ".png", UriKind.Absolute)); } GC.Collect(); count++; if (count >= 5) { count = 1; } } catch (IOException ie) { } catch (Exception ex) { log.Write("error:AdvertisePage:timer_Tick:" + ex.Message + ex.InnerException); this.listBoxPic.Dispatcher.Invoke(new setlistBoxPicDelegate(setlistBoxPic), listBoxPic, new BitmapImage(new Uri(System.AppDomain.CurrentDomain.BaseDirectory + "/image/GCImage/temp/temp.png", UriKind.Absolute))); } }
private void update() { try { GCResourceAccess gcaccess = new GCResourceAccess(); FindIsUpdateAdvInfo findIsUpdateAdvInfo = null; FindDownAdvInfo findDownAdvInfo = new FindDownAdvInfo(); WebClient myclient = new WebClient(); while (true) { try { //Thread.Sleep(1); Thread.Sleep((1000 * 60) * 10); // 是否更新广告 findIsUpdateAdvInfo = null; //是否更新广告 findIsUpdateAdvInfo = gcaccess.findIsUpdateAdv(); if (!"0".Equals(findIsUpdateAdvInfo.code)) { continue; } log.Write("----开始更新广告"); // 广告详情获取 GCResourceAccess.adv_id = findIsUpdateAdvInfo.data.id; //将id记录到本地 if (SysBLL.IsTest.Equals("正式")) // GCResourceAccess.adv_id = SysConfigHelper.readerNode("GcAdv_id"); { GcManage.WriteGCID(findIsUpdateAdvInfo.data.id); } else { SysConfigHelper.writerNode("GcAdv_id", findIsUpdateAdvInfo.data.id); } string m_id = ""; string m_name = ""; for (int i = 1; i <= 5; i++) { findDownAdvInfo = null; if (i == 3) { } if (i == 2) { for (int j = 0; j < GcManage.paths.Length; j++) { findDownAdvInfo = gcaccess.findDownAdv(i.ToString(), GcManage.paths[j]); if (findDownAdvInfo == null) { continue; } if ("0".Equals(findDownAdvInfo.code)) { m_id = findDownAdvInfo.data.m_id; m_name = findDownAdvInfo.data.m_name; //下载资源 ResourceDownload(findDownAdvInfo.data.data, i, myclient, GcManage.paths[j]); } } continue; } else { findDownAdvInfo = gcaccess.findDownAdv(i.ToString(), "0"); if (findDownAdvInfo == null) { continue; } if ("0".Equals(findDownAdvInfo.code)) { m_id = findDownAdvInfo.data.m_id; m_name = findDownAdvInfo.data.m_name; //下载资源 ResourceDownload(findDownAdvInfo.data.data, i, myclient, ""); } } } // 更新结果通知参数 gcaccess.recordAdvUpdateLog(m_id, m_name); while (true) { if (!SysBLL.IsOpenIndexForm) { continue; } if ("1".Equals(GcManage.ReadGCStateID())) { log.Write("广告更新完毕,执行重启"); //ComputerBLL.Restart(); break; } break; } } catch (ThreadAbortException e) { log.Write("error:PictureChangeUserControl:01:update:" + e.Message + e.InnerException); continue; } catch (Exception e) { log.Write("error:PictureChangeUserControl:02:update:" + e.Message + e.InnerException); continue; } } } catch (ThreadAbortException e) { log.Write("error:PictureChangeUserControl:03:update:" + e.Message + e.InnerException); } catch (Exception e) { log.Write("error:PictureChangeUserControl:04:update:" + e.Message + e.InnerException); } }
/// <summary> /// 下载资源 /// </summary> /// <param name="pathId"></param> /// <param name="type"></param> /// <param name="myclient"></param> public void ResourceDownload(string pathId, int type, WebClient myclient, string leftImgPath) { try { string mainPath = System.AppDomain.CurrentDomain.BaseDirectory; if (type == 1) { //timer.Stop(); //List<PicClass> pic = new List<PicClass>(); //pic.Add(new PicClass() { Image = string.Format(System.AppDomain.CurrentDomain.BaseDirectory + "/image/GCImage/temp/temp.png"), Site = 0.ToString() }); //listBoxPic.Dispatcher.Invoke(new setListbBoxNullDelegate(setListbBoxNull), listBoxPic, pic); //listBoxPic.Dispatcher.Invoke(new setListbBoxSelectDelegate(setListBoxSelect), listBoxPic, 0); Thread.Sleep(1000 * 3); SysBLL.deleteDirFile(System.AppDomain.CurrentDomain.BaseDirectory + "/image/GCImage/index"); //1、缴费系统主界面轮播图 string[] imgId = pathId.Split(','); log.Write("----更新首页轮播图:" + pathId); int count = GcManage.getImgMaxPath(GcManage.mainImgPath); count++; System.IO.Directory.CreateDirectory(GcManage.mainImgPath + "//" + count); for (int j = 0; j < imgId.Length; j++) { string path = SysConfigHelper.readerNode("downAdvName") + "?id=" + imgId[j]; myclient.DownloadFile(path, GcManage.mainImgPath + "//" + count + "//" + (j + 1) + ".png"); } IniPic(); GcManage.WriteGCStateID("1"); //IniPic(); //listBoxPic.Dispatcher.Invoke(new setListbBoxSelectDelegate(setListBoxSelect), listBoxPic, 0); //timer.Start(); } if (type == 2) { SysBLL.deleteDirFile(System.AppDomain.CurrentDomain.BaseDirectory + "/image/GCImage/leftImg/" + leftImgPath); log.Write("----更新左侧轮播图:" + pathId); int count = GcManage.getImgMaxPath(GcManage.leftImgPath + "//" + leftImgPath); count++; System.IO.Directory.CreateDirectory(GcManage.leftImgPath + "//" + leftImgPath + "//" + count); //2、缴费系统左侧轮播图 string[] imgId = pathId.Split(','); for (int j = 0; j < imgId.Length; j++) { myclient.DownloadFile(SysConfigHelper.readerNode("downAdvName") + "?id=" + imgId[j], GcManage.leftImgPath + "//" + leftImgPath + "//" + count + "//" + (j + 1) + ".png"); } GcManage.WriteGCStateID("1"); } if (type == 3) { SysConfigHelper.writerNode("mainTopInfo", pathId); } if (type == 4) { log.Write("----更新视屏广告:" + pathId); ComputerBLL.KillApplication("GCMp4"); Thread.Sleep(1000); SysBLL.deleteDirFile(GcManage.mp4Path); //4.视频广告 string[] imgId = pathId.Split(','); for (int j = 0; j < imgId.Length; j++) { myclient.DownloadFile(SysConfigHelper.readerNode("downAdvName") + "?id=" + imgId[j], System.AppDomain.CurrentDomain.BaseDirectory + "/mp4" + "//" + (j + 1) + ".mp4"); } GcManage.WriteGCStateID("1"); ComputerBLL.KillApplication("GCMp4"); GcManage.GcMp4FileIsExists(); ComputerBLL.StartApp(System.AppDomain.CurrentDomain.BaseDirectory + "GCMp4.exe"); } } catch (IOException e) { log.Write("error:PictureChangeUserControl:ResourceDownload:" + e.Message + e.InnerException); } catch (Exception e) { log.Write("error:PictureChangeUserControl:ResourceDownload:" + e.Message + e.InnerException); } }