public void Startup() { IContactService contactService = (IContactService)Core.PluginLoader.GetPluginService(typeof(IContactService)); if (contactService != null) { ContactBlockCreator creator = ICQContactBlock.CreateBlock; contactService.RegisterContactEditBlock(0, ListAnchor.Last, "ICQ Accounts", creator); contactService.RegisterContactEditBlock(ContactTabNames.GeneralTab, ListAnchor.Last, "ICQ Accounts", creator); } ISettingStore settings = Core.SettingStore; _indexStartDate = settings.ReadDate("Startup", "IndexStartDate", DateTime.MinValue); if (_indexStartDate > DateTime.MinValue) { _idleIndexing = settings.ReadBool("Startup", "IdleIndexing", false); bool needIdle = ObjectStore.ReadBool("ICQ", "NeedIdle", true); if (_idleIndexing && needIdle) { Trace.WriteLine("Queueing conversations rebuild in idle mode", "ICQ.Plugin"); Core.ResourceAP.QueueIdleJob(this); } else { Trace.WriteLine("_idleIndexing = " + _idleIndexing, "ICQ.Plugin"); Trace.WriteLine("NeedIdle = " + needIdle, "ICQ.Plugin"); } } Core.StateChanged += Core_StateChanged; }
public override void OK() { ISettingStore settings = Core.SettingStore; int lastMethod = BookmarkService.DownloadMethod; BookmarkService service = FavoritesPlugin._bookmarkService; if (_idleButton.Checked) { BookmarkService.DownloadMethod = 0; if (lastMethod != 0) { service.SynchronizeBookmarks(); } } else if (_immediateButton.Checked) { BookmarkService.DownloadMethod = 1; if (lastMethod != 1) { service.SynchronizeBookmarks(); } } else { BookmarkService.DownloadMethod = 2; } CookiesManager.SetUserCookieProviderName(typeof(FavoriteJob), _cookieProviderSelector.SelectedProfileName); IResource res = (IResource)_bookmarkFoldersBox.SelectedItem; if (res != null) { settings.WriteInt("Favorites", "CatAnnRoot", res.Id); } }
private static void PrepareSettings(ISettingStore store) { s_SharedBrushListModel = store.Fetch <BrushListModel>("SharedBrushListModel", null, filter: (value) => { if (value == null) { value = new BrushListModel(); } value.HideAliasBrushes = false; return(value); } ); s_setting_ActiveTileSystemInstanceID = store.Fetch <int>("ActiveTileSystemInstanceID", 0); s_setting_Rotation = store.Fetch <int>("Rotation", 0, filter: (value) => Mathf.Clamp(value, 0, 3) ); s_setting_RandomizeVariations = store.Fetch <bool>("RandomizeVariations", true); s_setting_RandomizeVariations.ValueChanged += (args) => { if (ToolManager.Instance.CurrentTool != null) { SceneView.RepaintAll(); } }; s_setting_BrushNozzle = store.Fetch <BrushNozzle>("BrushNozzle", BrushNozzle.Round); s_setting_FillCenter = store.Fetch <bool>("FillCenter", true); s_setting_PaintAroundExistingTiles = store.Fetch <bool>("PaintAroundExistingTiles", false); }
/// <inheritdoc/> protected override void PrepareOptions(ISettingStore store) { base.PrepareOptions(store); this.settingCanPickPlops = store.Fetch <bool>("CanPickPlops", true); this.settingInteractWithActiveSystemOnly = store.Fetch <bool>("InteractWithActiveSystemOnly", true); }
public static SidebarState RestoreFromIni(string section) { ISettingStore ini = Core.SettingStore; int count = ini.ReadInt(section, "PaneCount", 0); if (count == 0) { return(null); } int[] paneHeights = new int[count]; for (int i = 0; i < count; i++) { paneHeights[i] = ini.ReadInt(section, "Pane" + i + "Height", 0); } int activePaneIndex = ini.ReadInt(section, "ActivePaneIndex", 0); if (activePaneIndex >= paneHeights.Length) { activePaneIndex = 0; } IResource selResource = null; int resId = ini.ReadInt(section, "SelectedResource", -1); if (resId >= 0) { selResource = Core.ResourceStore.TryLoadResource(resId); } return(new SidebarState(paneHeights, activePaneIndex, selResource)); }
private static void PrepareSettings_Painting(ISettingStore store) { EraseEmptyChunksPreference = store.Fetch <EraseEmptyChunksPreference>( "EraseEmptyChunksPreference", Editor.EraseEmptyChunksPreference.Yes ); EraseEmptyChunksPreference.ValueChanged += (args) => { EditorInternalUtility.Instance.eraseEmptyChunks = (int)args.NewValue; }; ToolPreferredNozzleIndicator = store.Fetch <NozzleIndicator>( "ToolPreferredNozzleIndicator", NozzleIndicator.Automatic ); ToolWireframeColor = store.Fetch <Color>( "ToolWireframeColor", new Color(1f, 0f, 0f, 0.55f) ); ToolShadedColor = store.Fetch <Color>( "ToolShadedColor", new Color(1f, 0f, 0f, 0.07f) ); ToolImmediatePreviews = store.Fetch <bool>( "ToolImmediatePreviews", true ); ToolImmediatePreviewsTintColor = store.Fetch <Color>( "ToolImmediatePreviewsTintColor", new Color(1f, 0.33f, 0.33f, 0.7f) ); ToolImmediatePreviewsSeeThrough = store.Fetch <bool>( "ToolImmediatePreviewsSeeThrough", false ); }
public static T GetOrSet <T>(this ISettingStore settings, string key, Func <T> getDefaultValue, string description) { T returnValue; string keyValue = settings.Get(key); if (keyValue.IsNullOrWhiteSpace()) { returnValue = getDefaultValue(); // set default settings.Set(key, returnValue); } else { returnValue = keyValue.ToType <T>(); } var descriptionKey = $"{key}_Description"; if (!description.IsNullOrWhiteSpace() && settings.Get(descriptionKey).IsNullOrWhiteSpace()) { settings.Set(descriptionKey, $@"## {description}"); } return(returnValue); }
/// <summary> /// Create a new instance of the <see cref="Setting{TSetting}"/> /// </summary> /// <param name="settingStore"><see cref="ISettingStore"/> used for loading and saving settings</param> /// <param name="eventAggregator"><see cref="IEventAggregator"/> used to notify subscribers about settings changes</param> public Setting(ISettingStore settingStore, IEventAggregator eventAggregator) { _settingStore = settingStore ?? throw new ArgumentNullException(nameof(settingStore)); _eventAggregator = eventAggregator ?? throw new ArgumentNullException(nameof(eventAggregator)); CurrentSetting = _settingStore.Load<TSetting>(); }
private static void PrepareSettings_Grid(ISettingStore store) { BackgroundGridColor = store.Fetch <Color>( "BackgroundGridColor", new Color32(0, 0, 0, 15) ); MajorGridColor = store.Fetch <Color>( "MajorGridColor", new Color32(255, 255, 255, 15) ); MinorGridColor = store.Fetch <Color>( "MinorGridColor", new Color32(255, 255, 255, 5) ); ChunkGridColor = store.Fetch <Color>( "ChunkGridColor", new Color32(70, 192, 255, 30) ); ShowActiveTileSystem = store.Fetch <bool>( "ShowActiveTileSystem", true ); ShowGrid = store.Fetch <bool>( "ShowGrid", true ); ShowChunks = store.Fetch <bool>( "ShowChunks", true ); }
public override void ShowPane() { _ini = ICore.Instance.SettingStore; _chkGreetingInReplies.Checked = _ini.ReadBool("MailFormat", "GreetingInReplies", true); _chkPrefixInitials.Checked = _ini.ReadBool("MailFormat", "PrefixInitials", false); _boxPrefix.Text = _ini.ReadString("MailFormat", "GreetingString", "Hello"); /** * signatures */ _chkUseSignature.Checked = _ini.ReadBool("MailFormat", "UseSignature", false); _signatureBox.Enabled = _chkUseSignature.Checked; if (_signatureBox.Enabled) { _signatureBox.Text = _ini.ReadString("MailFormat", "Signature"); } switch (_ini.ReadInt("MailFormat", "SignatureInReplies", 1)) { case 0: _radReplySignatureNone.Checked = true; break; case 1: _radSignatureBeforeQuoting.Checked = true; break; case 2: _radSignatureAfterQuoting.Checked = true; break; } }
public AbpIdentityOverrideOptionsFactory( ISettingStore settingStore, IEnumerable <IConfigureOptions <IdentityOptions> > setups, IEnumerable <IPostConfigureOptions <IdentityOptions> > postConfigures) : base(setups, postConfigures) { SettingStore = settingStore; }
/// <inheritdoc/> public SettingManager(ISettingDefinitionManager settingDefinitionManager, ICacheManager cacheManager) { _settingDefinitionManager = settingDefinitionManager; SettingStore = DefaultConfigSettingStore.Instance; _applicationSettingCache = cacheManager.GetApplicationSettingsCache(); }
public AbstractPluginCommand(ISettingStore settings, IDataStore data) { this.Settings = settings; this.Data = data; PluginNameFormatter pluginNameFormatter = new PluginNameFormatter(); PluginType = pluginNameFormatter.GetPluginName(this.GetType()); }
public CodesSettingValueProvider( ISettingStore settingStore, ICurrentCodes currentCodes ) : base(settingStore) { CurrentCodes = currentCodes; }
/// <inheritdoc/> protected override void PrepareOptions(ISettingStore store) { base.PrepareOptions(store); this.settingMaximumFillCount = store.Fetch <int>("MaximumFillCount", 300, filter: value => Mathf.Clamp(value, 1, 10000) ); }
public AttachmentType(ISettingStore settings, int index) { _name = settings.ReadString("Attachments", "Attachment" + index + "Name"); string exts = settings.ReadString("Attachments", "Attachment" + index + "Exts"); _exts = exts.Split(','); }
public WebServer(ILifetimeScope scope, ISettingStore settingStore, ILogger logger) { _scope = scope; _logger = logger.ForContext <WebServer>(); _httpServerEnabled = settingStore.GetOrSet("HttpServerEnabled", true, $"Is the Papercut Web UI Server enabled (Defaults to true)?"); _httpBaseAddress = settingStore.GetOrSet("HttpBaseAddress", DefaultHttpBaseAddress, $"The Papercut Web UI Server listening address (Defaults to {DefaultHttpBaseAddress})."); _httpPort = settingStore.GetOrSet("HttpPort", DefaultHttpPort, $"The Papercut Web UI Server listening port (Defaults to {DefaultHttpPort})."); }
public AmazonDataService(CountryType countryType, IAmazonProxyService service, IParser parser, ISettingStore settingStore, ISerializer serializer) { _service = service; CountryType = countryType; _parser = parser; _settingStore = settingStore; _serializer = serializer; }
/// <inheritdoc/> protected override void PrepareOptions(ISettingStore store) { base.PrepareOptions(store); this.settingFillRatePercentage = store.Fetch <int>("FillRatePercentage", 50, filter: value => Mathf.Clamp(value, 0, 100) ); this.settingRandomizeRotation = store.Fetch <bool>("RandomizeRotation", false); }
public PymeAdminService(PymeProvider pymeManager, ImageProvider imageManager, ThemeProvider themeManager, ISettingStore settingStore, IThemeClientService themeClientService) { _pymeManager = pymeManager; _imageManager = imageManager; _themeManager = themeManager; _settingStore = settingStore; _themeClientService = themeClientService; _server = HttpContext.Current.Server; }
/// <inheritdoc/> public SettingManager(ISettingDefinitionManager settingDefinitionManager, ICacheManager cacheManager) { _settingDefinitionManager = settingDefinitionManager; AbpSession = NullAbpSession.Instance; SettingStore = DefaultConfigSettingStore.Instance; _applicationSettingCache = cacheManager.GetApplicationSettingsCache(); _userSettingCache = cacheManager.GetUserSettingsCache(); }
/// <inheritdoc/> protected override void PrepareOptions(ISettingStore store) { base.PrepareOptions(store); this.settingNozzleSizeOption = store.Fetch <int>("NozzleSize", this.DefaultNozzleSize, filter: value => Mathf.Clamp(value, 1, 19) ); this.settingNozzleSizeOption.ValueChanged += (args) => ToolUtility.RepaintToolPalette(); }
/// <inheritdoc/> public SettingManager(ISettingDefinitionManager settingDefinitionManager, ICacheManager cacheManager) { _settingDefinitionManager = settingDefinitionManager; Session = NullInfrastructureSession.Instance; SettingStore = DefaultConfigSettingStore.Instance; _applicationSettingCache = cacheManager.GetApplicationSettingsCache(); _tenantSettingCache = cacheManager.GetTenantSettingsCache(); _userSettingCache = cacheManager.GetUserSettingsCache(); }
public MockPluginEnvironment(IResourceStore storage) { _picoContainer = new DefaultPicoContainer(); _mockPicoContainer = new DefaultPicoContainer(_picoContainer); Storage = storage; if (storage != null) { _picoContainer.RegisterComponentInstance(storage); } File.Delete(".\\MockPluginEnvironment.ini"); _settingStore = new Ini.IniFile(".\\MockPluginEnvironment.ini"); DynamicMock actionManagerMock = new DynamicMock(typeof(IActionManager)); actionManagerMock.SetupResult("GetKeyboardShortcut", "", typeof(IAction)); _actionManager = (IActionManager)actionManagerMock.MockInstance; _uiManager = (IUIManager) new DynamicMock(typeof(IUIManager)).MockInstance; _pluginLoader = (IPluginLoader) new DynamicMock(typeof(IPluginLoader)).MockInstance; _resourceBrowser = (IResourceBrowser) new DynamicMock(typeof(IResourceBrowser)).MockInstance; _tabManager = new MockTabManager(); _resourceAP = new MockAsyncProcessor(); _networkAP = new MockAsyncProcessor(); _uiAP = new MockAsyncProcessor(); DynamicMock resourceIconManagerMock = new DynamicMock(typeof(IResourceIconManager)); resourceIconManagerMock.SetupResult("IconColorDepth", ColorDepth.Depth8Bit); resourceIconManagerMock.SetupResult("GetIconIndex", 0, typeof(IResource)); _resourceIconManager = (IResourceIconManager)resourceIconManagerMock.MockInstance; _notificationManager = (INotificationManager) new DynamicMock(typeof(INotificationManager)).MockInstance; _textIndexManager = (ITextIndexManager) new DynamicMock(typeof(ITextIndexManager)).MockInstance; _messageFormatter = (IMessageFormatter) new DynamicMock(typeof(IMessageFormatter)).MockInstance; _displayColumnManager = (IDisplayColumnManager) new DynamicMock(typeof(IDisplayColumnManager)).MockInstance; // DynamicMock filterManagerMock = new DynamicMock( typeof(IFilterRegistry) ); DynamicMock filterEngineMock = new DynamicMock(typeof(IFilterEngine)); filterEngineMock.SetupResult("ExecRules", true, typeof(string), typeof(IResource)); DynamicMock filterManagerMock = new DynamicMock(typeof(IFilterRegistry)); _filterRegistry = (IFilterRegistry)filterManagerMock.MockInstance; _rcManager = (IRemoteControlManager) new DynamicMock(typeof(IRemoteControlManager)).MockInstance; _trayIconManager = (ITrayIconManager) new DynamicMock(typeof(ITrayIconManager)).MockInstance; _formattingRuleManager = (IFormattingRuleManager) new DynamicMock(typeof(IFormattingRuleManager)).MockInstance; _expirationRuleManager = (IExpirationRuleManager) new DynamicMock(typeof(IExpirationRuleManager)).MockInstance; _filteringFormsManager = (IFilteringFormsManager) new DynamicMock(typeof(IFilteringFormsManager)).MockInstance; _searchQueryExtensions = (ISearchQueryExtensions) new DynamicMock(typeof(ISearchQueryExtensions)).MockInstance; _filterEngine = (IFilterEngine) new DynamicMock(typeof(IFilterEngine)).MockInstance; theInstance = this; }
public static void SetBackupDefaults() { ISettingStore ini = Core.SettingStore; if (ini.ReadString("ResourceStore", "EnableBackup").Length == 0) { ini.WriteBool("ResourceStore", "EnableBackup", true); ini.WriteString("ResourceStore", "BackupPath", GetDefaultBackupPath(OMEnv.WorkDir)); } }
private void SaveBackupPath() { ISettingStore ini = Core.SettingStore; if (ini != null) { ini.WriteBool("ResourceStore", "EnableBackup", _enableBackupBox.Checked); ini.WriteString("ResourceStore", "BackupPath", _backupPath.Text); } }
/// <inheritdoc/> public SettingManager(ISettingDefinitionManager settingDefinitionManager, ICacheManager cacheManager) { _settingDefinitionManager = settingDefinitionManager; SharePlatformSession = NullSharePlatformSession.Instance; SettingStore = DefaultConfigSettingStore.Instance; _applicationSettingCache = cacheManager.GetApplicationSettingsCache(); _userSettingCache = cacheManager.GetUserSettingsCache(); }
/** * Saves the setting store used by the form and restores its settings * from the INI file. */ public void RestoreSettings() { AdjustContolProperties(Controls); KeyPreview = true; _ini = Core.SettingStore; string section = GetFormSettingsSection(); bool maximized = _ini.ReadBool(section, "Maximized", false); if (maximized) { WindowState = FormWindowState.Maximized; } else { int x = _ini.ReadInt(section, "X", -1); int y = _ini.ReadInt(section, "Y", -1); int width = _ini.ReadInt(section, "Width", -1); int height = _ini.ReadInt(section, "Height", -1); if (x != -1 && y != -1) { Screen scr = Screen.FromPoint(new Point(x, y)); // First correct horizontal location (since it is that // what changes most of the time when screens configuration // is changed). If new point is suitable, do not change vertical // location. // NB: pay attention to cases when Screen.WorkingArea is (0, 0, 0, 0)!!! if (!scr.Bounds.Contains(x, y)) { x = scr.WorkingArea.X; if (scr.WorkingArea.Width != 0) { x += Math.Abs(x) % scr.WorkingArea.Width; } } if (!scr.Bounds.Contains(x, y)) { y = scr.WorkingArea.Y; if (scr.WorkingArea.Height != 0) { y += Math.Abs(y) % scr.WorkingArea.Height; } } StartPosition = FormStartPosition.Manual; Location = new Point(x, y); } if (width > 0 && height > 0) { ClientSize = new Size(width, height); } } }
public SettingManager(ISettingDefinitionManager settingDefinitionManager) { _settingDefinitionManager = settingDefinitionManager; Session = NullAbpSession.Instance; SettingStore = NullSettingStore.Instance; //Should be constructor injection? For that, ISettingStore must be registered! _applicationSettings = new Lazy <Dictionary <string, SettingInfo> >(GetApplicationSettingsFromDatabase, true); _tenantSettingCache = new ThreadSafeObjectCache <Dictionary <string, SettingInfo> >(new MemoryCache(GetType().FullName + ".TenantSettings"), TimeSpan.FromMinutes(60)); //TODO: Get constant from somewhere else. _userSettingCache = new ThreadSafeObjectCache <Dictionary <string, SettingInfo> >(new MemoryCache(GetType().FullName + ".UserSettings"), TimeSpan.FromMinutes(20)); //TODO: Get constant from somewhere else. }
/// <inheritdoc/> public SettingManager(ISettingDefinitionManager settingDefinitionManager) { _settingDefinitionManager = settingDefinitionManager; AbpSession = NullAbpSession.Instance; SettingStore = DefaultConfigSettingStore.Instance; _applicationSettings = new Lazy<Dictionary<string, SettingInfo>>(() => AsyncHelper.RunSync(GetApplicationSettingsFromDatabase), true); //TODO: Run async _tenantSettingCache = new AsyncThreadSafeObjectCache<Dictionary<string, SettingInfo>>(new MemoryCache(GetType().FullName + ".TenantSettings"), TimeSpan.FromMinutes(60)); //TODO: Get constant from somewhere else. _userSettingCache = new AsyncThreadSafeObjectCache<Dictionary<string, SettingInfo>>(new MemoryCache(GetType().FullName + ".UserSettings"), TimeSpan.FromMinutes(20)); //TODO: Get constant from somewhere else. }
public SettingManager(ISettingDefinitionManager settingDefinitionManager) { _settingDefinitionManager = settingDefinitionManager; Session = NullAbpSession.Instance; SettingStore = NullSettingStore.Instance; _applicationSettings = new Lazy <Dictionary <string, Setting> >(GetApplicationSettingsFromDatabase, true); _tenantSettingCache = new ThreadSafeObjectCache <Dictionary <string, Setting> >(new MemoryCache(GetType().Name + "_TenantSettings"), TimeSpan.FromMinutes(60)); //TODO: Get constant from somewhere else. _userSettingCache = new ThreadSafeObjectCache <Dictionary <string, Setting> >(new MemoryCache(GetType().Name + "_UserSettings"), TimeSpan.FromMinutes(30)); //TODO: Get constant from somewhere else. }
/// <inheritdoc/> public SettingManager(ISettingDefinitionManager settingDefinitionManager, ICacheManager cacheManager) { _settingDefinitionManager = settingDefinitionManager; HozaruSession = NullHozaruSession.Instance; SettingStore = DefaultConfigSettingStore.Instance; //_applicationSettingCache = cacheManager.GetApplicationSettingsCache(); //_tenantSettingCache = cacheManager.GetTenantSettingsCache(); //_userSettingCache = cacheManager.GetUserSettingsCache(); }
/// <inheritdoc/> public SettingManager(ISettingDefinitionManager settingDefinitionManager, ICacheManager cacheManager) { _settingDefinitionManager = settingDefinitionManager; AbpSession = NullAbpSession.Instance; SettingStore = DefaultConfigSettingStore.Instance; _applicationSettings = new Lazy<Dictionary<string, SettingInfo>>(() => AsyncHelper.RunSync(GetApplicationSettingsFromDatabase), true); _tenantSettingCache = cacheManager .GetCache("AbpTenantSettingsCache") .AsTyped<int, Dictionary<string, SettingInfo>>(); _userSettingCache = cacheManager .GetCache("AbpUserSettingsCache") .AsTyped<long, Dictionary<string, SettingInfo>>(); }