mirror of
https://github.com/sourcegit-scm/sourcegit
synced 2025-06-21 18:35:00 +00:00
code_style: general cleanup (#1415)
* code_style: general cleanup * code_style: whitespace cleanup
This commit is contained in:
parent
35eda489be
commit
ffac71b15f
89 changed files with 161 additions and 243 deletions
|
@ -62,7 +62,6 @@
|
|||
</Button>
|
||||
</StackPanel>
|
||||
|
||||
|
||||
<TextBlock x:Name="TxtCopyright" Margin="0,40,0,0" Foreground="{DynamicResource Brush.FG2}"/>
|
||||
</StackPanel>
|
||||
</Grid>
|
||||
|
|
|
@ -10,4 +10,3 @@ namespace SourceGit.Views
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -66,7 +66,7 @@
|
|||
<Grid Height="26" ColumnDefinitions="26,*,30">
|
||||
<Path Grid.Column="0" Width="14" Height="14" Margin="8,0,0,0" HorizontalAlignment="Center" Data="{StaticResource Icons.File}"/>
|
||||
<Border Grid.Column="1" Margin="4,0" ClipToBounds="True">
|
||||
<TextBlock Grid.Column="1" Text="{Binding}" HorizontalAlignment="Left"/>
|
||||
<TextBlock Text="{Binding}" HorizontalAlignment="Left"/>
|
||||
</Border>
|
||||
<Button Grid.Column="2" Classes="icon_button" Click="OnRemoveButtonClicked">
|
||||
<Path Width="14" Height="14" Data="{StaticResource Icons.Clear}"/>
|
||||
|
|
|
@ -187,7 +187,7 @@ namespace SourceGit.Views
|
|||
if (storageFile != null)
|
||||
{
|
||||
var saveTo = storageFile.Path.LocalPath;
|
||||
using (var writer = File.OpenWrite(saveTo))
|
||||
await using (var writer = File.OpenWrite(saveTo))
|
||||
{
|
||||
if (_img != null)
|
||||
{
|
||||
|
@ -201,7 +201,7 @@ namespace SourceGit.Views
|
|||
using (var rt = new RenderTargetBitmap(pixelSize, dpi))
|
||||
using (var ctx = rt.CreateDrawingContext())
|
||||
{
|
||||
this.Render(ctx);
|
||||
Render(ctx);
|
||||
rt.Save(writer);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -48,7 +48,7 @@
|
|||
<Path Grid.Column="0"
|
||||
Width="14" Height="14"
|
||||
Data="{StaticResource Icons.File}"/>
|
||||
|
||||
|
||||
<TextBlock Grid.Column="1"
|
||||
Margin="4,0,0,0"
|
||||
VerticalAlignment="Center"
|
||||
|
@ -61,7 +61,7 @@
|
|||
Command="{Binding Back}">
|
||||
<Path Width="12" Height="12" Data="{StaticResource Icons.TriangleLeft}"/>
|
||||
</Button>
|
||||
|
||||
|
||||
<Button Grid.Column="3"
|
||||
Classes="icon_button"
|
||||
IsEnabled="{Binding CanForward}"
|
||||
|
@ -77,10 +77,10 @@
|
|||
Margin="0,0,6,0"
|
||||
Text="{Binding Revision.SHA, Converter={x:Static c:StringConverters.ToShortSHA}, Mode=OneWay}"/>
|
||||
|
||||
<TextBlock Grid.Column="2"
|
||||
<TextBlock Grid.Column="1"
|
||||
Text="{Binding Revision.Subject}"
|
||||
TextTrimming="CharacterEllipsis"/>
|
||||
</Grid>
|
||||
</Grid>
|
||||
</Border>
|
||||
</Grid>
|
||||
</Border>
|
||||
|
|
|
@ -102,9 +102,8 @@ namespace SourceGit.Views
|
|||
|
||||
var info = _editor.BlameData.LineInfos[lineNumber - 1];
|
||||
|
||||
if (calculated.Contains(info.CommitSHA))
|
||||
if (!calculated.Add(info.CommitSHA))
|
||||
continue;
|
||||
calculated.Add(info.CommitSHA);
|
||||
|
||||
var x = 0.0;
|
||||
var shaLink = new FormattedText(
|
||||
|
|
|
@ -96,4 +96,3 @@
|
|||
</ListBox.ItemTemplate>
|
||||
</ListBox>
|
||||
</UserControl>
|
||||
|
||||
|
|
|
@ -479,12 +479,12 @@ namespace SourceGit.Views
|
|||
|
||||
if (branches.Find(x => x.IsCurrent) != null)
|
||||
return;
|
||||
|
||||
|
||||
if (branches.Count == 1)
|
||||
repo.DeleteBranch(branches[0]);
|
||||
else
|
||||
repo.DeleteMultipleBranches(branches, branches[0].IsLocal);
|
||||
|
||||
|
||||
e.Handled = true;
|
||||
}
|
||||
|
||||
|
@ -537,4 +537,3 @@ namespace SourceGit.Views
|
|||
private bool _disableSelectionChangingEvent = false;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -47,7 +47,7 @@
|
|||
Text="{DynamicResource Text.Checkout.WithFastForward.Upstream}"/>
|
||||
<StackPanel Grid.Row="1" Grid.Column="1" Orientation="Horizontal">
|
||||
<Path Width="14" Height="14" Margin="4,0" Data="{StaticResource Icons.Branch}"/>
|
||||
<TextBlock Text="{Binding RemoteBrach.FriendlyName}"/>
|
||||
<TextBlock Text="{Binding RemoteBranch.FriendlyName}"/>
|
||||
</StackPanel>
|
||||
|
||||
<TextBlock Grid.Row="2" Grid.Column="0"
|
||||
|
|
|
@ -76,8 +76,7 @@
|
|||
<Border Grid.Column="1"
|
||||
Background="Transparent"
|
||||
ToolTip.Tip="{DynamicResource Text.CherryPick.Mainline.Tips}">
|
||||
<Path Grid.Column="1"
|
||||
Width="14" Height="14"
|
||||
<Path Width="14" Height="14"
|
||||
Data="{StaticResource Icons.Info}"/>
|
||||
</Border>
|
||||
</Grid>
|
||||
|
|
|
@ -19,7 +19,7 @@ namespace SourceGit.Views
|
|||
}
|
||||
|
||||
// Values are copied from Avalonia: src/Avalonia.Controls.ColorPicker/ColorPalettes/FluentColorPalette.cs
|
||||
private static readonly Color[,] COLOR_TABLE = new Color[,]
|
||||
private static readonly Color[,] COLOR_TABLE = new[,]
|
||||
{
|
||||
{
|
||||
Color.FromArgb(255, 255, 67, 67), /* #FF4343 */
|
||||
|
|
|
@ -61,7 +61,7 @@ namespace SourceGit.Views
|
|||
|
||||
private void StopTimer()
|
||||
{
|
||||
if (_refreshTimer is { })
|
||||
if (_refreshTimer is not null)
|
||||
{
|
||||
_refreshTimer.Dispose();
|
||||
_refreshTimer = null;
|
||||
|
|
|
@ -120,7 +120,7 @@
|
|||
<Binding Path="$self.(ToolTip.Tip)" Converter="{x:Static ObjectConverters.IsNotNull}"/>
|
||||
</MultiBinding>
|
||||
</ToolTip.IsOpen>
|
||||
|
||||
|
||||
<TextBlock.DataTemplates>
|
||||
<DataTemplate DataType="m:Commit">
|
||||
<StackPanel MinWidth="400" Orientation="Vertical">
|
||||
|
@ -165,7 +165,7 @@
|
|||
<Binding Path="$self.(ToolTip.Tip)" Converter="{x:Static ObjectConverters.IsNotNull}"/>
|
||||
</MultiBinding>
|
||||
</ToolTip.IsOpen>
|
||||
|
||||
|
||||
<TextBlock.DataTemplates>
|
||||
<DataTemplate DataType="m:Commit">
|
||||
<StackPanel MinWidth="400" Orientation="Vertical">
|
||||
|
@ -209,7 +209,7 @@
|
|||
<Binding Path="$self.(ToolTip.Tip)" Converter="{x:Static ObjectConverters.IsNotNull}"/>
|
||||
</MultiBinding>
|
||||
</ToolTip.IsOpen>
|
||||
|
||||
|
||||
<v:CommitMessagePresenter.DataTemplates>
|
||||
<DataTemplate DataType="m:Commit">
|
||||
<StackPanel MinWidth="400" Orientation="Vertical">
|
||||
|
|
|
@ -264,8 +264,7 @@ namespace SourceGit.Views
|
|||
if (currentParent is { DataContext: ViewModels.CommitDetail currentDetail } &&
|
||||
currentDetail.Commit.SHA == lastDetailCommit)
|
||||
{
|
||||
if (!_inlineCommits.ContainsKey(sha))
|
||||
_inlineCommits.Add(sha, c);
|
||||
_inlineCommits.TryAdd(sha, c);
|
||||
|
||||
// Make sure user still hovers the target SHA.
|
||||
if (_lastHover == link && c != null)
|
||||
|
|
|
@ -67,7 +67,7 @@
|
|||
<Grid ColumnDefinitions="Auto,Auto,Auto,Auto,*" Margin="0,4">
|
||||
<Button Grid.Column="0"
|
||||
Classes="icon_button"
|
||||
Width="24"
|
||||
Width="24"
|
||||
Margin="0,0,4,0" Padding="0"
|
||||
Click="OnOpenCommitMessagePicker"
|
||||
IsVisible="{Binding #ThisControl.ShowAdvancedOptions}"
|
||||
|
@ -120,4 +120,3 @@
|
|||
</Grid>
|
||||
</Border>
|
||||
</UserControl>
|
||||
|
||||
|
|
|
@ -35,7 +35,7 @@ namespace SourceGit.Views
|
|||
set => SetValue(BehindBrushProperty, value);
|
||||
}
|
||||
|
||||
enum Status
|
||||
private enum Status
|
||||
{
|
||||
Normal,
|
||||
Ahead,
|
||||
|
|
|
@ -121,7 +121,7 @@
|
|||
<Grid RowDefinitions="30,32,30,32,30,Auto,32">
|
||||
<TextBlock Grid.Row="0" Margin="0,0,0,4" Text="{DynamicResource Text.ConfigureWorkspace.Name}" VerticalAlignment="Bottom"/>
|
||||
<TextBox Grid.Row="1" CornerRadius="3" Height="28" Text="{Binding Name, Mode=TwoWay}"/>
|
||||
|
||||
|
||||
<TextBlock Grid.Row="2" Margin="0,0,0,4" Text="{DynamicResource Text.Preferences.Git.DefaultCloneDir}" VerticalAlignment="Bottom"/>
|
||||
<TextBox Grid.Row="3" CornerRadius="3" Height="28" Text="{Binding DefaultCloneDir, Mode=TwoWay}">
|
||||
<TextBox.InnerRightContent>
|
||||
|
@ -130,10 +130,10 @@
|
|||
</Button>
|
||||
</TextBox.InnerRightContent>
|
||||
</TextBox>
|
||||
|
||||
|
||||
<TextBlock Grid.Row="4" Margin="0,0,0,4" Text="{DynamicResource Text.ConfigureWorkspace.Color}" VerticalAlignment="Bottom"/>
|
||||
<v:ColorPicker Grid.Row="5" HorizontalAlignment="Left" Value="{Binding Color, Mode=TwoWay}"/>
|
||||
|
||||
|
||||
<CheckBox Grid.Row="6"
|
||||
Content="{DynamicResource Text.ConfigureWorkspace.Restore}"
|
||||
IsChecked="{Binding RestoreOnStartup, Mode=TwoWay}"/>
|
||||
|
|
|
@ -14,15 +14,15 @@
|
|||
<StackPanel Orientation="Vertical" IsVisible="{Binding !IsResolved}">
|
||||
<Path Width="64" Height="64" Data="{StaticResource Icons.Conflict}" Fill="{DynamicResource Brush.FG2}" HorizontalAlignment="Center"/>
|
||||
<TextBlock Margin="0,16" FontSize="20" FontWeight="Bold" Text="{DynamicResource Text.WorkingCopy.Conflicts}" Foreground="{DynamicResource Brush.FG2}" HorizontalAlignment="Center"/>
|
||||
|
||||
|
||||
<StackPanel Orientation="Horizontal" HorizontalAlignment="Center" Margin="0,0,0,8">
|
||||
<Border Height="16" VerticalAlignment="Center" Background="Red" CornerRadius="8">
|
||||
<TextBlock Classes="primary" Text="{Binding Marker}" Foreground="White" FontWeight="Bold" Margin="8,0" FontSize="10"/>
|
||||
</Border>
|
||||
|
||||
|
||||
<TextBlock Margin="8,0,0,0" VerticalAlignment="Center" Text="{Binding Description}"/>
|
||||
</StackPanel>
|
||||
|
||||
|
||||
<Border Margin="16,0" Padding="8" CornerRadius="4" BorderThickness="1" BorderBrush="{DynamicResource Brush.Border2}">
|
||||
<Border.DataTemplates>
|
||||
<DataTemplate DataType="vm:ConflictSourceBranch">
|
||||
|
@ -96,7 +96,7 @@
|
|||
</StackPanel>
|
||||
</DataTemplate>
|
||||
</Border.DataTemplates>
|
||||
|
||||
|
||||
<Border.IsVisible>
|
||||
<MultiBinding Converter="{x:Static BoolConverters.And}">
|
||||
<Binding Path="Theirs" Converter="{x:Static ObjectConverters.IsNotNull}"/>
|
||||
|
|
|
@ -56,11 +56,11 @@
|
|||
<TextBlock Text="{Binding Name}" Margin="0,0,8,0"/>
|
||||
<Border Height="16" CornerRadius="8" Padding="8,0" VerticalAlignment="Center" Background="Green">
|
||||
<TextBlock Text="{Binding Type}" VerticalAlignment="Center" FontSize="11" Foreground="White"/>
|
||||
</Border>
|
||||
</Border>
|
||||
</StackPanel>
|
||||
</DataTemplate>
|
||||
</ComboBox.SelectionBoxItemTemplate>
|
||||
|
||||
|
||||
<ComboBox.ItemTemplate>
|
||||
<DataTemplate DataType="m:ConventionalCommitType">
|
||||
<Grid Height="22">
|
||||
|
|
|
@ -10,4 +10,3 @@ namespace SourceGit.Views
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -51,7 +51,7 @@ namespace SourceGit.Views
|
|||
options.DefaultExtension = ".patch";
|
||||
options.FileTypeChoices = [new FilePickerFileType("Patch File") { Patterns = ["*.patch"] }];
|
||||
|
||||
var storageFile = await this.StorageProvider.SaveFilePickerAsync(options);
|
||||
var storageFile = await StorageProvider.SaveFilePickerAsync(options);
|
||||
if (storageFile != null)
|
||||
await compare.SaveAsPatch(storageFile.Path.LocalPath);
|
||||
|
||||
|
|
|
@ -163,5 +163,3 @@ namespace SourceGit.Views
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -133,7 +133,7 @@
|
|||
AheadBrush="{DynamicResource Brush.Accent}"
|
||||
BehindBrush="{DynamicResource Brush.FG1}"
|
||||
VerticalAlignment="Center"/>
|
||||
|
||||
|
||||
<v:BisectStateIndicator Grid.Column="1"
|
||||
Background="{DynamicResource Brush.Contents}"
|
||||
Foreground="{DynamicResource Brush.FG1}"
|
||||
|
|
|
@ -141,7 +141,7 @@ namespace SourceGit.Views
|
|||
if (DataContext is ViewModels.Histories)
|
||||
{
|
||||
var list = CommitListContainer;
|
||||
if (list != null && list.SelectedItems.Count == 1)
|
||||
if (list is { SelectedItems.Count: 1 })
|
||||
list.ScrollIntoView(list.SelectedIndex);
|
||||
}
|
||||
}
|
||||
|
@ -170,7 +170,7 @@ namespace SourceGit.Views
|
|||
|
||||
private void OnCommitListContextRequested(object sender, ContextRequestedEventArgs e)
|
||||
{
|
||||
if (DataContext is ViewModels.Histories histories && sender is ListBox { SelectedItems: { Count: > 0 } } list)
|
||||
if (DataContext is ViewModels.Histories histories && sender is ListBox { SelectedItems.Count: > 0 } list)
|
||||
{
|
||||
var menu = histories.MakeContextMenu(list);
|
||||
menu?.Open(list);
|
||||
|
@ -180,7 +180,7 @@ namespace SourceGit.Views
|
|||
|
||||
private void OnCommitListDoubleTapped(object sender, TappedEventArgs e)
|
||||
{
|
||||
if (DataContext is ViewModels.Histories histories && sender is ListBox { SelectedItems: { Count: 1 } })
|
||||
if (DataContext is ViewModels.Histories histories && sender is ListBox { SelectedItems.Count: 1 })
|
||||
{
|
||||
var source = e.Source as Control;
|
||||
var item = source.FindAncestorOfType<ListBoxItem>();
|
||||
|
|
|
@ -69,10 +69,10 @@
|
|||
|
||||
<TextBlock Grid.Row="7" Grid.Column="0" Classes="primary bold" Text="{OnPlatform Ctrl+Q, macOS=⌘+Q}"/>
|
||||
<TextBlock Grid.Row="7" Grid.Column="1" Margin="16,0,0,0" Text="{DynamicResource Text.Quit}" />
|
||||
|
||||
|
||||
<TextBlock Grid.Row="8" Grid.Column="0" Classes="primary bold" Text="{OnPlatform Ctrl+Shift+P, macOS=⌘+⇧+P}"/>
|
||||
<TextBlock Grid.Row="8" Grid.Column="1" Margin="16,0,0,0" Text="{DynamicResource Text.Hotkeys.Global.SwitchWorkspace}" />
|
||||
|
||||
|
||||
<TextBlock Grid.Row="9" Grid.Column="0" Classes="primary bold" Text="{OnPlatform Ctrl+P, macOS=⌘+P}"/>
|
||||
<TextBlock Grid.Row="9" Grid.Column="1" Margin="16,0,0,0" Text="{DynamicResource Text.Hotkeys.Global.SwitchTab}" />
|
||||
</Grid>
|
||||
|
|
|
@ -102,7 +102,7 @@
|
|||
</DataTemplate>
|
||||
</ContentControl.DataTemplates>
|
||||
</ContentControl>
|
||||
|
||||
|
||||
<!-- Workspace/Pages Switcher -->
|
||||
<Border Grid.Row="0" Grid.RowSpan="2"
|
||||
Background="Transparent"
|
||||
|
@ -115,7 +115,7 @@
|
|||
<DataTemplate DataType="vm:WorkspaceSwitcher">
|
||||
<v:WorkspaceSwitcher/>
|
||||
</DataTemplate>
|
||||
|
||||
|
||||
<DataTemplate DataType="vm:LauncherPageSwitcher">
|
||||
<v:LauncherPageSwitcher/>
|
||||
</DataTemplate>
|
||||
|
|
|
@ -13,7 +13,7 @@
|
|||
Text="{DynamicResource Text.Launcher.Pages}"
|
||||
FontWeight="Bold"
|
||||
HorizontalAlignment="Center"/>
|
||||
|
||||
|
||||
<TextBox Grid.Row="1"
|
||||
Height="24"
|
||||
Margin="4,8,4,0"
|
||||
|
|
|
@ -46,4 +46,3 @@ namespace SourceGit.Views
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -80,7 +80,7 @@
|
|||
VerticalAlignment="Center"
|
||||
IsVisible="{Binding DirtyBrush, Converter={x:Static ObjectConverters.IsNotNull}}"
|
||||
Fill="{Binding DirtyBrush}"/>
|
||||
|
||||
|
||||
<TextBlock Grid.Column="1"
|
||||
Classes="primary"
|
||||
VerticalAlignment="Center"
|
||||
|
@ -89,7 +89,7 @@
|
|||
Text="{Binding Node.Name}"
|
||||
IsHitTestVisible="False"/>
|
||||
</Grid>
|
||||
|
||||
|
||||
<TextBlock Grid.Column="1"
|
||||
Classes="primary"
|
||||
HorizontalAlignment="Stretch" VerticalAlignment="Center"
|
||||
|
@ -98,7 +98,7 @@
|
|||
Text="{DynamicResource Text.PageTabBar.Welcome.Title}"
|
||||
IsVisible="{Binding !Node.IsRepository}"
|
||||
IsHitTestVisible="False"/>
|
||||
|
||||
|
||||
<Button Grid.Column="2"
|
||||
Classes="icon_button"
|
||||
Width="16" Height="16" Margin="12,0"
|
||||
|
|
|
@ -98,7 +98,6 @@ namespace SourceGit.Views
|
|||
ctx.BeginFigure(new Point(x, y), true);
|
||||
y = 1;
|
||||
ctx.LineTo(new Point(x, y));
|
||||
x = drawRightX - 6;
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -112,9 +111,10 @@ namespace SourceGit.Views
|
|||
x += 6;
|
||||
y = 1;
|
||||
ctx.ArcTo(new Point(x, y), new Size(6, 6), angle, false, SweepDirection.Clockwise);
|
||||
x = drawRightX - 6;
|
||||
}
|
||||
|
||||
x = drawRightX - 6;
|
||||
|
||||
if (drawRightX <= LauncherTabsScroller.Bounds.Right)
|
||||
{
|
||||
ctx.LineTo(new Point(x, y));
|
||||
|
|
|
@ -10,5 +10,3 @@ namespace SourceGit.Views
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -95,20 +95,15 @@ namespace SourceGit.Views
|
|||
normalTypeface,
|
||||
FontSize,
|
||||
Foreground);
|
||||
context.DrawText(formatted, new Point(offsetX, 0));
|
||||
|
||||
if (isName)
|
||||
{
|
||||
var lineY = formatted.Baseline + 2;
|
||||
context.DrawText(formatted, new Point(offsetX, 0));
|
||||
context.DrawLine(underlinePen, new Point(offsetX, lineY), new Point(offsetX + formatted.Width, lineY));
|
||||
offsetX += formatted.WidthIncludingTrailingWhitespace;
|
||||
}
|
||||
else
|
||||
{
|
||||
context.DrawText(formatted, new Point(offsetX, 0));
|
||||
offsetX += formatted.WidthIncludingTrailingWhitespace;
|
||||
}
|
||||
|
||||
offsetX += formatted.WidthIncludingTrailingWhitespace;
|
||||
isName = !isName;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -178,7 +178,7 @@ namespace SourceGit.Views
|
|||
SetIfChanged(config, "user.name", DefaultUser, "");
|
||||
SetIfChanged(config, "user.email", DefaultEmail, "");
|
||||
SetIfChanged(config, "user.signingkey", GPGUserKey, "");
|
||||
SetIfChanged(config, "core.autocrlf", CRLFMode != null ? CRLFMode.Value : null, null);
|
||||
SetIfChanged(config, "core.autocrlf", CRLFMode?.Value, null);
|
||||
SetIfChanged(config, "fetch.prune", EnablePruneOnFetch ? "true" : "false", "false");
|
||||
SetIfChanged(config, "commit.gpgsign", EnableGPGCommitSigning ? "true" : "false", "false");
|
||||
SetIfChanged(config, "tag.gpgsign", EnableGPGTagSigning ? "true" : "false", "false");
|
||||
|
|
|
@ -769,7 +769,7 @@
|
|||
Click="OnBisectCommand"
|
||||
Tag="reset"/>
|
||||
</Grid>
|
||||
|
||||
|
||||
<Border Grid.Row="2" Background="{DynamicResource Brush.ToolBar}" BorderThickness="0,0,0,1" BorderBrush="{DynamicResource Brush.Border0}">
|
||||
<Border.IsVisible>
|
||||
<MultiBinding Converter="{x:Static BoolConverters.And}">
|
||||
|
|
|
@ -208,7 +208,7 @@ namespace SourceGit.Views
|
|||
|
||||
private void OnWorktreeListPropertyChanged(object _, AvaloniaPropertyChangedEventArgs e)
|
||||
{
|
||||
if (e.Property == ListBox.ItemsSourceProperty || e.Property == ListBox.IsVisibleProperty)
|
||||
if (e.Property == ItemsControl.ItemsSourceProperty || e.Property == IsVisibleProperty)
|
||||
UpdateLeftSidebarLayout();
|
||||
}
|
||||
|
||||
|
@ -221,7 +221,7 @@ namespace SourceGit.Views
|
|||
private void UpdateLeftSidebarLayout()
|
||||
{
|
||||
var vm = DataContext as ViewModels.Repository;
|
||||
if (vm == null || vm.Settings == null)
|
||||
if (vm?.Settings == null)
|
||||
return;
|
||||
|
||||
if (!IsLoaded)
|
||||
|
|
|
@ -102,7 +102,7 @@
|
|||
|
||||
<Button Classes="icon_button" Width="32" Margin="8,0,0,0" Command="{Binding Cleanup}" ToolTip.Tip="{DynamicResource Text.Repository.Clean}">
|
||||
<Path Width="14" Height="14" Margin="0,1,0,0" Data="{StaticResource Icons.Clean}"/>
|
||||
</Button>
|
||||
</Button>
|
||||
</StackPanel>
|
||||
|
||||
<StackPanel Grid.Column="2" Orientation="Horizontal" HorizontalAlignment="Right" Margin="0,0,4,0">
|
||||
|
@ -132,4 +132,3 @@
|
|||
</StackPanel>
|
||||
</Grid>
|
||||
</UserControl>
|
||||
|
||||
|
|
|
@ -152,4 +152,3 @@ namespace SourceGit.Views
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -45,7 +45,7 @@
|
|||
KeyDown="OnResetModeKeyDown">
|
||||
<ComboBox.ItemTemplate>
|
||||
<DataTemplate DataType="m:ResetMode">
|
||||
<Grid ColumnDefinitions="16,60,*">
|
||||
<Grid ColumnDefinitions="16,60,*,*">
|
||||
<Ellipse Grid.Column="0" Width="12" Height="12" Fill="{Binding Color}"/>
|
||||
<TextBlock Grid.Column="1" Text="{Binding Name}" Margin="2,0,0,0"/>
|
||||
<TextBlock Grid.Column="2" Text="{Binding Desc}" Margin="2,0,16,0" FontSize="11" Foreground="{DynamicResource Brush.FG2}" HorizontalAlignment="Right"/>
|
||||
|
|
|
@ -97,4 +97,3 @@
|
|||
</DataTemplate>
|
||||
</UserControl.DataTemplates>
|
||||
</UserControl>
|
||||
|
||||
|
|
|
@ -163,4 +163,3 @@ namespace SourceGit.Views
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -157,7 +157,7 @@ namespace SourceGit.Views
|
|||
else
|
||||
{
|
||||
var vm = DataContext as ViewModels.CommitDetail;
|
||||
if (vm == null || vm.Commit == null)
|
||||
if (vm?.Commit == null)
|
||||
return;
|
||||
|
||||
var objects = vm.GetRevisionFilesUnderFolder(file);
|
||||
|
@ -254,7 +254,7 @@ namespace SourceGit.Views
|
|||
_searchResult.Clear();
|
||||
|
||||
var vm = DataContext as ViewModels.CommitDetail;
|
||||
if (vm == null || vm.Commit == null)
|
||||
if (vm?.Commit == null)
|
||||
{
|
||||
GC.Collect();
|
||||
return;
|
||||
|
|
|
@ -144,7 +144,7 @@
|
|||
</ToggleButton>
|
||||
</Grid>
|
||||
</Border>
|
||||
|
||||
|
||||
<v:RevisionFileContentViewer Grid.Row="1" Content="{Binding ViewRevisionFileContent}"/>
|
||||
</Grid>
|
||||
</Border>
|
||||
|
|
|
@ -25,7 +25,6 @@ namespace SourceGit.Views
|
|||
TextArea.TextView.Margin = new Thickness(4, 0);
|
||||
TextArea.TextView.Options.EnableHyperlinks = false;
|
||||
TextArea.TextView.Options.EnableEmailHyperlinks = false;
|
||||
|
||||
}
|
||||
|
||||
protected override void OnLoaded(RoutedEventArgs e)
|
||||
|
|
|
@ -203,7 +203,7 @@
|
|||
</Grid>
|
||||
</StackPanel>
|
||||
</ToolTip.Tip>
|
||||
|
||||
|
||||
<Grid ColumnDefinitions="16,*,Auto" Margin="8,0,0,0" VerticalAlignment="Center">
|
||||
<Path Grid.Column="0" Width="10" Height="10" Margin="8,0" Data="{StaticResource Icons.Submodule}"/>
|
||||
<TextBlock Grid.Column="1" Text="{Binding Path}" ClipToBounds="True" Classes="primary" TextTrimming="CharacterEllipsis"/>
|
||||
|
|
|
@ -41,7 +41,7 @@
|
|||
</StackPanel>
|
||||
</DataTemplate>
|
||||
</ListBox.DataTemplates>
|
||||
|
||||
|
||||
<ListBox.ItemTemplate>
|
||||
<DataTemplate DataType="vm:TagTreeNode">
|
||||
<Border Height="24"
|
||||
|
@ -50,7 +50,7 @@
|
|||
DoubleTapped="OnItemDoubleTapped"
|
||||
ContextRequested="OnItemContextRequested"
|
||||
ToolTip.Tip="{Binding ToolTip}"
|
||||
ToolTip.Placement="Right">
|
||||
ToolTip.Placement="Right">
|
||||
<Grid ColumnDefinitions="16,Auto,*,Auto"
|
||||
Margin="{Binding Depth, Converter={x:Static c:IntConverters.ToTreeMargin}}"
|
||||
VerticalAlignment="Center">
|
||||
|
@ -111,7 +111,7 @@
|
|||
<TextBlock Text="{Binding Message}" IsVisible="{Binding Message, Converter={x:Static StringConverters.IsNotNullOrEmpty}}"/>
|
||||
</StackPanel>
|
||||
</ToolTip.Tip>
|
||||
|
||||
|
||||
<Grid ColumnDefinitions="Auto,*,Auto" VerticalAlignment="Center">
|
||||
<Path Grid.Column="0"
|
||||
Margin="8,0,0,0"
|
||||
|
@ -133,4 +133,3 @@
|
|||
</DataTemplate>
|
||||
</UserControl.DataTemplates>
|
||||
</UserControl>
|
||||
|
||||
|
|
|
@ -230,4 +230,3 @@ namespace SourceGit.Views
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -765,12 +765,10 @@ namespace SourceGit.Views
|
|||
}
|
||||
else if (change.Property == BlockNavigationProperty)
|
||||
{
|
||||
var oldValue = change.OldValue as ViewModels.BlockNavigation;
|
||||
if (oldValue != null)
|
||||
if (change.OldValue is ViewModels.BlockNavigation oldValue)
|
||||
oldValue.PropertyChanged -= OnBlockNavigationPropertyChanged;
|
||||
|
||||
var newValue = change.NewValue as ViewModels.BlockNavigation;
|
||||
if (newValue != null)
|
||||
if (change.NewValue is ViewModels.BlockNavigation newValue)
|
||||
newValue.PropertyChanged += OnBlockNavigationPropertyChanged;
|
||||
|
||||
TextArea?.TextView?.Redraw();
|
||||
|
@ -1251,8 +1249,7 @@ namespace SourceGit.Views
|
|||
{
|
||||
base.OnDataContextChanged(e);
|
||||
|
||||
var textDiff = DataContext as Models.TextDiff;
|
||||
if (textDiff != null)
|
||||
if (DataContext is Models.TextDiff textDiff)
|
||||
{
|
||||
var builder = new StringBuilder();
|
||||
foreach (var line in textDiff.Lines)
|
||||
|
@ -1410,8 +1407,7 @@ namespace SourceGit.Views
|
|||
return;
|
||||
}
|
||||
|
||||
var textDiff = this.FindAncestorOfType<TextDiffView>()?.DataContext as Models.TextDiff;
|
||||
if (textDiff != null)
|
||||
if (this.FindAncestorOfType<TextDiffView>()?.DataContext is Models.TextDiff textDiff)
|
||||
{
|
||||
var lineIdx = -1;
|
||||
foreach (var line in view.VisualLines)
|
||||
|
@ -1537,7 +1533,7 @@ namespace SourceGit.Views
|
|||
|
||||
private void DirectSyncScrollOffset()
|
||||
{
|
||||
if (_scrollViewer is { } && DataContext is ViewModels.TwoSideTextDiff diff)
|
||||
if (_scrollViewer is not null && DataContext is ViewModels.TwoSideTextDiff diff)
|
||||
diff.SyncScrollOffset = _scrollViewer?.Offset ?? Vector.Zero;
|
||||
}
|
||||
|
||||
|
|
|
@ -44,7 +44,7 @@
|
|||
<ColumnDefinition Width="4"/>
|
||||
<ColumnDefinition Width="*"/>
|
||||
</Grid.ColumnDefinitions>
|
||||
|
||||
|
||||
<ListBox Grid.Column="0"
|
||||
Padding="4"
|
||||
Background="{DynamicResource Brush.Contents}"
|
||||
|
@ -84,14 +84,14 @@
|
|||
Width="14" Height="14"
|
||||
Margin="4,0,4,0"
|
||||
IsVisible="{Binding !IsComplete}"/>
|
||||
|
||||
|
||||
<TextBlock Grid.Column="1"
|
||||
Classes="primary"
|
||||
Margin="4,0,0,0"
|
||||
Text="{Binding Name}"
|
||||
VerticalAlignment="Center"
|
||||
TextTrimming="CharacterEllipsis"/>
|
||||
|
||||
|
||||
<v:CommandLogTime Grid.Column="2"
|
||||
Classes="primary"
|
||||
Margin="4,0"
|
||||
|
|
|
@ -14,7 +14,7 @@
|
|||
<ColumnDefinition Width="2*" MinWidth="600"/>
|
||||
<ColumnDefinition Width="1*"/>
|
||||
</Grid.ColumnDefinitions>
|
||||
|
||||
|
||||
<!-- Managed Repositories -->
|
||||
<Grid Grid.Row="0" Grid.Column="1" Margin="8" RowDefinitions="Auto,*">
|
||||
<!-- Search Box -->
|
||||
|
|
|
@ -215,16 +215,8 @@ namespace SourceGit.Views
|
|||
if (to == null)
|
||||
return;
|
||||
|
||||
if (to.IsRepository)
|
||||
{
|
||||
e.DragEffects = DragDropEffects.None;
|
||||
e.Handled = true;
|
||||
}
|
||||
else
|
||||
{
|
||||
e.DragEffects = DragDropEffects.Move;
|
||||
e.Handled = true;
|
||||
}
|
||||
e.DragEffects = to.IsRepository ? DragDropEffects.None : DragDropEffects.Move;
|
||||
e.Handled = true;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -32,4 +32,3 @@
|
|||
</StackPanel>
|
||||
</Grid>
|
||||
</UserControl>
|
||||
|
||||
|
|
|
@ -50,4 +50,3 @@ namespace SourceGit.Views
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -168,7 +168,7 @@
|
|||
ViewMode="{Binding Source={x:Static vm:Preferences.Instance}, Path=StagedChangeViewMode, Mode=TwoWay}"/>
|
||||
</Grid>
|
||||
</Border>
|
||||
|
||||
|
||||
<!-- Staged Changes -->
|
||||
<v:ChangeCollectionView Grid.Row="1"
|
||||
x:Name="StagedChangesView"
|
||||
|
@ -357,7 +357,7 @@
|
|||
<Binding Path="CommitMessage" Converter="{x:Static c:StringConverters.IsNotNullOrWhitespace}"/>
|
||||
</MultiBinding>
|
||||
</Button.IsEnabled>
|
||||
|
||||
|
||||
<Button.IsVisible>
|
||||
<MultiBinding Converter="{x:Static BoolConverters.And}">
|
||||
<Binding Path="HasRemotes"/>
|
||||
|
|
|
@ -12,7 +12,7 @@
|
|||
Text="{DynamicResource Text.Launcher.Workspaces}"
|
||||
FontWeight="Bold"
|
||||
HorizontalAlignment="Center"/>
|
||||
|
||||
|
||||
<TextBox Grid.Row="1"
|
||||
Height="24"
|
||||
Margin="4,8,4,0"
|
||||
|
@ -108,4 +108,3 @@
|
|||
</ListBox>
|
||||
</Grid>
|
||||
</UserControl>
|
||||
|
||||
|
|
|
@ -46,4 +46,3 @@ namespace SourceGit.Views
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue