static void Main(string[] args) { ThemeManager.LoadFromFile("DefaultTheme.xml"); ThemeManager.SetTheme("dark"); StyleBank.LoadFromFile("style.hss"); HlyssApplication.InitializeStyles(); HlyssForm form = new HlyssForm() { Size = new Vector2u(1280, 720), Title = "Cior" }; form.Root.AddChild(new BasicRouter() { Name = "router" }); (form.Root.GetChild("router") as Router).Navigate(Test2()); form.Show(); app.RegisterForm("main", form); app.RegisterForm("browse_folder_dialog", new MessageBox("Galactic Dissent", "Czy na pewno chcesz odinstalować ten produkt?\n• Galactic Dissent", "Nie", "Tak")); //Handle(form); //form.Window.SetFramerateLimit(0); Stopwatch fpsTimer = Stopwatch.StartNew(); int fps = 0; form.Window.KeyPressed += (object sender, KeyEventArgs e) => { if (e.Code == Keyboard.Key.F3) { HlyssApplication.Debug = !HlyssApplication.Debug; } if (e.Code == Keyboard.Key.C) { Console.Clear(); } }; while (form.IsOpen) { app.UpdateAllForms(); app.DrawAllForms(); fps++; if (fpsTimer.ElapsedMilliseconds >= 1000) { form.Title = $"{caption} ({fps} fps)"; fps = 0; fpsTimer.Restart(); } } }
public HlyssApp(RenderWindow window) { Window = window; StyleBank.LoadFromString(Encoding.UTF8.GetString(HlyssUI.Properties.Resources.DefaultStyle)); Root = new RootComponent(this); _input = new InputManager(this); _input.RegisterEvents(); Theme.OnThemeLoaded += () => Root.StyleChanged = true; }
public static void InitializeStyles() { StyleBank.LoadFromString(Properties.Resources.DefaultStyle); }
private void Initialize() { string style = @"<hss><style name=""drives""><size-ease>instant</size-ease></style></hss>"; StyleBank.LoadFromString(style); _internalApp = new HlyssApp(Window); _internalApp.Root.Children.Add(new Component() { Width = "100%", Height = "100%", Padding = "10px", Layout = LayoutType.Column, Children = new List <Component>() { new Component() { Width = "100%", AutosizeY = true, CenterContent = true, Children = new List <Component>() { new Button() { Padding = "10px", Children = new List <Component>() { new Icon(Icons.AngleUp) }, Name = "up_btn" }, new TextBox() { Expand = true, Margin = "0px 10px", Height = "0px", Name = "directory_box" }, new Dropdown() { Width = "100px", Name = "drives", Items = DriveInfo.GetDrives().Select(o => o.Name).ToList() } } }, new Panel() { Width = "100%", MarginTop = "10px", Padding = "5px 1px", Expand = true, Name = "files_panel", Layout = LayoutType.Column, Overflow = OverflowType.Scroll }, new Component() { Width = "100%", AutosizeY = true, Reversed = true, MarginTop = "10px", Children = new List <Component>() { new Button("Otwórz") { Appearance = Button.ButtonStyle.Filled, Name = "ok_btn" }, new Button("Anuluj") { MarginRight = "5px", Name = "close_btn" } } } } }); _internalApp.Root.FindChild("dropdown_menu").Slot.Style = "drives"; _internalApp.Root.FindChild("dropdown_button").Padding = "10px"; _internalApp.Root.FindChild("close_btn").Clicked += (object sender) => { _internalApp.Window.Close(); }; _internalApp.Root.FindChild("up_btn").Clicked += Up; _internalApp.Window.KeyReleased += (object sender, KeyEventArgs e) => { if (e.Code == Keyboard.Key.Enter) { Navigate(CurrentPath); } }; (_internalApp.Root.FindChild("drives") as Dropdown).OnSelected += (object sender, string text, int id) => { Navigate(text); }; _internalApp.Root.FindChild("ok_btn").Clicked += (object sender) => { OnFileSelected?.Invoke(this, new FSEntry(CurrentPath)); _internalApp.Window.Close(); }; Navigate(StartDirectory); }