private void MenuList_SelectionChanged(object sender, SelectionChangedEventArgs e)
        {
            ListBoxItem menuSelection = (sender as ListBox).SelectedItem as ListBoxItem;

            if (menuSelection == null || menuSelection.Name == "Home")
            {
                RootFrame?.Navigate(new HomePage());
            }
            else
            {
                RootFrame?.Navigate(new InputOutputPage(menuSelection.Name));
            }
        }
        private void SyncState()
        {
            var item      = AssociatedObject.SelectedItem as ListBoxItem;
            var pageToken = NavigateTo.GetPageToken(item);
            var param     = NavigateTo.GetParameters(item);

            if (param is ParameterBase)
            {
                param = ((ParameterBase)param).ToJson();
            }
            if (!string.IsNullOrWhiteSpace(pageToken))
            {
                RootFrame?.Navigate(GetPageType(pageToken), param);
            }

            if (ParentSplitView != null)
            {
                ParentSplitView.IsPaneOpen = false;
            }
        }
Ejemplo n.º 3
0
 public void SetSelectTableForUpdatePage()
 {
     RootFrame.Navigate(new SelectTablePage(false));
 }
Ejemplo n.º 4
0
 public void SetStatisticsPage()
 {
     RootFrame.Navigate(new StatisticsPage());
 }
Ejemplo n.º 5
0
 public void SetAddPublishPage()
 {
     RootFrame.Navigate(new AddPublishToDBPage());
 }
Ejemplo n.º 6
0
 public void SetAddCustomerPage()
 {
     RootFrame.Navigate(new AddCustomerToDBPage());
 }
Ejemplo n.º 7
0
 public void SetSellerPage()
 {
     RootFrame.Navigate(new SellerPage());
 }
Ejemplo n.º 8
0
        public async Task HandleProtocolAsync(string path)
        {
            LoggingService.Log(LoggingService.LogType.Debug, "Performing protocol work using path of " + path);


            if (!string.IsNullOrEmpty(path))
            {
                try
                {
                    if (path == "playUserLikes" || path == "shufflePlayUserLikes")
                    {
                        if (SoundByteV3Service.Current.IsServiceConnected(ServiceType.SoundCloud))
                        {
                            // Navigate to the now playing screen
                            RootFrame.Navigate(typeof(NowPlayingView));

                            // Get and load the user liked items
                            var userLikes = new SoundByteCollection <LikeSoundCloudSource, BaseTrack>();
                            userLikes.Source.User = SoundByteV3Service.Current.GetConnectedUser(ServiceType.SoundCloud);

                            // Loop through loading all the likes
                            while (userLikes.HasMoreItems)
                            {
                                await userLikes.LoadMoreItemsAsync(50);
                            }

                            // Play the list of items
                            await PlaybackService.Instance.StartModelMediaPlaybackAsync(userLikes, path == "shufflePlayUserLikes");

                            return;
                        }
                    }

                    if (path == "playUserStream")
                    {
                        if (SoundByteV3Service.Current.IsServiceConnected(ServiceType.SoundCloud))
                        {
                            // Navigate to the now playing screen
                            RootFrame.Navigate(typeof(NowPlayingView));

                            // Get and load the user liked items
                            var userStream = new SoundByteCollection <StreamSoundCloudSource, GroupedItem>();

                            // Counter so we don't get an insane amount of items
                            var i = 0;

                            // Grab all the users stream / 5 items
                            while (userStream.HasMoreItems && i <= 5)
                            {
                                i++;
                                await userStream.LoadMoreItemsAsync(50);
                            }

                            // Play the list of items
                            await PlaybackService.Instance.StartPlaylistMediaPlaybackAsync(
                                userStream.Where(x => x.Track != null).Select(x => x.Track).ToList());

                            return;
                        }
                    }

                    var parser = DeepLinkParser.Create(path);

                    var section = parser.Root.Split('/')[0].ToLower();
                    var page    = parser.Root.Split('/')[1].ToLower();

                    await App.SetLoadingAsync(true);

                    if (section == "core")
                    {
                        switch (page)
                        {
                        case "track":

                            BaseTrack track = null;

                            switch (parser["service"])
                            {
                            case "soundcloud":
                                track = (await SoundByteV3Service.Current.GetAsync <SoundCloudTrack>(ServiceType.SoundCloud, $"/tracks/{parser["id"]}")).ToBaseTrack();
                                break;

                            case "youtube":
                                break;

                            case "fanburst":
                                track = (await SoundByteV3Service.Current.GetAsync <FanburstTrack>(ServiceType.Fanburst, $"/videos/{parser["id"]}")).ToBaseTrack();
                                break;
                            }

                            if (track != null)
                            {
                                var startPlayback =
                                    await PlaybackService.Instance.StartPlaylistMediaPlaybackAsync(new List <BaseTrack> {
                                    track
                                });

                                if (!startPlayback.Success)
                                {
                                    await new MessageDialog(startPlayback.Message, "Error playing track.").ShowAsync();
                                }
                            }
                            break;

                        case "playlist":
                            var playlist =
                                await SoundByteV3Service.Current.GetAsync <SoundCloudPlaylist>(ServiceType.SoundCloud, $"/playlists/{parser["id"]}");

                            App.NavigateTo(typeof(PlaylistView), playlist.ToBasePlaylist());
                            return;

                        case "user":
                            var user = await SoundByteV3Service.Current.GetAsync <SoundCloudUser>(ServiceType.SoundCloud, $"/users/{parser["id"]}");

                            App.NavigateTo(typeof(UserView), user.ToBaseUser());
                            return;

                        case "changelog":
                            App.NavigateTo(typeof(WhatsNewView));
                            return;
                        }
                    }
                }
                catch (Exception)
                {
                    await new MessageDialog("The specified protocol is not correct. App will now launch as normal.")
                    .ShowAsync();
                }
                await App.SetLoadingAsync(false);
            }

            RootFrame.Navigate(SoundByteV3Service.Current.IsServiceConnected(ServiceType.SoundCloud)
                ? typeof(SoundCloudStreamView)
                : typeof(ExploreView));
        }
