Exemplo n.º 1
0
        public override void EnablePlugin()
        {
            ConfigurationDialog = new PluginConfigurationDialog <WS281XConfigurationViewModel>();

            PluginSetting <List <DeviceDefinition> > definitions = _settings.GetSetting <List <DeviceDefinition> >("DeviceDefinitions");

            if (definitions.Value == null)
            {
                definitions.Value = new List <DeviceDefinition>();
            }

            foreach (DeviceDefinition deviceDefinition in definitions.Value)
            {
                switch (deviceDefinition.Type)
                {
                case DeviceDefinitionType.Arduino:
                    RGB.NET.Devices.WS281X.WS281XDeviceProvider.Instance.AddDeviceDefinition(new ArduinoWS281XDeviceDefinition(deviceDefinition.Port));
                    break;

                case DeviceDefinitionType.Bitwizard:
                    RGB.NET.Devices.WS281X.WS281XDeviceProvider.Instance.AddDeviceDefinition(new BitwizardWS281XDeviceDefinition(deviceDefinition.Port));
                    break;

                default:
                    throw new ArgumentOutOfRangeException();
                }
            }

            _rgbService.AddDeviceProvider(RgbDeviceProvider);
        }
Exemplo n.º 2
0
        public RootViewModel(
            IKernel kernel,
            IEventAggregator eventAggregator,
            ISettingsService settingsService,
            ICoreService coreService,
            IWindowManager windowManager,
            IDebugService debugService,
            IRegistrationService builtInRegistrationService,
            IMessageService messageService,
            SidebarViewModel sidebarViewModel)
        {
            _kernel                     = kernel;
            _eventAggregator            = eventAggregator;
            _settingsService            = settingsService;
            _coreService                = coreService;
            _windowManager              = windowManager;
            _debugService               = debugService;
            _builtInRegistrationService = builtInRegistrationService;
            _messageService             = messageService;
            _sidebarViewModel           = sidebarViewModel;
            _frameTimeUpdateTimer       = new Timer(500);

            _windowSize = _settingsService.GetSetting <WindowSize>("UI.RootWindowSize");
            _sidebarViewModel.ConductWith(this);

            ActiveItem      = sidebarViewModel.SelectedItem;
            ActiveItemReady = true;
            PinSidebar      = _settingsService.GetSetting("UI.PinSidebar", false);

            AssemblyInformationalVersionAttribute versionAttribute = typeof(RootViewModel).Assembly.GetCustomAttribute <AssemblyInformationalVersionAttribute>();

            WindowTitle = $"Artemis {versionAttribute?.InformationalVersion} build {Constants.BuildInfo.BuildNumberDisplay}";
        }
        public void Init(ServiceLocator sl, ref PluginSetting setting)
        {
            if (string.IsNullOrEmpty(setting["enable"]))
                setting.Enable = !HttpContext.Current.IsDebuggingEnabled;

            if (!setting.Enable) return;

            ErrorHandler eh = new ErrorHandler();
            eh.Start();
            sl.AddComponentInstance<IErrorHandler>(eh);

            List<string> emails = new List<string>(StringUtil.Split(setting["notifyEmails"], StringUtil.Comma, true, true));

            if (emails.Count == 0) return;

            ErrorHandler.NotifyError += (sender, e) =>
            {
                try
                {
                    Dictionary<string, object> param = new Dictionary<string, object>();
                    param["jc"] = JContext.Current;
                    param["exception"] = ExceptionUtil.WriteException(e.Exception);

                    Kiss.Notice.NoticeFactory.Create("Email").Send("未处理异常", param,
                        null,
                        emails.ToArray());
                }
                catch (Exception ex)
                {
                    LogManager.GetLogger<ExceptionHandlerInitializer>().Error(ExceptionUtil.WriteException(ex));
                }
            };
        }
 public HueDataModelExpansion(PluginSettings settings, ILogger logger, IHueService hueService)
 {
     _logger               = logger;
     _hueService           = hueService;
     _storedBridgesSetting = settings.GetSetting("Bridges", new List <PhilipsHueBridge>());
     _pollingRateSetting   = settings.GetSetting("PollingRate", 2);
 }
