示例#1
0
 /// <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);
     }
 }
示例#2
0
        /// <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); }
        }
示例#3
0
        /// <summary>
        /// 更新更新程序
        /// </summary>
        public static void updateApp()
        {
            try
            {
                string updatePath = System.Environment.CurrentDirectory;
                logger("更新程序路径:" + updatePath);
                //确定更新程序版本
                if (!updatePath.Contains("3.1"))
                {
                    logger("开始更新更新程序");
                    string configPath = @"D:\appliaction\UpdateProjectSharding\InletWindow.exe.config";
                    string dir        = System.AppDomain.CurrentDomain.BaseDirectory + "UpdateInletWindow";
                    string path       = @"D:\appliaction\UpdateProjectTV-G3.1\InletWindow.exe";
                    string newdir     = @"D:\appliaction\UpdateProjectTV-G3.1";
                    if (System.IO.Directory.Exists(newdir))
                    {
                        System.IO.Directory.Delete(newdir);
                    }
                    System.IO.Directory.CreateDirectory(newdir);

                    CopyFolder(dir, newdir);

                    File.Copy(configPath, newdir + @"\InletWindow.exe.config");
                    string copy = System.AppDomain.CurrentDomain.BaseDirectory + @"InletWindow.exe";

                    ComputerBLL.StartApp(path);
                    Thread.Sleep(1000 * 10);
                    ComputerBLL.Restart();
                }
            }
            catch (Exception ex)
            {
                logger("error:updateApp:" + ex.Message);
            }
        }
示例#4
0
 public static FormLoad frmload = null;//启动初始化页面
 /// <summary>
 /// 程序入口
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 private void Application_Startup(object sender, StartupEventArgs e)
 {
     logger("------------------------------------------------AppStart!!!");
     //启动初始化页面
     ComputerBLL.StartApp(System.AppDomain.CurrentDomain.BaseDirectory + "FormPage.exe");
     //正式OR测试
     SysBLL.IsTest = SqlLiteHelper.SqlLiteHelper.query("isTest")[0].FormalValue;
     //显示任务栏
     SysBLL.ShowWindow(SysBLL.FindWindow("Shell_TrayWnd", null), SysBLL.SW_RESTORE);
     try
     {
         //设置全局异常
         exception();
         //外部配置文件,广告文件处理
         ExternalHandle();
         //驱动管理
         DriveHandle();
         //初始化缴费按钮
         InitialiseButton();
         //程序初始化
         Initialize();
         //输出程序日志
         PrintLog();
         //打开主页面
         MainWindow mainWindow = new MainWindow();
         mainWindow.Show();
     }
     catch (Exception ex)
     {
         logger("error:程序入口函数异常:" + ex.Message + " " + ex.InnerException + ",请重启程序。");
     }
 }
示例#5
0
 private void systemOrderWorker_DoWork(object sender, DoWorkEventArgs e)
 {
     while (true)
     {
         try
         {
             if (!SysBLL.IsOpenIndexForm)
             {
                 continue;
             }
             systemOrder = SystemOrderAccess.getSystemOrder();
             if (!SysBLL.IsOpenIndexForm)
             {
                 continue;
             }
             if ("1".Equals(systemOrder.code))
             {
                 continue;
             }
             log.Write("确认指令执行结果");
             SystemOrderAccess.SaveResualt(systemOrder.data.cmd_no);
             log.Write("开始执行");
             ComputerBLL.executeOrder(systemOrder);
         }
         catch (Exception ex)
         {
             log.Write("error:获取命令异常:" + ex.Message);
         }
         Thread.Sleep((1000 * 60) * 5);
     }
 }
示例#6
0
        private static void CurrentDomain_UnhandledException(object sender, UnhandledExceptionEventArgs e)
        {
            var ex = e.ExceptionObject as Exception;

            if (ex != null)
            {
                logger("Error:CurrentDomain_UnhandledException:" + ex.Message + Environment.NewLine + ex.InnerException.ToString());
                ComputerBLL.Restart();
            }
        }
