Esempio n. 1
0
        /// <summary>
        /// コンストラクタ。
        /// </summary>
        /// <param name="accessoryFileConfig">アクセサリファイル設定。</param>
        /// <param name="effectFileConfig">エフェクトファイル設定。</param>
        public ConfigViewModel(
            AccessoryFileConfig accessoryFileConfig,
            EffectFileConfig effectFileConfig)
        {
            if (accessoryFileConfig == null)
            {
                throw new ArgumentNullException("accessoryFileConfig");
            }
            if (effectFileConfig == null)
            {
                throw new ArgumentNullException("effectFileConfig");
            }

            // ファイル設定を設定
            AccessoryFileConfig = accessoryFileConfig;
            EffectFileConfig = effectFileConfig;

            // 色の ViewModel 作成
            FaceColorViewModel = ColorViewModel.Bind(AccessoryFileConfig, "FaceColor");
            EmissiveColorViewModel =
                ColorViewModel.Bind(AccessoryFileConfig, "EmissiveColor");
            SpecularColorViewModel =
                ColorViewModel.Bind(AccessoryFileConfig, "SpecularColor");

            // コマンド作成
            ResetCommand =
                new DelegateCommand(
                    _ =>
                    {
                        AccessoryFileConfig.Reset();
                        EffectFileConfig.Reset();
                    });

            // ファイル設定変更時の処理を登録
            AccessoryFileConfig.PropertyChanged += Config_PropertyChanged;
            EffectFileConfig.PropertyChanged += Config_PropertyChanged;

            // RenderType 関連プロパティ初期化
            ChangeRenderTypeStatus(EffectFileConfig.RenderType);
        }