Exemplo n.º 5
0
        public RootViewModel(
            IEventAggregator eventAggregator,
            ISettingsService settingsService,
            ICoreService coreService,
            IDebugService debugService,
            IRegistrationService builtInRegistrationService,
            ISnackbarMessageQueue snackbarMessageQueue,
            SidebarViewModel sidebarViewModel)
        {
            SidebarViewModel            = sidebarViewModel;
            _eventAggregator            = eventAggregator;
            _coreService                = coreService;
            _debugService               = debugService;
            _builtInRegistrationService = builtInRegistrationService;
            _snackbarMessageQueue       = snackbarMessageQueue;

            _frameTimeUpdateTimer = new Timer(500);

            _colorScheme = settingsService.GetSetting("UI.ColorScheme", ApplicationColorScheme.Automatic);
            _windowSize  = settingsService.GetSetting <WindowSize>("UI.RootWindowSize");

            _themeWatcher = new ThemeWatcher();
            ApplyColorSchemeSetting();

            ActiveItem      = SidebarViewModel.SelectedItem;
            ActiveItemReady = true;

            AssemblyInformationalVersionAttribute?versionAttribute = typeof(RootViewModel).Assembly.GetCustomAttribute <AssemblyInformationalVersionAttribute>();

            WindowTitle = $"Artemis {versionAttribute?.InformationalVersion}";
        }
        public async Task RegisterPluginSettingOptionAddedTest()
        {
            //Arrange
            var dbConnection = new UnitTestDbConnection();

            Database.SetInitializer(new CreateFreshDbInitializer());
            var pluginBuilder = new PluginSettingBuilder(dbConnection, CancellationToken.None);
            var dbPlugin      = UnitTesting.CreateFakePlugin();

            var pluginSetting = new PluginSetting
            {
                Name             = "Plugin Setting 1",
                ValueType        = DataType.STRING,
                Value            = "Hello World",
                UniqueIdentifier = "PropertyTest"
            };

            dbPlugin.Settings.Add(pluginSetting);
            var option1 = new PluginSettingOption
            {
                Name = "Option 1",
            };
            var option2 = new PluginSettingOption
            {
                Name = "Option 2",
            };

            pluginSetting.Options.Add(option1);


            using (var context = new ZvsContext(dbConnection))
            {
                context.Plugins.Add(dbPlugin);
                await context.SaveChangesAsync();
            }
            var plugin = new StubUnitTestPlugin
            {
                PluginGuidGet = () => dbPlugin.PluginGuid
            };

            pluginSetting.Options.Add(option2);

            //act
            var result = await pluginBuilder.Plugin(plugin).RegisterPluginSettingAsync(pluginSetting, o => o.PropertyTest);

            PluginSetting a;

            using (var context = new ZvsContext(dbConnection))
            {
                a = await context.PluginSettings
                    .Include(o => o.Options)
                    .FirstOrDefaultAsync(o => o.Id == pluginSetting.Id);
            }

            //assert
            Console.WriteLine(result.Message);
            Assert.IsFalse(result.HasError);
            Assert.IsTrue(a.Options.Count == 2, "Expected 2 plugin setting options");
            Assert.IsTrue(a.Options[1].Name == option2.Name, "Plugin option name mismatch");
        }
Exemplo n.º 7
0
 public PluginInfoViewModel(PluginSetting setting, PluginKindId kindId)
     : base(null, false)
 {
     Name    = setting.Name;
     Enabled = setting.Enabled;
     Kind    = kindId;
 }