示例#7
0
 private void Button_Click_3(object sender, RoutedEventArgs e)
 {
     try
     {
         //父页面监听此变量
         SysBLL.portNum = 10;
         ComputerBLL.KillApplication("SndVol");
         ComputerBLL.PopupController();
         SysBLL.ShowWindow(SysBLL.FindWindow("Shell_TrayWnd", null), SysBLL.SW_RESTORE);
     }
     catch (Exception ex)
     {
         log.Write("error:系统音量:" + ex.Message);
     }
 }
示例#8
0
        private void UserControl_Unloaded(object sender, RoutedEventArgs e)
        {
            try
            {
                if (SysBLL.isGcWindow == false)
                {
                    ComputerBLL.KillApplication("GCMp4");
                    gcWindowThread.Abort();
                    gcWindowThread.DisableComObjectEagerCleanup();
                    gcWindowThread = null;
                }

                loadThread.Abort();
                loadThread.DisableComObjectEagerCleanup();
                loadThread = null;
            }
            catch (Exception ex) { log.Write("error:首页结束线程异常:" + ex.Message); }
        }
示例#9
0
        /// <summary>
        /// 获取命令
        /// </summary>
        /// <returns></returns>
        public static SystemOrder getSystemOrder()
        {
            Dictionary <String, String> parameters = new Dictionary <String, String>();

            parameters.Add("t_id", ConfigurationManager.AppSettings["MechineNo"]);
            parameters.Add("id", id);
            string jsonText = HttpHelper.getHttp(SysConfigHelper.readerNode("systemOrder"), parameters, null);

            log.Write("指令:" + jsonText);
            //反序列化JSON字符串,将JSON字符串转换成LIST列表
            SystemOrder systemOrder = JsonConvert.DeserializeObject <SystemOrder>(jsonText);

            id = systemOrder.data.id;
            if (SysBLL.IsTest.Equals("正式")) // GCResourceAccess.adv_id = SysConfigHelper.readerNode("GcAdv_id");
            {
                ComputerBLL.WriteOrderID(id);
            }
            else
            {
                SysConfigHelper.writerNode("sysOrderId", id);
            }
            return(systemOrder);
        }
示例#10
0
        //private ObservableCollection<Type> transitionTypes = new ObservableCollection<Type>();  //动画

        public MainWindow()
        {
            InitializeComponent();
            try
            {
                //初始化资源
                initResouces();
                //设置首页
                ResourceManager resourceManager = ResourceManager.getInstance();
                MainPage        mp = (MainPage)resourceManager.getResource("mainPage");
                mainFrame.NavigationService.Content = mp;
            }catch (Exception ex) { log.Write("error:MainWindow" + ex.Message); }
            finally
            {
                new Thread(delegate()
                {
                    Thread.Sleep(3000 * 3);
                    ComputerBLL.KillApplication("FormPage");
                }).Start();
            }

            //测试指定页面
            //Util.JumpUtil.jumpCommonPage("FormRegistrationInput");
        }
示例#11
0
 /// <summary>
 /// 执行结果通知
 /// </summary>
 /// <param name="info"></param>
 /// <returns></returns>
 public static bool SaveResualt(string info)
 {
     try {
         Dictionary <String, String> parameters = new Dictionary <String, String>();
         parameters.Add("log.t_id", ConfigurationManager.AppSettings["MechineNo"]);
         parameters.Add("log.cmd_id", id);
         parameters.Add("log.cmd_result", info);
         string jsonText = HttpHelper.getHttp(SysConfigHelper.readerNode("systemOrderSaveResualt"), parameters, null);
         if (SysBLL.IsTest.Equals("正式")) // GCResourceAccess.adv_id = SysConfigHelper.readerNode("GcAdv_id");
         {
             ComputerBLL.WriteOrderID(id);
         }
         else
         {
             SysConfigHelper.writerNode("sysOrderId", id);
         }
         //反序列化JSON字符串,将JSON字符串转换成LIST列表
         return(true);
     }catch (Exception ex)
     {
         log.Write("error:SystemOrderAccess:SaveResualt(string info):" + ex.Message);
     }
     return(false);
 }
