/// <summary> /// Initializes a new instance of the PushViewModel class. /// </summary> public SettingsViewModel(IExtendedApiClient apiClient, INavigationService navigationService, IApplicationSettingsService applicationSettings) { _apiClient = apiClient; _navigationService = navigationService; _applicationSettings = applicationSettings; if (IsInDesignMode) { IsRegistered = UseNotifications = true; RegisteredText = "Device registered"; ServerPluginInstalled = false; #if WP8 FoundServers = new ObservableCollection<Server> { new Server {IpAddress = "192.168.0.2", PortNo = "8096"}, new Server {IpAddress = "192.168.0.4", PortNo = "8096"} }; #endif } else { LoadingFromSettings = true; SendTileUpdates = SendToastUpdates = true; RegisteredText = AppResources.DeviceNotRegistered; LoadingFromSettings = false; ServerPluginInstalled = false; } }
/// <summary> /// Initializes a new instance of the PushViewModel class. /// </summary> public SettingsViewModel( IConnectionManager connectionManager, INavigationService navigationService, IApplicationSettingsService applicationSettings, IMessageBoxService messageBox, IServerInfoService serverInfo) : base(navigationService, connectionManager) { _applicationSettings = applicationSettings.Legacy; _messageBox = messageBox; _serverInfo = serverInfo; if (IsInDesignMode) { FoundServers = new ObservableCollection<ServerInfo> { new ServerInfo{Id = Guid.NewGuid().ToString(), Name = "Home", LocalAddress = "http://192.168.0.2:8096"} }; } else { LoadingFromSettings = true; SendTileUpdates = SendToastUpdates = true; RegisteredText = AppResources.DeviceNotRegistered; LoadingFromSettings = false; SetStreamingQuality(); _ignoreRunUnderLockChanged = true; RunUnderLock = App.SpecificSettings.PlayVideosUnderLock; _ignoreRunUnderLockChanged = false; } }
/// <summary> /// Initializes a new instance of the ChooseProfileViewModel class. /// </summary> public ChooseProfileViewModel(IExtendedApiClient apiClient, INavigationService navigationService, IApplicationSettingsService applicationSettings) { _apiClient = apiClient; _navigationService = navigationService; Profiles = new ObservableCollection<UserDto>(); if (IsInDesignMode) { Profiles = new ObservableCollection<UserDto> { new UserDto { Id = new Guid("dd425709431649698e92d86b1f2b00fa").ToString(), Name = "ScottIsAFool" }, new UserDto { Id = new Guid("dab28e40cfbc43658082f55a44cf139a").ToString(), Name = "Redshirt", LastLoginDate = DateTime.Now.AddHours(-1) } }; } else { WireCommands(); } }
public void Start(IExtendedApiClient apiClient, ILogger logger) { _apiClient = apiClient; _logger = logger; _settingsService = new ApplicationSettingsService(); CheckIfUserSignedIn(); }
public Picon2RuntimeDevice(IApplicationSettingsService applicationSettingsService, IRuntimeModeDriversService runtimeModeDriversService, Picon2StarterFactory picon2StarterFactory, ApplicationConnectionService.ApplicationConnectionService applicationConnectionService, IDeviceTimerInterrogationService timerInterrigationService, IDefectState defectState, IDeviceDataCache deviceDataCache, IAnalogData analogData, IResistorFactory resistorFactory, ICustomItemsFactory customItemsFactory, ConnectionLogger connectionLogger) : base( applicationSettingsService, runtimeModeDriversService, applicationConnectionService, timerInterrigationService, defectState, deviceDataCache, analogData, resistorFactory, customItemsFactory, connectionLogger) { _picon2StarterFactory = picon2StarterFactory; Picon2ModuleInfo = new Picon2ModuleInfo(); }
public AuthenticationService( INewsBlurClient newsBlurClient, IApplicationSettingsService applicationSettingsService) { _newsBlurClient = newsBlurClient; _applicationSettingsService = applicationSettingsService; GetAuthenticationDetails(); GetUserProfile(); }
public Program(IApplicationSettingsService applicationSettingsService, IStorageService storageService, ICommandHandler commandHandler, ISystemService systemService) { _commandHandler = commandHandler; _systemService = systemService; _applicationSettingsService = applicationSettingsService; _storageService = storageService; }
public UniconJournalViewModel(ILocalizerService localizerService, IFragmentOptionsViewModel fragmentOptionsViewModel, Func <IFragmentOptionGroupViewModel> fragmentOptionGroupViewModelgetFunc, Func <IFragmentOptionCommandViewModel> fragmentOptionCommandViewModelgetFunc, IApplicationGlobalCommands applicationGlobalCommands, ITypesContainer typesContainer, ILogService logService , IApplicationSettingsService applicationSettingsService, IJournalLoaderProvider journalLoaderProvider, IValueViewModelFactory valueViewModelFactory) { _localizerService = localizerService; _applicationGlobalCommands = applicationGlobalCommands; _typesContainer = typesContainer; _logService = logService; _applicationSettingsService = applicationSettingsService; _journalLoaderProvider = journalLoaderProvider; _valueViewModelFactory = valueViewModelFactory; IFragmentOptionGroupViewModel fragmentOptionGroupViewModel = fragmentOptionGroupViewModelgetFunc(); fragmentOptionGroupViewModel.NameKey = "Device"; IFragmentOptionCommandViewModel fragmentOptionCommandViewModel = fragmentOptionCommandViewModelgetFunc(); fragmentOptionCommandViewModel.TitleKey = "Load"; fragmentOptionCommandViewModel.IconKey = IconResourceKeys.IconInboxIn; fragmentOptionGroupViewModel.FragmentOptionCommandViewModels.Add(fragmentOptionCommandViewModel); LoadCommand = new RelayCommand(OnLoadJournal, CanLoadExecute); fragmentOptionCommandViewModel.OptionCommand = LoadCommand; fragmentOptionsViewModel.FragmentOptionGroupViewModels.Add(fragmentOptionGroupViewModel); fragmentOptionCommandViewModel = fragmentOptionCommandViewModelgetFunc(); fragmentOptionCommandViewModel.TitleKey = "Open"; fragmentOptionCommandViewModel.IconKey = IconResourceKeys.IconDiscUpload; fragmentOptionCommandViewModel.OptionCommand = new RelayCommand(OnExecuteLoadJournal); fragmentOptionGroupViewModel.FragmentOptionCommandViewModels.Add(fragmentOptionCommandViewModel); fragmentOptionCommandViewModel = fragmentOptionCommandViewModelgetFunc(); fragmentOptionCommandViewModel.TitleKey = "Save"; fragmentOptionCommandViewModel.IconKey = IconResourceKeys.IconDiscDownload; fragmentOptionCommandViewModel.OptionCommand = new RelayCommand(OnExecuteSaveJournal); fragmentOptionGroupViewModel.FragmentOptionCommandViewModels.Add(fragmentOptionCommandViewModel); fragmentOptionCommandViewModel = fragmentOptionCommandViewModelgetFunc(); fragmentOptionCommandViewModel.TitleKey = ApplicationGlobalNames.UiCommandStrings.SAVE_FOR_PRINT; fragmentOptionCommandViewModel.IconKey = IconResourceKeys.IconPrintText; fragmentOptionCommandViewModel.OptionCommand = new RelayCommand(OnExecuteExportJournal); fragmentOptionGroupViewModel.FragmentOptionCommandViewModels.Add(fragmentOptionCommandViewModel); _loaderHooks = new LoaderHooks( () => { Table.Values.Clear(); }, list => { Table.AddFormattedValueViewModel(list.Select(formattedValue => _valueViewModelFactory.CreateFormattedValueViewModel(formattedValue)).ToList()); }); FragmentOptionsViewModel = fragmentOptionsViewModel; CanExecuteJournalLoading = true; }
/// <summary> /// Initializes a new instance of the MainViewModel class. /// </summary> public MainViewModel(IExtendedNavigationService navigationService, IAsyncStorageService asyncStorageService, IApplicationSettingsService settingsService) { _navigationService = navigationService; _asyncStorageService = asyncStorageService; _settingsService = settingsService; if (IsInDesignMode) { DataExists = true; } }
public WebSynchronizationViewModel(IApplicationSettingsService applicationSettingsService, IDevicesContainerService devicesContainerService) { _applicationSettingsService = applicationSettingsService; _devicesContainerService = devicesContainerService; Definitions = new ObservableCollection <DefinitionInfoViewModel>(); UseDefaultUrl = true; //RefreshAll = new RelayCommand(); ToggleSettingsPopup = new RelayCommand(OnTogglePopup); RefreshAll(); }
/// <summary> /// Initializes a new instance of the <see cref="JsonEventLogger"/> class. /// </summary> /// <param name="applicationSettingsService">The application settings service.</param> /// <param name="remoteLogger">The remote logger.</param> public JsonEventLogger( IApplicationSettingsService applicationSettingsService, IRemoteLogger remoteLogger) { this.applicationSettingsService = applicationSettingsService; this.remoteLogger = remoteLogger; this.jsonSerializer = new DataContractJsonSerializer( typeof(List<EventRecord>), additionalKnownTypes); }
public RoomsService( IRepository <Room> roomsRepository, IRepository <Contest> contestsRepository, IApplicationSettingsService applicationSettingsService, Random rnd) { this.roomsRepository = roomsRepository; this.contestsRepository = contestsRepository; this.applicationSettingsService = applicationSettingsService; this.rnd = rnd; }
public SettingsViewModel( IUsersRepository usersRepository, ILoginService loginService, IApplicationSettingsService appSettingsService, LongRunningOperationHelper longRunningOperationHelper) { _usersRepository = usersRepository; _loginService = loginService; _appSettingsService = appSettingsService; _longRunningOperationHelper = longRunningOperationHelper; }
public AuthenticationService(IConnectionManager connectionManager, IApplicationSettingsService settingsService) { _settingsService = settingsService.Legacy; _connectionManager = connectionManager; _logger = new WPLogger(typeof (AuthenticationService)); Current = this; _connectionManager.ConnectUserSignIn += ConnectionManagerOnConnectUserSignIn; _connectionManager.ConnectUserSignOut += ConnectionManagerOnConnectUserSignOut; _connectionManager.LocalUserSignIn += ConnectionManagerOnLocalUserSignIn; _connectionManager.LocalUserSignOut += ConnectionManagerOnLocalUserSignOut; }
public TrialHelper(INavigationService navigationService, IApplicationSettingsService applicationSettings) { _navigationService = navigationService; _settings = applicationSettings.Legacy; #if TRIAL IsTrial = true; #else CheckLicences().ConfigureAwait(false); #endif _logger = new WPLogger(GetType()); Current = this; }
public RoomsController( IRoomsService roomsService, IContestsService contestsService, IApplicationSettingsService applicationSettingsService, UserManager <ApplicationUser> userManager, IHubContext <RoomHub> roomHub) { this.roomsService = roomsService; this.contestsService = contestsService; this.applicationSettingsService = applicationSettingsService; this.userManager = userManager; this.roomHub = roomHub; }
public BrowseFolderViewModel(INavigationService navigationService, IEventAggregator eventAggregator, IApplicationSettingsService settingsService) : base(navigationService, eventAggregator) { this.settingsService = settingsService; SortOptions = new BindableCollection<MediaSortViewModel> { new MediaSortViewModel(MediaSort.Alphabetical, Strings.MediaSortAlphabetical), new MediaSortViewModel(MediaSort.Type, Strings.MediaSortType), new MediaSortViewModel(MediaSort.DateCreated, Strings.MediaSortDateCreated) }; SelectedSortOption = SortOptions[0]; }
public async Task ThrowExceptionWhenCreatePolicyKeyRelayNameSpaceIsNotPresentAsync() { // Arrange IApplicationSettingsService applicationSettingsService = A.Fake <IApplicationSettingsService>(); A.CallTo(() => applicationSettingsService.AzureManagementApi).Returns(TestHelper.GetDefaultLocalHostUri.ToString()); A.CallTo(() => applicationSettingsService.AzureSubscriptionId).Returns("ffc1f3f6-a8ac-4d89-b485-02563edf182g"); A.CallTo(() => applicationSettingsService.ResourceGroupname).Returns("Relay_RG"); IRelayManagementApiClient sut = new RelayManagementApiClient(applicationSettingsService, new HttpClient(new RelayManagementClientHttpMock())); // Act & Assert await Assert.ThrowsAsync <InvalidOperationException>(() => sut.CreatePolicykeyAsync(TestHelper.TenantId, PolicyClaim.Listen)); }
public BrowseFolderViewModel(INavigationService navigationService, IEventAggregator eventAggregator, IApplicationSettingsService settingsService) : base(navigationService, eventAggregator) { this.settingsService = settingsService; SortOptions = new BindableCollection <MediaSortViewModel> { new MediaSortViewModel(MediaSort.Alphabetical, Strings.MediaSortAlphabetical), new MediaSortViewModel(MediaSort.Type, Strings.MediaSortType), new MediaSortViewModel(MediaSort.DateCreated, Strings.MediaSortDateCreated) }; SelectedSortOption = SortOptions[0]; }
public UniconProjectService(IUniconProject uniconProject, ILocalizerService localizerService, Func <IDialogCoordinator> dialogCoordinator, IApplicationSettingsService applicationSettingsService, IDevicesContainerService devicesContainerService, ITypesContainer container, ILogService logService, ISerializerService serializerService ) { _uniconProject = uniconProject; _localizerService = localizerService; _dialogCoordinator = dialogCoordinator; _applicationSettingsService = applicationSettingsService; _devicesContainerService = devicesContainerService; _container = container; _logService = logService; _serializerService = serializerService; }
private static void LoadApplicationSettings() { try { Program._jsonSerializationService = new JsonSerializationService <ApplicationSettings>(); Program._audioService = new AudioService(); Program._applicationSettingsService = new ApplicationSettingsService(_jsonSerializationService, _audioService); } catch (Exception ex) { Program.ErrorLoadingApplicationSettings = true; MessageBox.Show("There was an error trying to load the application. Please view the error log for more details.", "Error Occurred.", MessageBoxButtons.OK, MessageBoxIcon.Error); _loggingService.LogErrorFormat(ex, MethodBase.GetCurrentMethod().Name); } }
public RuntimeConfigurationViewModel(ITypesContainer container, IApplicationSettingsService applicationSettingsService, BaseValuesViewModelFactory baseValuesViewModelFactory) { _container = container; _applicationSettingsService = applicationSettingsService; _baseValuesViewModelFactory = baseValuesViewModelFactory; AllRows = new ObservableCollection <IRuntimeConfigurationItemViewModel>(); MainRows = new ObservableCollection <MainConfigItemViewModel>(); RootConfigurationItemViewModels = new ObservableCollection <IRuntimeConfigurationItemViewModel>(); MainItemSelectedCommand = new RelayCommand <object>(OnMainItemSelected); ShowTableCommand = new RelayCommand <object>(OnShowTable); }
public async Task ThrowExceptionWhenAzureSubscriptionIdIsNotPresentAsync() { // Arrange IApplicationSettingsService applicationSettingsService = A.Fake <IApplicationSettingsService>(); var relayNameSpace = "Relay"; A.CallTo(() => applicationSettingsService.AzureManagementApi).Returns(TestHelper.GetDefaultLocalHostUri.ToString()); A.CallTo(() => applicationSettingsService.ResourceGroupname).Returns("Relay_RG"); A.CallTo(() => applicationSettingsService.RelayNameSpace).Returns(relayNameSpace); IRelayManagementApiClient sut = new RelayManagementApiClient(applicationSettingsService, new HttpClient(new RelayManagementClientHttpMock())); // Act & Assert await Assert.ThrowsAsync <InvalidOperationException>(() => sut.CreateHybridConnectionAsync(TestHelper.TenantId)); }
public async Task ThrowHttpExceptionIfHttpRequestDoesNotReturnOkAsync() { // Arrange IApplicationSettingsService applicationSettingsService = A.Fake <IApplicationSettingsService>(); var relayNameSpace = "Relay"; A.CallTo(() => applicationSettingsService.AzureManagementApi).Returns(TestHelper.GetCorrectUrlFormatWithWrongAddress.ToString()); A.CallTo(() => applicationSettingsService.AzureSubscriptionId).Returns("ffc1f3f6-a8ac-4d89-b485-02563edf182g"); A.CallTo(() => applicationSettingsService.ResourceGroupname).Returns("Relay_RG"); A.CallTo(() => applicationSettingsService.RelayNameSpace).Returns(relayNameSpace); IRelayManagementApiClient sut = new RelayManagementApiClient(applicationSettingsService, new HttpClient(new RelayManagementClientHttpMock())); // Act & Assert await Assert.ThrowsAsync <HttpRequestException>(() => sut.CreateHybridConnectionAsync(TestHelper.TenantId)); }
public void TestInitialize() { mockContext = new Mock <Core.Database.DbContext>("ConnectionString"); mockArticleSet = GetQueryableMockDbSet <Article>(GetArticleList()); mockContext.Setup(m => m.Set <Article>()).Returns(mockArticleSet.Object); mockArticleFeedbackSet = GetQueryableMockDbSet <ArticleFeedback>(GetArticleFeedbackList()); mockContext.Setup(m => m.Set <ArticleFeedback>()).Returns(mockArticleFeedbackSet.Object); mockUserSet = GetQueryableMockDbSet <User>(GetUserList()); mockContext.Setup(m => m.Set <User>()).Returns(mockUserSet.Object); applicationSettingsService = new ApplicationSettingsService(mockContext.Object); articleService = new ArticleService(mockContext.Object, applicationSettingsService); }
/// <summary /> public static bool GetBoolean(IApplicationSettingsService settingSvc, string key) { Argument.IsNotNull("settingSvc", settingSvc); Argument.IsNotNullOrEmpty("key", key); string value = settingSvc.GetValue(key); if (string.Equals(value, "true", StringComparison.OrdinalIgnoreCase) || string.Equals(value, "t", StringComparison.OrdinalIgnoreCase) || string.Equals(value, "0", StringComparison.OrdinalIgnoreCase)) { return true; } return false; }
/// <summary> /// Initializes a new instance of the PhotoUploadViewModel class. /// </summary> public PhotoUploadViewModel(INavigationService navigationService, IConnectionManager connectionManager, IApplicationSettingsService appSettingsService) : base(navigationService, connectionManager) { _appSettingsService = appSettingsService.Legacy; if (IsInDesignMode) { IsPhotoUploadsEnabled = true; } else { _ignoreChange = true; IsPhotoUploadsEnabled = App.UploadSettings.IsPhotoUploadsEnabled; UploadAll = App.UploadSettings.UploadAllPhotos; AfterDateTime = App.UploadSettings.UploadAfterDateTime; _ignoreChange = false; } }
public VideoItemViewModel(Video video, VideoLoadingViewModel videoLoadingViewModel) { _vidMeClient = SimpleIoc.Default.GetInstance <IVidMeClient>(); _settingsService = SimpleIoc.Default.GetInstance <IApplicationSettingsService>(); _navigationService = SimpleIoc.Default.GetInstance <INavigationService>(); _tileService = SimpleIoc.Default.GetInstance <ITileService>(); _toastService = SimpleIoc.Default.GetInstance <IToastService>(); _videoLoadingViewModel = videoLoadingViewModel; Video = video; if (Video != null && Video.Channel != null) { Channel = new ChannelItemViewModel(Video.Channel); } if (IsInDesignMode) { var user = new User { UserId = "59739", Username = "******", AvatarUrl = "https://d1wst0behutosd.cloudfront.net/avatars/59739.gif?gv2r1420954820", CoverUrl = "https://d1wst0behutosd.cloudfront.net/channel_covers/59739.jpg?v1r1420500373", FollowerCount = 1200, LikesCount = "92", VideoCount = 532, VideoViews = "71556", VideosScores = 220, Bio = "Some bio information" }; Items = new ObservableCollection <CommentViewModel> { new CommentViewModel(new Comment { Body = "This is a comment", User = user }, this) }; Video = new Video { User = user }; } }
/// <summary /> public static Uri GetUri(IApplicationSettingsService settingSvc, string key) { Argument.IsNotNull("settingSvc", settingSvc); Argument.IsNotNullOrEmpty("key", key); string value = settingSvc.GetValue(key); bool absoluteUri = value.IndexOf("://", StringComparison.OrdinalIgnoreCase) >= 0; try { return new Uri(value, absoluteUri ? UriKind.Absolute : UriKind.Relative); } catch (Exception ex) { throw new ApplicationSettingException("Unable to convert value to an URI", ex); } }
public UploadVideoViewModel( INavigationService navigationService, IVidMeClient vidMeClient, IApplicationSettingsService applicationSettings, FoursqureViewModel foursqureViewModel, EditVideoViewModel editVideoViewModel) { EditVideo = editVideoViewModel; _navigationService = navigationService; _vidMeClient = vidMeClient; _applicationSettings = applicationSettings; _foursqureViewModel = foursqureViewModel; if (IsInDesignMode) { IsUploading = true; } }
protected override void Application_Start() { base.Application_Start(); AppSettings = MefHttpApplication.ApplicationContainer.GetExportedValue <IApplicationSettingsService>(); AreaRegistration.RegisterAllAreas(); RegisterRoutes(RouteTable.Routes, AppSettings.HideHomePage); var databaseSchemaManager = MefHttpApplication.ApplicationContainer.GetExportedValue <IDatabaseSchemaManagerService>(); var searchService = MefHttpApplication.ApplicationContainer.GetExportedValue <TicketSearchService>(); var ticketService = MefHttpApplication.ApplicationContainer.GetExportedValue <ITicketService>(); databaseSchemaManager.EnsureSchemaVersion(); searchService.InitializeSearch(ticketService); var securityService = MefHttpApplication.ApplicationContainer.GetExportedValue <ISecurityService>(); //timer is initialized by the service, but we have to hold a reference to it here or it will be garbage collected // in SQL Security Environments, this will just return null; there is no timer SecurityRefreshTimer = securityService.InitializeSecurityCacheRefreshTimer(); DerelictAttachmentsTimer = new System.Timers.Timer(); int derelictInterval = 300000; DerelictAttachmentsTimer.Elapsed += new System.Timers.ElapsedEventHandler(DerelictAttachmentsTimer_Elapsed); DerelictAttachmentsTimer.Interval = derelictInterval; DerelictAttachmentsTimer.AutoReset = true; DerelictAttachmentsTimer.Start(); if (AppSettings.EmailNotificationsEnabled()) { EmaiNotificationsTimer = new System.Timers.Timer(); int emailInterval = AppSettings.EmailDeliveryTimerIntervalMinutes * 60000; EmaiNotificationsTimer.Elapsed += new System.Timers.ElapsedEventHandler(EmaiNotificationsTimer_Elapsed); EmaiNotificationsTimer.Interval = emailInterval; EmaiNotificationsTimer.AutoReset = true; EmaiNotificationsTimer.Start(); } }
public async Task BeAbleToCreateHybridConnectionAsync() { // Arrange IApplicationSettingsService applicationSettingsService = A.Fake <IApplicationSettingsService>(); var relayNameSpace = "Relay"; A.CallTo(() => applicationSettingsService.AzureManagementApi).Returns(TestHelper.GetDefaultLocalHostUri.ToString()); A.CallTo(() => applicationSettingsService.AzureSubscriptionId).Returns("ffc1f3f6-a8ac-4d89-b485-02563edf182g"); A.CallTo(() => applicationSettingsService.ResourceGroupname).Returns("Relay_RG"); A.CallTo(() => applicationSettingsService.RelayNameSpace).Returns(relayNameSpace); IRelayManagementApiClient sut = new RelayManagementApiClient(applicationSettingsService, new HttpClient(new RelayManagementClientHttpMock())); // Act Uri actual = await sut.CreateHybridConnectionAsync(TestHelper.TenantId); // Assert Assert.Contains(TestHelper.TenantId, actual.OriginalString); Assert.Contains(relayNameSpace, actual.OriginalString); }
/// <summary> /// Creates an instance of <see cref="ApplicationConfigurationModeViewModel" /> /// </summary> /// <param name="interactionService"> /// An instance of <see cref="IInteractionService" /> to use /// </param> /// <param name="configService"> /// An instance of <see cref="IConfigurationModeDevicesService" /> to use /// </param> /// <param name="persistanceService"></param> /// <param name="settings">Сервис с настройками приложения</param> /// <param name="configDeviceViewModelFactory"></param> public ApplicationConfigurationModeViewModel(IInteractionService interactionService, IConfigurationModeDevicesService configService, IPersistanceService persistanceService, IApplicationSettingsService settings, IConfigDeviceViewModelFactory configDeviceViewModelFactory, IApplicationLogViewModel applicationLogViewModel) { Guard.AgainstNullReference(interactionService, "interactionService"); Guard.AgainstNullReference(configService, "configService"); Guard.AgainstNullReference(persistanceService, "persistanceService"); Guard.AgainstNullReference(settings, "settings"); this._interactionService = interactionService; this._configService = configService; this._persistanceService = persistanceService; this._settings = settings; _configDeviceViewModelFactory = configDeviceViewModelFactory; _applicationLogViewModel = applicationLogViewModel; this._logger = LogManager.GetLogger("Конфигурация"); }
/// <summary> /// Initializes a new instance of the GameViewModel class. /// </summary> public GameViewModel(IExtendedNavigationService navigationService, IApplicationSettingsService applicationSettings) { _navigationService = navigationService; _applicationSettings = applicationSettings; if (IsInDesignMode) { // Code runs in Blend --> create design time data. Genres = new List <Genre> { new Genre { Name = "Rock" } }; SelectedGenre = Genres[0]; GameLocked = false; GameTrack = new Product { Name = "I don't wanna miss a thing", Performers = new[] { new Artist { Name = "Aerosmith", Thumb320Uri = new Uri("http://assets.ent.nokia.com/p/d/music_image/320x320/1470.jpg") } }, Thumb320Uri = new Uri("http://4.musicimg.ovi.com/u/1.0/image/156920531/?w=320&q=90") }; MaximumRoundPoints = 300; } else { _gameTimer = new DispatcherTimer(); GameLength = TimeSpan.FromSeconds(2); _gameTimer.Interval = GameLength; _gameTimer.Tick += GameTimerOnTick; _usedTracks = new List <string>(); GetDefaults(); } }
/// <summary> /// Gets a select list for a collection. /// </summary> /// <param name="settingCollection">The setting collection.</param> /// <param name="includeEmptyOption">if set to <c>true</c> [include empty option].</param> /// <param name="emptyOptionText">The empty option text.</param> /// <param name="emptyOptionValue">The empty option value.</param> /// <param name="selectedOptionValue">The selected option value.</param> /// <returns></returns> public static SelectList GetSelectListOfSettingCollection(this IApplicationSettingsService settingsService, string[] settingCollection, bool includeEmptyOption, string emptyOptionText, string emptyOptionValue, string selectedOptionValue) { var selectItems = new List <SelectListItem>(); if (includeEmptyOption) { var emptyItem = new SelectListItem { Text = emptyOptionText, Value = emptyOptionValue, Selected = (emptyOptionValue == selectedOptionValue) }; selectItems.Add(emptyItem); } foreach (var pri in settingCollection) { var item = new SelectListItem(); item.Text = pri; item.Value = pri; item.Selected = (pri == selectedOptionValue); selectItems.Add(item); } return(new SelectList(selectItems, "Value", "Text")); }
public async Task BeAbleToCreateHybridConnectionPolicyAsync() { // Arrange IApplicationSettingsService applicationSettingsService = A.Fake <IApplicationSettingsService>(); var relayNameSpace = "Relay"; A.CallTo(() => applicationSettingsService.AzureManagementApi).Returns(TestHelper.GetDefaultLocalHostUri.ToString()); A.CallTo(() => applicationSettingsService.AzureSubscriptionId).Returns("ffc1f3f6-a8ac-4d89-b485-02563edf182g"); A.CallTo(() => applicationSettingsService.ResourceGroupname).Returns("Relay_RG"); A.CallTo(() => applicationSettingsService.RelayNameSpace).Returns(relayNameSpace); IRelayManagementApiClient sut = new RelayManagementApiClient(applicationSettingsService, new HttpClient(new RelayManagementClientHttpMock())); // Act PolicyDto actual = await sut.CreatePolicykeyAsync(TestHelper.TenantId, PolicyClaim.Listen); // Assert Assert.NotNull(actual); Assert.Equal(TestHelper.PrimaryKey, actual.PolicyKey); Assert.True(Guid.TryParse(actual.PolicyName, out Guid policyNameAsGuid)); Assert.Equal(PolicyClaim.Listen, actual.PolicyType); }
public AuthenticationService( IConnectionManager connectionManager, IApplicationSettingsService settingsService, IServerInfoService serverInfoService, IMessengerService messengerService) { _settingsService = settingsService.Legacy; _connectionManager = connectionManager; _messengerService = messengerService; _logger = new WPLogger(typeof(AuthenticationService)); Current = this; _connectionManager.ConnectUserSignIn += ConnectionManagerOnConnectUserSignIn; _connectionManager.ConnectUserSignOut += ConnectionManagerOnConnectUserSignOut; _connectionManager.LocalUserSignIn += ConnectionManagerOnLocalUserSignIn; _connectionManager.LocalUserSignOut += ConnectionManagerOnLocalUserSignOut; _connectionManager.Connected += ConnectionManagerOnConnected; serverInfoService.ServerInfoChanged += ServerInfoServiceOnServerInfoChanged; if (serverInfoService.HasServer) { SetUserUpdateHandler(serverInfoService.ServerInfo); } }
public AuthenticationService( IConnectionManager connectionManager, IApplicationSettingsService settingsService, IServerInfoService serverInfoService, IMessengerService messengerService) { _settingsService = settingsService.Legacy; _connectionManager = connectionManager; _messengerService = messengerService; _logger = new WPLogger(typeof (AuthenticationService)); Current = this; _connectionManager.ConnectUserSignIn += ConnectionManagerOnConnectUserSignIn; _connectionManager.ConnectUserSignOut += ConnectionManagerOnConnectUserSignOut; _connectionManager.LocalUserSignIn += ConnectionManagerOnLocalUserSignIn; _connectionManager.LocalUserSignOut += ConnectionManagerOnLocalUserSignOut; _connectionManager.Connected += ConnectionManagerOnConnected; serverInfoService.ServerInfoChanged += ServerInfoServiceOnServerInfoChanged; if (serverInfoService.HasServer) { SetUserUpdateHandler(serverInfoService.ServerInfo); } }
public DataManager(IPatientDatabase patientDatabase, IFileManager fileManager, IApplicationSettingsService applicationSettingsService) { PatientDatabase = patientDatabase; FileManager = fileManager; ApplicationSettingsService = applicationSettingsService; }
private static void LoadApplicationSettings() { try { Program._jsonSerializationService = new JsonSerializationService<ApplicationSettings>(); Program._audioService = new AudioService(); Program._applicationSettingsService = new ApplicationSettingsService(_jsonSerializationService, _audioService); } catch (Exception ex) { Program.ErrorLoadingApplicationSettings = true; MessageBox.Show("There was an error trying to load the application. Please view the error log for more details.", "Error Occurred.", MessageBoxButtons.OK, MessageBoxIcon.Error); _loggingService.LogErrorFormat(ex, MethodBase.GetCurrentMethod().Name); } }
public DeviceCommandService(ICommandSendingService commandSendingService, IDeviceCommandStateViewModelFactory deviceCommandStateViewModelFactory, IApplicationSettingsService settingsService) { _commandSendingService = commandSendingService; _deviceCommandStateViewModelFactory = deviceCommandStateViewModelFactory; _settingsService = settingsService; _queueCommandDictionary = new Dictionary <IRuntimeDevice, Queue <Func <IDeviceCommand> > >(); _presiousDeviceCommands = new ConcurrentDictionary <IRuntimeDeviceViewModel, IDeviceCommand>(); }
/// <summary> /// Initializes a new instance of the SplashscreenViewModel class. /// </summary> public SplashscreenViewModel(IConnectionManager connectionManager, INavigationService navigationService, IApplicationSettingsService applicationSettings) : base(navigationService, connectionManager) { _applicationSettings = applicationSettings.Legacy; }
public SettingsService(IApplicationSettingsService applicationSettings, IUserSettingsService userSettings) { ApplicationSettings = applicationSettings; UserSettings = userSettings; }
public StorageService(ISerializationService serializationService, IApplicationSettingsService applicationSettingsService) { _serializationService = serializationService; _applicationSettingsService = applicationSettingsService; }
/// <summary> /// Initializes a new instance of the MbConnectViewModel class. /// </summary> public MbConnectViewModel(INavigationService navigationService, IConnectionManager connectionManager, IApplicationSettingsService appSettings, IServerInfoService serverInfo) : base(navigationService, connectionManager) { _serverInfo = serverInfo; _appSettings = appSettings.Legacy; }
public void StartService(IApplicationSettingsService settingsService) { _settingsService = settingsService; GetUserSettings(); }
/// <summary> /// Creates an instance of <see cref="ApplicationRuntimeModeViewModel" /> /// </summary> /// <param name="interactionService"> /// An instance of <see cref="IInteractionService" /> to use /// </param> /// <param name="configService"> /// An instance of <see cref="IRuntimeModeDevicesServices" /> to use /// </param> /// <param name="settings">Сервис с настойками программы</param> public ApplicationRuntimeModeViewModel(IInteractionService interactionService, IRuntimeModeDevicesServices configService, IApplicationSettingsService settings, CityWideCommandsLogger cityWideCommandsLogger, IApplicationLogViewModel applicationLogViewModel, IDeviceCommandFactory deviceCommandFactory, IDeviceCommandService deviceCommandService) { Guard.AgainstNullReference(interactionService, "interactionService"); Guard.AgainstNullReference(configService, "configService"); Guard.AgainstNullReference(settings, "settings"); this._interactionService = interactionService; this._configService = configService; this._settings = settings; _cityWideCommandsLogger = cityWideCommandsLogger; _applicationLogViewModel = applicationLogViewModel; _deviceCommandFactory = deviceCommandFactory; _deviceCommandService = deviceCommandService; try { if (!File.Exists(String.Format("./nlog_{0}_{1}.txt", DateTime.Now.Month.ToString("D2"), DateTime.Now.Year.ToString("D4")))) { using (File.Create(String.Format("./nlog_{0}_{1}.txt", DateTime.Now.Month.ToString("D2"), DateTime.Now.Year.ToString("D4")))) { } } } catch (Exception) { } this._logger = LogManager.GetLogger("Общие"); }
/// <summary> /// Initializes a new instance of the SplashscreenViewModel class. /// </summary> public SplashscreenViewModel(IExtendedApiClient apiClient, INavigationService navigationService, IApplicationSettingsService applicationSettings) { _apiClient = apiClient; _navigationService = navigationService; _applicationSettings = applicationSettings; }
public MembershipCreateStatus CreateUser(string userName, string displayName, string password, string email, ISecurityService security, IApplicationSettingsService appSettings) { if (String.IsNullOrEmpty(userName)) throw new ArgumentException("Value cannot be null or empty.", "userName"); if (String.IsNullOrEmpty(password)) throw new ArgumentException("Value cannot be null or empty.", "password"); if (String.IsNullOrEmpty(email)) throw new ArgumentException("Value cannot be null or empty.", "email"); MembershipCreateStatus status; var u = _provider.CreateUser(userName, password, email, null, null, true, null, out status); if (status == MembershipCreateStatus.Success) { u.Comment = displayName; _provider.UpdateUser(u); if (appSettings.CreateSqlMembershipRegistrationsAsSubmitters) { security.AddUserToTdSubmitter(u.UserName); } } return status; }
protected override void Application_Start() { base.Application_Start(); AppSettings = MefHttpApplication.ApplicationContainer.GetExportedValue<IApplicationSettingsService>(); AreaRegistration.RegisterAllAreas(); RegisterRoutes(RouteTable.Routes, AppSettings.HideHomePage); var databaseSchemaManager = MefHttpApplication.ApplicationContainer.GetExportedValue<IDatabaseSchemaManagerService>(); var searchService = MefHttpApplication.ApplicationContainer.GetExportedValue<TicketSearchService>(); var ticketService = MefHttpApplication.ApplicationContainer.GetExportedValue<ITicketService>(); databaseSchemaManager.EnsureSchemaVersion(); searchService.InitializeSearch(ticketService); var securityService = MefHttpApplication.ApplicationContainer.GetExportedValue<ISecurityService>(); //timer is initialized by the service, but we have to hold a reference to it here or it will be garbage collected // in SQL Security Environments, this will just return null; there is no timer SecurityRefreshTimer = securityService.InitializeSecurityCacheRefreshTimer(); DerelictAttachmentsTimer = new System.Timers.Timer(); int derelictInterval = 300000; DerelictAttachmentsTimer.Elapsed += new System.Timers.ElapsedEventHandler(DerelictAttachmentsTimer_Elapsed); DerelictAttachmentsTimer.Interval = derelictInterval; DerelictAttachmentsTimer.AutoReset = true; DerelictAttachmentsTimer.Start(); if (AppSettings.EmailNotificationsEnabled()) { EmaiNotificationsTimer = new System.Timers.Timer(); int emailInterval = AppSettings.EmailDeliveryTimerIntervalMinutes * 60000; EmaiNotificationsTimer.Elapsed += new System.Timers.ElapsedEventHandler(EmaiNotificationsTimer_Elapsed); EmaiNotificationsTimer.Interval = emailInterval; EmaiNotificationsTimer.AutoReset = true; EmaiNotificationsTimer.Start(); } }
public DatabaseSchemaManagerRepository(IApplicationSettingsService appService) { AppSettings = appService; }
/// <summary> /// Initializes a new instance of the MbConnectViewModel class. /// </summary> public MbConnectViewModel(INavigationService navigationService, IConnectionManager connectionManager, IApplicationSettingsService appSettings) : base(navigationService, connectionManager) { _appSettings = appSettings.Legacy; }
public ApplicationController(ISecurityService security) { Security = security; AppSettings = MefHttpApplication.ApplicationContainer.GetExportedValue<IApplicationSettingsService>(); }
public MainViewModel(IMainModel mainModel, INavigationService navigationService, IMessageBoxService messageBoxService, IApplicationSettingsService applicationSettingsService, IShellTileService shellTileService) { _mainModel = mainModel; _navigationService = navigationService; _messageBoxService = messageBoxService; _applicationSettingsService = applicationSettingsService; _shellTileService = shellTileService; NewAccountCommand = new RelayCommand(() => { _navigationService.NavigateTo("/View/AuthorizationPage.xaml"); }); RemoveAccountCommand = new RelayCommand<AccountViewModel>(account => { _mainModel.AvailableAccounts.Remove(account.Model); _mainModel.Save(); RefreshAccountsList(); }); OpenAccountCommand = new RelayCommand<AccountViewModel>(account => { _mainModel.CurrentAccount = account.Model; _mainModel.ExecuteInitialLoad = true; _navigationService.NavigateTo("/View/ExplorerPage.xaml"); }); ShowAboutCommand = new RelayCommand(() => { _navigationService.NavigateTo("/View/AboutPage.xaml"); }); PageLoadedCommand = new RelayCommand(() => { _mainModel.CurrentAccount = null; if (!_applicationSettingsService.Get<bool>("AcceptedDisclaimer", false)) { _applicationSettingsService.Set("AcceptedDisclaimer", true); _applicationSettingsService.Save(); _messageBoxService.Show("You are advised to read the GDrive disclaimer before you continue.\n\nWould you like to read it now?\n\nYou can always find it later in the About page.", "Welcome to GDrive", new[] { "now", "later" }, buttonIndex => { if (buttonIndex == 0) { _navigationService.NavigateTo("/View/AboutPage.xaml?disclaimer=true"); } }); } }); MessengerInstance.Register<AvailableAccountsChangedMessage>(this, message => { RefreshAccountsList(); }); #if !WP8 DispatcherHelper.RunAsync(UpdateTiles); #endif }