Exemplo n.º 8
0
        public WS281XConfigurationViewModel(Plugin plugin, PluginSettings settings, IDialogService dialogService) : base(plugin)
        {
            _dialogService = dialogService;
            _definitions   = settings.GetSetting <List <DeviceDefinition> >("DeviceDefinitions");

            Definitions = new BindableCollection <DeviceDefinition>(_definitions.Value);
        }
        private static void LoadConfig()
        {
            try
            {
                ConfigNode settings = ConfigNode.Load(KSPUtil.ApplicationRootPath + "GameData/_0000_KramaxPluginReload/Settings.cfg");

                windowsSdkBinPath   = settings.GetValue("windowsSdkBinPath");
                dotFrameworkBinPath = settings.GetValue("dotFrameworkBinPath");
                foreach (ConfigNode node in settings.GetNodes("PluginSetting"))
                {
                    PluginSetting pluginSetting = new PluginSetting()
                    {
                        Name                 = node.GetValue("name"),
                        Path                 = node.GetValue("path"),
                        LoadOnce             = bool.Parse(node.GetValue("loadOnce")),
                        MethodsAllowedToFail = bool.Parse(node.GetValue("methodsAllowedToFail"))
                    };

                    PluginSettings.Add(pluginSetting);
                }
            }
            catch (Exception ex)
            {
                Deb.LogError("KramaxPluginReload: Failed to load settings.cfg. Error:\n{0}", ex);
                return;
            }
        }
Exemplo n.º 10
0
            private Control GetControlForProperty(PluginSettingStore store, PropertyInfo property)
            {
                var           attr    = property.GetCustomAttribute <PropertyAttribute>();
                PluginSetting setting = store[property];

                if (setting == null)
                {
                    setting = new PluginSetting(property, null);
                    store.Settings.Add(setting);
                }

                var control = GetControlForSetting(property, setting);

                if (control != null)
                {
                    // Apply all visual modifier attributes
                    foreach (ModifierAttribute modifierAttr in property.GetCustomAttributes <ModifierAttribute>())
                    {
                        control = ApplyModifierAttribute(control, modifierAttr);
                    }

                    return(new GroupBoxBase(
                               attr.DisplayName ?? property.Name,
                               control
                               ));
                }
                else
                {
                    throw new NullReferenceException($"{nameof(control)} is null. This is likely due to {property.PropertyType.Name} being an unsupported type.");
                }
            }
        public PhilipsHueConfigurationViewModel(Plugin plugin,
                                                PluginSettings settings,
                                                IHueService hueService,
                                                IDialogService dialogService,
                                                IModelValidator <PhilipsHueConfigurationViewModel> validator)
            : base(plugin, validator)
        {
            _hueService    = hueService;
            _dialogService = dialogService;

            _storedBridgesSetting = settings.GetSetting("Bridges", new List <PhilipsHueBridge>());
            _pollingRateSetting   = settings.GetSetting("PollingRate", 2000);
            // Reset to default if the setting is below 100ms because the scale changed from seconds to milliseconds
            if (_pollingRateSetting.Value < 100)
            {
                _pollingRateSetting.Value = 2000;
            }

            PollingRate = _pollingRateSetting.Value;

            if (_storedBridgesSetting.Value.Any())
            {
                WizardPage = 3;
            }
        }
Exemplo n.º 12
0
        public void Init(ServiceLocator sl, ref PluginSetting setting)
        {
            if (!setting.Enable)
            {
                return;
            }

            IUrlMappingProvider urlMapping = sl.Resolve <IUrlMappingProvider>();

            UrlMappingItem item = UrlMapping.Utility.CreateTemplatedMappingItem("_res.aspx");

            item.Id          = "_res_";
            item.Action      = "proc";
            item.Index       = -1;
            item.SubIndex    = -1;
            item.SubsubIndex = -1;

            urlMapping.AddMapping(item);

            item             = UrlMapping.Utility.CreateTemplatedMappingItem("[]_resc.aspx");
            item.Id          = "_resc_";
            item.Action      = "proc";
            item.Index       = -1;
            item.SubIndex    = -1;
            item.SubsubIndex = -1;

            urlMapping.AddMapping(item);
        }
