Пример #1
0
        /// <summary>
        /// Navigates to the plugin from an external source, with a destination and parameters.
        /// </summary>
        public void NavigateTo(string destination, IDictionary <string, string> parameters, INavigationService navigationService)
        {
            switch (destination)
            {
            case ViewPoolQuery:
                string ticket = null;
                if (parameters.TryGetValue(UserTicketParameter, out ticket) && !_settings.UserTickets.Contains(ticket))
                {
                    // TODO once this is an observablecollection, make this simpler
                    string[] newTickets = new string[_settings.UserTickets.Length + 1];
                    Array.Copy(_settings.UserTickets, newTickets, _settings.UserTickets.Length);
                    newTickets[_settings.UserTickets.Length] = ticket;
                    _settings.UserTickets = newTickets;
                }

                string favoriteIdString = null;
                if (parameters.TryGetValue(MarkAsFavoriteParameter, out favoriteIdString))
                {
                    long favoriteId = long.Parse(favoriteIdString);
                    _settings.FavoriteItemIds.Add(favoriteId);

                    var request = new ViewEventItemRequest(favoriteId, true);
                    // Ignore the pool, go to the item
                    navigationService.NavigateTo <EventItemViewModel, ViewEventItemRequest>(request);
                }
                else
                {
                    long poolId = long.Parse(parameters[PoolIdParameter]);
                    navigationService.NavigateTo <EventPoolViewModel, long>(poolId);
                }
                break;

            case ViewItemQuery:
            {
                long itemId  = long.Parse(parameters[EventIdParameter]);
                var  request = new ViewEventItemRequest(itemId, false);
                navigationService.NavigateTo <EventItemViewModel, ViewEventItemRequest>(request);
                break;
            }
            }
        }
Пример #2
0
        public void NavigateTo( string destination, IDictionary<string, string> parameters, INavigationService navigationService )
        {
            switch ( destination )
            {
                case ViewPoolQuery:
                    string ticket;
                    if ( parameters.TryGetValue( UserTicketParameter, out ticket ) && !_settings.UserTickets.Contains( ticket ) )
                    {
                        _settings.UserTickets.Add( ticket );
                    }

                    string favoriteIdString;
                    if ( parameters.TryGetValue( MarkAsFavoriteParameter, out favoriteIdString ) )
                    {
                        long favoriteId = long.Parse( favoriteIdString );
                        _settings.FavoriteItemIds.Add( favoriteId );

                        var poolRequest = new ViewEventItemRequest( favoriteId, true );
                        // Ignore the pool, go to the item
                        navigationService.NavigateTo<EventItemViewModel, ViewEventItemRequest>( poolRequest );
                    }
                    else
                    {
                        long poolId = long.Parse( parameters[PoolIdParameter] );
                        navigationService.NavigateTo<EventPoolViewModel, long>( poolId );
                    }
                    break;

                case ViewItemQuery:
                    long itemId = long.Parse( parameters[EventIdParameter] );
                    var itemRequest = new ViewEventItemRequest( itemId, false );
                    navigationService.NavigateTo<EventItemViewModel, ViewEventItemRequest>( itemRequest );
                    break;

                default:
                    NavigateTo( navigationService );
                    break;
            }
        }
Пример #3
0
        /// <summary>
        /// Navigates to the plugin from an external source, with a destination and parameters.
        /// </summary>
        public void NavigateTo( string destination, IDictionary<string, string> parameters, INavigationService navigationService )
        {
            switch ( destination )
            {
                case ViewPoolQuery:
                    string ticket = null;
                    if ( parameters.TryGetValue( UserTicketParameter, out ticket ) && !_settings.UserTickets.Contains( ticket ) )
                    {
                        // TODO once this is an observablecollection, make this simpler
                        string[] newTickets = new string[_settings.UserTickets.Length + 1];
                        Array.Copy( _settings.UserTickets, newTickets, _settings.UserTickets.Length );
                        newTickets[_settings.UserTickets.Length] = ticket;
                        _settings.UserTickets = newTickets;
                    }

                    string favoriteIdString = null;
                    if ( parameters.TryGetValue( MarkAsFavoriteParameter, out favoriteIdString ) )
                    {
                        long favoriteId = long.Parse( favoriteIdString );
                        _settings.FavoriteItemIds.Add( favoriteId );

                        var request = new ViewEventItemRequest( favoriteId, true );
                        // Ignore the pool, go to the item
                        navigationService.NavigateTo<EventItemViewModel, ViewEventItemRequest>( request );
                    }
                    else
                    {
                        long poolId = long.Parse( parameters[PoolIdParameter] );
                        navigationService.NavigateTo<EventPoolViewModel, long>( poolId );
                    }
                    break;

                case ViewItemQuery:
                    {
                        long itemId = long.Parse( parameters[EventIdParameter] );
                        var request = new ViewEventItemRequest( itemId, false );
                        navigationService.NavigateTo<EventItemViewModel, ViewEventItemRequest>( request );
                        break;
                    }
            }
        }