示例#1
0
        public SettingsViewModel(ISettingsService settingsService, ILocationService locationService, IDependencyService dependencyService)
        {
            _settingsService   = settingsService;
            _locationService   = locationService;
            _dependencyService = dependencyService;

            _useAzureServices       = !_settingsService.UseMocks;
            _identityEndpoint       = _settingsService.IdentityEndpointBase;
            _gatewayCatalogEndpoint = _settingsService.GatewayCatalogEndpointBase;
            _latitude          = double.Parse(_settingsService.Latitude, CultureInfo.CurrentCulture);
            _longitude         = double.Parse(_settingsService.Longitude, CultureInfo.CurrentCulture);
            _useFakeLocation   = _settingsService.UseFakeLocation;
            _allowGpsLocation  = _settingsService.AllowGpsLocation;
            _gpsWarningMessage = string.Empty;
        }
示例#2
0
 public WebResourceDeleter(IAppContext appContext
                           , IWebResourceRepository webResourceRepository
                           , ILocalizedLabelService localizedLabelService
                           , ISolutionComponentService solutionComponentService
                           , IDependencyService dependencyService
                           , IDependencyChecker dependencyChecker)
 {
     _appContext               = appContext;
     _webResourceRepository    = webResourceRepository;
     _localizedLabelService    = localizedLabelService;
     _solutionComponentService = solutionComponentService;
     _dependencyService        = dependencyService;
     _dependencyChecker        = dependencyChecker;
     _cacheService             = new Caching.CacheManager <Domain.WebResource>(_appContext.OrganizationUniqueName + "webresource");
 }
示例#3
0
        /// <summary>
        /// Constructeur, on cree a partir d'une carte recuperee par le client les elements utilises pour l'affichage.
        /// On recupere egalement a cette occasion les checklist et pieces jointes.
        /// </summary>
        /// <param name="carte">la carte ciblee</param>
        public CardViewModel(Card card, IDependencyService dependencyService)
        {
            _dependencyService = dependencyService;
            attachments        = new ObservableCollection <Attachment>();
            checklists         = new ObservableCollection <CheckListViewModel>();
            labels             = new ObservableCollection <LabelViewModel>();
            this.carte         = card;

            foreach (Model.Label label in carte.labels)
            {
                this.labels.Add(new LabelViewModel(label));
            }

            GoToAttachment = new Command((url) => Device.OpenUri(new Uri(url.ToString())));
        }
示例#4
0
 public OpportunityFormController(OpportunityForm instance)
 {
     this.frmOpportunity       = instance;
     this.srvOrganization      = SamsaraAppContext.Resolve <IOrganizationService>();
     this.srvBidder            = SamsaraAppContext.Resolve <IBidderService>();
     this.srvDependency        = SamsaraAppContext.Resolve <IDependencyService>();
     this.srvEndUser           = SamsaraAppContext.Resolve <IEndUserService>();
     this.srvAsesor            = SamsaraAppContext.Resolve <IAsesorService>();
     this.srvTender            = SamsaraAppContext.Resolve <ITenderService>();
     this.srvOpportunity       = SamsaraAppContext.Resolve <IOpportunityService>();
     this.srvOpportunityType   = SamsaraAppContext.Resolve <IOpportunityTypeService>();
     this.srvOpportunityStatus = SamsaraAppContext.Resolve <IOpportunityStatusService>();
     this.srvManufacturer      = SamsaraAppContext.Resolve <IManufacturerService>();
     this.srvOpportunityLog    = SamsaraAppContext.Resolve <IOpportunityLogService>();
     this.InitializeFormControls();
 }
示例#5
0
        private void InitApp()
        {
            this.settingsService = ViewModelLocator.Resolve <ISettingsService>();
            this.DatabaseService = ViewModelLocator.Resolve <IDatabaseService>();

            IDependencyService dependencyService = ViewModelLocator.Resolve <IDependencyService>();
            string             dbPath            = dependencyService.Get <ILocalFileHelper>().GetLocalFilePath("aerenigma.db3");

            this.DatabaseService.InitializeAsync(dbPath);


            if (!this.settingsService.UseMocks)
            {
                ViewModelLocator.UpdateDependencies(this.settingsService.UseMocks);
            }
        }
