From 863f88133c2b5ffa59ee7aa72a499913b4e96f58 Mon Sep 17 00:00:00 2001 From: leo Date: Tue, 4 Jun 2024 13:10:48 +0800 Subject: [PATCH] refactor: using command binding instead of routed event binding --- src/Views/Repository.axaml | 9 +++++++-- src/Views/Repository.axaml.cs | 10 ---------- 2 files changed, 7 insertions(+), 12 deletions(-) diff --git a/src/Views/Repository.axaml b/src/Views/Repository.axaml index 5a3b9d52..9731da6f 100644 --- a/src/Views/Repository.axaml +++ b/src/Views/Repository.axaml @@ -395,12 +395,17 @@ Classes="icon_button" Width="14" Margin="8,0" - Click="UpdateSubmodules" + Command="{Binding UpdateSubmodules}" IsVisible="{Binding Submodules, Converter={x:Static c:ListConverters.IsNotNullOrEmpty}}" ToolTip.Tip="{DynamicResource Text.Repository.Submodules.Update}"> - diff --git a/src/Views/Repository.axaml.cs b/src/Views/Repository.axaml.cs index 1eadb7ac..2cca3ab3 100644 --- a/src/Views/Repository.axaml.cs +++ b/src/Views/Repository.axaml.cs @@ -1,6 +1,4 @@ -using System; using System.Collections.Generic; -using System.Threading.Tasks; using Avalonia; using Avalonia.Controls; @@ -305,14 +303,6 @@ namespace SourceGit.Views e.Handled = true; } - - private void UpdateSubmodules(object sender, RoutedEventArgs e) - { - if (DataContext is ViewModels.Repository repo) - repo.UpdateSubmodules(); - - e.Handled = true; - } private void CollectBranchesFromNode(List outs, ViewModels.BranchTreeNode node) {