Ejemplo n.º 9
0
 private void NavigateToChangePassword(object sender, RoutedEventArgs e)
 {
     RootFrame.Navigate(typeof(ChangePassword));
 }
Ejemplo n.º 10
0
 private void NavigateToPersonalInfo(object sender, RoutedEventArgs e)
 {
     RootFrame.Navigate(typeof(PersonalMessage));
 }
Ejemplo n.º 11
0
 private void NavigateToAdd(object sender, RoutedEventArgs e)
 {
     RootFrame.Navigate(typeof(NewOrUpdate));
 }
Ejemplo n.º 12
0
 /// <summary>
 /// 汉堡菜单各按钮对应跳转页面
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 private void NavigateToHome(object sender, RoutedEventArgs e)
 {
     RootFrame.Navigate(typeof(Home));
 }
Ejemplo n.º 13
0
 protected override void OnNavigatedTo(NavigationEventArgs e)
 {
     RootFrame.Navigate(typeof(Home));
 }
 public ConnectedAnimationsPage()
 {
     this.InitializeComponent();
     RootFrame.Navigate(typeof(FirstPage));
 }
Ejemplo n.º 15
0
        private void KategoryButton_Click(object sender, RoutedEventArgs e)
        {
            Page OpenPage = new Pages.KategoryPage(DataBaseSqlConnection);

            RootFrame.Navigate(OpenPage);
        }
 /// <summary>
 /// Navigates to a page via type.
 /// Typically in Universal apps
 /// </summary>
 /// <param name="destination">Destination page Uri</param>
 public bool Navigate(Type destinationPageType)
 {
     return(RootFrame.Navigate(destinationPageType));
 }
 /// <summary>
 /// Navigates to a page via type.
 /// Typically in Universal apps
 /// </summary>
 /// <param name="destination">Destination page Uri</param>
 /// <param name="dataToPass">Data to be passed to the destination page</param>
 public bool Navigate <TModel>(Type destinationPageType, TModel dataToPass)
 {
     return(RootFrame.Navigate(destinationPageType, dataToPass));
 }
