예제 #1
0
 public RouteService(IRestService restService, IUriHelper uriHelper, SitecoreItemService sitecoreItemService, BlazorStateMachine blazorStateMachine)
 {
     _restService         = restService;
     _uriHelper           = uriHelper;
     _sitecoreItemService = sitecoreItemService;
     _blazorStateMachine  = blazorStateMachine;
 }
예제 #2
0
        // This method gets called by the runtime. Use this method to add services to the container.
        // For more information on how to configure your application, visit https://go.microsoft.com/fwlink/?LinkID=398940
        public void ConfigureServices(IServiceCollection services)
        {
            services.AddMvc().AddNewtonsoftJson();
            services.AddRazorPages();

            services.AddServerSideBlazor();

            // Server Side Blazor doesn't register HttpClient by default
            if (!services.Any(x => x.ServiceType == typeof(HttpClient)))
            {
                // Setup HttpClient for server side in a client side compatible fashion
                services.AddScoped <HttpClient>(s =>
                {
                    // Creating the URI helper needs to wait until the JS Runtime is initialized, so defer it.
                    IUriHelper uriHelper = s.GetRequiredService <IUriHelper>();
                    return(new HttpClient
                    {
                        BaseAddress = new Uri(uriHelper.GetBaseUri())
                    });
                });
            }

            services.AddResponseCompression(opts =>
            {
                opts.MimeTypes = ResponseCompressionDefaults.MimeTypes.Concat(
                    new[] { "application/octet-stream" });
            });
        }
        public static string GetQueryParameterValue(this IUriHelper uriHelper, string key)
        {
            var uri = new Uri(uriHelper.GetAbsoluteUri());

            Microsoft.AspNetCore.WebUtilities.QueryHelpers.ParseQuery(uri.Query).TryGetValue(key, out var value);
            return(value);
        }
예제 #4
0
 public ApiClientService(HttpClient httpClient, IUriHelper uriHelper, LocalStorage storage, StaticClientInfoViewModel staticClientInfoViewModel)
 {
     _httpClient = httpClient;
     _uriHelper  = uriHelper;
     _storage    = storage;
     _staticClientInfoViewModel = staticClientInfoViewModel;
 }
예제 #5
0
        // This method gets called by the runtime. Use this method to add services to the container.
        // For more information on how to configure your application, visit https://go.microsoft.com/fwlink/?LinkID=398940
        public void ConfigureServices(IServiceCollection services)
        {
            // Server Side Blazor doesn't register HttpClient by default
            if (!services.Any(x => x.ServiceType == typeof(HttpClient)))
            {
                // Setup HttpClient for server side in a client side compatible fashion
                services.AddScoped <HttpClient>(s =>
                {
                    // Creating the URI helper needs to wait until the JS Runtime is initialized, so defer it.
                    IUriHelper uriHelper = s.GetRequiredService <IUriHelper>();
                    return(new HttpClient
                    {
                        BaseAddress = new Uri(uriHelper.GetBaseUri())
                    });
                });
            }

            services.AddRazorPages();
            services.AddServerSideBlazor();
            services.AddBlazorPrettyCode(config =>
            {
                config.IsDevelopmentMode = true;
                config.ShowLineNumbers   = true;
                config.DefaultTheme      = "SolarizedLight";
            });
            services.AddTypography();
        }
예제 #6
0
 public InitializeRouteHandler(
     IStore aStore,
     IUriHelper aUriHelper
     ) : base(aStore)
 {
     UriHelper = aUriHelper;
 }
예제 #7
0
        public QueryString(IUriHelper uri)
        {
            Ensure.NotNull(uri, "uri");
            this.uri = uri;

            uri.OnLocationChanged += OnLocationChanged;
        }
예제 #8
0
 public LayoutService(ComponentFactory componentFactory, RouteService routeService, IUriHelper uriHelper, BlazorStateMachine blazorStateMachine)
 {
     _componentFactory   = componentFactory;
     _routeService       = routeService;
     _uriHelper          = uriHelper;
     _blazorStateMachine = blazorStateMachine;
 }
        public NavigationService()
        {
            jsRuntime = Splat.Locator.Current.GetServiceExt <IJSRuntime>();
            uriHelper = Splat.Locator.Current.GetServiceExt <IUriHelper>();

            this.uriHelper.OnLocationChanged += UriHelper_OnLocationChanged;
        }
예제 #10
0
 public HttpApiClientRequestBuilderFactory(HttpClient httpClient, IUriHelper uriHelper, IBrowserCookieService browserCookieService, IJsInterop jsInterop)
 {
     _uriHelper  = uriHelper;
     _httpClient = httpClient;
     this.browserCookieService = browserCookieService;
     this.jsInterop            = jsInterop;
 }
