Example #1
0
        private void UpdateMainGuiStats()
        {
            Application.Current.Dispatcher.BeginInvoke(new Action(() =>
            {
                var leftControl  = Wpf.FindControlByName <Label>(Application.Current.MainWindow, "StatusBarLeftLabel");
                var rightControl = Wpf.FindControlByName <Label>(Application.Current.MainWindow, "StatusBarRightLabel");

                if (StatsSettings.Instance.Wins + StatsSettings.Instance.Losses == 0)
                {
                    if (StatsSettings.Instance.Concedes == 0)
                    {
                        rightControl.Content = string.Format("(No Games)");
                    }
                    else
                    {
                        rightControl.Content = string.Format("[{0} concedes]", StatsSettings.Instance.Concedes);
                    }
                }
                else
                {
                    rightControl.Content = string.Format("{0} / {1} ({2:0.00} %) [{3} concedes]",
                                                         StatsSettings.Instance.Wins,
                                                         StatsSettings.Instance.Wins + StatsSettings.Instance.Losses,
                                                         100.0f * (float)StatsSettings.Instance.Wins /
                                                         (float)(StatsSettings.Instance.Wins + StatsSettings.Instance.Losses),
                                                         StatsSettings.Instance.Concedes);

                    Log.InfoFormat("[Stats] Summary: {0}", rightControl.Content);
                }

                // Force a save all.
                Configuration.Instance.SaveAll();
            }));
        }
Example #2
0
 private void TritonHsOnOnGuiTick(object sender, GuiTickEventArgs guiTickEventArgs)
 {
     // Only update if we're actually enabled.
     if (IsEnabled)
     {
         Application.Current.Dispatcher.BeginInvoke(new Action(() =>
         {
             var leftControl     = Wpf.FindControlByName <Label>(Application.Current.MainWindow, "StatusBarLeftLabel");
             leftControl.Content = string.Format("运行时间: {0}", TritonHs.Runtime.Elapsed.ToString("h'小时 'm'分 's'秒'"));
         }));
     }
 }
Example #3
0
 private void TritonHsOnOnGuiTick(object sender, GuiTickEventArgs guiTickEventArgs)
 {
     // Only update if we're actually enabled.
     if (IsEnabled)
     {
         Application.Current.Dispatcher.BeginInvoke(new Action(() =>
         {
             var leftControl     = Wpf.FindControlByName <Label>(Application.Current.MainWindow, "StatusBarLeftLabel");
             leftControl.Content = string.Format("Runtime: {0}", TritonHs.Runtime.Elapsed.ToString("h'h 'm'm 's's'"));
         }));
         if (!_isNewgameing && _isStartingNewGame)
         {
             _numStartingNewGame++;
             if (_numStartingNewGame >= 75)
             {
                 Log.DebugFormat("StartingNewGame is hang 50s , so Unlock this Hero");
                 _numStartingNewGame = 0;
                 _isUnlocking        = true;
                 UnlockHeroConf();
             }
         }
         if (_tickstop)
         {
             Log.InfoFormat("The stats plugin is stop, Ticktime not update");
         }
         else
         {
             if (_numtick >= 60)
             {
                 DateTime baseTime = Convert.ToDateTime("1970-1-1 8:00:00");
                 TimeSpan ts       = DateTime.Now - baseTime;
                 long     intervel = (long)ts.TotalSeconds;
                 StatsSettings.Instance.Ticktime = intervel;
                 _numtick = 0;
                 UpdateMainGuiStats();
             }
             else
             {
                 _numtick++;
             }
         }
     }
 }