Ejemplo n.º 18
0
        /// <summary>
        /// Invoked when the application is launched normally by the end user.  Other entry points
        /// will be used such as when the application is launched to open a specific file.
        /// </summary>
        /// <param name="e">Details about the launch request and process.</param>
        protected override void OnLaunched(LaunchActivatedEventArgs e)
        {
#if DEBUG
            if (System.Diagnostics.Debugger.IsAttached)
            {
                //this.DebugSettings.EnableFrameRateCounter = true;
            }
#endif
            Logger.WriteLine(LoggerLevel.Info, "Started logger...");

            var Dispatcher = CoreApplication.MainView.CoreWindow.Dispatcher;

            // App loaded for first time
            Initialize(e).ContinueWith(async(t) =>
            {
                if (!e.PrelaunchActivated)
                {
                    if (Settings.WeatherLoaded && !String.IsNullOrEmpty(e.TileId) && !e.TileId.Equals("App", StringComparison.OrdinalIgnoreCase))
                    {
                        await Dispatcher.RunAsync(CoreDispatcherPriority.Normal, () =>
                        {
                            if (RootFrame.Content == null)
                            {
                                RootFrame.Navigate(typeof(Shell), "suppressNavigate");
                            }
                        });

                        // Navigate to WeatherNow page for location
                        if (Shell.Instance != null)
                        {
                            var locData   = Task.Run(Settings.GetLocationData).Result;
                            var locations = new List <LocationData>(locData)
                            {
                                Settings.HomeData,
                            };
                            var location = locations.FirstOrDefault(loc => loc.query.Equals(SecondaryTileUtils.GetQueryFromId(e.TileId)));
                            if (location != null)
                            {
                                var isHome = location.Equals(Settings.HomeData);

                                await Dispatcher.RunAsync(CoreDispatcherPriority.Normal, () =>
                                {
                                    Shell.Instance.AppFrame.Navigate(typeof(WeatherNow), location);
                                    Shell.Instance.AppFrame.BackStack.Clear();
                                    if (!isHome)
                                    {
                                        Shell.Instance.AppFrame.BackStack.Add(new PageStackEntry(typeof(WeatherNow), null, null));
                                        SystemNavigationManager.GetForCurrentView().AppViewBackButtonVisibility = AppViewBackButtonVisibility.Visible;
                                    }
                                    else
                                    {
                                        SystemNavigationManager.GetForCurrentView().AppViewBackButtonVisibility = AppViewBackButtonVisibility.Collapsed;
                                    }
                                });
                            }

                            // If Shell content is empty navigate to default page
                            await Dispatcher.RunAsync(CoreDispatcherPriority.Normal, () =>
                            {
                                if (Shell.Instance.AppFrame.CurrentSourcePageType == null)
                                {
                                    Shell.Instance.AppFrame.Navigate(typeof(WeatherNow), null);
                                }
                            });
                        }
                    }

                    await Dispatcher.RunAsync(CoreDispatcherPriority.Normal, () =>
                    {
                        if (RootFrame.Content == null)
                        {
                            // When the navigation stack isn't restored navigate to the first page,
                            // configuring the new page by passing required information as a navigation
                            // parameter
                            if (Settings.WeatherLoaded)
                            {
                                RootFrame.Navigate(typeof(Shell), e.Arguments);
                            }
                            else
                            {
                                RootFrame.Navigate(typeof(SetupPage), e.Arguments);
                            }
                        }

                        // Ensure the current window is active
                        Window.Current.Activate();
                    });
                }
            });
        }
Ejemplo n.º 19
0
 public void SetManagerPage()
 {
     RootFrame.Navigate(new ManagerPage());
 }
