optimize<*>: remove Windows Terminal settings because it can be set outside in Windows Terminal

This commit is contained in:
leo 2022-05-20 15:29:56 +08:00
parent 44ed55937d
commit 171f1d1d0c
5 changed files with 511 additions and 546 deletions

View file

@ -68,11 +68,6 @@ namespace SourceGit.Models {
/// 上一次检测的时间(用于控制每天仅第一次启动软件时,检测)
/// </summary>
public int LastCheckDay { get; set; } = 0;
/// <summary>
/// 是否尝试使用 Windows Terminal 打开终端
/// </summary>
public bool UseWindowsTerminal { get; set; } = false;
}
/// <summary>

View file

@ -67,7 +67,6 @@
<RowDefinition Height="28"/>
<RowDefinition Height="28"/>
<RowDefinition Height="28"/>
<RowDefinition Height="28"/>
</Grid.RowDefinitions>
<Grid.ColumnDefinitions>
@ -166,13 +165,6 @@
Grid.Row="6" Grid.Column="1"
Content="{DynamicResource Text.Preference.RestoreTabs}"
IsChecked="{Binding Source={x:Static models:Preference.Instance}, Path=Restore.IsEnabled, Mode=TwoWay}"/>
<!-- Use Windows Terminal -->
<CheckBox
Grid.Row="7" Grid.Column="1"
Content="{DynamicResource Text.Preference.UseWindowsTerminal}"
IsEnabled="{Binding ElementName=me, Path=HasWindowsTerminal}"
IsChecked="{Binding Source={x:Static models:Preference.Instance}, Path=General.UseWindowsTerminal, Mode=TwoWay}"/>
</Grid>
</TabItem>

View file

@ -15,14 +15,9 @@ namespace SourceGit.Views {
public string Email { get; set; }
public string CRLF { get; set; }
public string Version { get; set; }
public bool HasWindowsTerminal { get; set; }
public Preference() {
UpdateGitInfo(false);
HasWindowsTerminal = Models.ExecutableFinder.Find("wt.exe") != null;
if (!HasWindowsTerminal) Models.Preference.Instance.General.UseWindowsTerminal = false;
InitializeComponent();
}

View file

@ -320,20 +320,11 @@ namespace SourceGit.Views.Widgets {
return;
}
if (Models.Preference.Instance.General.UseWindowsTerminal) {
Process.Start(new ProcessStartInfo {
WorkingDirectory = repo.Path,
FileName = "wt",
Arguments = $"-d \"{repo.Path}\" \"{bash}\"",
UseShellExecute = false,
});
} else {
Process.Start(new ProcessStartInfo {
WorkingDirectory = repo.Path,
FileName = bash,
UseShellExecute = true,
});
}
Process.Start(new ProcessStartInfo {
WorkingDirectory = repo.Path,
FileName = bash,
UseShellExecute = true,
});
}
private void OpenInVSCode(object sender, RoutedEventArgs e) {

View file

@ -86,18 +86,10 @@ namespace SourceGit.Views.Widgets {
return;
}
if (Models.Preference.Instance.General.UseWindowsTerminal) {
Process.Start(new ProcessStartInfo {
FileName = "wt",
Arguments = $"\"{bash}\"",
UseShellExecute = false,
});
} else {
Process.Start(new ProcessStartInfo {
FileName = bash,
UseShellExecute = true,
});
}
Process.Start(new ProcessStartInfo {
FileName = bash,
UseShellExecute = true,
});
e.Handled = true;
}