Exemplo n.º 13
0
        /// <inheritdoc />
        public void ApplyPreferredGraphicsContext()
        {
            if (_coreService.StartupArguments.Contains("--force-software-render"))
            {
                _logger.Warning("Startup argument '--force-software-render' is applied, forcing software rendering.");
                _rgbService.UpdateGraphicsContext(null);
                return;
            }

            PluginSetting <string> preferredGraphicsContext = _settingsService.GetSetting("Core.PreferredGraphicsContext", "Vulkan");

            try
            {
                switch (preferredGraphicsContext.Value)
                {
                case "Software":
                    _rgbService.UpdateGraphicsContext(null);
                    break;

                case "Vulkan":
                    _vulkanContext ??= new VulkanContext();
                    _rgbService.UpdateGraphicsContext(_vulkanContext);
                    break;

                default:
                    throw new ArgumentOutOfRangeException();
                }
            }
            catch (Exception e)
            {
                _logger.Warning(e, "Failed to apply preferred graphics context {preferred}", preferredGraphicsContext.Value);
                _rgbService.UpdateGraphicsContext(null);
            }
        }
Exemplo n.º 14
0
        public static Control GetControlForProperty(PluginSettingStore store, PropertyInfo property)
        {
            var           attr    = property.GetCustomAttribute <PropertyAttribute>();
            PluginSetting setting = store[property];

            if (setting == null)
            {
                setting = new PluginSetting(property, null);
                store.Settings.Add(setting);
            }

            var settingBinding = new DelegateBinding <PluginSetting>(
                () => store[property],
                (v) => store[property] = v
                );

            var control = GetControlForSetting(property, settingBinding);

            if (control != null)
            {
                // Apply all visual modifier attributes
                foreach (ModifierAttribute modifierAttr in property.GetCustomAttributes <ModifierAttribute>())
                {
                    control = ApplyModifierAttribute(control, modifierAttr);
                }

                control.Width = 400;
                return(new Group(attr.DisplayName ?? property.Name, control, Orientation.Horizontal, false));
            }
            else
            {
                throw new NullReferenceException($"{nameof(control)} is null. This is likely due to {property.PropertyType.Name} being an unsupported type.");
            }
        }
Exemplo n.º 15
0
        private static void LoadConfig()
        {
            try
            {
                ConfigNode settings = ConfigNode.Load(KSPUtil.ApplicationRootPath + "GameData/PluginReload/Settings.cfg");

                foreach (ConfigNode node in settings.GetNodes("PluginSetting"))
                {
                    PluginSetting pluginSetting = new PluginSetting()
                    {
                        Name                 = node.GetValue("name"),
                        Path                 = node.GetValue("path"),
                        LoadOnce             = bool.Parse(node.GetValue("loadOnce")),
                        MethodsAllowedToFail = bool.Parse(node.GetValue("methodsAllowedToFail"))
                    };

                    PluginSettings.Add(pluginSetting);
                }
            }
            catch (Exception ex)
            {
                Debug.Log(string.Format("Failed to load settings.cfg. Error:\n{0}", ex));
                return;
            }
        }
Exemplo n.º 16
0
        public override void Enable()
        {
            PathHelper.ResolvingAbsolutePath += PathHelperOnResolvingAbsolutePath;

            PluginSetting <List <DeviceDefinition> > definitions = _settings.GetSetting("DeviceDefinitions", new List <DeviceDefinition>());

            if (definitions.Value == null)
            {
                definitions.Value = new List <DeviceDefinition>();
            }

            foreach (DeviceDefinition deviceDefinition in definitions.Value)
            {
                RGB.NET.Devices.Debug.DebugDeviceProvider.Instance.AddFakeDeviceDefinition(deviceDefinition.Layout, deviceDefinition.ImageLayout);
            }

            try
            {
                _rgbService.AddDeviceProvider(RgbDeviceProvider);
            }
            catch (Exception e)
            {
                _logger.Warning(e, "Debug device provided failed to initialize, check paths");
            }
        }
