public void Detach(SaitekPanel saitekPanel) { OnSettingsReadFromFile -= saitekPanel.PanelSettingsReadFromFile; OnSavePanelSettings -= saitekPanel.SavePanelSettings; OnClearPanelSettings -= saitekPanel.ClearPanelSettings; OnAirframeSelected -= saitekPanel.SelectedAirframe; }
public void Detach(SaitekPanel saitekPanel) { OnSettingsReadFromFile -= new ProfileReadFromFileEventHandler(saitekPanel.PanelSettingsReadFromFile); OnSavePanelSettings -= new SavePanelSettingsEventHandler(saitekPanel.SavePanelSettings); OnClearPanelSettings -= new ClearPanelSettingsEventHandler(saitekPanel.ClearPanelSettings); OnAirframeSelected -= new AirframeSelectedEventHandler(saitekPanel.SelectedAirframe); }
public static void RemoveSaitekPanelObject(SaitekPanel saitekPanel) { lock (_lockObject) { _saitekPanels.Remove(saitekPanel); } }
/* * These are used for static handling, the OnReport method must be static and to access the object that the OnReport belongs to must go via these methods. * If a static object would be kept inside the class it would go nuts considering there can be many panels of same type */ public static void AddSaitekPanelObject(SaitekPanel saitekPanel) { lock (_lockObject) { _saitekPanels.Add(saitekPanel); } }
public void RegisterProfileData(SaitekPanel saitekPanel, List <string> strings) { try { lock (_lockObject) { if (strings == null || strings.Count == 0) { return; } /* * Example: * * PanelType=PZ55SwitchPanel * PanelInstanceID=\\?\hid#vid_06a3&pid_0d06#8&3f11a32&0&0000#{4d1e55b2-f16f-11cf-88cb-001111000030} * BeginPanel * SwitchPanelKey{1KNOB_ENGINE_RIGHT}\o/OSKeyPress{FiftyMilliSec,LSHIFT + VK_Q} * SwitchPanelKey{1KNOB_ENGINE_LEFT}\o/OSKeyPress{FiftyMilliSec,LCONTROL + VK_Q} * SwitchPanelKey{1KNOB_ENGINE_BOTH}\o/OSKeyPress{FiftyMilliSec,LSHIFT + VK_C} * EndPanel * */ _listPanelSettingsData.Add(Environment.NewLine); _listPanelSettingsData.Add("PanelType=" + saitekPanel.TypeOfSaitekPanel); _listPanelSettingsData.Add("PanelInstanceID=" + saitekPanel.InstanceId); _listPanelSettingsData.Add("BeginPanel"); foreach (var s in strings) { if (s != null) { _listPanelSettingsData.Add("\t" + s); } } _listPanelSettingsData.Add("EndPanel"); } } catch (Exception ex) { Common.ShowErrorMessageBox(1062, ex); } }