예제 #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]);
        }
예제 #2
0
        public MainForm()
        {
            InitializeComponent();

            LogView.ListView  = this.LogListView;
            Connect.RenderBox = this.RenderBox;

            this.Load        += Connect.Create;
            this.FormClosed  += Connect.Destory;
            Application.Idle += Connect.Idle;

            _models = new Models(MaterialTable, SkeletonTreeView, SkeletonPanel, AnimationTrackBar, AnimationBarPanel, ModelLayoutPanel, ModelAdderPathBox, ModelAdderSkeletonBox);
            FileFbxConvertMenu.Click += _models.FileFbxConvertMenu_Click;
            FileOpenMenu.Click       += _models.FileOpenMenu_Click;
            FileSaveMenu.Click       += _models.FileSaveMenu_Click;

            _shaders = new Shaders(ShaderFileList, PartsListBox, ModelAdderPathBox);
            RefreshShaderFileList.Click += _shaders.Refresh;
            ShaderFileList.MouseDown    += ShaderFileLlist_MouseDown;

            _textures = new Textures(TextureFileList);
            TextureFileList.MouseDown    += TextureFileList_MouseDown;
            RefreshTextureFileList.Click += _textures.Refresh;

            _animations = new Animation(AnimationFileList, AnimationFilePathTextBox, AnimationNameTextBox, AnimationAdderButton, AnimationLayoutPanel, AnimationTrackBar, AnimationBarPanel);
            RefreshAnimationFileList.Click += _animations.Refresh;

            FrameTimer.Tick += FrameTimer_Tick;

            LogListView.Focus();
        }
        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          = "--.--";
                }
            }
        }
예제 #4
0
        private void SetLog()
        {
            LogListView.ItemsSource = Log.Instance.Messages;

            LogListView.SelectedIndex = LogListView.Items.Count - 1;
            LogListView.ScrollIntoView(LogListView.SelectedItem);
        }
예제 #5
0
 public void Log(string line)
 {
     Helper.ControlInvokeRequired(LogListView, () =>
     {
         LogListView.Items.Add(new ListViewItem(line));
         LogListView.EnsureVisible(LogListView.Items.Count - 1);
         LogListView.Refresh();
     });
 }
예제 #6
0
        private void Log(string message)
        {
            var record = new { Time = DateTime.Now, Message = message };

            Dispatcher.Invoke(() =>
            {
                LogListView.Items.Add(record);
                LogListView.ScrollIntoView(record);
            });
        }
예제 #7
0
파일: MainForm.cs 프로젝트: xiechongzhu/AK
 private void logTimer_Tick(object sender, EventArgs e)
 {
     if (logItemList.Count > 0)
     {
         LogListView.BeginUpdate();
         while (LogListView.Items.Count > 100)
         {
             LogListView.Items.RemoveAt(0);
         }
         LogListView.Items.AddRange(logItemList.ToArray());
         logItemList.Clear();
         if (LogListView.Items.Count > 0)
         {
             LogListView.EnsureVisible(LogListView.Items.Count - 1);
         }
         LogListView.EndUpdate();
     }
 }
예제 #8
0
 private void OnLogWrite(string from, string type, object content, LogLevel level)
 {
     LogListView.Invoke(new MethodInvoker(() =>
     {
         LogListView.Items.Add(new ListViewItem(DateTime.Now.ToString("HH:mm:ss")).Also(v =>
         {
             v.SubItems.Add(from);
             v.SubItems.Add(type);
             v.SubItems.Add(content.ToString());
             v.SubItems.Add("-");
             v.ForeColor = Color.FromKnownColor(level.GetAlias <KnownColor>());
         }));
         if (!RealTimeCheckbox.Checked)
         {
             return;
         }
         LogListView.EnsureVisible(LogListView.Items.Count - 1);
         LogListView.Items[LogListView.Items.Count - 1].Selected = true;
     }));
 }