Exemplo n.º 17
0
 public YeeLightDeviceProvider(IRgbService rgbService, PluginSettings pluginSettings) : base(RGB.NET.Devices.YeeLight.YeeLightDeviceProvider.Instance)
 {
     _rgbService = rgbService;
     _useAllAvailableMulticastAddresses = pluginSettings.GetSetting("UseAllAvailableMulticastAddresses", false);
     _yeeLightDeviceDefinitions         = pluginSettings.GetSetting("YeeLightDeviceDefinitionsSetting", new List <YeeLightDeviceDefinition>());
     _scanMode = pluginSettings.GetSetting("ScanMode", ScanMode.Automatic);
 }
Exemplo n.º 18
0
        public override void Enable()
        {
            PluginSetting <List <DeviceDefinition> > definitions = _settings.GetSetting("DeviceDefinitions", new List <DeviceDefinition>());

            RGBDeviceProvider.Instance.DeviceDefinitions.Clear();
            foreach (DeviceDefinition deviceDefinition in definitions.Value)
            {
                E131DMXDeviceDefinition definition = new(deviceDefinition.Hostname)
                {
                    Port         = deviceDefinition.Port,
                    Manufacturer = deviceDefinition.Manufacturer,
                    Model        = deviceDefinition.Model,
                    Universe     = deviceDefinition.Universe
                };
                foreach (LedDefinition ledDefinition in deviceDefinition.LedDefinitions.Where(l => l.LedId != LedId.Invalid))
                {
                    int rChannel = ledDefinition.R;
                    int gChannel = ledDefinition.G;
                    int bChannel = ledDefinition.B;
                    definition.AddLed(ledDefinition.LedId, (rChannel, c => c.GetR()), (gChannel, c => c.GetG()), (bChannel, c => c.GetB()));
                }

                RGBDeviceProvider.Instance.AddDeviceDefinition(definition);
            }

            _rgbService.AddDeviceProvider(RgbDeviceProvider);
        }
Exemplo n.º 19
0
        public override void Enable()
        {
            PluginSetting <List <OpenRGBServerDefinition> > definitions = _settings.GetSetting <List <OpenRGBServerDefinition> >("DeviceDefinitions");

            if (definitions.Value is null)
            {
                definitions.Value = new List <OpenRGBServerDefinition>();
                OpenRGBServerDefinition definition = new OpenRGBServerDefinition
                {
                    ClientName = "Artemis",
                    Ip         = "127.0.0.1",
                    Port       = 6742
                };
                definitions.Value.Add(definition);
                definitions.Save();
            }

            foreach (OpenRGBServerDefinition def in definitions.Value)
            {
                RGB.NET.Devices.OpenRGB.OpenRGBDeviceProvider.Instance.DeviceDefinitions.Add(def);
            }
            PathHelper.ResolvingAbsolutePath += (sender, args) => ResolveAbsolutePath(typeof(AbstractOpenRGBDevice <>), sender, args);

            _rgbService.AddDeviceProvider(RgbDeviceProvider);
        }
 public DiscordDataModelExpansion(PluginSettings pluginSettings, ILogger logger)
 {
     _logger      = logger;
     clientId     = pluginSettings.GetSetting <string>("DiscordClientId", null);
     clientSecret = pluginSettings.GetSetting <string>("DiscordClientSecret", null);
     token        = pluginSettings.GetSetting <SavedToken>("DiscordToken", null);
 }
        public void Init(ServiceLocator sl, ref PluginSetting setting)
        {
            if (!setting.Enable) return;

            UrlMappingModule module = new UrlMappingModule();
            module.Start();
            sl.AddComponentInstance(module);
        }
