mirror of
https://github.com/sourcegit-scm/sourcegit
synced 2025-05-21 12:15:00 +00:00
refactor: use List<T>
instead of AvaloniaList<T>
since it is not used for bindings
Signed-off-by: leo <longshuang@msn.cn>
This commit is contained in:
parent
64a41dce39
commit
f5d6e1264d
2 changed files with 20 additions and 22 deletions
|
@ -6,7 +6,6 @@ using System.Text.Json;
|
|||
using System.Threading;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
using Avalonia.Collections;
|
||||
using Avalonia.Controls;
|
||||
using Avalonia.Media;
|
||||
using Avalonia.Media.Imaging;
|
||||
|
@ -1221,23 +1220,26 @@ namespace SourceGit.ViewModels
|
|||
App.GetLauncer()?.OpenRepositoryInTab(node, null);
|
||||
}
|
||||
|
||||
public AvaloniaList<Models.OpenAIService> GetPreferedOpenAIServices()
|
||||
public List<Models.OpenAIService> GetPreferedOpenAIServices()
|
||||
{
|
||||
var services = Preferences.Instance.OpenAIServices;
|
||||
if (services == null || services.Count == 0)
|
||||
return [];
|
||||
|
||||
if (services.Count == 1)
|
||||
return services;
|
||||
return [services[0]];
|
||||
|
||||
var prefered = _settings.PreferedOpenAIService;
|
||||
var all = new List<Models.OpenAIService>();
|
||||
foreach (var service in services)
|
||||
{
|
||||
if (service.Name.Equals(prefered, StringComparison.Ordinal))
|
||||
return [service];
|
||||
|
||||
all.Add(service);
|
||||
}
|
||||
|
||||
return services;
|
||||
return all;
|
||||
}
|
||||
|
||||
public ContextMenu CreateContextMenuForGitFlow()
|
||||
|
|
|
@ -1452,14 +1452,11 @@ namespace SourceGit.ViewModels
|
|||
App.OpenDialog(dialog);
|
||||
return null;
|
||||
}
|
||||
else
|
||||
{
|
||||
var menu = new ContextMenu() { Placement = PlacementMode.TopEdgeAlignedLeft };
|
||||
|
||||
var menu = new ContextMenu() { Placement = PlacementMode.TopEdgeAlignedLeft };
|
||||
foreach (var service in services)
|
||||
{
|
||||
var dup = service;
|
||||
|
||||
var item = new MenuItem();
|
||||
item.Header = service.Name;
|
||||
item.Click += (_, e) =>
|
||||
|
@ -1474,7 +1471,6 @@ namespace SourceGit.ViewModels
|
|||
|
||||
return menu;
|
||||
}
|
||||
}
|
||||
|
||||
private List<Models.Change> GetVisibleUnstagedChanges(List<Models.Change> unstaged)
|
||||
{
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue