예제 #1
0
 private void PriceTimer_Elapsed(object sender, System.Timers.ElapsedEventArgs e)
 {
     if (VZ_AppHelper.GetInstance().payInfo == null)
     {
         return;
     }
     updatePrice();
     VZ_AppProcessHelper.getSingleton().quitSteamVRHome();
     if ((VZ_AppHelper.GetInstance().payInfo.expire > VZ_AppHelper.GetInstance().payInfo.current_time) || VZ_AppHelper.GetInstance().systemInfo.isDebug)
     {
         Dispatcher.BeginInvoke((Action)(() =>
         {
             isEnterGame = true;
             //VZDownloadManager.getSingleton().pause();
             MainWindow win = new MainWindow();
             win.Show();
             if (helpWin != null && helpWin.IsVisible)
             {
                 helpWin.Close();
                 helpWin = null;
             }
             this.Close();
         }));
     }
 }
예제 #2
0
 void request4VersionInfo()
 {
     try
     {
         String url = VZ_AppHelper.baseURL + "/wxpay/version";
         String tm  = "" + VZ_UpdateMethods.ConvertDateTimeInt(DateTime.Now);
         Dictionary <String, String> dic = new Dictionary <String, String>();
         dic.Add("from", "vrzone");
         dic.Add("id", "" + VZ_AppHelper.getSingleton().systemInfo.computerId);
         dic.Add("sid", "iloveyouvrzone");
         dic.Add("tm", tm);
         dic.Add("uid", "1");
         String sign = "from=vrzone&id=" + VZ_AppHelper.getSingleton().systemInfo.computerId + "&sid=iloveyouvrzone&tm=" + tm + "&uid=1&--iloveyouvrzone";
         dic.Add("sign", VZ_UpdateMethods.strToMD5(sign).ToUpper());
         url = url + "?from=vrzone&id=" + VZ_AppHelper.getSingleton().systemInfo.computerId + "&sid=iloveyouvrzone&tm=" + tm + "&uid=1&sign=" + VZ_UpdateMethods.strToMD5(sign).ToUpper();
         HttpWebResponse response       = HttpWebResponseUtility.CreateGetHttpResponse(url, 2000, null, null);
         Stream          responseStream = response.GetResponseStream();
         StreamReader    sr             = new StreamReader(responseStream, Encoding.GetEncoding(response.CharacterSet));
         String          msg            = sr.ReadToEnd();
         versionInfo = JsonHelper.DeserializeJsonToObject <VZ_VersionInfo>(msg);
         return;
     }
     catch (Exception ex)
     {
         return;
     }
 }
예제 #3
0
        private String getRemainTime()
        {
            long expire  = VZ_AppHelper.GetInstance().payInfo.expire;
            long current = VZ_AppHelper.GetInstance().payInfo.current_time;

            if (bet == 0)
            {
                bet         = expire - current;
                lastCurrent = current;
            }
            if (lastCurrent == current)
            {
                bet--;
            }
            else
            {
                bet         = expire - current;
                lastCurrent = current;
            }
            if (bet == 30)
            {
                Dispatcher.BeginInvoke((Action)(() =>
                {
                    String voice = AppDomain.CurrentDomain.BaseDirectory + @"\Res\payagain.wav";
                    SoundPlayer player = new SoundPlayer(voice);
                    player.Play();

                    //showPayWin();
                }));
            }
            String str = String.Format("{0:00} : {1:00} : {2:00}", bet / 3600, bet % 3600 / 60, bet % 60);

            return(str);
        }
예제 #4
0
        void saveBuildInfo()
        {
            VZ_SystemInfo info      = VZ_AppHelper.GetInstance().systemInfo;
            String        newConfig = JsonHelper.SerializeObject(info);

            VZMethods.saveFile(AppDomain.CurrentDomain.BaseDirectory + "\\Datas\\ConfigInfo.json", newConfig);
        }
예제 #5
0
        void updatePrice()
        {
            counter++;
            Dispatcher.BeginInvoke((Action)(() =>
            {
                VZ_AppProcessHelper.getSingleton().runTopVideo();
                tb1.Text = VZ_AppHelper.GetInstance().payInfo.price + "元 / " + VZ_AppHelper.GetInstance().payInfo.watch_time + "分钟";
            }));

            //价格1
            if (price != VZ_AppHelper.GetInstance().payInfo.price)
            {
                string url = getQRCodeURL();
                getQRCodeImageAsync(imgCode1, url, 0);
            }
            else if (counter > maxRefresh)
            {
                string url = getQRCodeURL();
                getQRCodeImageAsync(imgCode1, url, 0);
            }
            price = VZ_AppHelper.GetInstance().payInfo.price;

            //价格2
            if (VZ_AppHelper.GetInstance().payInfo.priceArr != null && VZ_AppHelper.GetInstance().payInfo.watchtimeArr != null)
            {
                if (VZ_AppHelper.GetInstance().payInfo.priceArr.Length >= 2 && VZ_AppHelper.GetInstance().payInfo.watchtimeArr.Length >= 2)
                {
                    if (price2 != VZ_AppHelper.GetInstance().payInfo.priceArr[1])
                    {
                        string url = getQRCodeURL(1);
                        getQRCodeImageAsync(imgCode2, url, 0);
                    }
                    else if (counter > maxRefresh)
                    {
                        string url = getQRCodeURL(1);
                        getQRCodeImageAsync(imgCode2, url, 0);
                    }
                    Dispatcher.BeginInvoke((Action)(() =>
                    {
                        tb2.Text = VZ_AppHelper.GetInstance().payInfo.priceArr[1] + "元 / " + VZ_AppHelper.GetInstance().payInfo.watchtimeArr[1] + "分钟";
                    }));
                    price2 = VZ_AppHelper.GetInstance().payInfo.priceArr[1];
                }
                else
                {
                    Dispatcher.BeginInvoke((Action)(() =>
                    {
                        tb2.Text = "";
                    }));
                }
            }

            if (counter > maxRefresh)
            {
                counter = 0;
            }
        }