示例#6
0
        public FavAdvertViewModel(INavigationService navigationService, IPageDialogService pageDialog,
                                  IRzeszowiak RzeszowiakRepository, ISetting setting, IDependencyService dependencyService, IEventAggregator eventAggregator)
        {
            Debug.Write("FavAdvertViewModel Contructor");
            _setting = setting ?? throw new NullReferenceException("ISetting setting == null !");
            _rzeszowiakRepository = RzeszowiakRepository ?? throw new NullReferenceException("ListViewModel => IRzeszowiakRepository RzeszowiakRepository == null !");
            _navigationService    = navigationService ?? throw new NullReferenceException("INavigationService navigationService == null !");
            _pageDialog           = pageDialog ?? throw new NullReferenceException("IPageDialogService pageDialog == null !");
            _dependencyService    = dependencyService ?? throw new NullReferenceException("IDependencyService setting == null !");
            _eventAggregator      = eventAggregator ?? throw new NullReferenceException("IEventAggregator eventAggregator == null !");

            ListViewItemTapped    = new Command <AdvertShort>(ListViewTappedAsync);
            DeleteAllButtonTapped = new Command(DeleteAllAdverFromDb);
            _eventAggregator.GetEvent <AdvertDeleteFavEvent>().Subscribe(DeleteFromList);
            _eventAggregator.GetEvent <AdvertAddFavEvent>().Subscribe(AddToList);
        }
示例#7
0
        public ListsViewModel(List liste, IDependencyService DS)
        {
            _dependencyService = DS;
            this.liste         = liste;
            this.cards         = new ObservableCollection <CardViewModel>();
            var position = 0;

            foreach (var card in liste.cards)
            {
                this.cards.Add(new CardViewModel(card, _dependencyService)
                {
                    pos = position
                });
                position += 1;
            }
        }
示例#8
0
 public ReportService(IAppContext appContext
                      , IReportRepository reportRepository
                      , ILocalizedLabelService localizedLabelService
                      , ISolutionComponentService solutionComponentService
                      , IRoleObjectAccessService roleObjectAccessService
                      , IDependencyService dependencyService
                      , IEventPublisher eventPublisher)
 {
     _appContext               = appContext;
     _reportRepository         = reportRepository;
     _localizedLabelService    = localizedLabelService;
     _solutionComponentService = solutionComponentService;
     _roleObjectAccessService  = roleObjectAccessService;
     _dependencyService        = dependencyService;
     _eventPublisher           = eventPublisher;
 }
示例#9
0
        /// <summary>
        /// コンストラクタ
        /// </summary>
        /// <param name="pageDialogServece">Prismのダイアログサービス</param>
        public MainPageViewModel(IPageDialogService pageDialogServece, IDependencyService dependencyService)
        {
            _customDialogService = dependencyService.Get <ICustomDialogService>();
            _pageDialogService   = pageDialogServece;

            // カスタムダイアログ表示コマンドの購読。
            ShowCostomDialogCommand = new AsyncReactiveCommand();
            ShowCostomDialogCommand.Subscribe(async _ => await OnShowCustomDialogCommandAsync());

            // 照合ダイアログ表示コマンド(全部)の購読。
            ShowCollationCommand = new AsyncReactiveCommand();
            ShowCollationCommand.Subscribe(async _ => await OnShowCollationCommandAsync());

            // 照合ダイアログ表示コマンド(エラーなし)の購読。
            ShowNonErrorCommand = new AsyncReactiveCommand();
            ShowNonErrorCommand.Subscribe(async _ => await OnShowCollationNonErrorCommandAsync());
        }
 public AddNewPageViewModel(IPageDialogService dialogService, IDependencyService dependencyService)
 {
     _dialogService      = dialogService;
     _dependencyService  = dependencyService;
     EventTypeLabel      = "Select the Event Type*";
     ContactNameLabel    = "Add Contact*";
     RelationshipLabel   = "Select RelationShip";
     EventDateLabel      = "Select Event Date*";
     RemindLabel         = "Remind Before*";
     SelectedDate        = DateTime.Today;
     EventTypeCommand    = new DelegateCommand(async() => await selectEventTypeAsync());
     AddContactCommand   = new DelegateCommand(async() => await selectAddContactAsync());
     RelationshipCommand = new DelegateCommand(async() => await selectRelationshipAsync());
     EventDateCommand    = new DelegateCommand(async() => await selectEventDateAsync());
     RemindCommand       = new DelegateCommand(async() => await selectRemindBeforeAsync());
     SaveReminder        = new DelegateCommand(saveReminder);
 }
