Exemplo n.º 1
0
        // Click to either create new config for current app or remove the existing config.
        private void Button_AppBinding_Click(object sender, RoutedEventArgs e)
        {
            var tag = (sender as Button).Tag;

            switch (tag)
            {
            case null:
                // This should never happen as the button cannot be pressed while disabled.
                break;

            case true:
                var result = MessageBox.Show(
                    Application.Current.MainWindow,
                    "Are you sure you want to delete this configuration?",
                    "OpenVR2Key",
                    MessageBoxButton.YesNo,
                    MessageBoxImage.Warning
                    );
                if (result == MessageBoxResult.Yes)
                {
                    MainModel.ClearBindings();
                    MainModel.DeleteConfig();
                    _controller.LoadConfig(true);     // Loads default
                    UpdateConfigButton(false);
                }
                break;

            case false:
                MainModel.SetConfigName(_currentlyRunningAppId);
                MainModel.StoreConfig(new Dictionary <string, Key[]>());
                _controller.LoadConfig();     // Loads the empty new one
                UpdateConfigButton(true);
                break;
            }
        }
Exemplo n.º 2
0
        // This should clear all bindings from the current config
        private void Button_ClearAll_Click(object sender, RoutedEventArgs e)
        {
            var result = MessageBox.Show(
                Application.Current.MainWindow,
                "Are you sure you want to clear all mappings in this configuration?",
                "OpenVR2Key",
                MessageBoxButton.YesNo,
                MessageBoxImage.Warning
                );

            if (result == MessageBoxResult.Yes)
            {
                MainModel.ClearBindings();
                InitList();
            }
        }