public ApplicationManager(IMessengerManager messenger, ITranslationManager translation, IConfigurationManager configuration, IUserManager user, INotifyIconManager notifyIcon, IEventLogManager logger, IControllerConfigurationManager controller, IThemeManager theme) { Messenger = messenger; Translation = translation; Configuration = configuration; User = user; NotifyIcon = notifyIcon; Logger = logger; Controller = controller; Theme = theme; Logger.Initialize(Constants.SERVICE_NAME); Logger.Subscribe(param => Messenger.NotifyColleagues(AppMessages.NEW_LOG_MESSAGE, param.Entry)); string a = Configuration.GetData(ConfOptions.OPTION_ACCENT); string t = Configuration.GetData(ConfOptions.OPTION_THEME); Theme.SetTheme(a, t); Translation.ChangeLanguage(Configuration.GetData(ConfOptions.OPTION_LANGUAGE)); DuplexChannelFactory<ISubscribingService> pipeFactory = new DuplexChannelFactory<ISubscribingService>(new ServiceCommand(Messenger), new NetNamedPipeBinding(), new EndpointAddress(Constants.PIPE_ADDRESS + Constants.SERVICE_NAME)); Service = pipeFactory.CreateChannel(); Service.Subscribe(); }
public ThemeConfigViewModel(IThemeSettingsProvider settings, IThemeManager themeManager) { name = themeManager.CurrentTheme; themes = themeManager.Themes.ToList(); Save = new DelegateCommand(() => { themeManager.SetTheme(ThemeName); settings.UpdateSettings(ThemeName); IsModified = false; }); }
public ThemeConfigViewModel(IThemeSettingsProvider settings, IThemeManager themeManager, IMainWindowHolder mainWindowHolder) { var currentSettings = settings.GetSettings(); name = CurrentThemeName = themeManager.CurrentTheme; themes = themeManager.Themes.ToList(); useCustomScaling = currentSettings.UseCustomScaling; scalingValue = Math.Clamp(currentSettings.CustomScaling, 0.5, 4); RecommendedScalingPercentage = (int)(((mainWindowHolder.Window?.Screens?.Primary ?? mainWindowHolder.Window?.Screens?.All?.FirstOrDefault())?.PixelDensity ?? 1) * 100); AllowCustomScaling = RuntimeInformation.IsOSPlatform(OSPlatform.Windows); Save = new DelegateCommand(() => { themeManager.SetTheme(ThemeName); themeManager.UpdateCustomScaling(useCustomScaling ? ScalingValue : null); settings.UpdateSettings(ThemeName, UseCustomScaling ? Math.Clamp(ScalingValue, 0.5, 4) : null); IsModified = false; }); }