style<Dashboard>: code style - nest class when it's only used by outer class

This commit is contained in:
leo 2020-12-21 16:04:44 +08:00
parent 4ee9234289
commit 8a4dee918d
2 changed files with 26 additions and 26 deletions

View file

@ -302,7 +302,7 @@
</TreeView.ItemContainerStyle> </TreeView.ItemContainerStyle>
<TreeView.Resources> <TreeView.Resources>
<HierarchicalDataTemplate DataType="{x:Type local:RemoteNode}" ItemsSource="{Binding Children}"> <HierarchicalDataTemplate DataType="{x:Type local:Dashboard+RemoteNode}" ItemsSource="{Binding Children}">
<Grid Height="24"> <Grid Height="24">
<Grid.ColumnDefinitions> <Grid.ColumnDefinitions>
<ColumnDefinition Width="16"/> <ColumnDefinition Width="16"/>
@ -314,7 +314,7 @@
</Grid> </Grid>
</HierarchicalDataTemplate> </HierarchicalDataTemplate>
<HierarchicalDataTemplate DataType="{x:Type local:BranchNode}" ItemsSource="{Binding Children}"> <HierarchicalDataTemplate DataType="{x:Type local:Dashboard+BranchNode}" ItemsSource="{Binding Children}">
<Grid Height="24"> <Grid Height="24">
<Grid.ColumnDefinitions> <Grid.ColumnDefinitions>
<ColumnDefinition Width="16"/> <ColumnDefinition Width="16"/>

View file

@ -13,30 +13,6 @@ using System.Windows.Threading;
namespace SourceGit.UI { namespace SourceGit.UI {
/// <summary>
/// Branch node in tree.
/// </summary>
public class BranchNode {
public string Name { get; set; }
public Git.Branch Branch { get; set; }
public bool IsExpanded { get; set; }
public bool IsCurrent => Branch != null ? Branch.IsCurrent : false;
public bool IsFiltered => Branch != null ? Branch.IsFiltered : false;
public string Track => Branch != null ? Branch.UpstreamTrack : "";
public Visibility FilterVisibility => Branch == null ? Visibility.Collapsed : Visibility.Visible;
public Visibility TrackVisibility => (Branch != null && !Branch.IsSameWithUpstream) ? Visibility.Visible : Visibility.Collapsed;
public List<BranchNode> Children { get; set; }
}
/// <summary>
/// Remote node in tree.
/// </summary>
public class RemoteNode {
public string Name { get; set; }
public bool IsExpanded { get; set; }
public List<BranchNode> Children { get; set; }
}
/// <summary> /// <summary>
/// Dashboard for opened repository. /// Dashboard for opened repository.
/// </summary> /// </summary>
@ -46,6 +22,30 @@ namespace SourceGit.UI {
private List<RemoteNode> cachedRemotes = new List<RemoteNode>(); private List<RemoteNode> cachedRemotes = new List<RemoteNode>();
private string abortCommand = null; private string abortCommand = null;
/// <summary>
/// Branch node in tree.
/// </summary>
public class BranchNode {
public string Name { get; set; }
public Git.Branch Branch { get; set; }
public bool IsExpanded { get; set; }
public bool IsCurrent => Branch != null ? Branch.IsCurrent : false;
public bool IsFiltered => Branch != null ? Branch.IsFiltered : false;
public string Track => Branch != null ? Branch.UpstreamTrack : "";
public Visibility FilterVisibility => Branch == null ? Visibility.Collapsed : Visibility.Visible;
public Visibility TrackVisibility => (Branch != null && !Branch.IsSameWithUpstream) ? Visibility.Visible : Visibility.Collapsed;
public List<BranchNode> Children { get; set; }
}
/// <summary>
/// Remote node in tree.
/// </summary>
public class RemoteNode {
public string Name { get; set; }
public bool IsExpanded { get; set; }
public List<BranchNode> Children { get; set; }
}
/// <summary> /// <summary>
/// Expand/Collapsed tags /// Expand/Collapsed tags
/// </summary> /// </summary>