예제 #9
0
        private void Form1_Load(object sender, EventArgs e)
        {
            ColumnHeader logHeader = new ColumnHeader();

            geneticController = new GeneticController(this);
            bestInds          = new List <BitIndividual>();
            averageInds       = new List <BitIndividual>();
            worstInds         = new List <BitIndividual>();
            bestIndsBackup    = new List <BitIndividual>();
            averageIndsBackup = new List <BitIndividual>();
            worstIndsBackup   = new List <BitIndividual>();
            LogListView.Columns.Add(logHeader);
            LogListView.Scrollable  = true;
            LogListView.HeaderStyle = ColumnHeaderStyle.None;
            LogListView.View        = View.Details;
            LogListView.AutoResizeColumns(ColumnHeaderAutoResizeStyle.HeaderSize);
            geneticChart.ChartAreas[0].AxisX.ScaleView.Zoom(0, 50);
            geneticChart.ChartAreas[0].CursorX.IsUserEnabled              = true;
            geneticChart.ChartAreas[0].CursorX.IsUserSelectionEnabled     = true;
            geneticChart.ChartAreas[0].AxisX.ScaleView.Zoomable           = true;
            geneticChart.ChartAreas[0].AxisX.ScrollBar.IsPositionedInside = true;
        }
예제 #10
0
파일: GUI.cs 프로젝트: tiganov/CAT
        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));
        }
예제 #11
0
 protected ScannerBase(LogListView log)
 {
     _log           = log;
     _uiSyncContext = TaskScheduler.FromCurrentSynchronizationContext();
 }
예제 #12
0
        private void LoadMenuItem_Click(object sender, EventArgs e)
        {
            //десериализация состояния программы и восстановление состояния программы
            if (!isAnimationFinished)
            {
                MessageBox.Show(Constants.Strings.ANIMATION_END);
                return;
            }
            OpenFileDialog        openFileDialog = new OpenFileDialog();
            SerializableContainer container;
            BinaryFormatter       formatter = new BinaryFormatter();

            openFileDialog.InitialDirectory = "c:\\";
            openFileDialog.Filter           = Constants.Strings.FILE_FORMAT;
            openFileDialog.FilterIndex      = 1;
            if (openFileDialog.ShowDialog() == DialogResult.OK)
            {
                clearChart();
                var fs = openFileDialog.OpenFile();
                foreach (ListViewItem i in LogListView.Items)
                {
                    i.Remove();
                }
                container    = (SerializableContainer)formatter.Deserialize(fs);
                this.logType = container.LogType;
                if (logType == Constants.Integers.LOG_TYPE_BEST)
                {
                    LogTypeBox.SelectedItem = "Best individual";
                }
                else if (logType == Constants.Integers.LOG_TYPE_AVERAGE)
                {
                    LogTypeBox.SelectedItem = "Average individual";
                }
                else if (logType == Constants.Integers.LOG_TYPE_WORST)
                {
                    LogTypeBox.SelectedItem = "Worst individual";
                }
                this.EpochNumeric.Value         = container.EpochCount;
                this.MutationNumeric.Value      = container.MutationChance;
                this.PopulationNumeric.Value    = container.PopSize;
                this.BestIndividualTextBox.Text = container.BestInd;
                this.bestIndsBackup             = container.BestInds;
                this.averageIndsBackup          = container.AverageInds;
                this.worstIndsBackup            = container.WorstInds;
                for (int i = 0; i < container.BestInds.Count; ++i)
                {
                    geneticChart.Series[0].Points.Add(new DataPoint((double)container.BestInds[i].Epoch, (double)container.BestInds[i].Fitness));
                    geneticChart.Series[1].Points.Add(new DataPoint((double)container.AverageInds[i].Epoch, (double)container.AverageInds[i].Fitness));
                    geneticChart.Series[2].Points.Add(new DataPoint((double)container.WorstInds[i].Epoch, (double)container.WorstInds[i].Fitness));
                    if (logType == Constants.Integers.LOG_TYPE_BEST)
                    {
                        LogListView.Items.Add("Epoch: " + container.BestInds[i].Epoch + " best: " + container.BestInds[i].GetChromosomeString() + "\n");
                    }
                    else if (logType == Constants.Integers.LOG_TYPE_AVERAGE)
                    {
                        LogListView.Items.Add("Epoch: " + container.AverageInds[i].Epoch + " average: " + container.AverageInds[i].GetChromosomeString() + "\n");
                    }
                    else if (logType == Constants.Integers.LOG_TYPE_WORST)
                    {
                        LogListView.Items.Add("Epoch: " + container.WorstInds[i].Epoch + " worst: " + container.WorstInds[i].GetChromosomeString() + "\n");
                    }
                }
                LogListView.Refresh();
            }
        }
예제 #13
0
 public FloutecScanner(LogListView log) : base(log)
 {
 }
예제 #14
0
 public RocScanner(LogListView log, GprsClient gprsClient) : base(log)
 {
     _gprsClient = gprsClient;
 }