コード例 #1
0
 private void On_ThemeChange(object sender, RoutedEventArgs e)
 {
     System.Windows.Controls.MenuItem src = (System.Windows.Controls.MenuItem)e.Source;
     model.Theme = Theme.GetThemeByName(src.Name);
     DrawSurface.Focus();
     UpdateWindow();
 }
コード例 #2
0
        public void CloseSideColumn()
        {
            model.IsSideColumnVisible = false;

            model.ShowDeleteButton = false;
            model.EditingEvent     = null;

            UpdateWindow();

            DrawSurface.Focus();
        }
コード例 #3
0
        private void Window_Loaded(object sender, RoutedEventArgs e)
        {
            UpdateWindow();

            RefreshScreenStopwatch.Start();

            Thread backgroundThread = new Thread(() =>
            {
                while (_renderWindow.IsOpen)
                {
                    System.Windows.Application.Current?.Dispatcher.Invoke(DispatcherPriority.Loaded, new Action(() =>
                    {
                        // Update Year At Mouse
                        model.YearAtMouse = (int)Math.Round(
                            (Mouse.GetPosition().X - _renderWindow.Position.X - model.OffsetX) / (model.IntervalLengthPx * model.Zoom));

                        bool Update;

                        if (RefreshScreenStopwatch.ElapsedMilliseconds > RefreshRateInSeconds * 1000)
                        {
                            Update = true;
                            RefreshScreenStopwatch.Restart();
                        }
                        else
                        {
                            Update =
                                IsMouseDown ||
                                KeyPressed_W || KeyPressed_A || KeyPressed_S || KeyPressed_D;
                        }


                        // Check if a note needs to be drawn

                        bool DrawNote = false;
                        foreach (EventViewModel n in model.ListOfEvents)
                        {
                            if (n.IsMouseOver(_renderWindow))
                            {
                                // Update window so the background color changes
                                Update = true;

                                // Check if Note needs to be drawn
                                if (n.Note != null)
                                {
                                    DrawNote = true;

                                    if (!DisplayEventNoteStopwatch.IsRunning)
                                    {
                                        DisplayEventNoteStopwatch.Start();
                                    }

                                    if (DisplayEventNoteStopwatch.Elapsed.TotalSeconds > model.DisplayNoteDelayInSeconds)
                                    {
                                        model.EventToDrawNote = n;
                                    }
                                }
                            }
                        }

                        if (!DrawNote)
                        {
                            DisplayEventNoteStopwatch.Stop();
                            DisplayEventNoteStopwatch.Reset();

                            model.EventToDrawNote = null;
                        }

                        if (Update)
                        {
                            UpdateWindow();
                        }
                    }
                                                                                                                ));
                }
            });

            backgroundThread.Start();

            DrawSurface.Focus();
        }