コード例 #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" });
            });
        }
コード例 #3
0
        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
ファイル: Startup.cs プロジェクト: cojegede/BlazorTypography
        // 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;
 }
コード例 #9
0
        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;
 }
コード例 #13
0
        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;
 }
コード例 #18
0
        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());
 }
コード例 #27
0
        /// <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));
 }
コード例 #29
0
        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;
 }
コード例 #31
0
 public SocialMediaConnections(IUriHelper uriHelper)
 {
     _uriHelper = uriHelper;
 }