Пример #1
0
        private async Task sendPush(string userTag, string message)
        {
            var httpClientFactory = new LocalHostTestHttpClientFactory();
            var settingsCache     = SettingsCache.GetInstance();
            var POST_URL          = $"{MagicValues.BackendUrl}/api/Publish";

            var publishModel = new PublishModel
            {
                message = message,
                to_tag  = userTag
            };

            using (var httpClient = httpClientFactory.CreateHttpClient(settingsCache.GetAuthenticationToken().Token))
            {
                try
                {
                    var json    = JsonConvert.SerializeObject(publishModel);
                    var content = new StringContent(json,
                                                    System.Text.Encoding.UTF8, "application/json");
                    var response = await httpClient.PostAsync(POST_URL, content);
                }
                catch (Exception ex)
                {
                    MessageDialog alert = new MessageDialog(ex.Message, "Failed to send message");
                    await alert.ShowAsync();
                }
            }
        }
Пример #2
0
 protected override void Load(ContainerBuilder builder)
 {
     builder.RegisterType <JwtAuthService>()
     .As <IAuthenticationService>();
     builder
     .RegisterInstance(SettingsCache.GetInstance())
     .As <IAuthenticationCache>()
     .SingleInstance();
 }
Пример #3
0
 protected override void Load(ContainerBuilder builder)
 {
     builder
     .RegisterInstance(SettingsCache.GetInstance())
     .As <IRegistrationCache>()
     .SingleInstance();
     builder
     .RegisterType <RegistrationService>()
     .As <IRegistrationService>()
     .SingleInstance();
     builder
     .RegisterType <RegisterClient>()
     .SingleInstance();
     builder
     .RegisterType <PushNotificationChannelProvider>()
     .SingleInstance();
 }