Ejemplo n.º 20
0
        protected override void OnActivated(IActivatedEventArgs e)
        {
            base.OnActivated(e);

            var Dispatcher = CoreApplication.MainView.CoreWindow.Dispatcher;

            // Handle toast activation
            if (e is ToastNotificationActivatedEventArgs)
            {
                // Get the root frame
                RootFrame = Window.Current.Content as Frame;

                var toastActivationArgs = e as ToastNotificationActivatedEventArgs;

                // Parse the query string (using QueryString.NET)
                var args = QueryString.Parse(toastActivationArgs.Argument);

                if (!args.Contains("action"))
                {
                    return;
                }

                // See what action is being requested
                switch (args["action"])
                {
                case "view-alerts":
                    if (Settings.WeatherLoaded)
                    {
                        Task.Run(async() =>
                        {
                            var key = args["query"];

                            // App loaded for first time
                            await Initialize(e);

                            await Dispatcher.RunAsync(CoreDispatcherPriority.Normal, () =>
                            {
                                if (RootFrame.Content == null)
                                {
                                    RootFrame.Navigate(typeof(Shell), "suppressNavigate");
                                }
                            });

                            if (Shell.Instance != null)
                            {
                                var weather            = await Settings.GetWeatherData(key);
                                weather.weather_alerts = await Settings.GetWeatherAlertData(key);

                                await Dispatcher.RunAsync(CoreDispatcherPriority.Normal, () =>
                                {
                                    // If we're already on WeatherNow navigate to Alert page
                                    if (Shell.Instance.AppFrame.Content != null && Shell.Instance.AppFrame.SourcePageType.IsTypeOf(typeof(WeatherNow)))
                                    {
                                        Shell.Instance.AppFrame.Navigate(typeof(WeatherAlertPage), new WeatherNowViewModel(weather));
                                    }
                                    // If not clear backstack and navigate to Alert page
                                    // Add a WeatherNow page in backstack to go back to
                                    else
                                    {
                                        Shell.Instance.AppFrame.Navigate(typeof(WeatherAlertPage), new WeatherNowViewModel(weather));
                                        Shell.Instance.AppFrame.BackStack.Clear();
                                        Shell.Instance.AppFrame.BackStack.Add(new PageStackEntry(typeof(WeatherNow), null, null));
                                        SystemNavigationManager.GetForCurrentView().AppViewBackButtonVisibility = AppViewBackButtonVisibility.Visible;
                                    }
                                });
                            }
                        });
                    }
                    break;

                default:
                    break;
                }
            }

            // TODO: Handle other types of activation

            // Ensure the current window is active
            Window.Current.Activate();
        }
Ejemplo n.º 21
0
 public void SetPasswordPage()
 {
     RootFrame.Navigate(new PasswordPage());
 }
Ejemplo n.º 22
0
 private static void Navigate(Uri link)
 {
     Log.Info("Navigating to: {0}", link);
     RootFrame.Navigate(link);
 }
Ejemplo n.º 23
0
 public void SetAddBookPage()
 {
     RootFrame.Navigate(new AddBookToDBPage());
 }
