mirror of
https://fastgit.cc/github.com/sourcegit-scm/sourcegit
synced 2026-04-21 05:10:25 +08:00
code_style: rewrite editing repository node in welcome page
Signed-off-by: leo <longshuang@msn.cn>
This commit is contained in:
@@ -6,10 +6,19 @@ namespace SourceGit.ViewModels
|
||||
{
|
||||
public class EditRepositoryNode : Popup
|
||||
{
|
||||
public string Id
|
||||
public string Target
|
||||
{
|
||||
get => _id;
|
||||
set => SetProperty(ref _id, value);
|
||||
get;
|
||||
}
|
||||
|
||||
public bool IsRepository
|
||||
{
|
||||
get;
|
||||
}
|
||||
|
||||
public List<int> Bookmarks
|
||||
{
|
||||
get;
|
||||
}
|
||||
|
||||
[Required(ErrorMessage = "Name is required!")]
|
||||
@@ -19,31 +28,20 @@ namespace SourceGit.ViewModels
|
||||
set => SetProperty(ref _name, value, true);
|
||||
}
|
||||
|
||||
public List<int> Bookmarks
|
||||
{
|
||||
get;
|
||||
}
|
||||
|
||||
public int Bookmark
|
||||
{
|
||||
get => _bookmark;
|
||||
set => SetProperty(ref _bookmark, value);
|
||||
}
|
||||
|
||||
public bool IsRepository
|
||||
{
|
||||
get => _isRepository;
|
||||
set => SetProperty(ref _isRepository, value);
|
||||
}
|
||||
|
||||
public EditRepositoryNode(RepositoryNode node)
|
||||
{
|
||||
_node = node;
|
||||
_id = node.Id;
|
||||
_name = node.Name;
|
||||
_isRepository = node.IsRepository;
|
||||
_bookmark = node.Bookmark;
|
||||
|
||||
Target = node.IsRepository ? node.Id : node.Name;
|
||||
IsRepository = node.IsRepository;
|
||||
Bookmarks = new List<int>();
|
||||
for (var i = 0; i < Models.Bookmarks.Brushes.Length; i++)
|
||||
Bookmarks.Add(i);
|
||||
@@ -65,9 +63,7 @@ namespace SourceGit.ViewModels
|
||||
}
|
||||
|
||||
private RepositoryNode _node = null;
|
||||
private string _id = null;
|
||||
private string _name = null;
|
||||
private bool _isRepository = false;
|
||||
private int _bookmark = 0;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -24,10 +24,26 @@
|
||||
IsVisible="{Binding IsRepository}"/>
|
||||
</StackPanel>
|
||||
|
||||
<Grid Height="28" Margin="8,16,0,0" ColumnDefinitions="120,*" >
|
||||
<TextBlock Grid.Column="0" HorizontalAlignment="Right" VerticalAlignment="Center" Margin="0,0,8,0" Text="{DynamicResource Text.EditRepositoryNode.Target}"/>
|
||||
<TextBlock Grid.Column="1" VerticalAlignment="Center" Text="{Binding Name, Mode=OneTime}" IsVisible="{Binding !IsRepository}"/>
|
||||
<TextBlock Grid.Column="1" VerticalAlignment="Center" Text="{Binding Id, Mode=TwoWay}" IsVisible="{Binding IsRepository}"/>
|
||||
<Grid Height="28" Margin="8,16,0,0" ColumnDefinitions="120,Auto,*" >
|
||||
<TextBlock Grid.Column="0"
|
||||
HorizontalAlignment="Right" VerticalAlignment="Center"
|
||||
Margin="0,0,8,0"
|
||||
Text="{DynamicResource Text.EditRepositoryNode.Target}"/>
|
||||
|
||||
<Path Grid.Column="1"
|
||||
Width="12" Height="12"
|
||||
Margin="0,1,0,0"
|
||||
Data="{StaticResource Icons.Folder.Open}"
|
||||
IsVisible="{Binding !IsRepository, Mode=OneWay}"/>
|
||||
<Path Grid.Column="1"
|
||||
Width="12" Height="12"
|
||||
Data="{StaticResource Icons.Repositories}"
|
||||
IsVisible="{Binding IsRepository, Mode=OneWay}"/>
|
||||
|
||||
<TextBlock Grid.Column="2"
|
||||
Margin="6,0,0,0"
|
||||
VerticalAlignment="Center"
|
||||
Text="{Binding Target, Mode=OneWay}"/>
|
||||
</Grid>
|
||||
<Grid Height="28" Margin="8,4,0,0" ColumnDefinitions="120,*">
|
||||
<TextBlock Grid.Column="0" HorizontalAlignment="Right" Margin="0,0,8,0" Text="{DynamicResource Text.EditRepositoryNode.Name}"/>
|
||||
|
||||
Reference in New Issue
Block a user