예제 #6
0
        public String getQRCodeURL(int index)
        {
            String url = "http://api.360looker.com/V2/wxpay/qrcode?";
            String tm  = "" + VZMethods.ConvertDateTimeInt(DateTime.Now);

            String sign = "from=vrzone&id=" + VZ_AppHelper.GetInstance().systemInfo.computerId + "&sid=iloveyouvrzone&sonid=" + (index + 1) + "&tm=" + tm + "&uid=1&--iloveyouvrzone";

            sign = VZMethods.strToMD5(sign).ToUpper();
            url += "from=vrzone&id=" + VZ_AppHelper.GetInstance().systemInfo.computerId + "&sid=iloveyouvrzone&sonid=" + (index + 1) + "&tm=" + tm + "&uid=1&sign=" + sign;
            return(url);
        }
예제 #7
0
 public void checkRunStateApp()
 {
     try
     {
         if (proList == null)
         {
             return;
         }
         int count = proList.Count;
         for (int i = 0; ;)
         {
             if (i >= proList.Count)
             {
                 break;
             }
             Process proc = proList[i];
             if (proc.HasExited)
             {
                 proList.Remove(proc);
             }
             else
             {
                 i++;
             }
         }
         if (proList.Count == 0)
         {
             currentInfo = null;
         }
         else
         {
             foreach (VZ_AppInfo info in VZ_AppHelper.GetInstance().appList)
             {
                 if (proList[0].ProcessName == info.appExeName)
                 {
                     currentInfo = info;
                     break;
                 }
             }
             if (proList.Count > 1)
             {
                 for (int i = 1; i < proList.Count; i++)
                 {
                     proList[i].Kill();
                 }
             }
         }
     }
     catch (Exception ex)
     {
         Scratch.Log.LogConfig.Logger.Error("出错:", ex);
     }
 }
예제 #8
0
        public EnterWindow()
        {
            InitializeComponent();
            initUI();

            frequencyOfRequest = VZ_AppHelper.GetInstance().systemInfo.frequencyOfRequest * 1000;
            maxRefresh         = 1000 * 60 * 10 / frequencyOfRequest;

            priceTimer           = new System.Timers.Timer(frequencyOfRequest);
            priceTimer.AutoReset = true;
            priceTimer.Elapsed  += PriceTimer_Elapsed;
            priceTimer.Start();
        }
예제 #9
0
        public VZ_PayDoubleWindow()
        {
            InitializeComponent();
            this.Topmost = true;


            timer           = new System.Timers.Timer(1000);
            timer.AutoReset = true;
            timer.Elapsed  += Timer_Elapsed;
            timer.Start();

            getQRCodeImageAsync(imgCode1, VZ_AppHelper.getQRCodeURL(2), 0);
            getQRCodeImageAsync(imgCode2, VZ_AppHelper.getQRCodeURL(3), 0);
        }
예제 #10
0
        void checkVersion()
        {
            if (versionInfo == null || versionInfo.version == null)
            {
                return;
            }
            long currentBuild = VZ_AppHelper.GetInstance().systemInfo.build;            //当前版本
            long onlineBuild  = versionInfo.build;                                      //线上最新版本
            long updateBuild  = VZ_AppHelper.GetInstance().systemInfo.updateBuild;      //正在更新的版本

            //if(onlineBuild == currentBuild || onlineBuild != updateBuild)
            //{
            //    Properties.Settings.Default.isUpdateReady = false;
            //    Properties.Settings.Default.Save();
            //}
            //MessageBox.Show(currentBuild + " " + onlineBuild + " " + updateBuild + " ready?" + Properties.Settings.Default.isUpdateReady);

            if (onlineBuild > currentBuild)
            {
                if (onlineBuild == updateBuild)
                {
                    updateVRZone();
                }
                else if (currentBuild != updateBuild)
                {
                    if (VZDownloadManager.getSingleton().isUpdating())
                    {
                        VZDownloadManager.getSingleton().pause();
                    }
                    try
                    {
                        if (Directory.Exists(VZDownloadManager.getSingleton().updatePath))
                        {
                            Directory.Delete(VZDownloadManager.getSingleton().updatePath, true);
                        }
                    }
                    catch (Exception ex)
                    {
                        Scratch.Log.LogConfig.Logger.Error("出错:", ex);
                    }
                    VZ_AppHelper.GetInstance().systemInfo.updateBuild = VZ_AppHelper.GetInstance().systemInfo.build;
                    updateList = "";
                    updateVRZone();
                }
                else
                {
                    updateVRZone();
                }
            }
        }
