Group UI to reslove #9

This commit is contained in:
JacobTech 2023-01-02 23:03:29 -05:00
parent f7e557344d
commit 3389495a98
3 changed files with 50 additions and 1 deletions

View File

@ -0,0 +1,8 @@
using Luski.net.JsonTypes;
namespace Luski.GUI.MainScreen.Interfaces;
public interface IChannelPick
{
public SocketTextChannel Channel { get; }
}

View File

@ -0,0 +1,41 @@
using GraphicsManager.Interfaces;
using GraphicsManager.Objects;
using GraphicsManager.Objects.Core;
using Luski.net.JsonTypes;
using Luski.GUI.MainScreen.Interfaces;
namespace Luski.GUI.MainScreen.UI;
public class Group : UserControl, IChannelPick
{
public SocketTextChannel Channel { get; set; }
private string members = "";
private Rectangle r;
private Label Username, Status;
public Group(SocketGroupChannel chan)
{
Channel = chan;
Size = new(370, 96);
BackgroundColor = new(34, 34, 34, 255);
Controls.Add( r = new Rectangle(new Texture(chan.GetPicture().Result)) { Location = new(15,17), Size = new(58,58)});
Controls.Add(Username = new Label() { Text = chan.Title, Location = new(77,20)});
string sl = "Online";
if (chan.Id != 0)
{
sl = chan.Members.Count + " Memmbers";
}
Controls.Add(Status = new Label() { Text = sl, Location = new(77,48)});
//r.Clicked += AllOnClicked;
//Username.Clicked += AllOnClicked;
//Status.Clicked += AllOnClicked;
this.Clicked += AllOnClicked;
}
private Task AllOnClicked(IRenderObject arg)
{
if (ClickCon is not null) _ = ClickCon.Invoke(this);
return Task.CompletedTask;
}
public event Func<IChannelPick, Task> ClickCon;
}

View File

@ -8,7 +8,7 @@
</PropertyGroup>
<ItemGroup>
<PackageReference Include="GraphicsManager" Version="1.0.0-alpha995" />
<PackageReference Include="GraphicsManager" Version="1.0.0-alpha999991" />
<PackageReference Include="Luski.net" Version="1.1.0-alpha" />
</ItemGroup>