public BoerseUserEditViewModel(IExceptionHandler exceptionHandler, INavigationHandler navigationHandler, BoerseUserConfigurationLogic boerseUserConfigurationLogic)
 {
     _exceptionHandler             = exceptionHandler;
     _navigationHandler            = navigationHandler;
     _boerseUserConfigurationLogic = boerseUserConfigurationLogic;
     LoadUser();
 }
 public DownloadContextEditViewModel(IExceptionHandler exceptionHandler, INavigationHandler navigationHandler, DownloadContextConfigurationLogic logic)
 {
     BoerseLinkProviders = (BoerseLinkProvider[])Enum.GetValues(typeof(BoerseLinkProvider));
     _exceptionHandler   = exceptionHandler;
     _navigationHandler  = navigationHandler;
     _logic = logic;
 }
        private static void OnSetHandlerNameCallback(DependencyObject dependencyObject, DependencyPropertyChangedEventArgs e)
        {
            var _handler = NavigationService.GetNavigationHandler(dependencyObject);

            if (_handler == null)
            {
                return;
            }

            // if the handler had a old name registered, we remove it
            var _oldName = Convert.ToString(e.OldValue);

            if (!string.IsNullOrEmpty(_oldName) && NavigationService.IsNavigationHandlerRegistered(_oldName))
            {
                INavigationHandler _oldHandler = NavigationService.GetNavigationHandler(_oldName);
                if (_oldHandler != null)
                {
                    if (Object.ReferenceEquals(_oldHandler, _handler))
                    {
                        NavigationService.UnregisterNavigationHandler(_oldName);
                    }
                }
            }

            var _newName = Convert.ToString(e.NewValue);

            if (!string.IsNullOrEmpty(_newName))
            {
                NavigationService.RegisterNavigationHandler(_newName, _handler);
            }
        }
Example #4
0
 public DownloadContextsOverviewViewModel(IExceptionHandler exceptionHandler, INavigationHandler navigationHandler, DownloadContextConfigurationLogic downloadContextConfigurationLogic)
 {
     _exceptionHandler  = exceptionHandler;
     _navigationHandler = navigationHandler;
     _downloadContextConfigurationLogic = downloadContextConfigurationLogic;
     DownloadContextEntries             = new ObservableCollection <DownloadContext>(_downloadContextConfigurationLogic.LoadAll());
 }
Example #5
0
 protected virtual void Awake()
 {
     animator                 = GetComponent <Animator>();
     navigationHandler        = GetComponent <INavigationHandler>();
     variablesStringFormatter = new VariablesStringFormatter();
     decisions                = new List <PlayerDecisionUI>();
 }
        public static INavigationHandler ResolveHandlerInVisualTree(FrameworkElement element, string handlerName)
        {
            Guard.ArgumentNotNull(element, "element");
            Guard.ArgumentNotNullOrEmpty(handlerName, "handlerName");

            // OPTION 2. we check if we have a handler element name specified
            // we find the first possible FrameworkElement in the VisualTree
            var _frameworkElement = element;       // I've left this as later we can extend this to a DO

            if (_frameworkElement != null)
            {
                // we try and get the given element (who is supposed to be navigation handler) by name
                var _handlerElement = _frameworkElement.FindName(handlerName) as DependencyObject;
                if (_handlerElement != null)
                {
                    var _elementHandler = NavigationService.GetNavigationHandler(_handlerElement);
                    if (_elementHandler != null)
                    {
                        return(_elementHandler);
                    }
                }
            }

            // OPTION 3. we try against any globally registered handler
            INavigationHandler _registeredHandler = NavigationService.GetNavigationHandler(handlerName);

            if (_registeredHandler != null)
            {
                return(_registeredHandler);
            }

            // return null!
            return(null);
        }
 public RecentVideosViewModel(MediaLibrary mediaLibrary, IErrorHandler error, INavigationHandler navigation)
     : base(error, navigation)
 {
     this.mediaLibrary  = mediaLibrary;
     this.RecentTVShows = new ObservableCollection <TVShow>();
     this.RecentVideos  = new ObservableCollection <VideoItem>();
 }
        public NavigateResult(string url, ParametersCollection requestParameters, string siteArea, INavigationHandler handler)
        {
            Guard.ArgumentNotNullOrWhiteSpace(url, "url");

            _url               = url;
            _siteArea          = siteArea;
            _requestParameters = requestParameters;
            _handler           = handler;
        }
