private void OnViewServiceRequest(object?sender, ViewServiceRequestEventArgs e)
        {
            var foundViewService = this.Owner.TryFindViewService(e.ViewServiceType);

            if (foundViewService != null)
            {
                e.ViewService = foundViewService;
            }
        }
Esempio n. 2
0
        /// <summary>
        /// Gets the view service of the given type.
        /// </summary>
        protected T GetViewService <T>()
            where T : class
        {
            var eventArgs = new ViewServiceRequestEventArgs(typeof(T));

            this.ViewServiceRequest?.Invoke(this, eventArgs);

            if (!(eventArgs.ViewService is T result))
            {
                throw new ApplicationException($"Unable to get view service of type {typeof(T).FullName}!");
            }
            return(result);
        }
Esempio n. 3
0
        private void OnViewModel_ViewServiceRequest(object?sender, ViewServiceRequestEventArgs e)
        {
            var foundViewService = this.TryFindViewService(e.ViewServiceType);

            e.ViewService = foundViewService;
        }