Exemple #1
0
        private void Log(string msg)
        {
            msg = DateTime.Now.ToString("hh:mm::ss") + ": " + msg;
            int index = LogListView.Items.Add(msg);

            LogListView.ScrollIntoView(LogListView.Items[index]);
        }
        private void FPSTimer_Tick(object sender, EventArgs e)
        {
            LogInfo last = ETRViewModel.Instance.UpdateLog();

            if (null != last)
            {
                LogListView.UpdateLayout();
                LogListView.ScrollIntoView(last);
            }

            //if(true == FPSMeter.IsChecked)
            {
                float fps = ETRViewModel.Instance.UpdateFPS();
                if (true == ETRViewModel.Instance.IsPlaying)
                {
                    TotalElapsedText.Text = TimeSpan.FromSeconds((double)Time.TotalElapsedSeconds).ToString(@"hh\:mm\:ss");
                    FPSText.Text          = fps.ToString("F2");
                }
                else
                {
                    TotalElapsedText.Text = "--:--:--";
                    FPSText.Text          = "--.--";
                }
            }
        }
        private void SetLog()
        {
            LogListView.ItemsSource = Log.Instance.Messages;

            LogListView.SelectedIndex = LogListView.Items.Count - 1;
            LogListView.ScrollIntoView(LogListView.SelectedItem);
        }
Exemple #4
0
        private void Log(string message)
        {
            var record = new { Time = DateTime.Now, Message = message };

            Dispatcher.Invoke(() =>
            {
                LogListView.Items.Add(record);
                LogListView.ScrollIntoView(record);
            });
        }
Exemple #5
0
        private void UpdateLog()
        {
            // clear the previous visual data
            LogData.Clear();

            // get the selectedTab
            int selectedTabIndex = LogTabControl.SelectedIndex;

            // if the selected tab is undefined, just return
            if (selectedTabIndex == -1)
            {
                return;
            }

            LogData.Add(GameState.GetLogEntry(0)); // add "Game Started."

            // for each index of the log, except for the first, see if we want to display it
            for (int i = 1; i < GameState.GetLogSize(); ++i)
            {
                // get the string we are considering -> s
                string s = GameState.GetLogEntry(i);

                // if "Me" is selected, check if the entry pertains to user, continue if doesn't
                if (selectedTabIndex == 1)
                {
                    if (!s.Contains("You") && !s.Contains("Me"))
                    {
                        continue;
                    }
                }
                // if a non-user player tab is selected
                else if (selectedTabIndex > 1)
                {
                    // check if the entry contains their name, continue if doesn't
                    if (!s.Contains(PlayersData[selectedTabIndex - 1]))
                    {
                        continue;
                    }
                }
                // now check filters

                // if user only wants to see significant entries, and entry contains "significant", continue
                if (Filter1ToggleButton.IsChecked.Equals(true) && s.Contains("significant"))
                {
                    continue;
                }
                // if user only wants to see entries pertaining to cards shown and entry does not contain
                // "showed", continue
                if (Filter2ToggleButton.IsChecked.Equals(true) && Filter3ToggleButton.IsChecked.Equals(false) && !s.Contains("showed"))
                {
                    continue;
                }
                else if (Filter2ToggleButton.IsChecked.Equals(false) && Filter3ToggleButton.IsChecked.Equals(true) && !s.Contains("suggested"))
                {
                    continue;
                }
                else if (Filter2ToggleButton.IsChecked.Equals(true) && Filter3ToggleButton.IsChecked.Equals(true) && (!s.Contains("suggested")) && (!s.Contains("showed")))
                {
                    continue;
                }

                // add the string since at this point we have done all our checking
                LogData.Add(s);
            }

            // scroll to the last entry for convenience
            LogListView.ScrollIntoView(LogListView.Items.GetItemAt(LogListView.Items.Count - 1));
        }