Exemplo n.º 1
0
        public void NewLiveReadingsPopUp(bool isMajor, Type mainClockItemId, Type secondayClockItemId)
        {
            var window = new LiveReadingWindow()
            {
                WindowStartupLocation = WindowStartupLocation.CenterOwner,
                BorderThickness       = new Thickness(1),
                GlowBrush             = null
            };

            window.SetResourceReference(MetroWindow.BorderBrushProperty, "AccentColorBrush");

            var shouldShowArc = !(mainClockItemId == typeof(LiveLAegClockItem));

            popOutWindows.AddLast(window);
            var model = new LiveReadingViewModel(isMajor,
                                                 isMajor ?  settings.MajorInterval : settings.MinorInterval,
                                                 isMajor ? settings.MajorDBLimit : settings.MinorDBLimit,
                                                 mainClockItemId,
                                                 secondayClockItemId,
                                                 // Only the LAeq, 1 sek should not have the arcs
                                                 shouldShowArc);
            var minor = minorIntervalHistory.GetLatests();

            if (minor != null)
            {
                model.OnMinor(DateTime.Now, minor.Item1, minor.Item2);
            }
            var major = majorIntervalHistory.GetLatests();

            if (major != null)
            {
                model.OnMajor(DateTime.Now, major.Item1, major.Item2);
            }
            model.OnNext(isMajor ? MajorClock.NextReadingTime : MinorClock.NextReadingTime);

            model.Title = Title;
            this.engine.RegisterListener(model);
            window.DataContext = model;
            window.Closed     += (sender, args) =>
            {
                this.engine.UnRegisterListener(model);
                window.DataContext = null;
                popOutWindows.Remove(window);
                window = null;
            };
            window.Show();
        }
        public void NewLiveReadingsPopUp(bool isMajor, int mainClockItemId, int secondayClockItemId)
        {
            var window = new LiveReadingWindow()
            {
                WindowStartupLocation = WindowStartupLocation.CenterOwner,
                BorderThickness = new Thickness(1),
                GlowBrush = null
            };
            window.SetResourceReference(MetroWindow.BorderBrushProperty, "AccentColorBrush");

            popOutWindows.AddLast(window);
            var model = new LiveReadingViewModel(isMajor,
                isMajor ?  settings.MajorInterval : settings.MinorInterval,
                isMajor ? settings.MajorDBLimit : settings.MinorDBLimit,
                mainClockItemId,
                secondayClockItemId);
            model.OnNext(isMajor ? MajorClock.NextReadingTime : MinorClock.NextReadingTime);

            model.Title = Title;
            this.engine.RegisterListener(model);
            window.DataContext = model;
            window.Closed += (sender, args) =>
            {
                this.engine.UnRegisterListener(model);
                window.DataContext = null;
                popOutWindows.Remove(window);
                window = null;
            };
            window.Show();
        }