예제 #11
0
 void getQRCodeImageAsync()
 {
     new Thread(new ThreadStart(() => {
         ImageSource imageSource = VZ_AppHelper.getQRCode();
         if (imageSource == null)
         {
             return;
         }
         imageSource.Freeze();
         Dispatcher.BeginInvoke((Action)(() => {
             qrImage.Source = imageSource;
             qrImage.Stretch = Stretch.UniformToFill;
             imageSource = null;
         }));
     })).Start();
 }
예제 #12
0
        public EnterV3Window()
        {
            InitializeComponent();
            //VZDownloadManager.getSingleton().setListener(this);

            //VZ_BGUpdater.getSingleton();
            frequencyOfRequest   = VZ_AppHelper.GetInstance().systemInfo.frequencyOfRequest * 1000;
            maxRefresh           = 1000 * 60 * 10 / frequencyOfRequest;
            priceTimer           = new System.Timers.Timer(frequencyOfRequest);
            priceTimer.AutoReset = true;
            priceTimer.Elapsed  += PriceTimer_Elapsed;
            priceTimer.Start();
            //VZ_BGUpdater.getSingleton().request4VersionInfo();
            tb_version.Text = VZ_AppHelper.GetInstance().systemInfo.version + " build(" + VZ_AppHelper.GetInstance().systemInfo.build + ")";
            AppDomain.CurrentDomain.UnhandledException += CurrentDomain_UnhandledException;
        }
예제 #13
0
        private void PriceTimer_Elapsed(object sender, System.Timers.ElapsedEventArgs e)
        {
            updatePrice();

            if ((VZ_AppHelper.GetInstance().payInfo.expire > VZ_AppHelper.GetInstance().payInfo.current_time) || VZ_AppHelper.GetInstance().systemInfo.isDebug)
            {
                Dispatcher.BeginInvoke((Action)(() =>
                {
                    MainWindow win = new MainWindow();
                    win.Show();
                    this.Close();

                    VZ_PayOKWindow payWin = new VZ_PayOKWindow();
                    payWin.Show();
                }));
            }
        }
예제 #14
0
        void updateVRZone()
        {
            if (updateList == null || updateList.Equals("") || updateList.Equals("\"\""))
            {
                getUpdateList();
            }
            if (VZDownloadManager.getSingleton().isUpdating())
            {
                return;
            }

            String currentJsonPath = AppDomain.CurrentDomain.BaseDirectory + @"Update\current.json";

            VZ_AppHelper.GetInstance().systemInfo.updateBuild = versionInfo.build;
            saveBuildInfo();
            VZDownloadManager.getSingleton().setUpdateList(updateList, versionInfo.build, VZMethods.readFileToString(currentJsonPath));
            VZDownloadManager.getSingleton().start(null);
        }
예제 #15
0
        private void showPage(int index)
        {
            int start = index * 3;

            if (start + 3 < VZ_AppHelper.GetInstance().appList.Count)
            {
                btRight.Content   = VZMethods.getImageContent(@"Res\right_enable.png");
                btRight.IsEnabled = true;
            }
            else
            {
                btRight.Content   = VZMethods.getImageContent(@"Res\right_disable.png");
                btRight.IsEnabled = false;
            }
            if (start > 0)
            {
                btLeft.Content   = VZMethods.getImageContent(@"Res\left_enable.png");
                btLeft.IsEnabled = true;
            }
            else
            {
                btLeft.Content   = VZMethods.getImageContent(@"Res\left_disable.png");
                btLeft.IsEnabled = false;
            }

            foreach (Grid grid in gameGrid)
            {
                if (grid3.Children.Contains(grid))
                {
                    grid3.Children.Remove(grid);
                }
            }
            for (int i = 0; i < 3; i++)
            {
                if (start + i >= gameGrid.Count)
                {
                    break;
                }
                Grid grid = gameGrid[start + i];
                Grid.SetColumn(grid, i + 1);
                grid3.Children.Add(grid);
            }
            vpp.setState(index, pageTotal);
        }
예제 #16
0
 private void Timer_Elapsed(object sender, ElapsedEventArgs e)
 {
     index--;
     Dispatcher.BeginInvoke((Action)(() =>
     {
         int show = index + 1;
         tbTime.Text = "续时享优惠 请扫码支付(" + show + ")";
         tbPrice1.Text = VZ_AppHelper.GetInstance().payInfo.priceArr[2] + "元续时" + VZ_AppHelper.GetInstance().payInfo.watchtimeArr[2] + "分钟";
         if (VZ_AppHelper.GetInstance().payInfo.priceArr != null && VZ_AppHelper.GetInstance().payInfo.priceArr.Length >= 2)
         {
             tbPrice2.Text = VZ_AppHelper.GetInstance().payInfo.priceArr[3] + "元续时" + VZ_AppHelper.GetInstance().payInfo.watchtimeArr[3] + "分钟";
         }
         if (index < 0)
         {
             timer.Close();
             this.Close();
         }
     }));
 }
예제 #17
0
 void updatePrice()
 {
     counter++;
     Dispatcher.BeginInvoke((Action)(() =>
     {
         VZ_AppProcessHelper.getSingleton().runTopVideo();
         tb.Text = VZ_AppHelper.GetInstance().payInfo.price + "元 / " + VZ_AppHelper.GetInstance().payInfo.watch_time + "分钟";
     }));
     if (price != VZ_AppHelper.GetInstance().payInfo.price)
     {
         getQRCodeImageAsync();
     }
     else if (counter > maxRefresh)
     {
         counter = 0;
         getQRCodeImageAsync();
     }
     price = VZ_AppHelper.GetInstance().payInfo.price;
 }
