예제 #1
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 + ",请重启程序。");
     }
 }
예제 #2
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);
            }
        }
        /// <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); }
        }