// build config string from the dialog data internal YConfiguration GetNewSettings() { YConfiguration newSettings = new YConfiguration(); newSettings.RefreshPeriod = (int)numericUpDownRefreshInterval.Value; return(newSettings); }
public static YConfiguration GetDefaultConfigObject() { YConfiguration defConfig = new YConfiguration(); defConfig.RefreshPeriod = 10; return(defConfig); }
private static Queue <string> refreshQueue; // tickers waiting to be refreshed #endregion /// <summary> /// constructor to save params and init objects /// </summary> /// <param name="config"></param> /// <param name="workSpace"></param> public YDatabase(YConfiguration config, Workspace workSpace) { this.config = config; this.workspace = workSpace; this.tickers = new TickerDataCollection(); this.timer = new Timer(timer_tick, null, Timeout.Infinite, Timeout.Infinite); refreshQueue = new Queue <string>(); }
public static string GetConfigString(YConfiguration configuration) { XmlSerializer serializer = new XmlSerializer(typeof(YConfiguration)); Stream stream = new MemoryStream(); serializer.Serialize(XmlWriter.Create(stream), configuration); stream.Seek(0, SeekOrigin.Begin); StreamReader streamReader = new StreamReader(stream); return(streamReader.ReadToEnd()); }
// constructor internal YConfigureForm(YConfiguration oldSettings, ref InfoSite infoSite) { this.infoSite = infoSite; InitializeComponent(); if (oldSettings == null) { oldSettings = YConfiguration.GetDefaultConfigObject(); } // read and set values in controlls numericUpDownRefreshInterval.Value = oldSettings.RefreshPeriod; }
public static new string Configure(string oldSettings, ref InfoSite infoSite) { YConfiguration configuration = YConfiguration.GetConfigObject(oldSettings); YConfigureForm frm = new YConfigureForm(configuration, ref infoSite); if (frm.ShowDialog() == DialogResult.OK) { return(YConfiguration.GetConfigString(frm.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 (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); }