Beispiel #1
0
        /// <summary>
        /// Update Method that is called to Update the Observer Standardt when Modell has changed
        /// </summary>
        /// <param name="subject">Changed Subject</param>
        public void Update(object subject)
        {
            try {
            if (_updating) return;
            _updating = true;

            if (subject is GameNoiseList)
            {
                if (((GameNoiseList)subject).getCurrentSong() != null)
                {
                    _artist = ((GameNoiseList)subject).getCurrentSong().getTags()[1];
                    _album = ((GameNoiseList)subject).getCurrentSong().getTags()[0];
                    _title = ((GameNoiseList)subject).getCurrentSong().getTags()[2];
                }
                switch (((GameNoiseList)subject).getPlayMode())
                {
                    case (int)PlayModeEnum.PlaymodeNormal:
                        _playmode = "normal";
                        break;
                    case (int)PlayModeEnum.PlaymodeRandom:
                        _playmode = "shuffle";
                        break;
                    case (int)PlayModeEnum.PlaymodeRepeatList:
                        _playmode = "repeat all";
                        break;
                    case (int)PlayModeEnum.PlaymodeRepeatSong:
                        _playmode = "repeate one";
                        break;
                }
            }
            else if (subject is BassWrapper)
            {
                _time = ((BassWrapper)subject).getElapsedTime();
                _totaltime = ((BassWrapper)subject).getTotalTime();

                if (((BassWrapper)subject).getPaused() || ((BassWrapper)subject).getstopped())
                {
                    _hotkeyLabelPause = "Play";
                }
                else
                {
                    _hotkeyLabelPause = "Pause";
                }
            }
            else if (subject is Configuration)
            {
                _colorBackground = Color.FromArgb(255, ((Configuration)subject).OverlayColorBack.Red,
                                                            ((Configuration)subject).OverlayColorBack.Green,
                                                            ((Configuration)subject).OverlayColorBack.Blue);
                _colorHotkeyTop = Color.FromArgb(255, ((Configuration)subject).OverlayColorHKTop.Red,
                                                            ((Configuration)subject).OverlayColorHKTop.Green,
                                                            ((Configuration)subject).OverlayColorHKTop.Blue);
                _colorHotkeyBackground = Color.FromArgb(255, ((Configuration)subject).OverlayColorHKBack.Red,
                                                            ((Configuration)subject).OverlayColorHKBack.Green,
                                                            ((Configuration)subject).OverlayColorHKBack.Blue);
                _colorLines = Color.FromArgb(255, ((Configuration)subject).OverlayColorLine.Red,
                                                            ((Configuration)subject).OverlayColorLine.Green,
                                                            ((Configuration)subject).OverlayColorLine.Blue);
                _colorFont = Color.FromArgb(255, ((Configuration)subject).OverlayColorFont.Red,
                                                            ((Configuration)subject).OverlayColorFont.Green,
                                                            ((Configuration)subject).OverlayColorFont.Blue);
                _colorProgress = Color.FromArgb(255, ((Configuration)subject).OverlayColorProgress.Red,
                                                            ((Configuration)subject).OverlayColorProgress.Green,
                                                            ((Configuration)subject).OverlayColorProgress.Blue);

                _overlayPosition = ((Configuration)subject).OverlayPosition;

                string calc="";
                if (((Configuration)subject).HotkeyPlay.MCtrl)
                    calc =  "c+";
                if (((Configuration)subject).HotkeyPlay.MAlt)
                    calc += "a+";
                if (((Configuration)subject).HotkeyPlay.MShift)
                    calc = calc + "s+";
                _hotkeyPause = calc+ ((Configuration)subject).HotkeyPlay.HKey;
                calc = "";
                if (((Configuration)subject).HotkeyPrev.MCtrl)
                    calc = calc + "c+";
                if (((Configuration)subject).HotkeyPrev.MAlt)
                    calc += "a+";
                if (((Configuration)subject).HotkeyPrev.MShift)
                    calc = calc + "s+";
                _hotkeyPrev = calc + ((Configuration)subject).HotkeyPrev.HKey;
                calc = "";
                if (((Configuration)subject).HotkeyNext.MCtrl)
                    calc = calc + "c+";
                if (((Configuration)subject).HotkeyNext.MAlt)
                    calc += "a+";
                if (((Configuration)subject).HotkeyNext.MShift)
                    calc = calc + "s+";
                _hotkeyNext = calc + ((Configuration)subject).HotkeyNext.HKey;
                calc = "";
                if (((Configuration)subject).HotkeyStop.MCtrl)
                    calc = calc + "c+";
                if (((Configuration)subject).HotkeyStop.MAlt)
                    calc += "a+";
                if (((Configuration)subject).HotkeyStop.MShift)
                    calc = calc + "s+";
                _hotkeyStop = calc + ((Configuration)subject).HotkeyStop.HKey;
                calc = "";
                if (((Configuration)subject).HotkeyVolUp.MCtrl)
                    calc = calc + "c+";
                if (((Configuration)subject).HotkeyVolUp.MAlt)
                    calc += "a+";
                if (((Configuration)subject).HotkeyVolUp.MShift)
                    calc = calc + "s+";
                _hotkeyVolumeUp = calc + ((Configuration)subject).HotkeyVolUp.HKey;
                calc = "";
                if (((Configuration)subject).HotkeyVolDown.MCtrl)
                    calc = calc + "c+";
                if (((Configuration)subject).HotkeyVolDown.MAlt)
                    calc += "a+";
                if (((Configuration)subject).HotkeyVolDown.MShift)
                    calc = calc + "s+";
                _hotkeyVolumeDown = calc + ((Configuration)subject).HotkeyVolDown.HKey;

                calc = "";
                if (((Configuration)subject).HotkeyOverlay.MCtrl)
                    calc = calc + "c+";
                if (((Configuration)subject).HotkeyOverlay.MAlt)
                    calc += "a+";
                if (((Configuration)subject).HotkeyOverlay.MShift)
                    calc = calc + "s+";
                _hotkeyHide = calc + ((Configuration)subject).HotkeyOverlay.HKey;

            }

                if (_visible) MyOverlay.Update();
            }
            catch (OutOfCapsException e)
            {
                new Error("Can't display overlay.\nMaybe Vista Aero is enabled.\n" + e.Message, false, null);
                _visible = false;
            }
            catch (InvalidOperationException e)
            {
                new Error("Can't display overlay.\nMaybe another Application locked DirectX" + e.Message, false, null);
                _visible = false;
            }
            catch (NullReferenceException e)
            {
                new Error("Can't display overlay.\nMaybe another Application locked DirectX" + e.Message, false, null);
                _visible = false;
            }

            _updating = false;
        }