Ejemplo n.º 24
0
        public async Task HandleProtocolAsync(string path)
        {
            LoggingService.Log(LoggingService.LogType.Debug, "Performing protocol work using path of " + path);

            if (!string.IsNullOrEmpty(path))
            {
                try
                {
                    if (path == "playUserLikes" || path == "shufflePlayUserLikes")
                    {
                        if (SoundByteService.Current.IsServiceConnected(ServiceType.SoundCloud))
                        {
                            // Navigate to the now playing screen
                            RootFrame.Navigate(typeof(NowPlayingView));

                            // Get and load the user liked items
                            var userLikes = new SoundByteCollection <SoundCloudLikeSource, BaseTrack>();
                            userLikes.Source.User = SoundByteService.Current.GetConnectedUser(ServiceType.SoundCloud);

                            // Loop through loading all the likes
                            while (userLikes.HasMoreItems)
                            {
                                await userLikes.LoadMoreItemsAsync(50);
                            }

                            // Play the list of items
                            await BaseViewModel.PlayAllTracksAsync(userLikes, null, path == "shufflePlayUserLikes");

                            return;
                        }
                    }

                    if (path == "playUserStream")
                    {
                        if (SoundByteService.Current.IsServiceConnected(ServiceType.SoundCloud))
                        {
                            // Navigate to the now playing screen
                            RootFrame.Navigate(typeof(NowPlayingView));

                            // Get and load the user liked items
                            var userStream = new SoundByteCollection <SoundCloudStreamSource, GroupedItem>();

                            // Counter so we don't get an insane amount of items
                            var i = 0;

                            // Grab all the users stream / 5 items
                            while (userStream.HasMoreItems && i <= 5)
                            {
                                i++;
                                await userStream.LoadMoreItemsAsync(50);
                            }

                            // Play the list of items
                            var result = await PlaybackService.Instance.InitilizePlaylistAsync <DummyTrackSource>(
                                userStream.Where(x => x.Track != null).Select(x => x.Track).ToList());

                            if (result.Success)
                            {
                                await PlaybackService.Instance.StartTrackAsync();
                            }

                            return;
                        }
                    }

                    var parser = DeepLinkParser.Create(path);

                    var section = parser.Root?.Split('/')[0]?.ToLower();

                    await App.SetLoadingAsync(true);

                    if (section == "core")
                    {
                        var page = parser.Root?.Split('/')[1]?.ToLower();

                        switch (page)
                        {
                        case "track":

                            BaseTrack track = null;

                            switch (parser["service"])
                            {
                            case "soundcloud":
                                track = (await SoundByteService.Current.GetAsync <SoundCloudTrack>(ServiceType.SoundCloud, $"/tracks/{parser["id"]}")).Response.ToBaseTrack();
                                break;

                            case "youtube":
                                break;

                            case "fanburst":
                                track = (await SoundByteService.Current.GetAsync <FanburstTrack>(ServiceType.Fanburst, $"/videos/{parser["id"]}")).Response.ToBaseTrack();
                                break;
                            }

                            if (track != null)
                            {
                                var startPlayback =
                                    await PlaybackService.Instance.InitilizePlaylistAsync <DummyTrackSource>(new List <BaseTrack> {
                                    track
                                });

                                if (startPlayback.Success)
                                {
                                    await PlaybackService.Instance.StartTrackAsync();
                                }
                                else
                                {
                                    await NavigationService.Current.CallMessageDialogAsync(startPlayback.Message,
                                                                                           "Error playing track.");
                                }
                            }
                            break;

                        case "playlist":
                            var playlist =
                                await SoundByteService.Current.GetAsync <SoundCloudPlaylist>(ServiceType.SoundCloud, $"/playlists/{parser["id"]}");

                            App.NavigateTo(typeof(PlaylistView), playlist.Response.ToBasePlaylist());
                            return;

                        case "user":
                            var user = await SoundByteService.Current.GetAsync <SoundCloudUser>(ServiceType.SoundCloud, $"/users/{parser["id"]}");

                            App.NavigateTo(typeof(UserView), user.Response.ToBaseUser());
                            return;

                        case "changelog":
                            await NavigationService.Current.CallDialogAsync <WhatsNewDialog>();

                            break;
                        }
                    }
                    else if (section == "rs" || section == "remote-subsystem")
                    {
                        try
                        {
                            await App.SetLoadingAsync(true);

                            parser.TryGetValue("d", out var data);
                            parser.TryGetValue("t", out var timespan);

                            var result = App.RoamingService.DecodeActivityParameters(data);

                            // Get the current track object
                            BaseTrack currentTrack = null;
                            var       tracks       = new List <BaseTrack>();

                            switch (result.CurrentTrack.Service)
                            {
                            case ServiceType.Fanburst:
                                break;

                            case ServiceType.SoundCloud:
                            case ServiceType.SoundCloudV2:
                                currentTrack = (await SoundByteService.Current.GetAsync <SoundCloudTrack>(ServiceType.SoundCloud, $"/tracks/{result.CurrentTrack.TrackId}")).Response.ToBaseTrack();
                                break;

                            case ServiceType.YouTube:
                                currentTrack = (await SoundByteService.Current.GetAsync <YouTubeVideoHolder>(ServiceType.YouTube, "videos", new Dictionary <string, string>
                                {
                                    { "part", "snippet,contentDetails" },
                                    { "id", result.CurrentTrack.TrackId }
                                })).Response.Tracks.FirstOrDefault()?.ToBaseTrack();
                                break;

                            case ServiceType.ITunesPodcast:
                                // TODO: THIS
                                break;
                            }

                            //TODO: List has to be put back into wanted order.

                            var soundCloudIds = string.Join(',', result.Tracks.Where(x => x.Service == ServiceType.SoundCloud || x.Service == ServiceType.SoundCloudV2).Select(x => x.TrackId));
                            var fanburstIds   = string.Join(',', result.Tracks.Where(x => x.Service == ServiceType.Fanburst).Select(x => x.TrackId));
                            var youTubeIds    = string.Join(',', result.Tracks.Where(x => x.Service == ServiceType.YouTube).Select(x => x.TrackId));

                            // SoundCloud tracks
                            tracks.AddRange((await SoundByteService.Current.GetAsync <List <SoundCloudTrack> >(ServiceType.SoundCloud, $"/tracks?ids={soundCloudIds}")).Response.Select(x => x.ToBaseTrack()));

                            // YouTube Tracks
                            tracks.AddRange((await SoundByteService.Current.GetAsync <YouTubeVideoHolder>(ServiceType.YouTube, "videos", new Dictionary <string, string>
                            {
                                { "part", "snippet,contentDetails" },
                                { "id", youTubeIds }
                            })).Response.Tracks.Select(x => x.ToBaseTrack()));

                            var startPlayback = await PlaybackService.Instance.InitilizePlaylistAsync(result.Source, tracks);

                            if (startPlayback.Success)
                            {
                                TimeSpan?timeSpan = null;

                                if (!string.IsNullOrEmpty(timespan))
                                {
                                    timeSpan = TimeSpan.FromMilliseconds(double.Parse(timespan));
                                }

                                await PlaybackService.Instance.StartTrackAsync(currentTrack, timeSpan);
                            }
                            else
                            {
                                await NavigationService.Current.CallMessageDialogAsync(startPlayback.Message, "The remote protocol subsystem failed.");
                            }

                            await App.SetLoadingAsync(false);
                        }
                        catch (Exception e)
                        {
                            await App.SetLoadingAsync(false);

                            await NavigationService.Current.CallMessageDialogAsync(e.Message, "The remote protocol subsystem failed.");
                        }
                    }
                }
                catch (Exception ex)
                {
                    await NavigationService.Current.CallMessageDialogAsync(
                        "The specified protocol is not correct. App will now launch as normal.\n\n" + ex.Message);
                }
                await App.SetLoadingAsync(false);
            }

            if (DeviceHelper.IsMobile)
            {
                RootFrame.Navigate(typeof(MobileView));
            }
            else
            {
                RootFrame.Navigate(typeof(ExploreView));
            }
        }
