internal SaveLoadFileItemViewModel(bool isLoadMode, bool isCurrent, SettingFileOverview model, SaveLoadDataViewModel parent)
        {
            IsLoadMode      = isLoadMode;
            IsCurrent       = isCurrent;
            Index           = model.Index;
            IsExist         = model.Exist;
            ModelName       = model.ModelName;
            LastUpdatedDate = model.LastUpdateTime;

            SelectThisCommand = new ActionCommand(async() =>
            {
                if (isLoadMode)
                {
                    await parent.ExecuteLoad(Index);
                }
                else
                {
                    await parent.ExecuteSave(Index);
                }
            });
        }
Beispiel #2
0
        public MainWindowViewModel()
        {
            Model           = new RootSettingSync(MessageSender, MessageIo.Receiver);
            SettingFileIo   = new SettingFileIo(Model, MessageSender);
            SaveFileManager = new SaveFileManager(SettingFileIo, Model, MessageSender);

            WindowSetting          = new WindowSettingViewModel(Model.Window, MessageSender);
            MotionSetting          = new MotionSettingViewModel(Model.Motion, MessageSender, MessageIo.Receiver);
            GamepadSetting         = new GamepadSettingViewModel(Model.Gamepad, MessageSender);
            LayoutSetting          = new LayoutSettingViewModel(Model.Layout, Model.Gamepad, MessageSender, MessageIo.Receiver);
            LightSetting           = new LightSettingViewModel(Model.Light, MessageSender);
            WordToMotionSetting    = new WordToMotionSettingViewModel(Model.WordToMotion, MessageSender, MessageIo.Receiver);
            ExternalTrackerSetting = new ExternalTrackerViewModel(Model.ExternalTracker, Model.Motion, MessageSender, MessageIo.Receiver);
            SettingIo = new SettingIoViewModel(Model, Model.Automation, SaveFileManager, MessageSender);
            //オートメーションの配線: 1つしかないのでザツにやる。OC<T>をいじる関係でUIスレッド必須なことに注意
            Model.Automation.LoadSettingFileRequested += v =>
                                                         Application.Current.Dispatcher.BeginInvoke(new Action(
                                                                                                        () => SaveFileManager.LoadSetting(v.Index, v.LoadCharacter, v.LoadNonCharacter, true))
                                                                                                    );

            _runtimeHelper = new RuntimeHelper(MessageSender, MessageIo.Receiver, Model);

            LoadVrmCommand           = new ActionCommand(LoadVrm);
            LoadVrmByFilePathCommand = new ActionCommand <string>(LoadVrmByFilePath);
            ConnectToVRoidHubCommand = new ActionCommand(ConnectToVRoidHubAsync);

            OpenVRoidHubCommand      = new ActionCommand(() => UrlNavigate.Open("https://hub.vroid.com/"));
            AutoAdjustCommand        = new ActionCommand(() => MessageSender.SendMessage(MessageFactory.Instance.RequestAutoAdjust()));
            OpenSettingWindowCommand = new ActionCommand(() => SettingWindow.OpenOrActivateExistingWindow(this));

            ResetToDefaultCommand  = new ActionCommand(ResetToDefault);
            LoadPrevSettingCommand = new ActionCommand(LoadPrevSetting);

            TakeScreenshotCommand       = new ActionCommand(_runtimeHelper.TakeScreenshot);
            OpenScreenshotFolderCommand = new ActionCommand(_runtimeHelper.OpenScreenshotSavedFolder);

            MessageIo.Receiver.ReceivedCommand      += OnReceiveCommand;
            SaveFileManager.VRoidModelLoadRequested += id => LoadSavedVRoidModel(id, false);
        }
Beispiel #3
0
        internal MotionSettingViewModel(MotionSettingSync model, IMessageSender sender, IMessageReceiver receiver) : base(sender)
        {
            _model = model;

            ResetFaceBasicSettingCommand = new ActionCommand(
                () => SettingResetUtils.ResetSingleCategoryAsync(ResetFaceBasicSetting)
                );
            ResetFaceEyeSettingCommand = new ActionCommand(
                () => SettingResetUtils.ResetSingleCategoryAsync(_model.ResetFaceEyeSetting)
                );
            ResetFaceBlendShapeSettingCommand = new ActionCommand(
                () => SettingResetUtils.ResetSingleCategoryAsync(_model.ResetFaceBlendShapeSetting)
                );
            ResetArmMotionSettingCommand = new ActionCommand(
                () => SettingResetUtils.ResetSingleCategoryAsync(_model.ResetArmSetting)
                );
            ResetHandMotionSettingCommand = new ActionCommand(
                () => SettingResetUtils.ResetSingleCategoryAsync(_model.ResetHandSetting)
                );
            ResetWaitMotionSettingCommand = new ActionCommand(
                () => SettingResetUtils.ResetSingleCategoryAsync(_model.ResetWaitMotionSetting)
                );

            CalibrateFaceCommand = new ActionCommand(() => SendMessage(MessageFactory.Instance.CalibrateFace()));
            OpenFullEditionDownloadUrlCommand = new ActionCommand(() => UrlNavigate.Open("https://baku-dreameater.booth.pm/items/3064040"));
            OpenHandTrackingPageUrlCommand    = new ActionCommand(() => UrlNavigate.Open(LocalizedString.GetString("URL_docs_hand_tracking")));

            ShowMicrophoneVolume = new RProperty <bool>(false, b =>
            {
                SendMessage(MessageFactory.Instance.SetMicrophoneVolumeVisibility(b));
                if (!b)
                {
                    MicrophoneVolumeValue.Value = 0;
                }
            });

            _model.KeyboardAndMouseMotionMode.PropertyChanged += (_, __) => UpdateKeyboardAndMouseMotionMode();
            UpdateKeyboardAndMouseMotionMode();
            _model.GamepadMotionMode.PropertyChanged += (_, __) => UpdateGamepadMotionMode();
            UpdateGamepadMotionMode();

            _model.EyeBoneRotationScale.PropertyChanged += (_, __) => UpdateEyeRotRangeText();
            _model.EnableLipSync.PropertyChanged        += (_, __) =>
            {
                if (!_model.EnableLipSync.Value)
                {
                    ShowMicrophoneVolume.Value = false;
                }
            };

            _model.FaceNeutralClip.PropertyChanged += (_, __) =>
                                                      _blendShapeNameStore.Refresh(_model.FaceNeutralClip.Value, _model.FaceOffsetClip.Value);
            _model.FaceOffsetClip.PropertyChanged += (_, __) =>
                                                     _blendShapeNameStore.Refresh(_model.FaceNeutralClip.Value, _model.FaceOffsetClip.Value);

            //両方trueのときだけポインターを表示したいので、それのチェック
            _model.KeyboardAndMouseMotionMode.PropertyChanged += (_, __) => UpdatePointerVisibility();
            _model.ShowPresentationPointer.PropertyChanged    += (_, __) => UpdatePointerVisibility();
            //通常発生しないが、VMの初期化時点でポインター表示が必要ならそうする
            UpdatePointerVisibility();

            UpdateEyeRotRangeText();

            receiver.ReceivedCommand    += OnReceivedCommand;
            ShowInstallPathWarning.Value = InstallPathChecker.HasMultiByteCharInInstallPath();
        }