dotnet new console
dotnet add package GtkSharp
dotnet run
using Gtk; class Program { public static void Main() { Application.Init(); new FirstWindow(); Application.Run(); } public static void Quit() { Application.Quit(); } }
using Gtk; class FirstWindow : Window { public FirstWindow() : base("Test") { SetDefaultSize(600, 350); SetPosition(WindowPosition.Center); DeleteEvent += delegate { Program.Quit(); }; VBox vBox = new VBox(); Add(vBox); HBox hBox = new HBox(); vBox.PackStart(hBox, true, false, 0); ProgressBar progressBar = new ProgressBar(); hBox.PackStart(progressBar, true, false, 10); ProgressBar progressBar2 = new ProgressBar(); hBox.PackStart(progressBar2, true, false, 10); GLib.Timeout.Add(100, new GLib.TimeoutHandler(() => { progressBar.Pulse(); return true; })); bool direction = false; double step = 0.05; GLib.Timeout.Add(100, new GLib.TimeoutHandler(() => { if (direction) progressBar2.Fraction -= step; else progressBar2.Fraction += step; if (progressBar2.Fraction == 1.0) direction = true; if (progressBar2.Fraction == 0) direction = false; return true; })); ShowAll(); } }
© accounting.org.ua - 2024