public void sendAppLog(VZ_AppInfo info, int time) { try { String url = baseURL + "wxpay/wxmovieplay"; String tm = "" + VZ_UpdateMethods.ConvertDateTimeInt(DateTime.Now); Dictionary <String, String> dic = new Dictionary <string, string>(); dic.Add("from", "vrzone"); dic.Add("id", "" + systemInfo.computerId); dic.Add("sid", "iloveyouvrzone"); dic.Add("tm", tm); dic.Add("uid", "1"); dic.Add("cate", info.type); dic.Add("fname", info.appName); dic.Add("play_time", "" + time); String sign = "cate=" + info.type + "&fname=" + info.appName + "&from=vrzone&id=" + systemInfo.computerId + "&play_time=" + time + "&sid=iloveyouvrzone&tm=" + tm + "&uid=1&--iloveyouvrzone"; dic.Add("sign", VZ_UpdateMethods.strToMD5(sign).ToUpper()); HttpWebResponse response = HttpWebResponseUtility.CreatePostHttpResponse(url, dic, 2000, null, Encoding.UTF8, null); Stream responseStream = response.GetResponseStream(); StreamReader sr = new StreamReader(responseStream, Encoding.GetEncoding(response.CharacterSet)); String msg = sr.ReadToEnd(); return; } catch { } }
private void AsyncRunApp2(VZ_AppInfo info, Process proc) { if (!info.appId.Equals("9")) { proc.WaitForInputIdle(); } Thread.Sleep(1000); System.Drawing.Rectangle monitor; if (info.monitorNO == 1) { monitor = VZ_AppProcessHelper.getSingleton().getMainScreen().WorkingArea; } else { monitor = VZ_AppProcessHelper.getSingleton().getSecondScreen().WorkingArea; } //monitor = VZ_AppProcessHelper.getSingleton().getSecondScreen().WorkingArea;//Screen.AllScreens[sNumberOfMonitor].WorkingArea; //change the window to the second monitor SetWindowPos(proc.MainWindowHandle, 0, monitor.Left, monitor.Top, monitor.Width, monitor.Height, 0); proList.Add(proc); currentInfo = info; resetAppTimer(); }
public void onPlay(VZ_GameInfoUC view, VZ_AppInfo info) { showGameOpeningWin(); VZ_AppProcessHelper.getSingleton().runApp(info); if (info.type.Equals("game") && !info.appExeName.Equals("DrumGame.exe")) { this.Activate(); } view.setGameIsPlaying(true); }
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); } }
public VZ_GameInfoUC(VZ_AppInfo info, VZ_GameInfoUCCallback listener) { try { InitializeComponent(); }catch (Exception ex) { MessageBox.Show(ex.ToString()); } callback = listener; gameInfo = info; if (info != null) { try { //gameVideo.Source = new Uri(info.moviePath, UriKind.Absolute); gameVideo.LoadMedia(info.moviePath); gameVideo.Width = 1300; gameVideo.Height = 780; gameVideo.Volume = 75; gameVideo.IsMute = false; new Thread(new ThreadStart(() => { //Thread.Sleep(500); Dispatcher.BeginInvoke((Action)(() => { if (gameVideo != null) { gameVideo.Play(); } })); })).Start(); bgImage.Source = new BitmapImage(new Uri(info.bgPath, UriKind.Absolute)); } catch (Exception ex) { Scratch.Log.LogConfig.Logger.Error("出错:", ex); } } updateState(); }
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); } }
public void runApp(VZ_AppInfo info) { try { if (currentInfo != null) { if (currentInfo == info) { return; } } closeAllApp(); Process proc = new Process(); proc.StartInfo.FileName = info.appPath; proc.Start(); currentInfo = info; currentTime = DateTime.Now.Ticks; AsyncRunApp2(info, proc); } catch { } }
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); })); }
public void onQuit(VZ_GameInfoUC view, VZ_AppInfo info) { VZ_AppProcessHelper.getSingleton().closeAllApp(); view.setGameIsPlaying(false); }
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(); } })); }