public RendezvousCluster(IConfigurationStorage<RendezvousClusterConfiguration> configurationStorage) { this.configurationStorage = configurationStorage; config = new HashedLinkedList<RendezvousEndpoint>(); config.AddAll(configurationStorage.Read().Cluster); }
/// <summary> /// Initializes a new instance of the <see cref="Configuration"/> class. Uses the passed /// configuration storage to populate its settings. /// </summary> /// <param name="storage">The storage to use for settings.</param> public Configuration(IConfigurationStorage storage) { Storage = storage; Metadata = new Metadata(); BeforeNotifyCallbacks = new List<Func<Event, bool>>(); InternalBeforeNotifyCallbacks = new List<Action<Event>>(); }
public void ConfigurationStorage_Initialises_To_Known_State_And_Properties_Work() { _Implementation = Factory.Singleton.Resolve<IConfigurationStorage>(); Assert.IsNotNull(_Implementation.Provider); Assert.AreNotSame(_Provider, _Implementation.Provider); _Implementation.Provider = _Provider; Assert.AreSame(_Provider, _Implementation.Provider); }
public void TestInitialise() { _Provider = new TestProvider(); _Provider.Folder = TestContext.TestDeploymentDir; _Implementation = Factory.Singleton.Resolve<IConfigurationStorage>(); _Implementation.Provider = _Provider; _ConfigurationChangedEvent = new EventRecorder<EventArgs>(); }
public ConfigurationgService(IConfigurationStorage configurationStorage) { if (configurationStorage == null) { throw new ArgumentNullException(nameof(configurationStorage)); } this._configurationStorage = configurationStorage; }
public void SetUp() { _configurationManager = MockRepository.GenerateMock<IConfigurationManager>(); _configurationStorage = MockRepository.GenerateMock<IConfigurationStorage>(); _configurationStorage.Stub(x => x.VirtualBoxInstallLocation).Return(VirtualBoxPath); _configurationManager.Stub(x => x.Configuration).Return(_configurationStorage); _osTypes = MockRepository.GeneratePartialMock<OSTypes>(); _osTypes.ConfigurationManager = _configurationManager; }
/// <summary> /// Initializes a new instance of the <see cref="BaseClient"/> class. Provides the option to automatically /// hook into uncaught exceptions. Allows injection of dependant classes /// </summary> /// <param name="configStorage">The configuration of the client</param> public BaseClient(IConfigurationStorage configStorage) { Initialize(configStorage); }
public Client(IConfigurationStorage configStorage, MobileDeviceInfo deviceInfo) { Initialize(configStorage, deviceInfo); }
public GridCalculator(IConfigurationStorage configurationStorage) { _sampleIntervalMinutes = configurationStorage.SamplingGridMinutes; }
/// <summary> /// Initialize the client with dependencies /// </summary> /// <param name="configStorage">The configuration to use</param> /// <param name="deviceInfo">Information about device</param> protected void Initialize(IConfigurationStorage configStorage, MobileDeviceInfo deviceInfo=null) { if (configStorage == null || string.IsNullOrEmpty(configStorage.ApiKey) || !_apiRegex.IsMatch(configStorage.ApiKey)) { Logger.Error("You must provide a valid Bugsnag API key"); throw new ArgumentException("You must provide a valid Bugsnag API key"); } else { Config = new Configuration(configStorage, deviceInfo); Notifier = new Notifier(Config); // Install a default exception handler with this client if (Config.AutoNotify) StartAutoNotify(); Initialized(); } }
/// <summary> /// Initializes a new instance of the <see cref="Client"/> class. Provides the option to automatically /// hook into uncaught exceptions. Allows injection of dependant classes /// </summary> /// <param name="configStorage">The configuration of the client</param> public Client(IConfigurationStorage configStorage) { Initialize(configStorage); }
public EventController(IConfigurationStorage storage) { this.storage = storage; }
/// <summary> /// Updates existing feeds, removes dead feeds and adds new feeds after a change in configuration. /// </summary> /// <param name="configurationStorage"></param> private void ApplyConfigurationChanges(IConfigurationStorage configurationStorage) { var configuration = configurationStorage.Load(); var configReceiverSettings = configuration.Receivers; var configMergedFeedSettings = configuration.MergedFeeds; var existingFeeds = new List <IFeed>(Feeds); var feeds = new List <IFeed>(existingFeeds); for (var pass = 0; pass < 2; ++pass) { var justReceiverFeeds = pass == 0 ? null : new List <IFeed>(feeds); if (pass == 0) { foreach (var newReceiver in configReceiverSettings.Where(r => r.Enabled && !existingFeeds.Any(i => i.UniqueId == r.UniqueId))) { CreateFeedForReceiver(newReceiver, configuration, feeds); } } else { foreach (var newMergedFeed in configMergedFeedSettings.Where(r => r.Enabled && !existingFeeds.Any(i => i.UniqueId == r.UniqueId))) { CreateFeedForMergedFeed(newMergedFeed, justReceiverFeeds, feeds); } } foreach (var feed in existingFeeds) { var receiverConfig = configReceiverSettings.FirstOrDefault(r => r.UniqueId == feed.UniqueId); if (receiverConfig != null && !receiverConfig.Enabled) { receiverConfig = null; } var mergedFeedConfig = configMergedFeedSettings.FirstOrDefault(r => r.UniqueId == feed.UniqueId); if (mergedFeedConfig != null && !mergedFeedConfig.Enabled) { mergedFeedConfig = null; } if (receiverConfig != null) { if (pass == 0) { feed.ApplyConfiguration(receiverConfig, configuration); } } else if (mergedFeedConfig != null) { if (pass == 1) { var mergeFeeds = justReceiverFeeds.Where(r => mergedFeedConfig.ReceiverIds.Contains(r.UniqueId)).ToList(); feed.ApplyConfiguration(mergedFeedConfig, mergeFeeds); } } else if (pass == 0) { feed.ExceptionCaught -= Feed_ExceptionCaught; feed.Listener.ConnectionStateChanged -= Listener_ConnectionStateChanged; feed.Dispose(); feeds.Remove(feed); } } } Feeds = feeds.ToArray(); OnFeedsChanged(EventArgs.Empty); }
/// <summary> /// Creates a new object. /// </summary> public Database() { Provider = new DefaultProvider(); _ConfigurationStorage = Factory.Singleton.Resolve<IConfigurationStorage>().Singleton; _ConfigurationStorage.ConfigurationChanged += ConfigurationStorage_ConfigurationChanged; }
public DeviceGrain(IConfigurationStorage configuration, ILoggerFactory loggerFactory) { this.configuration = configuration; this.logger = loggerFactory.CreateLogger <DeviceGrain>(); }
public DeviceController(IConfigurationStorage storage) { this.storage = storage; }
public MainPresenter(IApplicationController controller, IMainView view, IThumbnailConfig configuration, IConfigurationStorage configurationStorage, IThumbnailManager thumbnailManager, IThumbnailDescriptionViewFactory thumbnailDescriptionViewFactory) : base(controller, view) { this._configuration = configuration; this._configurationStorage = configurationStorage; this._thumbnailDescriptionViewFactory = thumbnailDescriptionViewFactory; this._thumbnailManager = thumbnailManager; this._thumbnailDescriptionViews = new Dictionary <IntPtr, IThumbnailDescriptionView>(); this._exitApplication = false; this.View.FormActivated = this.Activate; this.View.FormMinimized = this.Minimize; this.View.FormCloseRequested = this.Close; this.View.ApplicationSettingsChanged = this.SaveApplicationSettings; this.View.ThumbnailsSizeChanged = this.UpdateThumbnailsSize; this.View.ThumbnailStateChanged = this.UpdateThumbnailState; this.View.ForumUrlLinkActivated = this.OpenForumUrlLink; this.View.ApplicationExitRequested = this.ExitApplication; this._thumbnailManager.ThumbnailsAdded = this.ThumbnailsAdded; this._thumbnailManager.ThumbnailsUpdated = this.ThumbnailsUpdated; this._thumbnailManager.ThumbnailsRemoved = this.ThumbnailsRemoved; this._thumbnailManager.ThumbnailSizeChanged = this.ThumbnailSizeChanged; }
/// <summary> /// Constructor. /// </summary> /// <param name="authUi">User Interface.</param> /// <param name="storage">Configuration storage.</param> /// <param name="endpoint">Keeper Endpoint.</param> public Auth(IAuthUI authUi, IConfigurationStorage storage, IKeeperEndpoint endpoint = null) { Storage = storage ?? new InMemoryConfigurationStorage(); Endpoint = endpoint ?? new KeeperEndpoint(Storage.LastServer, Storage.Servers); Ui = authUi; }
/// <summary> /// Initializes a new instance of the <see cref="Configuration"/> class. Uses the passed /// configuration storage to populate its settings. /// </summary> /// <param name="storage">The storage to use for settings.</param> /// <param name="deviceInfo">Information about device</param> public Configuration(IConfigurationStorage storage, MobileDeviceInfo deviceInfo) { Storage = storage; DeviceInfo = deviceInfo; Metadata = new Metadata(); BeforeNotifyCallbacks = new List<Func<Event, bool>>(); InternalBeforeNotifyCallbacks = new List<Action<Event>>(); }
public MainFormPresenter(IApplicationController controller, IMainFormView view, IMediator mediator, IThumbnailConfiguration configuration, IConfigurationStorage configurationStorage) : base(controller, view) { this._mediator = mediator; this._configuration = configuration; this._configurationStorage = configurationStorage; this._descriptionsCache = new Dictionary <string, IThumbnailDescription>(); this._suppressSizeNotifications = false; this._exitApplication = false; this.View.FormActivated = this.Activate; this.View.FormMinimized = this.Minimize; this.View.FormCloseRequested = this.Close; this.View.ApplicationSettingsChanged = this.SaveApplicationSettings; this.View.ThumbnailsSizeChanged = this.UpdateThumbnailsSize; this.View.ThumbnailStateChanged = this.UpdateThumbnailState; this.View.DocumentationLinkActivated = this.OpenDocumentationLink; this.View.ApplicationExitRequested = this.ExitApplication; }
/// <summary> /// Disposes of or finalises the object. Note that the object is sealed. /// </summary> /// <param name="disposing"></param> private void Dispose(bool disposing) { if(disposing) { _TransactionHelper.Abandon(); CloseConnection(); if(_AircraftTable != null) { _AircraftTable.Dispose(); _AircraftTable = null; } if(_FlightTable != null) { _FlightTable.Dispose(); _FlightTable = null; } if(_DbHistoryTable != null) { _DbHistoryTable.Dispose(); _DbHistoryTable = null; } if(_DbInfoTable != null) { _DbInfoTable.Dispose(); _DbInfoTable = null; } if(_LocationsTable != null) { _LocationsTable.Dispose(); _LocationsTable = null; } if(_SessionsTable != null) { _SessionsTable.Dispose(); _SessionsTable = null; } if(_SystemEventsTable != null) { _SystemEventsTable.Dispose(); _SystemEventsTable = null; } if(_ConfigurationStorage != null) { _ConfigurationStorage.ConfigurationChanged -= ConfigurationStorage_ConfigurationChanged; _ConfigurationStorage = null; } if(_DatabaseLog != null) { _DatabaseLog.Flush(); _DatabaseLog.Dispose(); _DatabaseLog = null; } } }
private Configuration LoadConfiguration(IConfigurationStorage configurationStorage) { Configuration result = new Configuration(); _View.ReportProgress(Strings.SplashScreenLoadingConfiguration); try { result = configurationStorage.Load(); } catch(Exception ex) { string message = String.Format(Strings.InvalidConfigurationFileFull, ex.Message, configurationStorage.Folder); if(_View.YesNoPrompt(message, Strings.InvalidConfigurationFileTitle, true)) { configurationStorage.Save(new Configuration()); _View.ReportProblem(Strings.DefaultSettingsSavedFull, Strings.DefaultSettingsSavedTitle, true); } Provider.AbortApplication(); } return result; }
/// <summary> /// Updates our copy of the configuration settings. /// </summary> /// <param name="configurationStorage"></param> private void LoadConfiguration(IConfigurationStorage configurationStorage) { var configuration = configurationStorage.Load(); _Enabled = configuration.GoogleMapSettings.EnableMinifying; }
public DashboardController(IRuntimeStorage runtime, IConfigurationStorage configuration, IGrainFactory factory) { this.runtime = runtime; this.configuration = configuration; this.factory = factory; }
private void InitialiseLog(IConfigurationStorage configurationStorage) { _View.ReportProgress(Strings.SplashScreenInitialisingLog); var log = Factory.Singleton.Resolve<ILog>().Singleton; log.Truncate(100); log.WriteLine("Program started, version {0}", Factory.Singleton.Resolve<IApplicationInformation>().FullVersion); log.WriteLine("Working folder {0}", configurationStorage.Folder); }
private void ParseCommandLineParameters(IConfigurationStorage configurationStorage) { _View.ReportProgress(Strings.SplashScreenParsingCommandLineParameters); if (CommandLineArgs != null) { foreach (var arg in CommandLineArgs) { var caselessArg = arg.ToUpper(); if (caselessArg.StartsWith("-CULTURE:")) { continue; } else if (caselessArg == "-SHOWCONFIGFOLDER") { continue; } else if (caselessArg == "-DEFAULTFONTS") { continue; } else if (caselessArg == "-NOGUI") { continue; } else if (caselessArg.StartsWith("-CREATEADMIN:")) { _CreateAdminUser = arg.Substring(13); if (String.IsNullOrEmpty(_CreateAdminUser)) { _View.ReportProblem(Strings.CreateAdminUserMissing, Strings.UserNameMissing, true); } } else if (caselessArg.StartsWith("-PASSWORD:"******"-WORKINGFOLDER:")) { var folder = arg.Substring(15); if (!Provider.FolderExists(folder)) { _View.ReportProblem(String.Format(Strings.FolderDoesNotExistFull, folder), Strings.FolderDoesNotExistTitle, true); } else { configurationStorage.Folder = folder; } } else if (caselessArg.StartsWith("-LISTENERTIMEOUT:")) { // This was removed in 2.0.3 - coarse timeouts are now a per-receiver configuration property } else if (caselessArg == "/?" || caselessArg == "-?" || caselessArg == "--HELP") { _View.ReportProblem(Strings.CommandLineHelp, Strings.CommandLineHelpTitle, true); } else { _View.ReportProblem(String.Format(Strings.UnrecognisedCommandLineParameterFull, arg), Strings.UnrecognisedCommandLineParameterTitle, true); } } } }
private void ParseCommandLineParameters(IConfigurationStorage configurationStorage) { _View.ReportProgress(Strings.SplashScreenParsingCommandLineParameters); if(CommandLineArgs != null) { foreach(var arg in CommandLineArgs) { var caselessArg = arg.ToUpper(); if(caselessArg.StartsWith("-CULTURE:")) continue; else if(arg == "-showConfigFolder") continue; else if(caselessArg.StartsWith("-WORKINGFOLDER:")) { var folder = arg.Substring(15); if(!Provider.FolderExists(folder)) _View.ReportProblem(String.Format(Strings.FolderDoesNotExistFull, folder), Strings.FolderDoesNotExistTitle, true); else configurationStorage.Folder = folder; } else { _View.ReportProblem(String.Format(Strings.UnrecognisedCommandLineParameterFull, arg), Strings.UnrecognisedCommandLineParameterTitle, true); } } } }
public SaveConfigurationHandler(IConfigurationStorage storage) { this._storage = storage; }