Ejemplo n.º 1
0
        public TrayIcon()
        {
            // Initialize custom components
            powerPlanManager = new PowerPlanManager();
            systemMonitor    = new SystemMonitor();
            server           = new Server(systemMonitor, powerPlanManager);
            systemMonitor.newForegroundProcess = server.sendForegroundProcessToListener;
            server.start();
            systemMonitor.applySettings();
            // Retrieve Application Icon
            MemoryStream ms = new MemoryStream(Resources.Icon);

            System.Drawing.Icon icon = new System.Drawing.Icon(ms);
            ms.Dispose();
            // Create and Initialize NotifyIcon
            notifyIcon                  = new NotifyIcon();
            notifyIcon.Icon             = icon;
            notifyIcon.Text             = "Ryder Engine";
            notifyIcon.ContextMenuStrip = new ContextMenuStrip();
            notifyIcon.ContextMenuStrip.Items.Add("Settings");
            notifyIcon.ContextMenuStrip.Items[0].Click += openSettings;;
            notifyIcon.ContextMenuStrip.Items.Add("Close");
            notifyIcon.ContextMenuStrip.Items[1].Click += close;
            notifyIcon.Visible = true;
            // Initialize interrupt timer
            timer          = new Timer();
            timer.Interval = 1000;
            timer.Tick    += systemMonitorUpdate;
            timer.Start();
        }
Ejemplo n.º 2
0
        // netsh http add urlacl url=http://+:9519/ user=administrator listen=yes
        public Server(SystemMonitor systemMonitor, PowerPlanManager powerPlanManager)
        {
            this.systemMonitor    = systemMonitor;
            this.powerPlanManager = powerPlanManager;

            this.listener = new TcpListener(IPAddress.Any, 9519);
        }