// Plugin icon in Wire has been clicked, show the options dialog public override void iconClicked(int x, int y, Plugin.MouseButton button) { switch (button) { // Show the dialog if left or right button is clicked case MouseButton.LeftButton: case MouseButton.RightButton: try { m_optionsDialog.initAllItems(); m_optionsDialog.Show(); m_optionsDialog.Activate(); } catch (System.ObjectDisposedException) { // Our form is destroyed, create new one m_optionsDialog = new FormOptions(); m_optionsDialog.initAllItems(); m_optionsDialog.Show(); m_optionsDialog.Activate(); } break; // Toggle activation with midbutton case MouseButton.MidButton: bool currentState = Properties.Settings.Default.Active; Properties.Settings.Default.Active = !currentState; // persistent save Properties.Settings.Default.Save(); showIcon(Properties.Settings.Default.Active); break; default: break; } }
// Init the plugin public override void init() { // We need the match start and the match stop signal m_gameInterface = InterfaceFactory.gameInterface(); m_gameInterface.MatchStarted += new GameInterface.MatchStartedHandler(gi_MatchStarted); m_gameInterface.MatchEnded += new GameInterface.MatchEndedHandler(gi_MatchEnded); // Set the option dialog sytle System.Windows.Forms.Application.EnableVisualStyles(); // Instanciate the form dialog member, read persistent settings and hide the options dialog m_optionsDialog = new FormOptions(); m_optionsDialog.initAllItems(); m_optionsDialog.Hide(); // Listen to the form dialog event "OnReminderActivated", that means activation sttaus of the plugin // has been changed FormOptions.OnReminderEvent += new FormOptions.OnReminderActivated(Reminder_OnActivatedEvent); // show icon showIcon(Properties.Settings.Default.Active); setTooltip("CS Reminder Plugin"); // Watcher class, which observes the debug output of the CS process m_watch = new Watcher(); Watcher.OnPlayerEvent += new Watcher.OnPlayerEventHandler(Player_OnPlayerEvent); // Timer for notification TimerCallback tcb = CheckStatus; m_timer = new System.Threading.Timer(tcb); StopTimer(); }