Exemple #1
0
 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); }
 }
Exemple #3
0
 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)));
     }
 }
        /// <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); }
        }