private async void FaceAddButton_Click(object sender, RoutedEventArgs e) { await Globals.Client.SendCommandAsync(new PipeCommands.StartKeyConfig { }); var win = new FaceControlKeyAddWindow(); win.Owner = this; if (win.ShowDialog() == true) { UpdateKeyList(); } await Globals.Client.SendCommandAsync(new PipeCommands.EndKeyConfig { }); }
private async void EditButton_Click(object sender, RoutedEventArgs e) { if (KeysDataGrid.SelectedItem != null) { bool?edited = true; var item = (KeysListItem)KeysDataGrid.SelectedItem; await Globals.Client.SendCommandAsync(new PipeCommands.StartKeyConfig { }); if (item.KeyAction.FaceAction) { var win = new FaceControlKeyAddWindow(item.KeyAction); win.Owner = this; edited = win.ShowDialog(); } else if (item.KeyAction.HandAction) { var win = new HandGestureControlKeyAddWindow(item.KeyAction); win.Owner = this; edited = win.ShowDialog(); } else if (item.KeyAction.FunctionAction) { var win = new FunctionKeyAddWindow(item.KeyAction); win.Owner = this; edited = win.ShowDialog(); } await Globals.Client.SendCommandAsync(new PipeCommands.EndKeyConfig { }); if (edited == true) { //編集なので、新しく追加された設定を選択中の設定と入れ替える var insertto = Globals.KeyActions.IndexOf(item.KeyAction); var newitem = Globals.KeyActions.Last(); Globals.KeyActions.Remove(newitem); Globals.KeyActions.Remove(item.KeyAction); Globals.KeyActions.Insert(insertto, newitem); await Globals.Client.SendCommandAsync(new PipeCommands.SetKeyActions { KeyActions = Globals.KeyActions }); UpdateKeyList(); } } }