Example #9
0
 public void Register(INavigationHandler handler)
 {
     OnNavigateToPage    += handler.NavigateToPage;
     OnSamePageNavigate  += handler.NavigateWithParam;
     OnNavigate          += handler.Navigate;
     OnNavigateWithId    += handler.NavigateWithId;
     OnNavigateWithQuery += handler.NavigateWithQuery;
     OnNavigateWithParam += handler.NavigateWithParam;
 }
 public RecentMediaViewModel(MediaLibrary mediaLibrary, IErrorHandler error, INavigationHandler navigation)
     : base(error, navigation)
 {
     this.mediaLibrary  = mediaLibrary;
     this.RecentTracks  = new ObservableCollection <TrackItem>();
     this.RecentAlbums  = new ObservableCollection <AlbumItem>();
     this.RecentArtists = new ObservableCollection <ArtistItem>();
     this.RecentTVShows = new ObservableCollection <TVShow>();
 }
Example #11
0
        protected virtual void Awake()
        {
            navigationHandler = GetComponent <INavigationHandler>();
            if (navigationHandler == null)
            {
                navigationHandler = gameObject.AddComponent <NavigationHandler>();
            }

            window = GetComponent <UIWindow>();
        }
Example #12
0
        public ViewModelContainer(IExceptionHandlerConfiguration exceptionHandlerConfiguration, IInformationHandlerConfiguration informationHandlerConfiguration, INavigationHandlerConfiguration navigationHandlerConfiguration, INavigationHandler navigationHandler)
        {
            _navigationHandler = navigationHandler;

            exceptionHandlerConfiguration.AddExceptionCallback(ShowExceptionMessageCallback);
            informationHandlerConfiguration.AddInformationCallback(ShowInformationMessageAsyncCallback);
            navigationHandlerConfiguration.AddNavigationRequestedCallback(NavigateToViewModelCallback);

            _navigationHandler.NavigateTo <DownloadEntriesOverviewViewModel>(ViewModelParameterCollection.Empty);
        }
Example #13
0
        public static IDisposable Navigate(NavigationRequest navigationRequest, INavigationHandler navigationHandler, Action <ResponseStatus> statusCallback)
        {
            Guard.ArgumentNotNull(navigationRequest, "navigationRequest");
            Guard.ArgumentNotNull(navigationHandler, "navigationHandler");

            // if the request already had a token then dispose it
            if (navigationRequest.Token != null)
            {
                navigationRequest.Token.Dispose();
            }

            // create a new token
            var _disposableToken = new DisposableToken();

            navigationRequest.Token = _disposableToken;

            // and process the response
            navigationHandler.ProcessRequest(navigationRequest, async(b) =>
            {
                // if the handler will not process it - note we don't return the
                if (!b)
                {
                    statusCallback.Notify(ResponseStatus.Cancelled);
                    _disposableToken.Dispose();
                    return;
                }

                // if the token was already disposed then we tell the handler it was cancelled
                if (_disposableToken.IsDisposed)
                {
                    statusCallback.Notify(ResponseStatus.Cancelled);
                    await navigationHandler.ProcessResponseAsync(new NavigationResponse(navigationRequest, ResponseStatus.Cancelled, null, null));
                    return;
                }

                // we delegate to the routing engine
                Resolve(navigationRequest, async(r) =>
                {
                    // if not cancelled
                    if (!_disposableToken.IsDisposed)
                    {
                        await navigationHandler.ProcessResponseAsync(r);
                        statusCallback.Notify(r.Status);
                    }
                    else
                    {
                        await navigationHandler.ProcessResponseAsync(new NavigationResponse(navigationRequest, ResponseStatus.Cancelled, null, null));
                        statusCallback.Notify(ResponseStatus.Cancelled);
                    }
                });
            });

            return(_disposableToken);
        }