示例#11
0
        public sealed override void RegisterCustomDependencies(IDependencyService dependencyService)
        {
            // required services
            dependencyService.Register <IMessengerService, DefaultMessengerService>();
            dependencyService.Register <ISerializationService, DefaultSerializationService>();

            // required strategies
            dependencyService.Register <IBootStrapperStrategy, DefaultBootStrapperStrategy>();
            dependencyService.Register <ILifecycleStrategy, DefaultLifecycleStrategy>();
            dependencyService.Register <INavStateStrategy, DefaultNavStateStrategy>();
            dependencyService.Register <IExtendedSessionStrategy, DefaultExtendedSessionStrategy>();
            dependencyService.Register <IViewModelActionStrategy, DefaultViewModelActionStrategy>();
            dependencyService.Register <IViewModelResolutionStrategy, DefaultViewModelResolutionStrategy>();

            // custom
            RegisterDependencies(dependencyService);
        }
示例#12
0
        public MainViewModel(IDependencyService serviceLocator)
        {
            this.serviceLocator = serviceLocator;
            GetContact();
            Contact unContact = new Contact();

            Contacts = new ObservableCollection <ContactViewModel>(ListContacts
                                                                   .Select(c => new ContactViewModel(c)));


            SelectedContact = Contacts.FirstOrDefault();

            AddContact        = new AsyncDelegateCommand(OnAddContact);
            DeleteContact     = new AsyncDelegateCommand <ContactViewModel>(OnDeleteContact);
            EditContact       = new AsyncDelegateCommand <ContactViewModel>(OnEditContact);
            ShowContactDetail = new AsyncDelegateCommand <ContactViewModel>(OnShowContactDetails);
        }
示例#13
0
        /// <summary>
        /// Constructor for the Main view model.
        /// </summary>
        /// <param name="serviceLocator"></param>
        public MainViewModel(IDependencyService serviceLocator)
        {
            this.serviceLocator = serviceLocator;
            diaryService        = serviceLocator.Get <IDiaryService>();

            AddEntry    = new AsyncDelegateCommand(OnAddEntryAsync);
            SaveEntry   = new AsyncDelegateCommand(OnSaveEntryAsync, () => SelectedEntry == null ? false : SelectedEntry.CanSave);
            DeleteEntry = new AsyncDelegateCommand(OnDeleteEntryAsync, de => de != null || (SelectedEntry != null && !SelectedEntry.IsNew));
            Refresh     = new AsyncDelegateCommand(() => deEntries.RefreshAsync());
            SelectEntry = new AsyncDelegateCommand(() => serviceLocator.Get <INavigationService>().NavigateAsync(AppPage.Detail));

            // Lab3: Add logout command
            Logout = new AsyncDelegateCommand(OnClearAuthAsync);

            deEntries = new RefreshingCollection <DiaryEntryViewModel>(LoadDiaryEntriesAsync)
            {
                BeforeRefresh = c =>
                {
                    IsBusy = true;
                    return(SelectedEntry);
                },

                AfterRefresh = (c, o) =>
                {
                    IsBusy        = false;
                    SelectedEntry = (DiaryEntryViewModel)o;
                },

                RefreshFailed = (c, ex) =>
                {
                    IsBusy = false;

                    return(serviceLocator.Get <IMessageVisualizerService>().ShowMessage(
                               "Are you connected?", ex.Flatten(), "OK"));
                }
            };

            // Set the 1st entry as active.
            deEntries.RefreshAsync()
            .ContinueWith(tr =>
            {
                SelectedEntry = deEntries.FirstOrDefault();
            },
                          CancellationToken.None, TaskContinuationOptions.OnlyOnRanToCompletion, TaskScheduler.FromCurrentSynchronizationContext());
        }
