fix<Preference>: fix external merge tool configuration lost when path can NOT be found automatically

This commit is contained in:
leo 2021-06-07 20:58:42 +08:00
parent dcf24db75a
commit e13467c457
2 changed files with 7 additions and 7 deletions

View file

@ -78,7 +78,6 @@ namespace SourceGit.Models {
/// 外部合并工具配置 /// 外部合并工具配置
/// </summary> /// </summary>
public class MergeToolInfo { public class MergeToolInfo {
/// <summary> /// <summary>
/// 合并工具类型 /// 合并工具类型
/// </summary> /// </summary>
@ -87,7 +86,7 @@ namespace SourceGit.Models {
/// <summary> /// <summary>
/// 合并工具可执行文件路径 /// 合并工具可执行文件路径
/// </summary> /// </summary>
public string Path { get; set; } public string Path { get; set; } = "";
} }
/// <summary> /// <summary>

View file

@ -87,17 +87,18 @@ namespace SourceGit.Views {
} }
private void MergeToolChanged(object sender, SelectionChangedEventArgs e) { private void MergeToolChanged(object sender, SelectionChangedEventArgs e) {
var selector = sender as ComboBox; var type = (int)(sender as ComboBox).SelectedValue;
var type = (int)selector.SelectedValue;
var tool = Models.MergeTool.Supported.Find(x => x.Type == type); var tool = Models.MergeTool.Supported.Find(x => x.Type == type);
if (tool == null) return; if (tool == null) return;
Models.Preference.Instance.MergeTool.Path = tool.Finder();
MergeCmd = tool.Cmd; MergeCmd = tool.Cmd;
txtMergeExec?.GetBindingExpression(TextBox.TextProperty).UpdateTarget();
txtMergeCmd?.GetBindingExpression(TextBlock.TextProperty).UpdateTarget(); txtMergeCmd?.GetBindingExpression(TextBlock.TextProperty).UpdateTarget();
if (IsLoaded) {
Models.Preference.Instance.MergeTool.Path = tool.Finder();
txtMergeExec?.GetBindingExpression(TextBox.TextProperty).UpdateTarget();
}
e.Handled = true; e.Handled = true;
} }