public ProcForm() { InitializeComponent(); SetDoubleBuffered(txtTemp1); SetDoubleBuffered(txtTemp2); SetDoubleBuffered(txtTemp3); SetDoubleBuffered(txtTemp4); txtTemp = new TextBox[] { txtTemp1, txtTemp2, txtTemp3, txtTemp4 };; Controllers = SteamController.GetControllers(); //Controllers[0].StateUpdated += MainForm_StateUpdated; if (Controllers.Length > 0) { Controllers[0].StateUpdated += (object sender, SteamController.SteamControllerState e) => MainForm_StateUpdated(sender, e, 0); } if (Controllers.Length > 1) { Controllers[1].StateUpdated += (object sender, SteamController.SteamControllerState e) => MainForm_StateUpdated(sender, e, 1); } if (Controllers.Length > 2) { Controllers[2].StateUpdated += (object sender, SteamController.SteamControllerState e) => MainForm_StateUpdated(sender, e, 2); } if (Controllers.Length > 3) { Controllers[3].StateUpdated += (object sender, SteamController.SteamControllerState e) => MainForm_StateUpdated(sender, e, 3); } }
private void LoadControllers(bool firstload) { tsmiController.DropDownItems.Clear(); SteamController[] Controllers = SteamController.GetControllers(); for (int i = 0; i < Controllers.Count(); i++) { ToolStripItem itm = tsmiController.DropDownItems.Add(Controllers[i].GetDevicePath(), null, LoadController); itm.Tag = Controllers[i]; switch (Controllers[i].ConnectionType) { case SteamController.EConnectionType.Wireless: itm.Image = Properties.Resources.icon_wireless; break; case SteamController.EConnectionType.USB: itm.Image = Properties.Resources.icon_usb; break; case SteamController.EConnectionType.BT: itm.Image = Properties.Resources.icon_bt; break; } // load the first controller in the list if it exists if (firstload && i == 0 && Controllers[i] != null) { LoadController(Controllers[i], null); } } }
private void LoadController(object sender, EventArgs e) { if (ActiveController != null) { ActiveController.DeInitalize(); } // differentiate between context selection and startup if (sender is ToolStripItem) { ToolStripItem item = (ToolStripItem)sender; ActiveController = (SteamController)item.Tag; } else { ActiveController = (SteamController)sender; } ControllerData.SetController(ActiveController); ActiveController.Initalize(); ActiveController.PlayMelody(SteamController.Melody.Rise_and_Shine); }
public void SetController(SteamController ActiveController) { this.ActiveController = ActiveController; }