This repository has been archived on 2022-08-05. You can view files and clone it, but cannot push or open issues or pull requests.
UpTool2/UpToolEto/UpToolEto/Controls/RepoItem.cs

35 lines
958 B
C#

using System;
using System.Collections.Generic;
using Eto.Forms;
using UpToolLib.DataStructures;
namespace UpToolEto.Controls
{
public class RepoItem : StackLayout
{
public RepoItem(Repo repo, int index, Action update, IList<Repo> repos)
{
TextBox name = new()
{
Text = repo.Name
};
name.TextChanged += (_, _) => repo.Name = name.Text;
TextBox link = new()
{
Text = repo.Url
};
link.TextChanged += (_, _) => repo.Url = link.Text;
Orientation = Orientation.Horizontal;
Items.Add(name);
Items.Add(new StackLayoutItem(link, HorizontalAlignment.Stretch, true));
Items.Add(new Button((_, _) =>
{
repos.RemoveAt(index);
update();
})
{
Text = "-"
});
}
}
}