コード例 #1
0
ファイル: Visualizer.xaml.cs プロジェクト: lulzzz/visualizer
 private void StopPlayback()
 {
     m_playbackTimer.Change(Timeout.Infinite, m_inSpeedMode);
     state.Content = "Paused";
     (PlaybackMenu.MenuPanel.FindName("btnReplay") as ToggleButton).IsChecked = false;
     PlaybackMenu.RefreshToggleButtonState((PlaybackMenu.MenuPanel.FindName("btnReplay")) as ToggleButton);
 }
コード例 #2
0
ファイル: MainPage.xaml.cs プロジェクト: aboe026/boxify
 /// <summary>
 /// Remove the extra margin so content touches display edge
 /// </summary>
 public void SafeAreaOff()
 {
     NavLeftBorder.Visibility = Visibility.Collapsed;
     NavLeftBorderHamburgerExtension.Visibility = Visibility.Collapsed;
     Header.Margin           = new Thickness(0, 0, 0, 0);
     MainSplitView.Margin    = new Thickness(0, 0, 0, 0);
     HamburgerOptions.Margin = new Thickness(0, 0, 0, 0);
     MainContentFrame.Margin = new Thickness(0, 0, 0, 0);
     PlaybackMenu.SafeAreaOff();
 }
コード例 #3
0
ファイル: MainPage.xaml.cs プロジェクト: aboe026/boxify
 /// <summary>
 /// Set the visibility state of the PlaybackMenu progress ring
 /// </summary>
 /// <param name="visible"></param>
 public async void SetPlaybackMenu(bool active)
 {
     await CoreApplication.MainView.CoreWindow.Dispatcher.RunAsync(CoreDispatcherPriority.Normal, () =>
     {
         if (PlaybackMenu != null)
         {
             PlaybackMenu.SetLoadingActive(active);
         }
     });
 }
コード例 #4
0
ファイル: MainPage.xaml.cs プロジェクト: aboe026/boxify
        /// <summary>
        /// Make the playback controls visible
        /// </summary>
        public async void ShowPlaybackMenu()
        {
            await CoreApplication.MainView.CoreWindow.Dispatcher.RunAsync(CoreDispatcherPriority.Normal, () =>
            {
                MainContentFrame.Margin = new Thickness(0, 0, 0, 0);
                PlaybackMenu.SetRepeat(Settings.repeatEnabled);
                PlaybackMenu.SetShuffle(Settings.shuffleEnabled);
                PlaybackMenu.SetVolume(Settings.volume);

                PlaybackMenu.Visibility = Visibility.Visible;
            });
        }
コード例 #5
0
ファイル: MainPage.xaml.cs プロジェクト: aboe026/boxify
 /// <summary>
 /// Add extra margin to ensure content inside of TV safe area
 /// </summary>
 public void SafeAreaOn()
 {
     NavLeftBorder.Visibility = Visibility.Visible;
     NavLeftBorderHamburgerExtension.Visibility = Visibility.Visible;
     Header.Margin           = new Thickness(TV_SAFE_HORIZONTAL_MARGINS, TV_SAFE_VERTICAL_MARGINS, TV_SAFE_HORIZONTAL_MARGINS, 0);
     MainSplitView.Margin    = new Thickness(TV_SAFE_HORIZONTAL_MARGINS, 0, TV_SAFE_HORIZONTAL_MARGINS, 0);
     HamburgerOptions.Margin = new Thickness(0, 0, 0, TV_SAFE_VERTICAL_MARGINS);
     if (!App.playbackService.showing)
     {
         MainContentFrame.Margin = new Thickness(0, 0, 0, TV_SAFE_VERTICAL_MARGINS);
     }
     PlaybackMenu.SafeAreaOn();
 }