Example #14
0
        public ViewPresenter(INavigation navigation, IServiceProvider serviceProvider)
        {
            _navigation      = navigation ?? throw new ArgumentNullException(nameof(navigation));
            _serviceProvider = serviceProvider ?? throw new ArgumentNullException(nameof(serviceProvider));

            _stateMachine = CreateNavigationStateMachine();

            LoginNavigationHandler    = new LoginNavigationHandler(_serviceProvider, _navigation, _stateMachine);
            TabsNavigationHandler     = new TabsNavigationHandler(_serviceProvider, _navigation, _stateMachine);
            SelectorNavigationHandler = new SelectorNavigationHandler(_serviceProvider, _navigation, _stateMachine);
        }
Example #15
0
 /// <summary>
 /// Initializes a new instance of the <see cref="SearchVideosViewModel"/> class.
 /// </summary>
 /// <param name="ytClient">YouTube Client.</param>
 /// <param name="properties">Platform Properties.</param>
 /// <param name="resource">Resources.</param>
 /// <param name="database">Database.</param>
 /// <param name="error">Error Handler.</param>
 /// <param name="navigation">Navigation Handler.</param>
 public SearchVideosViewModel(
     YoutubeClient ytClient,
     IPlatformProperties properties,
     IResourceHelper resource,
     IDatabase database,
     IErrorHandler error,
     INavigationHandler navigation)
     : base(properties, resource, database, error, navigation)
 {
     this.ytClient = ytClient ?? throw new ArgumentNullException(nameof(ytClient));
 }
 /// <summary>
 /// Initializes a new instance of the <see cref="ImageGalleryViewModel"/> class.
 /// </summary>
 /// <param name="popup">Popup.</param>
 /// <param name="client">API Client.</param>
 /// <param name="properties">Platform Properties.</param>
 /// <param name="resource">Resources.</param>
 /// <param name="database">Database.</param>
 /// <param name="error">Error Handler.</param>
 /// <param name="navigation">Navigation Handler.</param>
 public ImageGalleryViewModel(
     ImageUpload.Mobile.Interfaces.IPopup popup,
     ImageEndpoint client,
     IPlatformProperties properties,
     IResourceHelper resource,
     IDatabase database,
     IErrorHandler error,
     INavigationHandler navigation)
     : base(properties, resource, database, error, navigation)
 {
     this.popup  = popup;
     this.client = client;
     this.Images = new ObservableCollection <IImage>();
 }
        //public static bool TryGetNavigationHandler(string name, out INavigationHandler handler)
        //{
        //    Guard.ArgumentNotNullOrWhiteSpace(name, "name");

        //    handler = null;
        //    lock (_handlersLock)
        //    {
        //        WeakReference _handlerRef = null;
        //        if (!_navigationHandlers.TryGetValue(name, out _handlerRef)) return false;
        //        if (_handlerRef == null || !_handlerRef.IsAlive) return false;
        //        handler = (INavigationHandler)_handlerRef.Target;
        //        return (handler != null);
        //    }
        //}

        public static void RegisterNavigationHandler(string name, INavigationHandler handler)
        {
            Guard.ArgumentNotNullOrWhiteSpace(name, "name");
            Guard.ArgumentNotNull(handler, "handler");

            lock (_handlersLock)
            {
                if (_navigationHandlers.ContainsKey(name))
                {
                    _navigationHandlers[name] = new WeakReference(handler);
                }
                else
                {
                    _navigationHandlers.Add(name, new WeakReference(handler));
                }
            }
        }
 public EntrepreneurMapNavigationVM(INavigationHandler navigationHandler, MapBarShortcuts shortcuts)
 {
     this._navigationHandler          = navigationHandler;
     this._shortcuts                  = shortcuts;
     this.IsKingdomEnabled            = Hero.MainHero.MapFaction.IsKingdomFaction;
     this.IsPartyEnabled              = true;
     this.IsInventoryEnabled          = true;
     this.IsClanEnabled               = true;
     this.IsCharacterDeveloperEnabled = true;
     this.IsQuestsEnabled             = true;
     this.IsKingdomActive             = false;
     this.IsPartyActive               = false;
     this.IsInventoryActive           = false;
     this.IsClanActive                = false;
     this.IsCharacterDeveloperActive  = false;
     this.IsQuestsActive              = false;
     this.RefreshValues();
 }
