protected override void OnNavigatingFrom(NavigatingCancelEventArgs e)
        {
            base.OnNavigatingFrom(e);

            if (BackgroundMediaElement.Visibility == Visibility.Visible)
            {
                BackgroundMediaElement.Stop();
            }

            Uninitialize();
        }
 private void FilteredImage_Tap(object sender, System.Windows.Input.GestureEventArgs e)
 {
     if (BackgroundMediaElement.Visibility == Visibility.Collapsed)
     {
         BackgroundMediaElement.Position = TimeSpan.Zero;
         BackgroundMediaElement.Play();
         BackgroundMediaElement.Visibility = Visibility.Visible;
     }
     else
     {
         BackgroundMediaElement.Stop();
         BackgroundMediaElement.Visibility = Visibility.Collapsed;
     }
 }
Beispiel #3
0
        protected void ApplyHostWindow(IWindowSkin skin, bool saveinformation = true)
        {
            if (skin == HostedWindow) return;
            if (HostedWindow != null)
            {
                HostedWindow.DragMoveStart -= skin_DragMoveStart;
                HostedWindow.DragMoveStop -= skin_DragMoveStop;
                HostedWindow.ToggleWindowState -= skin_ToggleWindowState;
                HostedWindow.TitleBarMouseMove -= skin_TitleBarMouseMove;
                HostedWindow.DisableWindow();

                var element = (FrameworkElement) HostedWindow;
                ContentGrid.Children.Remove(element);
            }

            skin.CloseRequest += (s, e) => Close();
            skin.DragMoveStart += skin_DragMoveStart;
            skin.DragMoveStop += skin_DragMoveStop;
            skin.ToggleWindowState += skin_ToggleWindowState;
            skin.TitleBarMouseMove += skin_TitleBarMouseMove;

            var appstate = AnyListenSettings.Instance.CurrentState.ApplicationState;
            if (skin != AdvancedWindowSkin && saveinformation)
            {
                appstate.Height = Height;
                appstate.Width = Width;
            }

            HideEqualizer();

            MaxHeight = skin.Configuration.MaxHeight;
            MinHeight = skin.Configuration.MinHeight;
            MaxWidth = skin.Configuration.MaxWidth;
            MinWidth = skin.Configuration.MinWidth;
            ShowTitleBar = skin.Configuration.ShowTitleBar;
            ShowSystemMenuOnRightClick = skin.Configuration.ShowSystemMenuOnRightClick;

            if (!_isDragging)
            {
                if (skin.Configuration.IsResizable)
                {
                    WindowHelper.ShowMinimizeAndMaximizeButtons(this);
                    ResizeMode = ResizeMode.CanResize;
                }
                else
                {
                    WindowHelper.HideMinimizeAndMaximizeButtons(this);
                    ResizeMode = ResizeMode.NoResize;
                }
            }

            if (skin == AdvancedWindowSkin && saveinformation)
            {
                Width = appstate.Width;
                Height = appstate.Height;
            }

            if (skin.Configuration.SupportsCustomBackground)
            {
                SetBackground().Forget();
            }
            else
            {
                BackgroundImage.Visibility = Visibility.Collapsed;
                BackgroundImage.Source = null;
                BackgroundMediaElement.Stop();
                BackgroundMediaElement.Source = null;
                BackgroundMediaElement.Visibility = Visibility.Collapsed;
            }
            BackgroundImage.Visibility = skin.Configuration.SupportsCustomBackground ? Visibility.Visible : Visibility.Collapsed;

            if (skin == SmartWindowSkin)
            {
                Width = 300;
                Height = MagicArrow.DockManager.WindowHeight;
                if (MainViewModel.Instance.MusicManager != null)
                    MainViewModel.Instance.MusicManager.DownloadManager.IsOpen = false;
            }

            ShowMinButton = skin.Configuration.ShowWindowControls;
            ShowMaxRestoreButton = skin.Configuration.ShowWindowControls;
            ShowCloseButton = skin.Configuration.ShowWindowControls;

            var newUserControl = (FrameworkElement) skin;
            ContentGrid.Children.Add(newUserControl);
            var animation = new DoubleAnimation(0, 1, TimeSpan.FromMilliseconds(200));
            newUserControl.BeginAnimation(OpacityProperty, animation);
            HostedWindow = skin;
            HostedWindow.EnableWindow();
        }