Exemplo n.º 22
0
            private Control GetControlForSetting(PropertyInfo property, PluginSetting setting)
            {
                if (property.PropertyType == typeof(string))
                {
                    var textbox = new TextBox
                    {
                        Text = setting.GetValue <string>()
                    };
                    textbox.TextChanged += (sender, e) => setting.SetValue(textbox.Text);
                    return(textbox);
                }
                else if (property.PropertyType == typeof(bool))
                {
                    string description = property.Name;
                    if (property.GetCustomAttribute <BooleanPropertyAttribute>() is BooleanPropertyAttribute attribute)
                    {
                        description = attribute.Description;
                    }

                    var checkbox = new CheckBox
                    {
                        Text    = description,
                        Checked = setting.GetValue <bool>()
                    };
                    checkbox.CheckedChanged += (sender, e) => setting.SetValue((bool)checkbox.Checked);
                    return(checkbox);
                }
                else if (property.PropertyType == typeof(float))
                {
                    var tb = new TextBox
                    {
                        Text = $"{setting.GetValue<float>()}"
                    };
                    tb.TextChanged += (sender, e) => setting.SetValue(float.TryParse(tb.Text, out var val) ? val : 0f);

                    if (property.GetCustomAttribute <SliderPropertyAttribute>() is SliderPropertyAttribute sliderAttr)
                    {
                        // TODO: replace with slider when possible (https://github.com/picoe/Eto/issues/1772)
                        tb.ToolTip         = $"Minimum: {sliderAttr.Min}, Maximum: {sliderAttr.Max}";
                        tb.PlaceholderText = $"{sliderAttr.DefaultValue}";
                        if (setting.Value == null)
                        {
                            setting.SetValue(sliderAttr.DefaultValue);
                        }
                    }
                    return(tb);
                }
                else if (GenericallyConvertableTypes.Contains(property.PropertyType))
                {
                    var tb = new TextBox
                    {
                        Text = $"{setting.GetValue(property.PropertyType)}"
                    };
                    tb.TextChanged += (sender, e) => setting.SetValue(Convert.ChangeType(tb.Text, property.PropertyType) ?? 0);
                    return(tb);
                }
                throw new NotSupportedException($"'{property.PropertyType}' is not supported by {nameof(PluginSettingStoreEditor)}");
            }
Exemplo n.º 23
0
        public RazerDeviceProvider(IRgbService rgbService, PluginSettings pluginSettings, ILogger logger) : base(RGB.NET.Devices.Razer.RazerDeviceProvider.Instance)
        {
            _rgbService     = rgbService;
            _pluginSettings = pluginSettings;
            _logger         = logger;

            _loadEmulatorDevices = _pluginSettings.GetSetting("LoadEmulatorDevices", false);
            _loadEmulatorDevices.SettingChanged += LoadEmulatorDevicesOnSettingChanged;
        }
Exemplo n.º 24
0
        public LedenetConfigurationDialogViewModel(Plugin plugin, PluginSettings settings, IPluginManagementService pluginManagementService) : base(plugin)
        {
            _pluginManagementService = pluginManagementService;

            _ledenetDeviceDefinitionsSetting = settings.GetSetting("LedenetDeviceDefinitionsSetting", new List <LedenetDeviceDefinition>());
            _ledenetDeviceDefinitions        = _ledenetDeviceDefinitionsSetting.Value;

            Definitions = new BindableCollection <LedenetDeviceDefinition>(_ledenetDeviceDefinitions);
        }
Exemplo n.º 25
0
        public void SkipOrFinishWizard()
        {
            PluginSetting <bool> setting = _settingsService.GetSetting("UI.SetupWizardCompleted", false);

            setting.Value = true;
            setting.Save();

            RequestClose();
        }
        public void Init(ServiceLocator sl, ref PluginSetting setting)
        {
            if (!setting.Enable) return;

            DynamicQueryPlugin plugin = new DynamicQueryPlugin();
            plugin.Start();

            sl.AddComponentInstance<DynamicQueryPlugin>(plugin);
        }
Exemplo n.º 27
0
        public static string Format(this PluginSetting setting)
        {
            if (setting == null)
            {
                return(null);
            }

            return($"{{ {setting.Property}: {setting.GetValue(typeof(object))} }}");
        }