Example #19
0
        /// <summary>
        /// Initializes a new instance of the <see cref="VideoCaptionViewModel"/> class.
        /// </summary>
        /// <param name="video">YouTube video.</param>
        /// <param name="captionTrack">Captions.</param>
        /// <param name="properties">Platform Properties.</param>
        /// <param name="resource">Resources.</param>
        /// <param name="database">Database.</param>
        /// <param name="error">Error Handler.</param>
        /// <param name="navigation">Navigation Handler.</param>
        public VideoCaptionViewModel(
            Video video,
            ClosedCaptionTrack captionTrack,
            IPlatformProperties properties,
            IResourceHelper resource,
            IDatabase database,
            IErrorHandler error,
            INavigationHandler navigation)
            : base(properties, resource, database, error, navigation)
        {
            if (captionTrack == null)
            {
                throw new ArgumentNullException(nameof(captionTrack));
            }

            this.Video        = video;
            this.CaptionTrack = captionTrack;
            this.Captions     = captionTrack.Captions.ToList();
        }
        public static INavigationHandler ResolveHandlerInVisualTree(DependencyObject element)
        {
            Guard.ArgumentNotNull(element, "element");

            // OPTION 4. else, we try and check the visual tree
            DependencyObject   _visualTreeElement = element;
            INavigationHandler _visualTreeHandler = NavigationService.GetNavigationHandler(_visualTreeElement);

            while (_visualTreeElement != null)
            {
                if (_visualTreeHandler != null)
                {
                    return(_visualTreeHandler);
                }
                _visualTreeElement = VisualTreeHelper.GetParent(_visualTreeElement);
                _visualTreeHandler = NavigationService.GetNavigationHandler(_visualTreeElement);
            }

            return(null);
        }
        /// <summary>
        /// Initializes a new instance of the <see cref="MainMenuViewModel"/> class.
        /// </summary>
        /// <param name="database">Database.</param>
        /// <param name="error">Error Handler.</param>
        /// <param name="navigation">Navigation Handler.</param>
        public MainMenuViewModel(IDatabase database, IErrorHandler error, INavigationHandler navigation)
            : base(database, error, navigation)
        {
            this.MainMenuItems = new List <MainMenuItem>()
            {
                new MainMenuItem()
                {
                    Title      = "Main Feed",
                    IconSource = "",
                    Page       = new NavigationPage(new MainFeedPage()),
                },
                new MainMenuItem()
                {
                    Title      = "Settings",
                    IconSource = "",
                    Page       = new NavigationPage(new SettingsPage()),
                },
            };

            this.SelectedItem = this.MainMenuItems.First();
        }