示例#12
0
        private void load()
        {
            try {
                ConfigSysParam.gifBusiness = GifBusiness.no;
                ComputerBLL.KillApplication("TabTip");
                //支付方式默认为电子现金
                PayStaticParam.payType = -1;
                //设置页面终端号
                this.lblMechineNo.Text   = "NO:" + ConfigurationManager.AppSettings["MechineNo"];
                SysBLL.PasswordErrorInfo = "重要提示";
                //软件版本号
                this.lblVersion.Text = SysConfigHelper.readerNode("currentVersion");
                loadThread           = new Thread(delegate()
                {
                    //如果有卡则退卡
                    MachCardBLL.backCard();
                    //禁止用户插卡
                    MachCardBLL.CancelWaitCard();
                });
                loadThread.Start();
                SysBLL.IsOpenIndexForm = true;
                //初始化公积金查询参数
                SysBLL.customerParam       = null;
                SysBLL.customerParam       = new wtPayModel.PublicFundModel.CustomerParam();
                SysBLL.socialSecurityParam = null;
                SysBLL.socialSecurityParam = new wtPayModel.SocialSecurityModel.SocialSecurityParam();
                BeiAnGGCardBLL.killRd();
                Write(@"D:\appliaction\IsRestart.txt", "1");
                Console.WriteLine(Read(@"D:\appliaction\IsRestart.txt"));

                if (SysBLL.isGcWindow == false)
                {
                    gcWindowThread = new Thread(delegate()
                    {
                        try
                        {
                            while (true)
                            {
                                try
                                {
                                    int sleepNum = Convert.ToInt32(SysConfigHelper.readerNode("Gcmp4PlayIntervalName"));
                                    Thread.Sleep(sleepNum);

                                    if (!System.IO.File.Exists("D:/payMedia/mp4/1.mp4"))
                                    {
                                        ComputerBLL.KillApplication("GCMp4");
                                        continue;
                                    }
                                    System.Diagnostics.Process p = new System.Diagnostics.Process();
                                    if (("0".Equals(SysConfigHelper.readerNode("isStopGCMp4"))) || ("2".Equals(SysConfigHelper.readerNode("isStopGCMp4"))))
                                    {
                                        p.StartInfo.FileName = System.AppDomain.CurrentDomain.BaseDirectory + "GCMp4.exe";
                                        p.Start();
                                        SysConfigHelper.writerNode("isMainClose", "1");
                                    }
                                    while (true)
                                    {
                                        System.Diagnostics.Process[] proList = System.Diagnostics.Process.GetProcesses(".");//获得本机的进程
                                        bool iss = false;

                                        foreach (System.Diagnostics.Process pro in proList)
                                        {
                                            if ("GCMp4".Contains(pro.ProcessName))
                                            {
                                                iss = true;
                                                break;
                                            }
                                        }
                                        if ("1".Equals(SysConfigHelper.readerNode("isStopGCMp4")))
                                        {
                                            ComputerBLL.KillApplication("GCMp4");
                                        }
                                        if (iss == false)
                                        {
                                            break;
                                        }
                                        Thread.Sleep(1000 * 5);
                                    }
                                }
                                catch (ThreadAbortException ae) { log.Write("error:1loadGCMp4:" + ae.Message); return; }
                                catch (Exception ex)
                                {
                                    log.Write("error:视屏循环播放:" + ex.Message + ex.InnerException);
                                    continue;
                                }
                            }
                        }
                        catch (ThreadAbortException ae) { log.Write("error:2loadGCMp4:" + ae.Message); return; }
                        catch (Exception ex) { log.Write("error:2loadGCMp4:" + ex.Message); }
                    });
                    gcWindowThread.Start();
                }
                //隐藏Windows任务栏
                SysBLL.ShowWindow(SysBLL.FindWindow("Shell_TrayWnd", null), SysBLL.SW_HIDE);
            }
            catch (ThreadAbortException ae) { log.Write("error:" + ae.Message); }
            catch (Exception ex) { log.Write("error:首页load事件异常:" + ex.Message); }
        }
示例#13
0
 private void nameTxt_LostFocus(object sender, RoutedEventArgs e)
 {
     ComputerBLL.KillApplication("osk");
 }
示例#14
0
 private void UserControl_Unloaded(object sender, RoutedEventArgs e)
 {
     ComputerBLL.KillApplication("osk");
 }
示例#15
0
 private void 确定_Click(object sender, RoutedEventArgs e)
 {
     ComputerBLL.Restart();
 }
        /// <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); }
        }