/// <summary> /// Refresh data (quotation and rt window) of a single ticker /// </summary> /// <param name="ticker"></param> private static void RefreshTicker(object ticker) { TickerData tickerData = (TickerData)ticker; // if ticker needs a quotaton refresh or RT window refresh if (tickerData.QuoteDataStatus > QuoteDataStatus.Offline || tickerData.UpdateRecentInfo) { HttpWebResponse response = YDatabase.GetWebData(tickerData); if (response != null) { ProcessWebData(tickerData, response); response.Close(); } } // decrement no of downloads Interlocked.Decrement(ref concurrentDownloads); // notify AB to request quotes (execute GetQuotesEx again) DataSourceBase.NotifyQuotesUpdate(); }
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); }