mirror of
https://github.com/sourcegit-scm/sourcegit
synced 2025-05-22 20:54:59 +00:00
code_style: remove all IDE warnings
This commit is contained in:
parent
9ac550242e
commit
a807aa9e12
94 changed files with 785 additions and 807 deletions
|
@ -49,8 +49,7 @@ namespace SourceGit.Views
|
|||
{
|
||||
base.OnDataContextChanged(e);
|
||||
|
||||
var source = DataContext as Models.RevisionTextFile;
|
||||
if (source != null)
|
||||
if (DataContext is Models.RevisionTextFile source)
|
||||
Text = source.Content;
|
||||
else
|
||||
Text = string.Empty;
|
||||
|
@ -62,21 +61,24 @@ namespace SourceGit.Views
|
|||
if (string.IsNullOrEmpty(selected))
|
||||
return;
|
||||
|
||||
var icon = new Avalonia.Controls.Shapes.Path();
|
||||
icon.Width = 10;
|
||||
icon.Height = 10;
|
||||
icon.Stretch = Stretch.Uniform;
|
||||
icon.Data = App.Current?.FindResource("Icons.Copy") as StreamGeometry;
|
||||
|
||||
var copy = new MenuItem();
|
||||
copy.Header = App.Text("Copy");
|
||||
copy.Icon = icon;
|
||||
copy.Click += (o, ev) =>
|
||||
var copy = new MenuItem() { Header = App.Text("Copy") };
|
||||
copy.Click += (_, ev) =>
|
||||
{
|
||||
App.CopyText(selected);
|
||||
ev.Handled = true;
|
||||
};
|
||||
|
||||
if (this.FindResource("Icons.Copy") is Geometry geo)
|
||||
{
|
||||
copy.Icon = new Avalonia.Controls.Shapes.Path()
|
||||
{
|
||||
Width = 10,
|
||||
Height = 10,
|
||||
Stretch = Stretch.Uniform,
|
||||
Data = geo,
|
||||
};
|
||||
}
|
||||
|
||||
var menu = new ContextMenu();
|
||||
menu.Items.Add(copy);
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue