public static new string Configure(string oldSettings, ref InfoSite infoSite) { FTConfiguration ibConfiguration = FTConfiguration.GetConfigObject(oldSettings); FTConfigureForm ibConfigureForm = new FTConfigureForm(ibConfiguration, ref infoSite); if (ibConfigureForm.ShowDialog() == DialogResult.OK) { return(FTConfiguration.GetConfigString(ibConfigureForm.GetNewSettings())); } else { return(oldSettings); } }
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); }