コード例 #6
0
ファイル: MainPage.xaml.cs プロジェクト: aboe026/boxify
        /// <summary>
        /// Used when freeing memory
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        public async void Page_Unloaded(object sender, RoutedEventArgs e)
        {
            if (App.isInBackgroundMode)
            {
                await CoreApplication.MainView.CoreWindow.Dispatcher.RunAsync(CoreDispatcherPriority.Normal, async() =>
                {
                    this.KeyDown       -= Page_KeyUp;
                    currentNavSelection = null;
                    loadingLocks.Clear();

                    // direct elements
                    UserName.PointerReleased         -= UserElement_PointerReleased;
                    UserPicContainer.PointerReleased -= UserElement_PointerReleased;
                    BlankUser.PointerReleased        -= UserElement_PointerReleased;
                    Hamburger.Click -= Hamburger_Click;
                    Back.Click      -= Back_Click;
                    HamburgerOptions.SelectionChanged -= HamburgerOptions_SelectionChanged;
                    SettingsItem.Click -= SettingsItem_Click;

                    CancelDialog.Unload();
                    PlaybackMenu.UserControl_Unloaded(null, null);
                    PlaybackMenu.Unloaded -= PlaybackMenu.UserControl_Unloaded;

                    // dependant pages
                    await Task.Run(() =>
                    {
                        if (browsePage != null)
                        {
                            browsePage.Page_Unloaded(null, null);
                        }
                        if (profilePage != null)
                        {
                            profilePage.Page_Unloaded(null, null);
                        }
                        if (yourMusicPage != null)
                        {
                            yourMusicPage.Page_Unloaded(null, null);
                        }
                        if (searchPage != null)
                        {
                            searchPage.Page_Unloaded(null, null);
                        }
                        if (settingsPage != null)
                        {
                            settingsPage.Page_Unloaded(null, null);
                        }
                    });
                    if (browsePage != null)
                    {
                        browsePage.Unloaded -= browsePage.Page_Unloaded;
                    }
                    if (profilePage != null)
                    {
                        profilePage.Unloaded -= profilePage.Page_Unloaded;
                    }
                    if (yourMusicPage != null)
                    {
                        yourMusicPage.Unloaded -= yourMusicPage.Page_Unloaded;
                    }
                    if (searchPage != null)
                    {
                        searchPage.Unloaded -= searchPage.Page_Unloaded;
                    }
                    if (settingsPage != null)
                    {
                        settingsPage.Unloaded -= settingsPage.Page_Unloaded;
                    }

                    // announcements
                    Announcements.Content         = null;
                    PreviousAnnouncement.Click   -= PreviousAnnouncement_Click;
                    NextAnnouncement.Click       -= NextAnnouncement_Click;
                    CloseAnnouncements.Click     -= CloseAnnouncements_Click;
                    AnnouncementsContainer.KeyUp -= AnnouncementsContainer_KeyUp;
                });
            }
        }
コード例 #7
0
ファイル: MainPage.xaml.cs プロジェクト: aboe026/boxify
        /// <summary>
        /// When the user navigates to the page
        /// </summary>
        /// <param name="e">The navigation event arguments</param>
        protected override async void OnNavigatedTo(NavigationEventArgs e)
        {
            // announcements
            if (announcementItems.Count > 0 && !closedAnnouncements)
            {
                ShowAnnouncements(announcementItems);
            }
            else
            {
                AnnouncementsContainer.Visibility = Visibility.Collapsed;
            }

            // settings
            if (Settings.theme == Settings.Theme.Light)
            {
                this.RequestedTheme = ElementTheme.Light;
            }
            else if (Settings.theme == Settings.Theme.Dark)
            {
                this.RequestedTheme = ElementTheme.Dark;
            }
            if (Settings.tvSafeArea)
            {
                SafeAreaOn();
            }
            else
            {
                SafeAreaOff();
            }

            CancelDialog.Visibility = Visibility.Collapsed;
            if (errorMessage != "")
            {
                Errors.Visibility       = Visibility.Visible;
                ErrorMessage.Visibility = Visibility.Visible;
                ErrorMessage.Text       = errorMessage;
            }
            else
            {
                ErrorMessages.Visibility = Visibility.Collapsed;
            }

            SpotifyLogo.Visibility    = Visibility.Collapsed;
            SpotifyLoading.Visibility = Visibility.Collapsed;
            YouTubeLogo.Visibility    = Visibility.Collapsed;
            YouTubeLoading.Visibility = Visibility.Collapsed;
            LoadersMessage.Visibility = Visibility.Collapsed;

            SelectHamburgerOption(App.hamburgerOptionToLoadTo, true);
            if (App.hamburgerOptionToLoadTo == "SettingsItem")
            {
                SettingsItem_Click(null, null);
            }
            UpdateUserUI();

            if (App.playbackService.showing)
            {
                PlaybackMenu.Visibility = Visibility.Visible;
                if (returningFromMemoryReduction)
                {
                    await PlaybackMenu.UpdateUI();

                    returningFromMemoryReduction = false;
                }
            }
            else
            {
                PlaybackMenu.Visibility = Visibility.Collapsed;
            }

            LoadUserPlaylists();

            // Back button in title bar
            Frame rootFrame = Window.Current.Content as Frame;

            string myPages = "";

            foreach (PageStackEntry page in rootFrame.BackStack)
            {
                myPages += page.SourcePageType.ToString() + "\n";
            }

            if (rootFrame.CanGoBack)
            {
                // Show UI in title bar if opted-in and in-app backstack is not empty.
                SystemNavigationManager.GetForCurrentView().AppViewBackButtonVisibility = AppViewBackButtonVisibility.Visible;
            }
            else
            {
                // Remove the UI from the title bar if in-app back stack is empty.
                SystemNavigationManager.GetForCurrentView().AppViewBackButtonVisibility = AppViewBackButtonVisibility.Collapsed;
            }
        }