Exemplo n.º 28
0
        public override async Task OnSettingsCreating(PluginSettingBuilder settingBuilder)
        {
            var portSetting = new PluginSetting
            {
                Name        = "Port",
                Value       = (1337).ToString(),
                ValueType   = DataType.INTEGER,
                Description = "LightSwitch will listen for connections on this port."
            };
            await settingBuilder.Plugin(this).RegisterPluginSettingAsync(portSetting, o => o.PortSetting);

            var maxConnSetting = new PluginSetting
            {
                Name        = "Max Conn.",
                Value       = (200).ToString(),
                ValueType   = DataType.INTEGER,
                Description = "The maximum number of connections allowed."
            };
            await settingBuilder.Plugin(this).RegisterPluginSettingAsync(maxConnSetting, o => o.MaxConnectionsSettings);

            var verboseSettings = new PluginSetting
            {
                Name        = "Verbose Logging",
                Value       = false.ToString(),
                ValueType   = DataType.BOOL,
                Description = "(Writes all server client communication to the log for debugging.)"
            };
            await settingBuilder.Plugin(this).RegisterPluginSettingAsync(verboseSettings, o => o.VerboseSetting);

            var passwordSetting = new PluginSetting
            {
                Name        = "Password",
                Value       = "ChaNgeMe444",
                ValueType   = DataType.STRING,
                Description = "The password clients must use to connect to the LightSwitch server. "
            };
            await settingBuilder.Plugin(this).RegisterPluginSettingAsync(passwordSetting, o => o.PasswordSetting);

            var sortSetting = new PluginSetting
            {
                Name        = "Sort Device List",
                Value       = true.ToString(),
                ValueType   = DataType.BOOL,
                Description = "(Alphabetically sorts the device list.)"
            };
            await settingBuilder.Plugin(this).RegisterPluginSettingAsync(sortSetting, o => o.SortListSetting);

            var bonjourSetting = new PluginSetting
            {
                Name        = "Publish ZeroConf/Bonjour",
                Value       = false.ToString(),
                ValueType   = DataType.BOOL,
                Description = "Zero configuration networking allows clients on your network to detect and connect to your LightSwitch server automatically."
            };
            await settingBuilder.Plugin(this).RegisterPluginSettingAsync(bonjourSetting, o => o.UseBonjourSetting);
        }
Exemplo n.º 29
0
        private static MaskedTextBox <T> GetMaskedTextBox <T>(PropertyInfo property, PluginSetting setting)
        {
            var tb = new MaskedTextBox <T>
            {
                Value = GetSetting <T>(property, setting)
            };

            tb.ValueChanged += (sender, e) => setting.SetValue(tb.Value);
            return(tb);
        }
Exemplo n.º 30
0
        public LayerBrushDescriptor GetDefaultLayerBrush()
        {
            PluginSetting <LayerBrushReference> defaultReference = _settingsService.GetSetting("ProfileEditor.DefaultLayerBrushDescriptor", new LayerBrushReference
            {
                BrushPluginGuid = Guid.Parse("92a9d6ba-6f7a-4937-94d5-c1d715b4141a"),
                BrushType       = "ColorBrush"
            });

            return(LayerBrushStore.Get(defaultReference.Value.BrushPluginGuid, defaultReference.Value.BrushType)?.LayerBrushDescriptor);
        }
        public void Init(ServiceLocator sl, ref PluginSetting s)
        {
            if (!s.Enable)
            {
                return;
            }

            RepositoryPluginSetting setting = new Repository.RepositoryPluginSetting(s);

            s = setting;

            string type1 = setting["type1"];
            string type2 = setting["type2"];

            if (StringUtil.IsNullOrEmpty(type1) && StringUtil.IsNullOrEmpty(type2))
            {
                setting.Enable = false;

                LogManager.GetLogger <RepositoryInitializer>().Debug("RepositoryInitializer is disabled. type1 and type2 is null.");
            }
            else
            {
                if (StringUtil.HasText(type1))
                {
                    try
                    {
                        Type t1 = Type.GetType(type1, true, true);
                        sl.AddComponent("kiss.repository_1", typeof(IRepository <>), t1);
                    }
                    catch (Exception ex)
                    {
                        LogManager.GetLogger <RepositoryInitializer>().Error("RepositoryInitializer Error." + ExceptionUtil.WriteException(ex));
                    }
                }

                if (StringUtil.HasText(type2))
                {
                    try
                    {
                        Type t2 = Type.GetType(type2, true, true);
                        sl.AddComponent("kiss.repository_2", typeof(IRepository <,>), t2);
                    }
                    catch (Exception ex)
                    {
                        LogManager.GetLogger <RepositoryInitializer>().Error("RepositoryInitializer Error." + ExceptionUtil.WriteException(ex));
                    }
                }
            }

            foreach (var item in Plugin.Plugins.GetPlugins <DbProviderAttribute>())
            {
                sl.AddComponent(item.ProviderName, item.Decorates);
            }
        }