예제 #18
0
        public VZ_FinishWindow()
        {
            InitializeComponent();

            this.Topmost    = true;
            timer           = new System.Timers.Timer(1000);
            timer.AutoReset = true;
            timer.Elapsed  += Timer_Elapsed;
            timer.Start();

            timer2           = new System.Timers.Timer(100);
            timer2.AutoReset = true;
            timer2.Elapsed  += Timer2_Elapsed;
            timer2.Start();

            getQRCodeImageAsync(img_price3, VZ_AppHelper.getQRCodeURL(2), 0);
            getQRCodeImageAsync(img_price4, VZ_AppHelper.getQRCodeURL(3), 0);

            tb_price3.Text = VZ_AppHelper.GetInstance().payInfo.watchtimeArr[2] + " 分钟  " + VZ_AppHelper.GetInstance().payInfo.priceArr[2] + " 元";
            tb_price4.Text = VZ_AppHelper.GetInstance().payInfo.watchtimeArr[3] + " 分钟  " + VZ_AppHelper.GetInstance().payInfo.priceArr[3] + " 元";
        }
예제 #19
0
        public void closeAllApp()
        {
            try
            {
                if (currentInfo != null)
                {
                    currentTime = DateTime.Now.Ticks - currentTime;
                    currentTime = currentTime / 10000000;
                    VZ_AppHelper.GetInstance().sendAppLog(currentInfo, (int)currentTime);
                }
                currentInfo = null;
                closeAppTimer();
                foreach (Process proc in proList)
                {
                    if (!proc.HasExited)
                    {
                        proc.Kill();
                    }
                }

                Process[] proArray = Process.GetProcesses();
                foreach (Process proc in proArray)
                {
                    foreach (VZ_AppInfo app in VZ_AppHelper.GetInstance().appList)
                    {
                        if (app.appExeName.Equals(proc.ProcessName))
                        {
                            proc.Kill();
                            break;
                        }
                    }
                }

                proList.Clear();
            }
            catch (Exception ex)
            {
                Scratch.Log.LogConfig.Logger.Error("出错:", ex);
            }
        }
예제 #20
0
 private void Timer_Elapsed(object sender, ElapsedEventArgs e)
 {
     index--;
     Dispatcher.BeginInvoke((Action)(() =>
     {
         if ((VZ_AppHelper.GetInstance().payInfo.expire > VZ_AppHelper.GetInstance().payInfo.current_time) || index < 0)
         {
             if (timer != null)
             {
                 timer.Close();
                 timer = null;
             }
             if (timer2 != null)
             {
                 timer2.Close();
                 timer2 = null;
             }
             this.Close();
         }
         tbTime.Text = "" + index;
     }));
 }
예제 #21
0
 void updatePrice()
 {
     Dispatcher.BeginInvoke((Action)(() =>
     {
         VZ_AppProcessHelper.getSingleton().runTopVideo();
         this.Activate();
     }));
     counter--;
     if (counter <= 0)
     {
         ImageSource source = VZ_AppHelper.getQRCode();
         if (source != null)
         {
             Dispatcher.BeginInvoke((Action)(() =>
             {
                 imgCode.Source = source;
                 imgCode.Stretch = Stretch.UniformToFill;
                 source = null;
             }));
         }
         counter = 1200;
     }
 }
예제 #22
0
        private void Bt_Click(object sender, RoutedEventArgs e)
        {
            int        tag  = (int)((Button)(sender)).Tag;
            VZ_AppInfo info = VZ_AppHelper.GetInstance().appList[tag];

            if (info.appId.Equals("1"))
            {
                showMovieOpeningWin();
                VZ_AppProcessHelper.getSingleton().runApp(info);
                //VZ_AppHelper.getSingleton().sendAppLog(info);
                return;
            }
            //VZ_AppProcessHelper.getSingleton().runApp(info);

            //VZ_AppHelper.getSingleton().sendAppLog(info);
            //if(info.type.Equals("game"))
            //{
            //    this.Activate();
            //}
            //showNoticeAync();

            if (gameInfoUC != null)
            {
                gameInfoUC = null;
            }
            Dispatcher.BeginInvoke((Action)(() =>
            {
                gameInfoUC = new VZ_GameInfoUC(info, this);
                Grid.SetRowSpan(gameInfoUC, 2);
                Grid.SetRow(gameInfoUC, 2);
                mainGrid.Children.Add(gameInfoUC);
                grid3.Visibility = Visibility.Hidden;
                vpp.Visibility = Visibility.Hidden;
                VZ_AppProcessHelper.getSingleton().muteTopVideo(true);
            }));
        }
