コード例 #1
0
ファイル: MainFacade.cs プロジェクト: shichongdong/Cube.Pdf
        /* ----------------------------------------------------------------- */
        ///
        /// Setup
        ///
        /// <summary>
        /// Initializes the specified settings.
        /// </summary>
        ///
        /* ----------------------------------------------------------------- */
        private SettingFolder Setup(SettingFolder src)
        {
            src.Load();
            src.PropertyChanged += (s, e) => {
                switch (e.PropertyName)
                {
                case nameof(SettingValue.ItemSize):
                    this.Zoom();
                    break;

                case nameof(SettingValue.FrameOnly):
                    Value.Images.Preferences.FrameOnly = src.Value.FrameOnly;
                    break;
                }
            };
            return(src);
        }
コード例 #2
0
        /* ----------------------------------------------------------------- */
        ///
        /// 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(SettingFolder src, IQuery <string> query, SynchronizationContext context)
        {
            var images = new ImageCollection(e => _core?.GetOrAdd(e), new Dispatcher(context, true));
            var post   = new Dispatcher(context, false);

            _core    = new DocumentCollection(query, src.IO);
            Backup   = new Backup(src.IO);
            Bindable = new MainBindable(images, src, query, post);

            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;
        }