Beispiel #2
0
        /// <summary>
        /// Initialize the local variables
        /// </summary>
        /// <param name="aConfiguration">The Configuration</param>
        /// <param name="appHandle">Handler of the Root-Window</param>
        public Ingame(Configuration aConfiguration, App appHandle)
        {
            _anAppHandle = appHandle;
            _myConfiguration = aConfiguration;

            _time = 0;
            _totaltime = 0;
            _artist = "";
            _title = "";

            _hotkeyPause = "Space";
            _hotkeyPrev = "P";
            _hotkeyNext = "N";
            _hotkeyStop = "Return";
            _hotkeyVolumeUp = "+";
            _hotkeyVolumeDown = "-";
            _hotkeyHide = "O";

            _colorBackground = Color.FromArgb(255, _myConfiguration.OverlayColorBack.Red,
                                                        _myConfiguration.OverlayColorBack.Green,
                                                        _myConfiguration.OverlayColorBack.Blue);
            _colorHotkeyTop = Color.FromArgb(255, _myConfiguration.OverlayColorHKTop.Red,
                                                        _myConfiguration.OverlayColorHKTop.Green,
                                                        _myConfiguration.OverlayColorHKTop.Blue);
            _colorHotkeyBackground = Color.FromArgb(255, _myConfiguration.OverlayColorHKBack.Red,
                                                        _myConfiguration.OverlayColorHKBack.Green,
                                                        _myConfiguration.OverlayColorHKBack.Blue);
            _colorLines = Color.FromArgb(255, _myConfiguration.OverlayColorLine.Red,
                                                        _myConfiguration.OverlayColorLine.Green,
                                                        _myConfiguration.OverlayColorLine.Blue);
            _colorFont = Color.FromArgb(255, _myConfiguration.OverlayColorFont.Red,
                                                        _myConfiguration.OverlayColorFont.Green,
                                                        _myConfiguration.OverlayColorFont.Blue);
            _colorProgress = Color.FromArgb(255, _myConfiguration.OverlayColorProgress.Red,
                                                        _myConfiguration.OverlayColorProgress.Green,
                                                        _myConfiguration.OverlayColorProgress.Blue);

            _visible = false;
            _updating = false;
            try
            {
                MyOverlay = new Overlay {Size = new Size(OverlayWidth, OverlayHeight)};

                _overlayPosition = _myConfiguration.OverlayPosition;
                SetPosition(_overlayPosition);

                //Initialize the Overlay
                InitOverlay();
            }
            catch(Exception)
            {}
        }