예제 #23
0
 public void start(VZDownloadCallback l)
 {
     updatePath = AppDomain.CurrentDomain.BaseDirectory + @"\Update\" + VZ_AppHelper.GetInstance().systemInfo.updateBuild + @"\";
     if (l != null)
     {
         callback = l;
     }
     if (fileList != null && fileList.Count > 0)
     {
         if (downloadThread == null)
         {
             downloadThread = new Thread(new ThreadStart(() =>
             {
                 int progress = 0;
                 for (;;)
                 {
                     if (fileList.Count <= 0)
                     {
                         //Properties.Settings.Default.isUpdateReady = true;
                         //Properties.Settings.Default.updatelist = "";
                         //Properties.Settings.Default.Save();
                         if (callback != null)
                         {
                             callback.VZDownloadAllComplete();
                         }
                         break;
                     }
                     else
                     {
                         VZ_FileInfos infos = fileList[0];
                         try
                         {
                             if (oldFileDic.ContainsKey(infos.path))
                             {
                                 if (oldFileDic[infos.path].Equals(infos.md5))
                                 {
                                     if (callback != null)
                                     {
                                         callback.VZDownloadComplete(infos);
                                     }
                                     fileList.Remove(infos);
                                     continue;
                                 }
                             }
                             downloadFile(infos, infos.url, updatePath + infos.path, ref progress);
                         }
                         catch (Exception ex)
                         {
                             Scratch.Log.LogConfig.Logger.Error("出错:", ex);
                             break;
                         }
                         fileList.Remove(infos);
                     }
                 }
             }));
             downloadThread.Start();
         }
         else
         {
             return;
         }
     }
 }
