using MultiTerm.Core.ViewModel; using System.Diagnostics; using System.IO; using System.Reflection; using System.Windows.Controls; namespace MultiTerm.Wpf.View; public partial class ShellView : UserControl { public ShellView() { InitializeComponent(); this.DataContext = App.AppHost!.Services.GetService(typeof(ShellViewModel)); // set version item header this.versionMenuItem.Header = $"MultiTerm Version {Assembly.GetExecutingAssembly().GetName().Version}"; } /// /// Handles key down events for the whole user control. /// /// /// private void UserControl_KeyDown(object sender, System.Windows.Input.KeyEventArgs e) { // move tab forward if ( e.Key == System.Windows.Input.Key.Tab && e.KeyboardDevice.Modifiers == System.Windows.Input.ModifierKeys.Control ) { // increment to larger index than existing is handled by tab control this.terminalTabControl.SelectedIndex++; e.Handled = true; } // move tab backwards else if ( e.Key == System.Windows.Input.Key.Tab && e.KeyboardDevice.Modifiers == (System.Windows.Input.ModifierKeys.Control | System.Windows.Input.ModifierKeys.Shift) ) { // only move backwards if the resulting index is >= 0 if(this.terminalTabControl.SelectedIndex > 0) { this.terminalTabControl.SelectedIndex--; } e.Handled = true; } } private void MenuItem_Logfiles_Click(object sender, System.Windows.RoutedEventArgs e) { // exit if logfile directory does not exist if (Directory.Exists(Common.LogFilesDirectory) == false) { return; } // open logfiles folder Process ExplorerWindowProcess = new Process(); ExplorerWindowProcess.StartInfo.UseShellExecute = true; ExplorerWindowProcess.StartInfo.FileName = @$"{Common.LogFilesDirectory}"; ExplorerWindowProcess.Start(); } }