示例#14
0
 public EntityDeleter(IAppContext appContext
                      , IEntityRepository entityRepository
                      , ISolutionComponentService solutionComponentService
                      , ILocalizedLabelService localizedLabelService
                      , IDependencyService dependencyService
                      , IDependencyChecker dependencyChecker
                      , IEnumerable <ICascadeDelete <Domain.Entity> > cascadeDeletes
                      )
 {
     _appContext               = appContext;
     _entityRepository         = entityRepository;
     _localizedLabelService    = localizedLabelService;
     _cacheService             = new Caching.CacheManager <Domain.Entity>(_appContext.OrganizationUniqueName + ":entities", EntityCache.BuildKey);
     _solutionComponentService = solutionComponentService;
     _dependencyService        = dependencyService;
     _dependencyChecker        = dependencyChecker;
     _cascadeDeletes           = cascadeDeletes;
 }
        // Constructeur
        public ContactListViewModel(IDependencyService serviceLocator)
        {
            this.serviceLocator = serviceLocator;

            // Récupérer la liste de contacts
            Contacts = new ObservableCollection <ContactViewModel>(
                ((IEnumerable <Contact>)(App.ContactRepo.GetAllContactAsync().Result)).Select(q => new ContactViewModel(q)));

            // Relier les ICommand à leur méthode
            AddContact        = new Command(async() => await OnAddContact());
            DeleteContact     = new Command <ContactViewModel>(async qvm => await OnDeleteContact(qvm));
            EditContact       = new Command <ContactViewModel>(async qvm => await OnEditContact(qvm));
            ShowContactDetail = new Command <ContactViewModel>(async qvm => await OnShowContactDetails(qvm));
            SendEmail         = new Command <ContactViewModel>(OnSendMail);
            Call              = new Command <ContactViewModel>(OnCall);
            Sms               = new Command <ContactViewModel>(OnSms);
            TakePhoto         = new Command(OnTakePhoto);
            FilterContactList = new Command(OnFilterContact);
        }
示例#16
0
        /// <summary>
        /// Registers the known services with the ServiceLocator type.
        /// </summary>
        /// <param name="defaultLocator">ServiceLocator, if null, DependencyService is used.</param>
        /// <param name="registerBehavior">Registration behavior</param>
        /// <returns>IDependencyService</returns>
        public static IDependencyService Init(IDependencyService defaultLocator, RegisterBehavior registerBehavior)
        {
            // If the ServiceLocator has already been set, then something used it before
            // Init was called. This is not allowed if they are going to change the locator.
            if (defaultLocator != null &&
                serviceLocator != null)
            {
                throw new InvalidOperationException(
                          $"Must call {nameof(XamUInfrastructure.Init)} before using any library features; " +
                          "ServiceLocator has already been set.");
            }

            // Assign the locator; either use the supplied one, or the default
            // DependencyService version if not supplied.
            if (defaultLocator == null)
            {
                defaultLocator = ServiceLocator;
            }
            else
            {
                Debug.Assert(serviceLocator == null);
                serviceLocator = defaultLocator;
            }

            // Register the services
            if ((registerBehavior & RegisterBehavior.MessageVisualizer) != 0)
            {
                defaultLocator.Register <IMessageVisualizerService, FormsMessageVisualizerService>();
            }

            if ((registerBehavior & RegisterBehavior.Navigation) != 0)
            {
                // Use a single instance for the navigation service and
                // register both interfaces against it.
                var navService = new FormsNavigationPageService();
                defaultLocator.Register <INavigationPageService>(navService);
                defaultLocator.Register <INavigationService>(navService);
            }

            defaultLocator.Register <IDependencyService>(defaultLocator);

            return(defaultLocator);
        }
