Esempio n. 1
0
 //programmer's constructor
 public ChartForm(ChartFormManager chartFormManager) : this()
 {
     this.ChartFormManager = chartFormManager;
     // right now this.ChartFormsManager.Executor IS NULL, will create and Chart.Initialize() upstack :((
     //this.Chart.Initialize(this.ChartFormsManager.Executor);
     // TOO_EARLY_NO_BARS_SET_WILL_BE_THROWN this.PopulateBtnStreamingText();
 }
		internal void Initialize(ChartFormManager chartFormManager) {
			this.chartFormManager = chartFormManager;
			this.Text = this.chartFormManager.Strategy.Name;
			this.ScriptEditorControl.DocumentChangedIgnoredDuringInitialization = true;
			this.ScriptEditorControl.ScriptSourceCode = this.chartFormManager.Strategy.ScriptSourceCode;
			this.ScriptEditorControl.DocumentChangedIgnoredDuringInitialization = false;
		}
Esempio n. 3
0
 internal void Initialize(ChartFormManager chartFormManager)
 {
     this.chartFormManager = chartFormManager;
     this.Text             = this.chartFormManager.Strategy.Name;
     this.ScriptEditorControl.DocumentChangedIgnoredDuringInitialization = true;
     this.ScriptEditorControl.ScriptSourceCode = this.chartFormManager.Strategy.ScriptSourceCode;
     this.ScriptEditorControl.DocumentChangedIgnoredDuringInitialization = false;
 }
		ChartFormManager chartCreateShowPopulateSelectorsSlidersFromStrategy(Strategy strategy) {
			ChartFormManager chartFormManager = new ChartFormManager();
			chartFormManager.InitializeWithStrategy(this.mainForm, strategy);
			this.mainForm.GuiDataSnapshot.ChartFormManagers.Add(chartFormManager.DataSnapshot.ChartSerno, chartFormManager);
			chartFormManager.ChartFormShow();
			chartFormManager.StrategyCompileActivatePopulateSlidersShow();
			return chartFormManager;
		}
		public void CreateEditorFormAndSubscribeFactoryMethod(ChartFormManager chartFormsManager) {
			this.scriptEditorForm = new ScriptEditorForm(chartFormsManager);
			this.scriptEditorForm.ScriptEditorControl.OnSave += ScriptEditorControl_OnSave;
			this.scriptEditorForm.ScriptEditorControl.OnCompile += ScriptEditorControl_OnCompile;
			this.scriptEditorForm.ScriptEditorControl.OnRun += ScriptEditorControl_OnRun;
			this.scriptEditorForm.ScriptEditorControl.OnDebug += ScriptEditorControl_OnDebug;
			this.scriptEditorForm.ScriptEditorControl.OnTextNotSaved += ScriptEditorControl_OnTextNotSaved;
			this.scriptEditorForm.Disposed += editorForm_Disposed;
		}
Esempio n. 6
0
 public ChartFormEventManager(ChartFormManager chartFormManager)
 {
     this.chartFormManager = chartFormManager;
     this.chartFormManager.ChartForm.FormClosing += ChartForm_FormClosing;
     this.chartFormManager.ChartForm.Load        += ChartForm_Load;
 }
