diff --git a/src/GitMan/Clients/AzureClient.cs b/src/GitMan/Clients/AzureClient.cs index 8e1f9d9..8593eda 100644 --- a/src/GitMan/Clients/AzureClient.cs +++ b/src/GitMan/Clients/AzureClient.cs @@ -83,15 +83,11 @@ private JsonDocument GetResponse(string path) { var uri = BuildUri(path); - using (var client = GetClient()) - { - using (var response = client.GetAsync(uri).Result) - { - var json = response.Content.ReadAsStringAsync().Result; - var document = JsonDocument.Parse(json); - return document; - } - } + using var client = GetClient(); + using var response = client.GetAsync(uri).Result; + var json = response.Content.ReadAsStringAsync().Result; + var document = JsonDocument.Parse(json); + return document; } public RemoteRepository[] GetRepositories() diff --git a/src/GitMan/Clients/GitHubClient.cs b/src/GitMan/Clients/GitHubClient.cs index a95d3c5..475dd9a 100644 --- a/src/GitMan/Clients/GitHubClient.cs +++ b/src/GitMan/Clients/GitHubClient.cs @@ -55,15 +55,11 @@ private JsonDocument GetResponse(string path) { var uri = BuildUri(path); - using (var client = GetClient()) - { - using (var response = client.GetAsync(uri).Result) - { - var json = response.Content.ReadAsStringAsync().Result; - var document = JsonDocument.Parse(json); - return document; - } - } + using var client = GetClient(); + using var response = client.GetAsync(uri).Result; + var json = response.Content.ReadAsStringAsync().Result; + var document = JsonDocument.Parse(json); + return document; } public RemoteRepository[] GetRepositories() diff --git a/src/GitMan/Context.cs b/src/GitMan/Context.cs index 813fb0f..4bf7df2 100644 --- a/src/GitMan/Context.cs +++ b/src/GitMan/Context.cs @@ -19,6 +19,8 @@ public class Context : ApplicationContext private readonly Settings _settings; private readonly RepositoryAction[] _repositoryActions; + private static void EmptyHandler(object sender, EventArgs eventArgs) { } + public Context() { _icon = new NotifyIcon(); @@ -145,8 +147,6 @@ private MenuItem MakeAzureProviderItem( var mergeOrder = 0; var shortcut = Shortcut.None; - void onClick(object sender, EventArgs eventArgs) { } - void onPopup(object sender, EventArgs eventArgs) { var originalCursor = Cursor.Current; @@ -175,16 +175,14 @@ void onPopup(object sender, EventArgs eventArgs) Cursor.Current = originalCursor; } - void onSelect(object sender, EventArgs eventArgs) { } - menuItem = new MenuItem( mergeType, mergeOrder, shortcut, name, - onClick, + EmptyHandler, onPopup, - onSelect, + EmptyHandler, dummyItems); return menuItem; @@ -204,8 +202,6 @@ private MenuItem MakeGitHubProviderItem( var mergeOrder = 0; var shortcut = Shortcut.None; - void onClick(object sender, EventArgs eventArgs) { } - void onPopup(object sender, EventArgs eventArgs) { var originalCursor = Cursor.Current; @@ -233,16 +229,14 @@ void onPopup(object sender, EventArgs eventArgs) Cursor.Current = originalCursor; } - void onSelect(object sender, EventArgs eventArgs) { } - menuItem = new MenuItem( mergeType, mergeOrder, shortcut, name, - onClick, + EmptyHandler, onPopup, - onSelect, + EmptyHandler, dummyItems); return menuItem;