예제 #11
0
 public AppState(HttpClient httpClient,
                 ILocalStorage localStorage,
                 IUriHelper uriHelper)
 {
     _httpClient   = httpClient;
     _localStorage = localStorage;
     _uriHelper    = uriHelper;
 }
예제 #12
0
 public HttpApiClientRequestBuilderFactory(HttpClient httpClient, IUriHelper uriHelper, ILogger <HttpApiClientRequestBuilder> logger, Toastr toastr, IUtil util)
 {
     _uriHelper  = uriHelper;
     _httpClient = httpClient;
     _logger     = logger;
     _toastr     = toastr;
     _util       = util;
 }
        public string GetHtml(int page, int limit, int count, IUriHelper uriHelper)
        {
            var    uri     = new Uri(uriHelper.GetAbsoluteUri());
            string baseUrl = uriHelper.GetAbsoluteUri().Split('?')[0];
            string filters = GetQueryStringFilters(uri);

            return(GetHtml(page, limit, count, baseUrl, filters));
        }
예제 #14
0
 public DocumentMetadataService(IDocumentMetadataSettingsProvider metadataProvider, IUriHelper uriHelper)
 {
     UriHelper                    = uriHelper;
     MetadataProvider             = metadataProvider;
     UriHelper.OnLocationChanged += OnLocationChanged;
     MetadataProvider.GetDefault()?.Apply(Metadata);
     LoadMetadataForPage(GetPageNameByLocation(UriHelper.GetAbsoluteUri()));
 }
예제 #15
0
 public UserService(IUriHelper uri, HttpClient client)
 {
     http      = client;
     Uri       = uri;
     _imageUrl = "default.jpg";
     _emial    = "";
     _frineds  = new List <FriendModel>();
 }
예제 #16
0
 public UserService(HttpClient _http, IUriHelper uri)
 {
     http      = _http;
     Uri       = uri;
     _imageUrl = "default.jpg";
     _emial    = "";
     _frineds  = new List <FriendModel>();
 }
예제 #17
0
 public HttpApiClientRequestBuilder(HttpClient httpClient, string uri, IUriHelper uriHelper, IBrowserCookieService browserCookieService, ElementRef elementRef = default(ElementRef))
 {
     _uri                      = uri;
     this.uriHelper            = uriHelper;
     _httpClient               = httpClient;
     _elementRef               = elementRef;
     this.browserCookieService = browserCookieService;
 }
        public AuthenticationService(HttpClient httpClient, IJSRuntime jsRuntime, IUriHelper uriHelper, ClientSettings settings)
        {
            httpClientService         = httpClient;
            jsInProcessRuntimeService = (jsRuntime as IJSInProcessRuntime);
            uriHelperService          = uriHelper;
            clientSettings            = settings;

            ValidateSession();
        }
예제 #19
0
        public static string AddBaseUrl(this string url, IUriHelper uriHelper)
        {
            if (url.StartsWith("/"))
            {
                url = url.Substring(1);
            }

            return(new Uri(new Uri(uriHelper.GetBaseUri()), url).ToString());
        }
예제 #20
0
 public ApplicationState(HttpClient httpClient, LocalStorage localStorage, JwtDecode jwtDecoder, IUriHelper uriHelper)
 {
     _httpClient   = httpClient;
     _localStorage = localStorage;
     _jwtDecoder   = jwtDecoder;
     _uriHelper    = uriHelper;
     UserName      = String.Empty;
     UserRoles     = string.Empty;
 }
예제 #21
0
        public static string WithBaseUrl_UglyHackForGithub(this string url, IUriHelper uriHelper)
        {
            if (url.StartsWith("/"))
            {
                url = url.Substring(1);
            }

            return(new Uri(new Uri(uriHelper.GetBaseUri()), url).ToString());
        }
예제 #22
0
        public Navigator(IUriHelper uri, Interop interop)
        {
            Ensure.NotNull(uri, "uri");
            Ensure.NotNull(interop, "interop");
            this.uri     = uri;
            this.interop = interop;

            uri.OnLocationChanged += OnLocationChanged;
        }
예제 #23
0
        public static async Task AddAnimal(
            Dispatcher <IAction> dispatch,
            HttpClient http,
            Animal animalToAdd,
            IUriHelper helper)
        {
            await http.PostJsonAsync("/api/animals", animalToAdd);

            helper.NavigateTo("/animals");
            dispatch(new LoadAnimalsAction());
        }
