private async Task LoadHotKeysForCurrentModel() { this.HotKeys.Clear(); this.SelectedHotKey = null; if (this.SelectedModel != null) { foreach (VTubeStudioHotKey hotKey in await ChannelSession.Services.VTubeStudio.GetHotKeys(this.SelectedModel.modelID)) { this.HotKeys.Add(hotKey); } } }
protected override async Task OnLoadedInternal() { this.GetCurrentModelMovementCommand = this.CreateCommand(async() => { if (this.VTubeStudioConnected) { VTubeStudioModel model = await ChannelSession.Services.VTubeStudio.GetCurrentModel(); if (model != null && model.modelPosition != null) { this.MovementX = model.modelPosition.positionX; this.MovementY = model.modelPosition.positionY; this.Rotation = model.modelPosition.rotation; this.Size = model.modelPosition.size; } } }); if (ChannelSession.Settings.VTubeStudioOAuthToken != null && !this.VTubeStudioConnected) { Result result = await ChannelSession.Services.VTubeStudio.Connect(ChannelSession.Settings.VTubeStudioOAuthToken); if (!result.Success) { return; } } if (this.VTubeStudioConnected) { this.CurrentModel = await ChannelSession.Services.VTubeStudio.GetCurrentModel(); foreach (VTubeStudioModel model in await ChannelSession.Services.VTubeStudio.GetAllModels()) { this.Models.Add(model); } this.SelectedModel = this.Models.FirstOrDefault(m => string.Equals(m.modelID, this.modelID)); await this.LoadHotKeysForCurrentModel(); this.SelectedHotKey = this.HotKeys.FirstOrDefault(hk => string.Equals(hk.hotkeyID, this.hotKeyID)); } await base.OnLoadedInternal(); }