Beispiel #1
0
        private void ChangeHandler(LoggingHandler newHandler)
        {
            if (newHandler == _currentHandler)
            {
                return;
            }

            if (_clockWindow != null)
            {
                _currentHandler.Clock.SpeedChanged    -= clockSpeedChanged_event;
                _clockWindow.DisplayVisibilityChanged -= clockWindowDisplayChanged_event;
            }

            _currentHandler = newHandler;
            if (_currentHandler != null)
            {
                _currentHandler.Clock.SpeedChanged += clockSpeedChanged_event;

                Program.TryGetClockWindow(_currentHandler, out _clockWindow);
                _clockWindow.DisplayVisibilityChanged += clockWindowDisplayChanged_event;
            }
            else
            {
                _clockWindow = null;
            }
        }
Beispiel #2
0
        void loggerClockAdded_event(object sender, ClockHandlerEventArgs e)
        {
            StopwatchWindow newWindow = new StopwatchWindow(this, e.LoggingHandler);

            newWindow.Compact = Settings.WatchCompactByDefault;
            newWindow.Docked  = Settings.WatchDockedByDefault;

            clockWindows.Add(e.LoggingHandler, newWindow);
        }
Beispiel #3
0
        private Program()
        {
            Gtk.Window.DefaultIconList = new Pixbuf[]
            {
                Pixbuf.LoadFromResource("chrono-marker-16.png"),
                Pixbuf.LoadFromResource("chrono-marker-24.png"),
                Pixbuf.LoadFromResource("chrono-marker-32.png"),
                Pixbuf.LoadFromResource("chrono-marker-48.png"),
                Pixbuf.LoadFromResource("chrono-marker-64.png"),
            };

            // Load settings. This is important.
            Settings = Preferences.Load(settingsFilename);

            TextRefresher = new FrequentCaller(textRefreshFrequency);

            TimeLogger = new TimeLogger(Settings.TimeDisplaySettings);

            TimeLogger.ClockAdded   += loggerClockAdded_event;
            TimeLogger.ClockRemoved += loggerClockRemoved_event;

            History = new History(historySteps);

            // Creates exporters
            LogExporters = new List <Chrono.Files.ILogExporter>();
            LogExporters.Add(new Files.HTMLExporter());
            LogExporters.Add(new Files.XMLExporter());
            LogExporters.Add(new Files.PlainTextExporter());

            clockWindows          = new Dictionary <LoggingHandler, StopwatchWindow>();
            LoggerWindow          = new LoggerWindow(this);
            ClockPropertiesWindow = new ClockPropertiesWindow(this);
            PreferencesWindow     = new PreferencesWindow(this);

            // Creates the first clock if configured to do so
            if (Settings.CreateWatchOnStartup && TimeLogger.CanCreateClock(Settings.StartupWatchName))
            {
                LoggingHandler firstClockHandler =
                    TimeLogger.CreateClock(Settings.StartupWatchName);

                StopwatchWindow clockWindow = clockWindows [firstClockHandler];

                clockWindow.DisplayVisible = true;
            }
        }
Beispiel #4
0
 public bool TryGetClockWindow(LoggingHandler handler, out StopwatchWindow window)
 {
     return(clockWindows.TryGetValue(handler, out window));
 }