示例#17
0
 public OptionSetDeleter(IAppContext appContext
                         , IOptionSetRepository optionSetRepository
                         , ISolutionComponentService solutionComponentService
                         , IOptionSetDetailDeleter optionSetDetailDeleter
                         , ILocalizedLabelService localizedLabelService
                         , IDependencyService dependencyService
                         , IDependencyChecker dependencyChecker
                         , IEnumerable <ICascadeDelete <Domain.OptionSet> > cascadeDeletes)
 {
     _appContext          = appContext;
     _optionSetRepository = optionSetRepository;
     _loc = _appContext.GetFeature <ILocalizedTextProvider>();
     _localizedLabelService    = localizedLabelService;
     _solutionComponentService = solutionComponentService;
     _optionSetDetailDeleter   = optionSetDetailDeleter;
     _dependencyService        = dependencyService;
     _dependencyChecker        = dependencyChecker;
     _cascadeDeletes           = cascadeDeletes;
     _cacheService             = new Caching.CacheManager <Domain.OptionSet>(_appContext.OrganizationUniqueName + ":optionsets", _appContext.PlatformSettings.CacheEnabled);
 }
示例#18
0
        public LoginCadastroViewModel(IDependencyService dependencyService) : base(dependencyService)
        {
            //DataStore = _dependencyService.Get<IUsuarioRepository>() ?? new UsuarioMock();

            ConfirmacaoSenha = "";
            UsuarioModel     = new UsuarioModel(App.CurrentTipoApp)
            {
                Email = "",
                Senha = "",
                PessoaJuridicaModel = new PessoaJuridicaModel()
                {
                    CNPJ        = "",
                    RazaoSocial = ""
                }
            };

            this.ResponseViewModel = new ObjectReturnRestService <UsuarioModel>();

            RegisterCommand = new Command(async() => await ExecuteRegisterCommand());
        }
示例#19
0
        /// <summary>
        /// Initializes a new instance of the type
        /// </summary>
        /// <param name="dependencyService">A service that can be used to retrieve dependencies that were injected</param>
        /// <param name="loggerFactory">A factory that can be used to create loggers</param>
        /// <param name="metricFactory">A factory that can be used to create metrics</param>
        /// <param name="webSocketConfiguration">The configuration of the web socket</param>
        /// <param name="bufferPool">The buffer pool used to retreive arrays</param>
        public WebSocketHandler(IDependencyService dependencyService, IWebSocketConfiguration webSocketConfiguration, IMetricFactory metricFactory, ILoggerFactory loggerFactory, IBufferPool bufferPool)
        {
            Guard.NotNull(nameof(metricFactory), metricFactory);
            Guard.NotNull(nameof(loggerFactory), loggerFactory);
            Guard.NotNull(nameof(bufferPool), bufferPool);
            Guard.NotNull(nameof(webSocketConfiguration), webSocketConfiguration);

            WebSocketConfiguration = webSocketConfiguration;
            BufferPool             = bufferPool;
            SessionId     = Guid.NewGuid();
            MetricFactory = metricFactory;
            Logger        = loggerFactory.CreateLogger($"Session Handler: {SessionId:N}");

            DependencyService = dependencyService;

            _errorCounter        = metricFactory.CreateCounter("WebSocket error counter", "Tracks the number of errors that have occurred since the start of the service", false, new string[0]);
            _serviceSessionGauge = metricFactory.CreateGauge("WebSocket sessions in progress", "Tracks the number of sessions underway", false, new string[0]);
            _sessionTimes        = metricFactory.CreateSummary("WebSocket session iteration times", "Tracks the time taken to execute an iteration in the session", 10, false, new string[0]);
            _receiveTimes        = metricFactory.CreateSummary("WebSocket message receive time", "Tracks the time taken to receive a message", 10, false, new string[0]);
        }
        /// <summary>
        /// Initializes a new instance of the <see cref="DependencyManagerUserState"/> class.
        /// </summary>
        /// <param name="depService">The dependency service.</param>
        /// <param name="logger">The logger.</param>
        /// <param name="callbackMethod">The callback method action.</param>
        /// <param name="force">The flag if operation should be forced.</param>
        /// <param name="recursive">The mode if all or only direct dependencies should be fetched.</param>
        public DependencyManagerUserState(IDependencyService depService, ILogger logger, Action callbackMethod, bool force = false, bool recursive = true)
        {
            if (depService == null)
            {
                // ReSharper disable LocalizableElement
                throw new ArgumentNullException("depService", "DependencyService cannot be null!");
                // ReSharper restore LocalizableElement
            }

            if (logger == null)
            {
                // ReSharper disable LocalizableElement
                throw new ArgumentNullException("logger", "Logger cannot be null!");
                // ReSharper restore LocalizableElement
            }

            DependencyService = depService;
            Logger            = logger;
            ForceOperation    = force;
            Callback          = callbackMethod;
            Recursive         = recursive;
        }
        public async Task OnProcessPhotoStream(Func <Stream> mediaFile)
        {
            IDependencyService locator = XamUInfrastructure.ServiceLocator;

            string id = await locator.Get <IIdentifyPicture>().IdentifyAsync(mediaFile);

            if (string.IsNullOrEmpty(id))
            {
                Error = "Sorry, I was unable to identify that plant. Please try again.";
            }

            var plant = await locator.Get <IPlantDetails>().GetPlantFromIdAsync(id);

            if (plant != null)
            {
                await locator.Get <INavigationService>().NavigateAsync(AppPages.Details, new DetailsViewModel(plant, mediaFile.Invoke()));
            }
            else
            {
                Error = $"Sorry, I could not find any information on {id}.";
            }
        }
