diff --git a/Luski/GUI/MainScreen/Interfaces/IChannelPick.cs b/Luski/GUI/MainScreen/Interfaces/IChannelPick.cs new file mode 100644 index 0000000..ae7cfcf --- /dev/null +++ b/Luski/GUI/MainScreen/Interfaces/IChannelPick.cs @@ -0,0 +1,8 @@ +using Luski.net.JsonTypes; + +namespace Luski.GUI.MainScreen.Interfaces; + +public interface IChannelPick +{ + public SocketTextChannel Channel { get; } +} \ No newline at end of file diff --git a/Luski/GUI/MainScreen/UI/Group.cs b/Luski/GUI/MainScreen/UI/Group.cs new file mode 100644 index 0000000..49bfc96 --- /dev/null +++ b/Luski/GUI/MainScreen/UI/Group.cs @@ -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 ClickCon; +} \ No newline at end of file diff --git a/Luski/Luski.csproj b/Luski/Luski.csproj index 266f365..61c30bf 100644 --- a/Luski/Luski.csproj +++ b/Luski/Luski.csproj @@ -8,7 +8,7 @@ - +