Exemple #1
0
        private async void FunctionAddButton_Click(object sender, RoutedEventArgs e)
        {
            await Globals.Client.SendCommandAsync(new PipeCommands.StartKeyConfig {
            });

            var win = new FunctionKeyAddWindow();

            if (win.ShowDialog() == true)
            {
                UpdateKeyList();
            }
            await Globals.Client.SendCommandAsync(new PipeCommands.EndKeyConfig {
            });
        }
Exemple #2
0
        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);
                    edited = win.ShowDialog();
                }
                else if (item.KeyAction.HandAction)
                {
                    var win = new HandGestureControlKeyAddWindow(item.KeyAction);
                    edited = win.ShowDialog();
                }
                else if (item.KeyAction.FunctionAction)
                {
                    var win = new FunctionKeyAddWindow(item.KeyAction);
                    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();
                }
            }
        }