Exemplo n.º 32
0
        public DMXConfigurationViewModel(Plugin plugin, PluginSettings settings, IWindowManager windowManager, IPluginManagementService pluginManagementService)
            : base(plugin)
        {
            _settings                = settings;
            _windowManager           = windowManager;
            _pluginManagementService = pluginManagementService;
            _definitions             = _settings.GetSetting("DeviceDefinitions", new List <DeviceDefinition>());

            TurnOffLedsOnShutdown = _settings.GetSetting("TurnOffLedsOnShutdown", false).Value;
            Definitions           = new BindableCollection <DeviceDefinition>(_definitions.Value);
        }
 public SpotifyDataModelExpansion(PluginSettings settings, ILogger logger, IColorQuantizerService colorQuantizer)
 {
     _logger         = logger;
     _colorQuantizer = colorQuantizer;
     _token          = settings.GetSetting <PKCETokenResponse>(Constants.SPOTIFY_AUTH_SETTING);
     _httpClient     = new HttpClient
     {
         Timeout = TimeSpan.FromSeconds(2)
     };
     albumArtColorCache = new ConcurrentDictionary <string, TrackColorsDataModel>();
 }
        public void Init(ServiceLocator sl, ref PluginSetting setting)
        {
            if (!setting.Enable) return;

            OptimizationModule cm = new OptimizationModule();
            cm.Start();
            sl.AddComponentInstance(cm);

            if (setting["css_sprite"].ToBoolean())
                ImageOptimizations.AddCacheDependencies(ServerUtil.MapPath("~/"), true);
        }
Exemplo n.º 35
0
        public void Init(ServiceLocator sl, ref PluginSetting setting)
        {
            if (!setting.Enable) return;

            IUrlMappingProvider urlMapping = sl.Resolve<IUrlMappingProvider>();

            UrlMappingItem item = UrlMapping.Utility.CreateTemplatedMappingItem("ajax.aspx");
            item.Id = "_ajax_";
            item.Action = "proc";
            item.Index = -1;
            item.SubIndex = -1;
            item.SubsubIndex = -1;

            urlMapping.AddMapping(item);
        }
Exemplo n.º 36
0
        public void Init(ServiceLocator sl, ref PluginSetting setting)
        {
            if (!setting.Enable)
            {
                sl.AddComponent("kiss.XmlUrlMappingProvider", typeof(IUrlMappingProvider), typeof(XmlUrlMappingProvider));
                sl.AddComponent("kiss.defaultHost", typeof(IHost), typeof(Kiss.Web.Host));

                return;
            }

            sl.AddComponent("kiss.Areahost", typeof(IHost), typeof(Host));
            sl.AddComponent("kiss.AreaUrlMappingProvider", typeof(IUrlMappingProvider), typeof(AreaUrlMappingProvider));

            Areas.Add(@"/", AreaConfig.Instance);

            ControllerResolver resolver = ControllerResolver.Instance;

            load_areas(resolver);

            HttpRuntime.Cache.Insert(kCACHE_KEY, "dummyValue", null, Cache.NoAbsoluteExpiration, Cache.NoSlidingExpiration);

            logger.Debug("AreaInitializer done.");
        }