コード例 #8
0
ファイル: MainPage.xaml.cs プロジェクト: aboe026/boxify
 /// <summary>
 /// When key is pressed, check for special key
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 private void Page_KeyUp(object sender, KeyRoutedEventArgs e)
 {
     if (AnnouncementsContainer.Visibility != Visibility.Visible)
     {
         if (e.Key == VirtualKey.GamepadView)
         {
             MainSplitView.IsPaneOpen = !MainSplitView.IsPaneOpen;
         }
         else if (e.Key == VirtualKey.GamepadY)
         {
             SelectHamburgerOption("SearchItem", true);
         }
         else if (e.Key == VirtualKey.GamepadX)
         {
             if (App.playbackService.showing)
             {
                 PlaybackMenu.FocusPlayPause();
             }
         }
         else if (e.Key == VirtualKey.GamepadRightThumbstickButton)
         {
             if (App.playbackService.showing)
             {
                 if (App.playbackService.Player.PlaybackSession.PlaybackState == MediaPlaybackState.Playing)
                 {
                     App.playbackService.Player.Pause();
                 }
                 else
                 {
                     App.playbackService.Player.Play();
                 }
             }
         }
         else if (e.Key == VirtualKey.GamepadRightThumbstickRight)
         {
             if (App.playbackService.showing)
             {
                 App.playbackService.NextTrack();
             }
         }
         else if (e.Key == VirtualKey.GamepadRightThumbstickLeft)
         {
             if (App.playbackService.showing)
             {
                 App.playbackService.PreviousTrack();
             }
         }
         else if (e.Key == VirtualKey.Down && e.OriginalSource is Button && ((Button)e.OriginalSource).Name == "Back")
         {
             MainContentFrame.Focus(FocusState.Programmatic);
         }
         else if (e.Key == VirtualKey.Escape && e.OriginalSource is Slider && ((Slider)e.OriginalSource).Name == "VolumeSlider")
         {
             PlaybackMenu.VolumeSlider_LostFocus(null, null);
             PlaybackMenu.FocusOnVolume();
         }
         else if (e.Key == VirtualKey.Escape)
         {
             Back_Click(null, null);
         }
     }
 }
コード例 #9
0
ファイル: Visualizer.xaml.cs プロジェクト: lulzzz/visualizer
        /// <summary>
        /// Menu item has been clicked
        /// </summary>
        private void PopperMenu_MenuItemClicked(object sender, EHRS.Silverlight.MenuItemClickedEventArgs e)
        {
            switch (e.MenuItem.Name)
            {
            case "btnHelp":
                sbShowHelp.Begin();
                if (aboutText.Blocks.Count == 0)
                {
                    LoadAboutText();
                }
                aboutText.Selection.Select(aboutText.ContentStart, aboutText.ContentStart);
                break;

            case "btnSave":
                SaveCapture();
                break;

            case "btnOpen":
                OpenCapture();
                break;

            case "btnDiagram":
                ShowDiagramSelector();
                break;

            case "btnSpeed":
                if ((e.MenuItem as ToggleButton).IsChecked.Value)
                {
                    m_inSpeedMode = 1000;
                }
                else
                {
                    m_inSpeedMode = 100;
                }
                if ((PlaybackMenu.FindName("btnReplay") as ToggleButton).IsChecked.Value)
                {
                    m_playbackTimer.Change(m_inSpeedMode, m_inSpeedMode);
                }
                break;

            case "btnReplay":
                if ((e.MenuItem as ToggleButton).IsChecked.Value)
                {
                    StartPlayback();
                }
                else
                {
                    StopPlayback();
                }
                break;

            case "btnServer":
                ShowServerSelector();
                break;

            case "btnPlaybackMode":
                ShowPlaybackMenu();
                break;

            case "btnCaptureMode":
                if (m_currentCapture != null)
                {
                    StopPlayback();
                    eraseCaptureStatus.Visibility = System.Windows.Visibility.Visible;
                }
                else
                {
                    ShowCaptureMenu();
                }
                break;

            case "btnRecord":
                if (m_currentCapture != null && !(e.MenuItem as ToggleButton).IsChecked.Value)
                {
                    RepeatButton rp = CaptureMenu.MenuPanel.FindName("btnPlaybackMode") as RepeatButton;
                    rp.Visibility = System.Windows.Visibility.Visible;
                    ShowPlaybackMenu();
                }
                else if ((e.MenuItem as ToggleButton).IsChecked.Value)
                {
                    RepeatButton rp = CaptureMenu.MenuPanel.FindName("btnPlaybackMode") as RepeatButton;
                    rp.Visibility    = System.Windows.Visibility.Collapsed;
                    m_currentCapture = new VisualizationCollection();
                }
                break;
            }
        }