/* ----------------------------------------------------------------- */ /// /// MainFacade /// /// <summary> /// Initializes a new instance of the MainFacade class with the /// specified arguments. /// </summary> /// /// <param name="src">User settings.</param> /// <param name="query">Password query.</param> /// <param name="context">Synchronization context.</param> /// /* ----------------------------------------------------------------- */ public MainFacade(SettingsFolder src, IQuery <string> query, SynchronizationContext context) { _core = new DocumentCollection(query, src.IO); Backup = new Backup(src.IO); Bindable = new MainBindable(new ImageCollection(e => _core?.GetOrAdd(e), context), src, query); Settings = src; Settings.Load(); Settings.PropertyChanged += (s, e) => Update(e.PropertyName); var sizes = Bindable.Images.Preferences.ItemSizeOptions; var index = sizes.LastIndexOf(e => e <= Bindable.ItemSize.Value); Bindable.Images.Preferences.ItemSizeIndex = Math.Max(index, 0); Bindable.Images.Preferences.FrameOnly = src.Value.FrameOnly; Bindable.Images.Preferences.TextHeight = 25; }
/* ----------------------------------------------------------------- */ /// /// RibbonViewModel /// /// <summary> /// Initializes a new instance of the RibbonViewModel /// class with the specified arguments. /// </summary> /// /// <param name="src">Bindable data.</param> /// <param name="messenger">Messenger object.</param> /// /* ----------------------------------------------------------------- */ public RibbonViewModel(MainBindable src, IMessenger messenger) : base(messenger) { Insert = new RibbonElement( () => Properties.Resources.MenuInsert, () => Properties.Resources.TooltipInsert, () => !src.Busy.Value && src.IsOpen(), nameof(Insert) ); Remove = new RibbonElement( () => Properties.Resources.MenuRemove, () => Properties.Resources.TooltipRemove, () => !src.Busy.Value && src.IsOpen(), nameof(Remove) ); FrameOnly = this.Create( () => src.Settings.FrameOnly, e => src.Settings.FrameOnly = e, () => Properties.Resources.MenuFrameOnly ); }