Ejemplo n.º 1
0
        /// <summary>
        /// Creates a context menu for the tray
        /// </summary>
        /// <param name="controller">Handles the available power options</param>
        public PowerOptionsContextMenu(PowerOptionsController controller, StartUpHandler startupHandler)
        {
            PowerOptionsContextMenu.controller     = controller;
            PowerOptionsContextMenu.startupHandler = startupHandler;
            this.Popup += Menu_Popup;

            PopulateContextMenu();
        }
Ejemplo n.º 2
0
        private static void Main()
        {
            Application.EnableVisualStyles();
            Application.SetCompatibleTextRenderingDefault(false);

            // Do stuff here

            try
            {
                PowerOptionsController powerOptions = new PowerOptionsController();
                Application.Run();
                powerOptions.Dispose();
            }
            catch (Exception e)
            {
                string       logFilePath = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData), "Error Log.txt");
                StreamWriter writer      = new StreamWriter(logFilePath);
                writer.Write(e.Message);
                writer.WriteLine();
                writer.Write(e.StackTrace);
                writer.Close();
                MessageBox.Show($"An error occured:{Environment.NewLine}{e.Message}{Environment.NewLine}Please check:" + logFilePath);
            }
        }