Ejemplo n.º 25
0
 public void SetAddAuthorPage()
 {
     RootFrame.Navigate(new AddAuthorToDBPage());
 }
 protected override void OnNavigatedTo(NavigationEventArgs e)
 {
     base.OnNavigatedTo(e);
     Menu.SelectedItem = Menu.MenuItems[0];
     RootFrame.Navigate(typeof(HelloPage));
 }
Ejemplo n.º 27
0
 public void SetSelectTablePage()
 {
     RootFrame.Navigate(new SelectTablePage());
 }
Ejemplo n.º 28
0
 private void ListView_ItemClick(object sender, ItemClickEventArgs e)
 {
     RootFrame.Navigate(typeof(FeedPage), ((Feed)e.ClickedItem).Id);
 }
Ejemplo n.º 29
0
 public void SetEditTablePage(String tableName)
 {
     RootFrame.Navigate(new EditTablePage(tableName));
 }
Ejemplo n.º 30
0
 /// <summary>
 /// Called when a search query is submitted.
 /// </summary>
 /// <param name="sender">The sender.</param>
 /// <param name="args">The <see cref="SearchPaneQuerySubmittedEventArgs"/> instance containing the event data.</param>
 private void OnQuerySubmitted(object sender, SearchPaneQuerySubmittedEventArgs args)
 {
     RootFrame.Navigate(typeof(ShowListPage), new ShowListParams(MethodCall.Search, null, args.QueryText));
 }