예제 #24
0
        public static async Task AddFood(
            Dispatcher <IAction> dispatch,
            HttpClient http,
            FoodItem foodItemToAdd,
            IUriHelper helper)
        {
            await http.PostJsonAsync("/api/food", foodItemToAdd);

            helper.NavigateTo("/food");
            dispatch(new LoadFoodsAction());
        }
예제 #25
0
 public CategoryService(
     QueryOptions queryOptions, DropdownList dropdownList,
     ModelValidator modelValidator, IUriHelper uriHelper, JSInterop js,
     DataContextFactory contextFactory) :
     base(queryOptions, modelValidator)
 {
     DropdownList    = dropdownList;
     _uriHelper      = uriHelper;
     _js             = js;
     _contextFactory = contextFactory;
 }
예제 #26
0
 public RouteManager(
     IUriHelper aUriHelper,
     IMediator aMediator,
     IStore aStore)
 {
     UriHelper = aUriHelper;
     Mediator  = aMediator;
     Store     = aStore;
     UriHelper.OnLocationChanged += OnLocationChanged;
     Mediator.Send(new InitializeRouteRequest());
 }
        /// <summary>
        /// Opens PlanningPoker page with specified team name and member name.
        /// </summary>
        /// <param name="uriHelper">Helper to navigate to URL.</param>
        /// <param name="team">Scrum team name to include in URL.</param>
        /// <param name="member">Member name to include in URL.</param>
        public static void OpenPlanningPokerPage(IUriHelper uriHelper, ScrumTeam team, string member)
        {
            if (uriHelper == null)
            {
                throw new ArgumentNullException(nameof(uriHelper));
            }

            var urlEncoder = UrlEncoder.Default;
            var uri        = $"PlanningPoker/{urlEncoder.Encode(team.Name)}/{urlEncoder.Encode(member)}";

            uriHelper.NavigateTo(uri);
        }
예제 #28
0
 /// <summary>
 /// Initializes a new instance of the <see cref="CreateTeamController"/> class.
 /// </summary>
 /// <param name="planningPokerService">Planning poker client to create Scrum Team on server.</param>
 /// <param name="planningPokerInitializer">Objects that initialize new Planning Poker game.</param>
 /// <param name="messageBoxService">Service to display message to user.</param>
 /// <param name="busyIndicatorService">Service to display that operation is in progress.</param>
 /// <param name="uriHelper">Service to navigate to specified URL.</param>
 public CreateTeamController(
     IPlanningPokerClient planningPokerService,
     IPlanningPokerInitializer planningPokerInitializer,
     IMessageBoxService messageBoxService,
     IBusyIndicatorService busyIndicatorService,
     IUriHelper uriHelper)
 {
     _planningPokerService     = planningPokerService ?? throw new ArgumentNullException(nameof(planningPokerService));
     _planningPokerInitializer = planningPokerInitializer ?? throw new ArgumentNullException(nameof(planningPokerInitializer));
     _messageBoxService        = messageBoxService ?? throw new ArgumentNullException(nameof(messageBoxService));
     _busyIndicatorService     = busyIndicatorService ?? throw new ArgumentNullException(nameof(busyIndicatorService));
     _uriHelper = uriHelper ?? throw new ArgumentNullException(nameof(uriHelper));
 }
        public AuthenticationServiceBase(IComponentContext componentContext, HttpClient httpClient, IJSRuntime jsRuntime, IUriHelper uriHelper, ClientSettings settings)
        {
            componentContextService = componentContext ?? throw new ArgumentNullException(nameof(componentContext));;
            httpClientService       = httpClient ?? throw new ArgumentNullException(nameof(httpClient));;
            jsRuntimeService        = jsRuntime ?? throw new ArgumentNullException(nameof(jsRuntime));;
            uriHelperService        = uriHelper ?? throw new ArgumentNullException(nameof(uriHelper));;
            clientSettings          = settings ?? throw new ArgumentNullException(nameof(settings));

            injectJavascriptTimer          = new Timer(50);
            injectJavascriptTimer.Elapsed += async(Object source, ElapsedEventArgs e) => await InjectJavascript();

            injectJavascriptTimer.Start();
        }
예제 #30
0
 public AppState(HttpClient httpInstance
                 , ISyncLocalStorageService localStorage
                 , IUriHelper uriHelper
                 , IJSRuntime jsRuntime
                 , ILogger <AppState> logger
                 )
 {
     this._httpClient   = httpInstance;
     this._localStorage = localStorage;
     this._uriHelper    = uriHelper;
     this._jsRuntime    = jsRuntime;
     this._logger       = logger;
 }
 public SocialMediaConnections(IUriHelper uriHelper)
 {
     _uriHelper = uriHelper;
 }