コード例 #1
0
 void core_Tick()
 {
     if (mainTab.SelectedTab == graphsTab)
     {
         foreach (var name in mCollection.StatisticsNames)
         {
             TickStatistics stats = mCollection[name];
             double         s     = Math.Round(DateTime.UtcNow.Subtract(mStart).TotalSeconds, 2);
             mCurrentSeries[name].Points.Add(new DataPoint(s, stats.LastWork));
             mMeanSeries[name].Points.Add(new DataPoint(s, stats.MeanWorkLength));
         }
     }
     else if (mainTab.SelectedTab == valuesTab)
     {
         foreach (var name in mCollection.StatisticsNames)
         {
             TickStatistics stats = mCollection[name];
             double         s     = Math.Round(DateTime.UtcNow.Subtract(mStart).TotalSeconds, 2);
             mRows[name].SubItems[1].Text = stats.MeanWorkLength.ToString(".##");
             mRows[name].SubItems[2].Text = stats.LastWork.ToString(".##");
             mRows[name].SubItems[3].Text = stats.TickCount.ToString();
             mRows[name].SubItems[4].Text = stats.TicksPerSecond.ToString();
         }
     }
 }
コード例 #2
0
 public void Init(TickStatistics stats, Core core)
 {
     mStats = stats;
     mCore  = core;
     if (mActive)
     {
         mCore.Tick += mTickListener;
     }
 }
コード例 #3
0
        private void StateActivated(State state)
        {
            if (mCurrentStats != null)
            {
                mCurrentStats.End();
            }

            mCurrentStats = mStatistics[state.Name];
            mCurrentStats.Begin();
        }
コード例 #4
0
        public Step(FlythroughState state, XmlNode node, Text subtitlesText, int subtitleTimeoutS, IMediaPlayer player)
        {
            if (node.Attributes["St››ep"] == null && !int.TryParse(node.Attributes["Step"].Value, out mStep))
            {
                throw new ArgumentException("Unable to load slideshow step. A valid 'Step' attribute must be supplied.");
            }

#if DEBUG
            if (sStatistics == null)
            {
                sStatistics = new TickStatistics();
                StatisticsCollection.AddStatistics(sStatistics, "Flythrough Steps");
            }
#endif

            mPlayer  = player;
            mManager = state.Manager;
            mStep    = GetInt(node, -1, "Step");
            if (mStep == -1)
            {
                throw new ArgumentException("Unable to load step ID. A valid Step attribute is expected.");
            }

            XmlAttribute voiceoverAttribute = node.Attributes["Voiceover"];
            if (voiceoverAttribute != null && File.Exists(Path.GetFullPath(voiceoverAttribute.Value)))
            {
                if (mPlayer != null)
                {
                    mVoiceoverFile = Path.GetFullPath(voiceoverAttribute.Value);
                }
                else
                {
                    Logger.Warn("Unable to load voiceover for flythrough step. No MediaPlayer supplied.");
                }
            }

            mSubtitlesText = subtitlesText;

            XmlNode newFontNode = node.SelectSingleNode("child::SubtitlesFont");
            if (newFontNode != null)
            {
                mNewSubtitlesFont = state.Manager.MakeText(newFontNode);
            }

            if (mSubtitlesText != null)
            {
                mTickListener     = new Action(mCoordinator_Tick);
                mSubtitleTimeoutS = subtitleTimeoutS;
                XmlNode subtitlesNode = node.SelectSingleNode("child::Subtitles");
                if (subtitlesNode != null)
                {
                    foreach (XmlNode child in subtitlesNode.ChildNodes)
                    {
                        if (child is XmlElement)
                        {
                            double time = child.Attributes["Time"] != null?double.Parse(child.Attributes["Time"].Value) : 0;

                            mSubtitles.Add(time, child.InnerText.Trim('\n', ' ', Environment.NewLine[0]).Replace("  ", ""));
                        }
                    }
                }
            }

            foreach (var featureNode in GetChildrenOfChild(node, "Features"))
            {
                IFeature feature = mManager.GetFeature(featureNode, "flythrough step " + (mStep + 1), null);
                if (feature != null)
                {
                    mFeatures.Add(feature);
                    state.AddFeature(feature);
                    feature.Active = false;
                }
            }
        }
コード例 #5
0
 public StatisticsPanel(TickStatistics stats, Core core)
     : this()
 {
     Init(stats, core);
 }
コード例 #6
0
 public StatisticsForm(Core core, TickStatistics stats) : this()
 {
     statisticsPanel.Init(stats, core);
 }