Example #22
0
 public EntrepreneurMapVM(
     INavigationHandler navigationHandler,
     IMapStateHandler mapStateHandler,
     MapBarShortcuts shortcuts,
     Action openArmyManagement)
 {
     this._shortcuts                    = shortcuts;
     this._openArmyManagement           = openArmyManagement;
     this._navigationHandler            = navigationHandler;
     this._mapStateHandler              = mapStateHandler;
     this._refreshTimeSpan              = Campaign.Current.GetSimplifiedTimeControlMode() == CampaignTimeControlMode.UnstoppableFastForward ? 0.1f : 2f;
     this._needToBePartOfKingdomText    = GameTexts.FindText("str_need_to_be_a_part_of_kingdom", (string)null);
     this._cannotGatherWhileInEventText = GameTexts.FindText("str_cannot_gather_army_while_in_event", (string)null);
     this._needToBeLeaderToManageText   = GameTexts.FindText("str_need_to_be_leader_of_army_to_manage", (string)null);
     this._mercenaryCannotManageText    = GameTexts.FindText("str_mercenary_cannot_manage_army", (string)null);
     this.TutorialNotification          = new ElementNotificationVM();
     this.MapInfo        = new MapInfoVM();
     this.MapTimeControl = new MapTimeControlVM(shortcuts, new Action(this.OnTimeControlChange));
     this.MapNavigation  = new EntrepreneurMapNavigationVM(navigationHandler, shortcuts);
     this.GatherArmyHint = new HintViewModel();
     this.OnRefresh();
     this.IsEnabled = true;
     Game.Current.EventManager.RegisterEvent <TutorialNotificationElementChangeEvent>(new Action <TutorialNotificationElementChangeEvent>(this.OnTutorialNotificationElementIDChange));
 }
 public RegistrationPageHandler(IUmbracoMapper mapper, IMetadataHandler metadataHandler, INavigationHandler navigationHandler)
     : base(mapper, metadataHandler, navigationHandler)
 {
 }
 /// <summary>
 /// Initializes a new instance of the <see cref="ImgurView"/> class.
 /// </summary>
 /// <param name="image">Image.</param>
 /// <param name="handler">Navigation Handler.</param>
 public ImgurView(IImage image, INavigationHandler handler)
 {
     InitializeComponent();
     this.handler        = handler;
     this.BindingContext = this.image = image;
 }
 public static void SetHandler(DependencyObject dependencyObject, INavigationHandler handler)
 {
     dependencyObject.SetValue(HandlerProperty, handler);
 }
 public ControllerActionRequest(String requestUrl, ParametersCollection requestParameters, string siteArea, INavigationHandler handler, Object sender)
     : base(requestUrl, requestParameters, siteArea)
 {
     _sender  = sender;
     _handler = handler;
 }
 public ControllerActionRequest(String requestUrl, ParametersCollection requestParameters, string siteArea, INavigationHandler handler)
     : this(requestUrl, requestParameters, siteArea, handler, null)
 {
 }
Example #28
0
 /// <summary>
 /// Initializes a new instance of the <see cref="BaseViewModel"/> class.
 /// </summary>
 /// <param name="properties">Platform Properties.</param>
 /// <param name="resource">Resources.</param>
 /// <param name="database">Database.</param>
 /// <param name="error">Error Handler.</param>
 /// <param name="navigation">Navigation Handler.</param>
 public BaseViewModel(IPlatformProperties properties, IResourceHelper resource, IDatabase database, IErrorHandler error, INavigationHandler navigation)
 {
     this.Error              = error;
     this.Navigation         = navigation;
     this.Database           = database;
     this.PlatformProperties = properties;
     this.Resources          = resource;
 }
Example #29
0
 protected virtual void Awake()
 {
     animator                 = GetComponent <Animator>();
     navigationHandler        = GetComponent <INavigationHandler>();
     variablesStringFormatter = new VariablesStringFormatter();
 }
 /// <summary>
 /// Initializes a new instance of the <see cref="BaseViewModel"/> class.
 /// </summary>
 /// <param name="database">Database.</param>
 /// <param name="error">Error Handler.</param>
 /// <param name="navigation">Navigation Handler.</param>
 public BaseViewModel(IDatabase database, IErrorHandler error, INavigationHandler navigation)
 {
     this.Database   = database;
     this.Error      = error;
     this.Navigation = navigation;
 }
 public ListingPageHandler(IUmbracoMapper mapper, IMetadataHandler metadataHandler, INavigationHandler navigationHandler)
     : base(mapper, metadataHandler, navigationHandler)
 {
 }
 public ContactPageHandler(IUmbracoMapper mapper, IMetadataHandler metadataHandler, INavigationHandler navigationHandler)
     : base(mapper, metadataHandler, navigationHandler)
 {
 }