Esempio n. 7
0
 // chartFormsManager is needed for serialization and the following deserialization
 public ScriptEditorForm(ChartFormManager chartFormsManager) : this()
 {
     this.Initialize(chartFormsManager);
 }
		//programmer's constructor
		public ChartForm(ChartFormManager chartFormManager) : this() {
			this.ChartFormManager = chartFormManager;
			// right now this.ChartFormsManager.Executor IS NULL, will create and Chart.Initialize() upstack :((
			//this.Chart.Initialize(this.ChartFormsManager.Executor);
			// TOO_EARLY_NO_BARS_SET_WILL_BE_THROWN this.PopulateBtnStreamingText();
		}
		void chartCreateShowPopulateSelectorsSlidersNoStrategy(ContextChart contextChart) {
			ChartFormManager chartFormManager = new ChartFormManager();
			chartFormManager.InitializeChartNoStrategy(this.mainForm, contextChart);
			this.mainForm.GuiDataSnapshot.ChartFormManagers.Add(chartFormManager.DataSnapshot.ChartSerno, chartFormManager);
			chartFormManager.ChartFormShow();
		}
		public ChartFormStreamingConsumer(ChartFormManager chartFormManager) {
			this.chartFormManager = chartFormManager;
		}
		public ChartFormEventManager(ChartFormManager chartFormManager) {
			this.chartFormManager = chartFormManager;
			this.chartFormManager.ChartForm.FormClosing += ChartForm_FormClosing;
			this.chartFormManager.ChartForm.Load += ChartForm_Load;
		}
		public ScriptEditorFormFactory(ChartFormManager chartFormsManager, RepositoryDllJsonStrategy strategyRepository) {
			this.chartFormManager = chartFormsManager;
			this.strategyRepository = strategyRepository;
		}
		private IDockContent handleClassesWithGetPersistStringOverridden(string persistedSpecialString) {
			string msig = "handleClassesWithGetPersistStringOverridden(" + persistedSpecialString + "): ";
			IDockContent ret = null;
			//CsvImporter doesn't contain COMMAS if (persistedSpecialString.Contains(",") == false) return ret;
			int firstColumnColonIndex = persistedSpecialString.IndexOf(":");
			if (firstColumnColonIndex == -1) return ret;
			Dictionary<string, string> persistedParsedToHash = this.parseAsHash(persistedSpecialString);
			string managedFormCase = persistedSpecialString.Substring(0, firstColumnColonIndex);

			// common for all - this method is intended to link chart and its relatives
			int chartSerno = persistedParsedToHash.ContainsKey("ChartSerno") ? Int32.Parse(persistedParsedToHash["ChartSerno"]) : -1;

			// DockContent.Layout.xml contains definitions of "ReporterWrapped" and "ScriptEditor" next lines AFTER parent ChartFormsManager,
			// so we must've had parent chart deserialized on the previous invocation at {case ("Chart"):}
			// if too unreliable, then switch back to GuiDataSnapshot.ChartFormsManagers + GuiDataSnapshot.RebuildDeserializedChartFormsManagers()
			ChartFormManager parentChart = null;

			switch (managedFormCase) {
				case ("Chart"):
					// string ret = "Chart:" + this.GetType().FullName + ",ChartSerno:" + this.ChartFormsManager.ChartSerno;
					// if (this.ChartFormsManager.Strategy != null) ret += ",StrategyGuid=" + this.ChartFormsManager.Strategy.Guid;
					//if (this.ChartFormsManager.Strategy.ScriptContextCurrent != null) {
					//	ret += ",StrategyScriptContextName:" + this.ChartFormsManager.Strategy.ScriptContextCurrent.Name;
					//}
					if (this.GuiDataSnapshot.ChartFormManagers.ContainsKey(chartSerno)) {
						// who knows why LoadFromXml invokes me twice?
						return ret;
					}
					ChartFormManager chartFormsManagerDeserialized = new ChartFormManager(chartSerno);
					//chartFormsManagerDeserialized.Initialize(this, strategy);
					string strategyGuid;
					bool existsGuid = persistedParsedToHash.TryGetValue("StrategyGuid", out strategyGuid);
					if (string.IsNullOrEmpty(strategyGuid)) {
						chartFormsManagerDeserialized.InitializeChartNoStrategyAfterDeserialization(this);
						this.GuiDataSnapshot.AddChartFormsManagerJustDeserialized(chartFormsManagerDeserialized);
					} else {
						chartFormsManagerDeserialized.InitializeStrategyAfterDeserialization(this, strategyGuid);
						this.GuiDataSnapshot.AddChartFormsManagerJustDeserialized(chartFormsManagerDeserialized);
						chartFormsManagerDeserialized.StrategyCompileActivatePopulateSlidersBeforeShow();	// if it was streaming at exit, we should have it ready
					}
					chartFormsManagerDeserialized.PopulateWindowTitlesFromChartContextOrStrategy();
					ret = chartFormsManagerDeserialized.ChartForm;
					break;

				case ("ReporterWrapped"):
					// "Reporter:" + this.reporter.GetType().FullName + ",ChartSerno:" + this.reportersFormsManager.ChartFormsManager.ChartSerno;
					parentChart = this.GuiDataSnapshot.FindChartFormsManagerBySerno(chartSerno, msig, true);
					string typeFullName = persistedParsedToHash["ReporterWrapped"];
					ret = parentChart.ReportersFormsManager.ReporterActivateShowRegisterMniTick(typeFullName);
					break;

				case ("ScriptEditor"):
					//return "ScriptEditor:" + this.ScriptEditorControl.GetType().FullName + ",ChartSerno:" + this.chartFormsManager.ChartSerno;
					parentChart = this.GuiDataSnapshot.FindChartFormsManagerBySerno(chartSerno, msig, true);
					ret = parentChart.ScriptEditorFormConditionalInstance;
					break;

				default:
					string msg2 = "please add switch->case for managedFormCase[" + managedFormCase + "]";
					throw new Exception(msig + msg2);
			}
			return ret;
		}
		// chartFormsManager is needed for serialization and the following deserialization
		public ScriptEditorForm(ChartFormManager chartFormsManager) : this() {
			this.Initialize(chartFormsManager);
		}
		//public void RebuildDeserializedChartFormsManagers(MainForm mainForm) {
		//	foreach (int serno in this.ChartFormsManagers.Keys) {
		//		if (serno > ChartSernoLastUsed) ChartSernoLastUsed = serno;
		//	}

		//	foreach (int serno in this.ChartFormsManagers.Keys) {
		//		ChartFormsManager mgr = this.ChartFormsManagers[serno];
		//		//mgr.ChartSerno = serno;
		//		mgr.RebuildAfterDeserialization(mainForm);
		//	}
		//}
		public void AddChartFormsManagerJustDeserialized(ChartFormManager mgr) {
			if (mgr.DataSnapshot.ChartSerno > this.ChartSernoLastUsed) this.ChartSernoLastUsed = mgr.DataSnapshot.ChartSerno;
			this.ChartFormManagers.Add(mgr.DataSnapshot.ChartSerno, mgr);
		}
Esempio n. 16
0
 public ChartFormStreamingConsumer(ChartFormManager chartFormManager)
 {
     this.chartFormManager = chartFormManager;
 }