public ClipboardTriggerViewModel(ClipboardTrigger model, IProgramManager programManager) : base(model) { if (!(model.ForegroundProgram is null)) { ForegroundProgram = programManager.GetProgram(model.ForegroundProgram); } if (!(model.DataSourceProgram is null)) { DataSourceProgram = programManager.GetProgram(model.DataSourceProgram); } if (model.Type is ReferenceClipboardTriggerType || model.DataSourceProgram == model.ForegroundProgram) { IconSource = model.ForegroundWindow?.IconSource ?? ForegroundProgram?.IconSource ?? DataSourceProgram?.IconSource; Title = model.ForegroundWindow?.Title ?? ForegroundProgram?.Name ?? DataSourceProgram?.Name; } else { IconSource = DataSourceProgram?.IconSource ?? model.ForegroundWindow?.IconSource ?? ForegroundProgram?.IconSource; Title = DataSourceProgram?.Name ?? model.ForegroundWindow?.Title ?? ForegroundProgram?.Name; } }
public override SettingViewModel?Create(ISetting model) { return(model.Key switch { SettingConsts.ThemeKey => new ComboBoxSettingViewModel <Theme>(model, new ResolvableIOSettingApplier <Theme>(SettingChangeMode.OnSave, SettingChangeEffect.RestartRequired), (IKeyedCollectionSetting <string, Theme>)model, "Application theme"), SettingConsts.OwnerProgramClipboardFilterKey => new ProgramFilterSettingViewModel(model, new FuncIOSettingsApplier <List <Program>, List <string> >(SettingChangeMode.Direct, SettingChangeEffect.AtOnce, (programs) => programs.Select(p => p.Path).NotNull().ToList(programs.Count), new List <Program>( ((ListSetting <string>)model).Value.Select(p => programManager.GetProgram(p)) )), "Ignore clipboard content from specific programs", programManager), SettingConsts.Windows10HistoryFilterKey => new CheckBoxSettingViewModel(model, new IOSettingApplier <bool?>(SettingChangeMode.Direct, SettingChangeEffect.AtOnce), "Ignore clipboard content when the data owner does not want it to show up in Windows 10 Clipboard History"), SettingConsts.Windows10CloudFilterKey => new CheckBoxSettingViewModel(model, new IOSettingApplier <bool?>(SettingChangeMode.Direct, SettingChangeEffect.AtOnce), "Ignore clipboard content when the data owner does not want it to be uploaded to the cloud"), _ => null, });