static void Main() { Application.EnableVisualStyles(); Application.SetCompatibleTextRenderingDefault(false); ApplicationLibrary dict = new ApplicationLibrary(); string steamgames = dict.FindSteamGames(); if (!string.IsNullOrEmpty(steamgames)) MessageBox.Show(steamgames); // Try to get custom application definitions from the configuration xml try { XmlDocument xdoc = new XmlDocument(); xdoc.Load("Configuration.xml"); XmlElement xapps = xdoc["BasiK.lwbp"]["applications"]; foreach (XmlElement xapp in xapps.GetElementsByTagName("application")) { try { dict.AddApplication( xapp.GetAttribute("name"), xapp.GetAttribute("exe"), xapp.HasAttribute("options") ? xapp.GetAttribute("options") : null, xapp.HasAttribute("icon") ? xapp.GetAttribute("icon") : null); } catch { } } } catch { } dict.AddApplication(new ApplicationExitEntry()); dict.AddApplication(new WindowsShutdownEntry()); // dict.AddApplication("~ Windows Shutdown", "shutdown", "/s /f /t 05", ""); Application.Run(new LauncherForm(dict)); }
internal LauncherForm(ApplicationLibrary gdict) { InitializeComponent(); _dictionary = gdict; this.FormClosing += LWBPForm_FormClosing; SetStyle(ControlStyles.ResizeRedraw, true); SetStyle(ControlStyles.AllPaintingInWmPaint, true); SetStyle(ControlStyles.UserPaint, true); SetStyle(ControlStyles.DoubleBuffer, true); try { gameControlsPanel.BackgroundImage = new Bitmap(Assembly.GetExecutingAssembly().GetManifestResourceStream("BasiK.BasiKLauncher.Resources.full_background.png")); gameControlsPanel.BackgroundImageLayout = ImageLayout.Stretch; ComputeControls(); DrawPage(); gameControlsPanel.Resize += Panel2_Resize; _gamepad = new XInputController(0); _gamepad.StateChanged += _gamepad_StateChanged; _gamepad.Start(); } catch (Exception exc) { this.WindowState = FormWindowState.Minimized; this.TopMost = false; MessageBox.Show("Exception occured: \r\n" + exc.Message + "\r\n" + exc.StackTrace); Application.Exit(); } }