public override bool Notify(ref PluginNotification notifyData) { switch (notifyData.Reason) { case Reason.DatabaseLoaded: Workspace = notifyData.Workspace; _tradeClient = new TinyMessageBus("trades"); _tradeClient.MessageReceived += _tradeClient_MessageReceived; _tickClient = new TinyMessageBus("ticks"); _tickClient.MessageReceived += _tickClient_MessageReceived; break; case Reason.DatabaseUnloaded: _tradeClient.Dispose(); _tickClient.Dispose(); break; case Reason.RightMouseClick: break; default: break; } return(true); }
internal void RaisePluginNotify(IPlugin plugin, PluginNotification notification) { if (PluginNotify != null) { PluginNotify.Invoke(this, new PluginNotificationEventArgs(plugin, notification)); } }
public void NotifyPlugins(IPlugin plugin, PluginNotification notification) { foreach (PluginNode node in Nodes) { node.NotifyPlugin(plugin, notification); } }
public void NotifyPlugin(IPlugin plugin, PluginNotification notification) { if (!IsActive) { return; } PluginContext.RaisePluginNotify(plugin, notification); }
public static unsafe void Notify(PluginNotification* notification) { switch (notification->Reason) { case PluginNotificationReason.DatabaseLoaded: DataSource = new DataSource( databasePath: Marshal.PtrToStringAnsi(notification->DatabasePath), mainWnd: notification->MainWnd); RightClickMenu = new RightClickMenu(DataSource); break; case PluginNotificationReason.DatabaseUnloaded: DataSource.DatabasePath = null; break; case PluginNotificationReason.StatusRightClick: RightClickMenu.ContextMenu.IsOpen = true; break; case PluginNotificationReason.SettingsChange: break; } }
public PluginNotificationEventArgs(IPlugin plugin, PluginNotification notification) : base(plugin) { Notification = notification; }
public PluginNotificationEventArgs(IPlugin plugin, PluginNotification notification) : base(plugin) { Notification = notification; }
public override bool Notify(ref PluginNotification notifyData) { bool result = true; switch (notifyData.Reason) { case Reason.DatabaseLoaded: // if database is loaded if (controller != null) { // disconnect from TWS and reset all data controller.Disconnect(); ((IDisposable)controller).Dispose(); controller = null; } Workspace = notifyData.Workspace; DatabasePath = notifyData.DatabasePath; MainWindowHandle = notifyData.MainWnd; AllowMixedEODIntra = Workspace.AllowMixedEODIntra != 0; // start logging the opening of the database LogAndMessage.Log(MessageType.Info, "Database: " + DatabasePath); LogAndMessage.Log(MessageType.Info, "Mixed EOD/Intra: " + (Workspace.AllowMixedEODIntra != 0)); LogAndMessage.Log(MessageType.Info, "Number of bars: " + Workspace.NumBars); LogAndMessage.Log(MessageType.Info, "Database config: " + Settings); // create the config object IBConfiguration = FTConfiguration.GetConfigObject(Settings); LogAndMessage.VerboseLog = IBConfiguration.VerboseLog; RthOnly = IBConfiguration.RthOnly; CalcNextAutoRefreshTime(); // create new controller connectionRetryTime = DateTime.Now.AddSeconds(ConnectionRetryInterval); prevPluginState = IBPluginState.Disconnected; firstConnection = true; controller = new FTController(); // connect database to tws controller.Connect(false); if (rtWindowTickersBck.Count > 0) { for (int i = 0; i < rtWindowTickersBck.Count; i++) { controller.GetRecentInfo(rtWindowTickersBck[i]); } } break; // user changed the db case Reason.DatabaseUnloaded: // disconnect from TWS if (controller != null) { controller.Disconnect(); ((IDisposable)controller).Dispose(); controller = null; } // clean up Workspace = new Workspace(); DatabasePath = null; MainWindowHandle = IntPtr.Zero; searchForm = null; break; // seams to be obsolete case Reason.SettingsChanged: break; // user right clicks data plugin area in AB case Reason.RightMouseClick: if (controller != null) { currentSI = notifyData.CurrentSI; if (currentSI != null) { currentTicker = currentSI.ShortName; if (currentTicker.Length > 10) { currentTickerShortend = currentTicker.Substring(0, 7) + "..."; } else { currentTickerShortend = currentTicker; } } else { currentTicker = null; currentTickerShortend = null; } } SetContextMenuState(); ShowContextMenu(mContextMenu); break; default: result = false; break; } return(result); }
public override bool Notify(ref PluginNotification notifyData) { bool result = true; switch (notifyData.Reason) { case Reason.DatabaseLoaded: // if database is loaded if (database != null) { // disconnect from data provider and reset all data database.Disconnect(); } // start logging the opening of the database LogAndMessage.Log(MessageType.Info, "Database: " + notifyData.DatabasePath); allowMixedEodIntra = notifyData.Workspace.AllowMixedEODIntra != 0; LogAndMessage.Log(MessageType.Info, "Mixed EOD/Intra: " + allowMixedEodIntra); numBars = notifyData.Workspace.NumBars; LogAndMessage.Log(MessageType.Info, "Number of bars: " + numBars); LogAndMessage.Log(MessageType.Info, "Database config: " + Settings); // create the config object config = YConfiguration.GetConfigObject(Settings); // create new database object database = new YDatabase(config, notifyData.Workspace); // connect database to data provider database.Connect(); break; // user changed the db case Reason.DatabaseUnloaded: // disconnect from data provider if (database != null) { database.Disconnect(); } // clean up database = null; break; // seams to be obsolete case Reason.SettingsChanged: break; // user right clicks data plugin area in AB case Reason.RightMouseClick: if (database != null) { currentTicker = notifyData.CurrentSI.ShortName; SetContextMenuState(); ShowContextMenu(mContextMenu); } break; default: result = false; break; } return(result); }