示例#22
0
        /// <summary>
        /// Registers the known services with the ServiceLocator type.
        /// </summary>
        /// <param name="defaultLocator">ServiceLocator, if null, DependencyService is used.</param>
        /// <param name="registerBehavior">Registration behavior</param>
        /// <returns>IDependencyService</returns>
        public static IDependencyService Init(IDependencyService defaultLocator, RegisterBehavior registerBehavior)
        {
            // If the ServiceLocator has already been set, then something used it before
            // Init was called. This is not allowed if they are going to change the locator.
            if (defaultLocator != null &&
                serviceLocator != null)
            {
                throw new InvalidOperationException(
                          "Must call XamUInfrastructure.Init before using any library features; " +
                          "ServiceLocator has already been set.");
            }

            // Assign the locator; either use the supplied one, or the default
            // DependencyService version if not supplied.
            if (defaultLocator == null)
            {
                defaultLocator = ServiceLocator;
            }
            else
            {
                Debug.Assert(serviceLocator == null);
                serviceLocator = defaultLocator;
            }

            // Register the services
            if (registerBehavior.HasFlag(RegisterBehavior.MessageVisualizer))
            {
                defaultLocator.Register <IMessageVisualizerService, FormsMessageVisualizerService>();
            }
            if (registerBehavior.HasFlag(RegisterBehavior.Navigation))
            {
                defaultLocator.Register <INavigationService, FormsNavigationPageService>();
            }

            defaultLocator.Register <IDependencyService>(defaultLocator);

            return(defaultLocator);
        }
示例#23
0
        public BaseViewModel(IDependencyService dependencyService)
        {
            DependencyService    = dependencyService;
            ConnectivityServices = DependencyService.Get <IConnectivity>();
            NavigationService    = DependencyService.Get <INavigation>();

            ConnectivityServices.OnConnectivityChanged += async(sender, e) => {
                NotifyPropertyChanged("Online");
                NotifyPropertyChanged("Offline");
                if (Online)
                {
                    try
                    {
                        // Do something when connection recovered
                    }
                    catch { /* fail silently */ }
                }
                else
                {
                    CancelTasks();
                }
            };
        }