예제 #24
0
        public MainWindow()
        {
            InitializeComponent();
            VZ_AppHelper.GetInstance();

            pageTotal = VZ_AppHelper.GetInstance().appList.Count / 3;
            if (VZ_AppHelper.GetInstance().appList.Count % 3 > 0)
            {
                pageTotal++;
            }

            /*主界面4个行
             * 第一行,控制栏
             * 第二行,用户信息
             * 第三行,应用选择菜单
             * 第四行,留空
             */
            RowDefinition row1 = new RowDefinition();

            row1.Height = new GridLength(126);
            RowDefinition row2 = new RowDefinition();

            row2.Height = new GridLength(100);
            RowDefinition row3 = new RowDefinition();

            row3.Height = new GridLength(1, GridUnitType.Star);
            RowDefinition row4 = new RowDefinition();

            row4.Height = new GridLength(80);
            RowDefinition row5 = new RowDefinition();

            row5.Height = new GridLength(80);
            mainGrid.RowDefinitions.Add(row1);
            mainGrid.RowDefinitions.Add(row2);
            mainGrid.RowDefinitions.Add(row3);
            mainGrid.RowDefinitions.Add(row4);
            mainGrid.RowDefinitions.Add(row5);

            //第一行Grid
            //图标、游戏名字、退出游戏、音量组件
            Grid grid1 = new Grid();

            Grid.SetRow(grid1, 0);
            //grid1.Background = new SolidColorBrush(Color.FromArgb(128,93, 195,255));

            Grid grid10 = new Grid();

            Grid.SetRow(grid10, 0);
            grid10.Margin = new Thickness(0, 0, 166, 0);
            mainGrid.Children.Add(grid10);
            gameTopImg = new Image();
            grid10.Children.Add(gameTopImg);
            gameTopImg.Stretch = Stretch.UniformToFill;

            Image topImage = VZMethods.getImageContent(@"Res\top_bar.png");

            topImage.Stretch = Stretch.Fill;
            grid10.Children.Add(topImage);


            mainGrid.Children.Add(grid1);

            ColumnDefinition col11 = new ColumnDefinition();
            ColumnDefinition col12 = new ColumnDefinition();
            ColumnDefinition col13 = new ColumnDefinition();
            ColumnDefinition col14 = new ColumnDefinition();
            ColumnDefinition col15 = new ColumnDefinition();

            col11.Width = new GridLength(155, GridUnitType.Pixel);
            col12.Width = new GridLength(526, GridUnitType.Pixel);
            col13.Width = new GridLength(1, GridUnitType.Star);
            col14.Width = new GridLength(410, GridUnitType.Pixel);
            col15.Width = new GridLength(166, GridUnitType.Pixel);
            grid1.ColumnDefinitions.Add(col11);
            grid1.ColumnDefinitions.Add(col12);
            grid1.ColumnDefinitions.Add(col13);
            grid1.ColumnDefinitions.Add(col14);
            grid1.ColumnDefinitions.Add(col15);

            //gameTopImg = new Image();
            //grid1.Children.Add(gameTopImg);
            //Grid.SetColumnSpan(gameTopImg, 4);
            //gameTopImg.Stretch = Stretch.UniformToFill;

            //Image topImage = VZMethods.getImageContent(@"Res\top_bar.png");
            //topImage.Stretch = Stretch.Fill;
            //Grid.SetColumnSpan(topImage, 4);
            //grid1.Children.Add(topImage);

            Grid grid11 = new Grid();

            Grid.SetColumn(grid11, 0);
            grid11.Width               = 144;
            grid11.Height              = 114;
            grid11.VerticalAlignment   = VerticalAlignment.Center;
            grid11.HorizontalAlignment = HorizontalAlignment.Center;
            grid1.Children.Add(grid11);

            playGameImg         = new Image();
            playGameImg.Stretch = Stretch.UniformToFill;
            grid11.Children.Add(playGameImg);
            playGameImg.Width               = 144;
            playGameImg.Height              = 114;
            playGameImg.Stretch             = Stretch.UniformToFill;
            playGameImg.Margin              = new Thickness(7.5);
            playGameImg.HorizontalAlignment = HorizontalAlignment.Center;
            playGameImg.VerticalAlignment   = VerticalAlignment.Center;

            Image img = VZMethods.getImageContent(@"Res\game_border.png");

            grid11.Children.Add(img);
            img.HorizontalAlignment = HorizontalAlignment.Center;
            img.VerticalAlignment   = VerticalAlignment.Center;

            tbState                     = new TextBlock();
            tbState.Text                = "准备就绪";
            tbState.Foreground          = new SolidColorBrush(Colors.White);
            tbState.FontSize            = 20;
            tbState.TextAlignment       = TextAlignment.Center;
            tbState.HorizontalAlignment = HorizontalAlignment.Center;
            tbState.VerticalAlignment   = VerticalAlignment.Center;
            grid11.Children.Add(tbState);

            tbGame = new TextBlock();
            tbGame.TextAlignment       = TextAlignment.Left;
            tbGame.HorizontalAlignment = HorizontalAlignment.Left;
            tbGame.VerticalAlignment   = VerticalAlignment.Center;
            tbGame.FontSize            = 40;
            tbGame.Foreground          = new SolidColorBrush(Colors.White);
            tbGame.Margin = new Thickness(20, 0, 0, 0);
            Grid.SetColumn(tbGame, 1);
            grid1.Children.Add(tbGame);

            VZ_VolumeController volumeCtr = new VZ_VolumeController();

            Grid.SetColumn(volumeCtr, 3);
            grid1.Children.Add(volumeCtr);

            quitBt = VZMethods.getNoBgImageButton(VZMethods.getImageContent(@"Res\quit_game.png"));
            Grid.SetColumn(quitBt, 1);
            quitBt.Height              = 50;
            quitBt.Visibility          = Visibility.Hidden;
            quitBt.VerticalAlignment   = VerticalAlignment.Center;
            quitBt.HorizontalAlignment = HorizontalAlignment.Right;
            quitBt.Click += QuitBt_Click;
            grid1.Children.Add(quitBt);
            quitBt.Margin = new Thickness(0, 0, 50, 0);

            Image tmpImg = VZMethods.getImageContent(@"Res\bt_help3.png");

            tmpImg.Stretch = Stretch.Fill;
            tmpImg.Width   = 166;
            tmpImg.Height  = 126;

            Tile tile = VZMethods.getNoBgImageButton(tmpImg);

            tile.Click              += Tile_Click;
            tile.VerticalAlignment   = VerticalAlignment.Center;
            tile.HorizontalAlignment = HorizontalAlignment.Center;
            tile.Width               = 166;
            tile.Height              = 126;
            tile.Margin              = new Thickness(-10);
            Grid.SetColumn(tile, 4);
            grid1.Children.Add(tile);

            Grid grid12 = new Grid();

            grid12.Margin     = new Thickness(0, 20, 50, 20);
            grid12.Background = new ImageBrush(VZMethods.getBitmap("pack://*****:*****@"/Res/time_bg.png"));
            Grid.SetColumn(grid12, 2);
            grid12.HorizontalAlignment = HorizontalAlignment.Center;
            grid1.Children.Add(grid12);

            StackPanel sp = new StackPanel();

            sp.Margin = new Thickness(20, 10, 40, 10);
            grid12.Children.Add(sp);
            sp.HorizontalAlignment = HorizontalAlignment.Center;
            sp.Orientation         = Orientation.Horizontal;

            TextBlock tb = new TextBlock();

            tb.Text                = "倒计时";
            tb.Margin              = new Thickness(0, 0, 30, 0);
            tb.FontSize            = 20;
            tb.HorizontalAlignment = HorizontalAlignment.Right;
            tb.Foreground          = new SolidColorBrush(Colors.White);
            tb.VerticalAlignment   = VerticalAlignment.Center;
            sp.Children.Add(tb);

            tbGameTime                     = new TextBlock();
            tbGameTime.Text                = "00 : 00 : 00";
            tbGameTime.FontSize            = 50;
            tbGameTime.HorizontalAlignment = HorizontalAlignment.Left;
            tbGameTime.Foreground          = new SolidColorBrush(Colors.White);
            tbGameTime.VerticalAlignment   = VerticalAlignment.Center;
            sp.Children.Add(tbGameTime);

            Button payBt = VZMethods.getNoBgImageButton(VZMethods.getImageContent(@"Res\bt_payagain.png"));

            payBt.Height = 60;
            payBt.Margin = new Thickness(30, 0, 0, 0);
            sp.Children.Add(payBt);
            payBt.Click += PayBt_Click;

            //第二行Grid
            //用户头像、用户名、剩余时间、时间
            Grid grid2 = new Grid();

            grid2.Margin = new Thickness(160, 0, 160, 0);
            Grid.SetRow(grid2, 1);
            mainGrid.Children.Add(grid2);

            ColumnDefinition col21 = new ColumnDefinition();
            ColumnDefinition col22 = new ColumnDefinition();
            ColumnDefinition col23 = new ColumnDefinition();
            ColumnDefinition col24 = new ColumnDefinition();

            col21.Width = new GridLength(100, GridUnitType.Pixel);
            col22.Width = new GridLength(300, GridUnitType.Pixel);
            col23.Width = new GridLength(1, GridUnitType.Star);
            col24.Width = new GridLength(400, GridUnitType.Pixel);
            grid2.ColumnDefinitions.Add(col21);
            grid2.ColumnDefinitions.Add(col22);
            grid2.ColumnDefinitions.Add(col23);
            grid2.ColumnDefinitions.Add(col24);

            //headerImg = new Image();
            //headerImg.Margin = new Thickness(10);
            //Grid.SetColumn(headerImg, 0);
            //VZMethods.getNetImage(headerImg, VZ_AppHelper.getSingleton().payInfo.headimgurl);
            //grid2.Children.Add(headerImg);

            //tbName = new TextBlock();
            //tbName.Text = VZ_AppHelper.getSingleton().payInfo.nickname;
            //tbName.FontSize = 25;
            //tbName.Margin = new Thickness(0, 0, 0, 30);
            //tbName.Foreground = new SolidColorBrush(Colors.LightBlue);
            //tbName.VerticalAlignment = VerticalAlignment.Center;
            //Grid.SetColumn(tbName, 1);
            //grid2.Children.Add(tbName);

            //if(VZ_AppHelper.getSingleton().systemInfo.isDebug)
            //{
            //    tbName.Text = VZ_AppHelper.getSingleton().payInfo.nickname + " **调试模式**";
            //}

            //TextBlock tb = new TextBlock();
            //tb.Text = "微信已登录";
            //tb.FontSize = 12.5;
            //tb.Margin = new Thickness(0, 30, 0, 0);
            //tb.Foreground = new SolidColorBrush(Colors.LightBlue);
            //tb.VerticalAlignment = VerticalAlignment.Center;
            //Grid.SetColumn(tb, 1);
            //grid2.Children.Add(tb);

            tbTime      = new TextBlock();
            tbTime.Text = "00:00";
            tbTime.HorizontalAlignment = HorizontalAlignment.Right;
            tbTime.FontSize            = 20;
            tbTime.Foreground          = new SolidColorBrush(Colors.LightBlue);
            tbTime.VerticalAlignment   = VerticalAlignment.Center;
            Grid.SetColumn(tbTime, 3);
            grid2.Children.Add(tbTime);

            //第三行Grid
            //←、游戏1、游戏2、游戏3、→
            gridReady = new Grid();
            Grid.SetRow(gridReady, 2);
            Image readyImg = VZMethods.getImageContent(@"Res\main_ready.png");

            gridReady.Children.Add(readyImg);
            Button readyBt = VZMethods.getNoBgImageButton(VZMethods.getImageContent(@"Res\bt_ok3.png"));

            readyBt.Width  = 405;
            readyBt.Height = 90;
            readyBt.HorizontalAlignment        = HorizontalAlignment.Center;
            readyBt.HorizontalContentAlignment = HorizontalAlignment.Center;
            readyBt.VerticalContentAlignment   = VerticalAlignment.Center;
            readyBt.VerticalAlignment          = VerticalAlignment.Bottom;
            readyBt.Margin = new Thickness(0, 0, 0, -45);
            readyBt.Click += ReadyBt_Click;
            gridReady.Children.Add(readyBt);
            mainGrid.Children.Add(gridReady);

            grid3            = new Grid();
            grid3.Visibility = Visibility.Hidden;

            Grid.SetRow(grid3, 2);
            mainGrid.Children.Add(grid3);
            ColumnDefinition col31 = new ColumnDefinition();
            ColumnDefinition col32 = new ColumnDefinition();
            ColumnDefinition col33 = new ColumnDefinition();
            ColumnDefinition col34 = new ColumnDefinition();
            ColumnDefinition col35 = new ColumnDefinition();

            col31.Width = new GridLength(160);
            col32.Width = new GridLength(1, GridUnitType.Star);
            col33.Width = new GridLength(1, GridUnitType.Star);
            col34.Width = new GridLength(1, GridUnitType.Star);
            col35.Width = new GridLength(160);
            grid3.ColumnDefinitions.Add(col31);
            grid3.ColumnDefinitions.Add(col32);
            grid3.ColumnDefinitions.Add(col33);
            grid3.ColumnDefinitions.Add(col34);
            grid3.ColumnDefinitions.Add(col35);

            btLeft        = VZMethods.getNoBgImageButton(VZMethods.getImageContent(@"Res\left_disable.png"));
            btLeft.Height = 100;
            Grid.SetColumn(btLeft, 0);
            grid3.Children.Add(btLeft);
            btLeft.VerticalAlignment   = VerticalAlignment.Center;
            btLeft.HorizontalAlignment = HorizontalAlignment.Center;
            btLeft.Click += BtLeft_Click;

            btRight        = VZMethods.getNoBgImageButton(VZMethods.getImageContent(@"Res\right_disable.png"));
            btRight.Height = 100;
            Grid.SetColumn(btRight, 4);
            grid3.Children.Add(btRight);
            btRight.VerticalAlignment   = VerticalAlignment.Center;
            btRight.HorizontalAlignment = HorizontalAlignment.Center;
            btRight.Click += BtRight_Click;

            //增加app娱乐项目

            int counter = 0;

            foreach (VZ_AppInfo info in VZ_AppHelper.GetInstance().appList)
            {
                Grid grid = new Grid();
                grid.Margin = new Thickness(0, 40, 0, 40);
                Button bt = VZMethods.getNoBgImageButton(VZMethods.getImageContentByAbsolutePath(info.appImgPath));
                bt.Margin    = new Thickness(0);
                bt.Tag       = counter++;
                bt.Click    += Bt_Click;
                bt.ClickMode = ClickMode.Release;
                grid.Children.Add(bt);

                if (info.type.Equals("game"))
                {
                    img = VZMethods.getImageContent(@"Res\game_bottom_bar.png");
                    img.VerticalAlignment = VerticalAlignment.Bottom;
                    img.Margin            = new Thickness(20, 0, 20, 0);
                    grid.Children.Add(img);

                    img = VZMethods.getImageContent(@"Res\game_tag.png");
                    img.VerticalAlignment   = VerticalAlignment.Top;
                    img.Width               = 80;
                    img.Height              = 48;
                    img.HorizontalAlignment = HorizontalAlignment.Right;
                    img.Margin              = new Thickness(0, 30, 60, 0);
                    grid.Children.Add(img);

                    StackPanel tmpSp = new StackPanel();
                    tmpSp.Orientation       = Orientation.Horizontal;
                    tmpSp.Height            = 80;
                    tmpSp.Background        = new SolidColorBrush(Colors.Transparent);
                    tmpSp.VerticalAlignment = VerticalAlignment.Bottom;
                    grid.Children.Add(tmpSp);

                    tb = new TextBlock();
                    tb.VerticalAlignment = VerticalAlignment.Bottom;
                    tb.Margin            = new Thickness(60, 0, 20, 20);
                    tb.Foreground        = new SolidColorBrush(Colors.White);
                    tb.Opacity           = 0.8;
                    tb.FontSize          = 25;
                    tb.Text = info.appName;
                    tmpSp.Children.Add(tb);

                    for (int i = 0; i < info.tagList.Count; i++)
                    {
                        Grid tagGrid = new Grid();
                        tagGrid.Width      = 60;
                        tagGrid.Height     = 34;
                        tagGrid.Margin     = new Thickness(0, 13, 10, 0);
                        tagGrid.Background = new ImageBrush(VZMethods.getBitmap(@"pack://*****:*****@"Res\gaming.png");
                img.VerticalAlignment   = VerticalAlignment.Top;
                img.Width               = 139;
                img.Height              = 48;
                img.HorizontalAlignment = HorizontalAlignment.Right;
                img.Stretch             = Stretch.None;
                img.Margin              = new Thickness(0, 30, 60, 0);
                img.Name       = "img_cover";
                img.Visibility = Visibility.Hidden;
                grid.Children.Add(img);
                gameGrid.Add(grid);
            }
            //第四行 增加页码
            vpp = new VZ_PagePoint();
            Grid.SetRow(vpp, 3);
            vpp.Visibility = Visibility.Hidden;
            mainGrid.Children.Add(vpp);
            showPage(pageIndex);

            secondTimer           = new System.Timers.Timer(1000);
            secondTimer.AutoReset = true;
            secondTimer.Elapsed  += SecondTimer_Elapsed;
            secondTimer.Start();

            this.Activate();
        }
예제 #25
0
        private void SecondTimer_Elapsed(object sender, ElapsedEventArgs e)
        {
            Dispatcher.BeginInvoke((Action)(() =>
            {
                tbTime.Text = string.Format("{0:t}", DateTime.Now);
                tbGameTime.Text = getRemainTime();
            }));

            if ((VZ_AppHelper.GetInstance().payInfo.expire < VZ_AppHelper.GetInstance().payInfo.current_time) && !(VZ_AppHelper.GetInstance().systemInfo.isDebug))
            {
                Dispatcher.BeginInvoke((Action)(() =>
                {
                    secondTimer.Stop();
                    secondTimer = null;
                    VZ_AppProcessHelper.getSingleton().closeAllApp();
                    EnterV3Window win = new EnterV3Window();
                    win.Show();
                    VZ_FinishV2Window win2 = new VZ_FinishV2Window();
                    win2.Show();
                    //EnterV2Window win = new EnterV2Window();
                    //win.Show();
                    //VZ_FinishWindow win2 = new VZ_FinishWindow();
                    //win2.Show();
                    this.Close();
                }));
            }

            VZ_AppProcessHelper.getSingleton().checkRunStateApp();

            VZ_AppInfo gameInfo = VZ_AppProcessHelper.getSingleton().getCurrentGame();

            Dispatcher.BeginInvoke((Action)(() =>
            {
                if (gameInfoUC != null)
                {
                    VZ_AppProcessHelper.getSingleton().muteTopVideo(true);
                }

                if (gameInfo == null)
                {
                    playGameImg.Source = null;
                    tbState.Text = "准备就绪";
                    quitBt.Visibility = Visibility.Hidden;
                    gameTopImg.Source = null;
                    tbGame.Text = "";

                    foreach (Grid grid in gameGrid)
                    {
                        Image img = grid.FindChild <Image>("img_cover");
                        if (img != null)
                        {
                            img.Visibility = Visibility.Hidden;
                        }
                    }
                    VZ_AppProcessHelper.getSingleton().runTopVideo();
                }
                else
                {
                    BitmapSource bmp = getGameImg(gameInfo.appImgPath);
                    playGameImg.Source = bmp;
                    tbState.Text = "游戏中";
                    gameTopImg.Source = getGameCropImg(gameInfo.appImgPath);
                    quitBt.Visibility = Visibility.Visible;
                    tbGame.Text = gameInfo.appName;

                    foreach (Grid grid in gameGrid)
                    {
                        Image img = grid.FindChild <Image>("img_cover");
                        if (grid.Tag == gameInfo)
                        {
                            if (img != null)
                            {
                                img.Visibility = Visibility.Visible;
                            }
                        }
                        else
                        {
                            if (img != null)
                            {
                                img.Visibility = Visibility.Hidden;
                            }
                        }
                    }
                    VZ_AppProcessHelper.getSingleton().hideTopVideo();
                }
            }));
        }