tesses.broadcast/Tesses.Broadcast.EtoTest/Program.cs

56 lines
2.0 KiB
C#
Raw Normal View History

2024-03-26 19:34:54 +00:00
/*
A simple udp broadcast library
Copyright (C) 2024 Mike Nolan
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <https://www.gnu.org/licenses/>.
I am reachable at tesses@tesses.net
*/
using Tesses.Broadcast.Eto;
using Eto.Forms;
new Application().Run(CreateForm());
Form CreateForm()
{
Form form = new Form(){Title="Tesses Broadcast Eto Test"};
DynamicLayout layout = new DynamicLayout();
layout.BeginVertical();
layout.BeginHorizontal();
TextBox serviceName=new TextBox(){PlaceholderText="Service Name",Text="Test"};
TextBox serviceUrl = new TextBox(){ReadOnly=true};
NumericStepper port = new NumericStepper(){MinValue=1024,MaxValue=65533,Value=6942};
layout.Add(new Label(){Text="Service Name: "});
layout.Add(serviceName,true);
layout.EndBeginHorizontal();
layout.Add(new Label(){Text="Port: "});
layout.Add(port,true);
layout.EndBeginHorizontal();
layout.Add(new Label(){Text="Service Url: "});
layout.Add(serviceUrl,true);
layout.EndHorizontal();
layout.EndBeginVertical();
layout.BeginHorizontal();
layout.Add(new Button((sender,e)=>{
using(var bro = new BroadcastDialog(serviceName.Text,(int)port.Value))
{
serviceUrl.Text=bro.ShowModal();
}
}){Text="Browse"});
layout.EndHorizontal();
layout.EndVertical();
form.Content=layout;
return form;
}