Beispiel #3
0
 /// <summary>
 /// Overlay Top 
 /// </summary>
 /// <param name="sender">not used</param>
 /// <param name="e">not used</param>
 private void radioButtonTop_Checked(object sender, RoutedEventArgs e)
 {
     rectangleOverlay.Margin = new Thickness(26, 1, 1, 1);
     _overlayPosition = Organisation.OverlayPositionEnum.TOP;
 }
Beispiel #4
0
        /// <summary>
        /// Updates all information
        /// </summary>
        /// <param name="subject">object</param>
        public void Update(object subject)
        {
            if (!(subject is Configuration)) return;

            //Hotkeys
            UpdateHotkeys(subject);

            //OverlayColors
            UpdateColors(subject);

            _overlayPosition = ((Configuration)subject).OverlayPosition;

            //OverlayPosition
            switch (_overlayPosition)
            {
                case Organisation.OverlayPositionEnum.TOP:
                    radioButtonTop.IsChecked = true;
                    break;
                case Organisation.OverlayPositionEnum.Topleft:
                    radioButtonTopLeft.IsChecked = true;
                    break;
                case Organisation.OverlayPositionEnum.Topright:
                    radioButtonTopRight.IsChecked = true;
                    break;
                case Organisation.OverlayPositionEnum.Bottom:
                    radioButtonBottom.IsChecked = true;
                    break;
                case Organisation.OverlayPositionEnum.Bottomleft:
                    radioButtonBottomLeft.IsChecked = true;
                    break;
                case Organisation.OverlayPositionEnum.Bottomright:
                    radioButtonBottomRight.IsChecked = true;
                    break;
            }

            _overlayTimerEnabled = ((Configuration)subject).OverlayTimerEnabled;
            _overlayTimerSeconds = ((Configuration)subject).OverlayTimerSeconds;
            if (_overlayTimerEnabled)
                radioButtonVisSeconds.IsChecked = true;
            else
                radioButtonVisAlways.IsChecked = true;
            textBoxVisSeconds.Text = Convert.ToString(_overlayTimerSeconds);

            comboBoxSkin.SelectedValue = ((Configuration)subject).UsedSkin;
            checkBoxTray.IsChecked = ((Configuration)subject).MinimizeToTray;
            checkBoxResumePlay.IsChecked = ((Configuration)subject).ResumePlayback;

            comboBoxLanguage.SelectedValue = _cultConvert.ConvertFromString(((Configuration)subject).Language);

            UpdatePreview();
        }
Beispiel #5
0
 /// <summary>
 /// Overlay Bottom Right Corner
 /// </summary>
 /// <param name="sender">not used</param>
 /// <param name="e">not used</param>
 private void radioButtonBottomRight_Checked(object sender, RoutedEventArgs e)
 {
     rectangleOverlay.Margin = new Thickness(52, 59, 1, 1);
     _overlayPosition = Organisation.OverlayPositionEnum.Bottomright;
 }