示例#24
0
        /// <summary>
        /// Initializes a new instance of the type
        /// </summary>
        /// <param name="authenticationPath">The HTTP path used for authentication</param>
        /// <param name="authorizationHeaderName">The name of the header where the authorization token is stored</param>
        /// <param name="authorizationPolicyHeaderName">The name of the header where the policy is stored</param>
        /// <param name="dependencyService">A service that can be used to retrieve dependencies that were injected</param>
        /// <param name="loggerFactory">A factory that can be used to create loggers</param>
        /// <param name="metricFactory">A factory that can be used to create metrics</param>
        /// <param name="resourceUriHeaderName">The name of the header that stores the resource URL</param>
        /// <param name="sasSigningKey">A Shared Access Signature signing key</param>
        /// <param name="sasTokenPolicyName">A Shared Access Signature token policy name</param>
        /// <param name="sasTokenTimeout">The Shared Access Signature token timeout</param>
        /// <param name="next">The next middleware component to execute</param>
        public SasAuthenticationMiddleware(RequestDelegate next, IDependencyService dependencyService, IMetricFactory metricFactory, ILoggerFactory loggerFactory, TimeSpan?sasTokenTimeout, string sasTokenPolicyName, string sasSigningKey, string authenticationPath, string authorizationHeaderName = "Authorization", string resourceUriHeaderName = "AuthResourceUri", string authorizationPolicyHeaderName = "AuthPolicyName")
        {
            Guard.NotNull(nameof(metricFactory), metricFactory);
            Guard.NotNull(nameof(loggerFactory), loggerFactory);
            Guard.NotNull(nameof(dependencyService), dependencyService);
            Guard.NotNullOrWhitespace(nameof(sasTokenPolicyName), sasTokenPolicyName);
            Guard.NotNullOrWhitespace(nameof(sasSigningKey), sasSigningKey);
            Guard.NotNullOrWhitespace(nameof(authorizationHeaderName), authorizationHeaderName);
            Guard.NotNullOrWhitespace(nameof(resourceUriHeaderName), resourceUriHeaderName);
            Guard.NotNullOrWhitespace(nameof(authorizationPolicyHeaderName), authorizationPolicyHeaderName);
            Guard.NotNullOrWhitespace(nameof(authenticationPath), authenticationPath);

            _logger = loggerFactory.CreateLogger("SAS Authentication");

            using (_logger.BeginScope("SAS CTOR"))
            {
                _logger.LogInformation("Initializing authentication middleware");

                _next = next;

                _sasTokenTimeout               = sasTokenTimeout ?? TimeSpan.FromHours(1);
                _sasTokenPolicyName            = sasTokenPolicyName;
                _sasTokenScheme                = sasTokenPolicyName;
                _sasSigningKey                 = sasSigningKey;
                _authorizationHeaderName       = authorizationHeaderName;
                _resourceUriHeaderName         = resourceUriHeaderName;
                _authorizationPolicyHeaderName = authorizationPolicyHeaderName;
                _authenticationPath            = authenticationPath;

                _authenticationTiming  = metricFactory.CreateSummary("sas-timing", "Timing summary for authentication timing", 10, false, new string[0]);
                _authenticationSuccess = metricFactory.CreateSummary("sas-authentication-success", "Successful authorization count", 10, false, new string[0]);
                _authenticationFailure = metricFactory.CreateSummary("sas-authentication-failure", "Failure authorization count", 10, false, new string[0]);
                _validateSuccess       = metricFactory.CreateSummary("sas-validation-success", "Successful validation count", 10, false, new string[0]);
                _validateFailure       = metricFactory.CreateSummary("sas-validation-failure", "Failure validation count", 10, false, new string[0]);
            }
        }
示例#25
0
        public LoginCadastroViewModelUnitTest()
        {
            _dependencyService = new DependencyServiceStub();
            _dependencyService.Register <IUsuarioRepository>(new UsuarioMock());
            cadastroViewModel = new LoginCadastroViewModel(_dependencyService)
            {
                RepeticaoSenha = "87654321",
                UsuarioModel   =
                {
                    Email = "*****@*****.**",
                    Senha = "87654321",
                    PessoaJuridicaModel =
                    {
                        CNPJ         = "12123123123412",
                        NomeFantasia = "Nome fantasia da empresa"
                    }
                }
            };

            loginViewModel = new LoginViewModel(_dependencyService)
            {
                UsuarioModel = cadastroViewModel.UsuarioModel
            };
        }
 public CreateReportViewModel(IDependencyService dependencyService) : base(dependencyService)
 {
     DependencyService = dependencyService;
     InitializeViewModel();
 }
 public UnitTestViewModel(IDependencyService dependencyService)
 {
     DependencyService = dependencyService;
     LoadDataCommand   = new Command(async() => await LoadData());
 }
示例#28
0
 public DependentService(IDependencyService dependency)
 {
     this.dependency = dependency;
 }
示例#29
0
 public SqlBusStopService(IDependencyService dependencyService)
 {
     _conn = dependencyService.Get <IFileAccessHelper>().GetConnection();
     _conn.CreateTable <SqlBusStop>();
 }
示例#30
0
 public MessageService(IDependencyService dependencyService)
 {
     this.messageServiceImplementation = dependencyService.Get <IMessageServiceImplementation>();
 }