Beispiel #1
0
 public ReportersFormsManager(ChartFormManager chartFormManager, RepositoryDllReporters repository)
 {
     this.ChartFormManager = chartFormManager;
     this.repository       = repository;
     this.ReporterShortNamesUserInvoked = new Dictionary <string, Reporter>();
     this.MenuItemsProvider             = new MenuItemsProvider(this, this.repository.TypesFound);
 }
        internal void ChartForm_FormClosed(object sender, FormClosedEventArgs e)
        {
            if (this.mainForm.MainFormClosingSkipChartFormsRemoval)
            {
                return;
            }
            try {
                ChartForm        chartFormClosed  = sender as ChartForm;
                ChartFormManager chartFormManager = chartFormClosed.ChartFormManager;
                // chartFormsManager lifecycle ends here
                this.mainForm.GuiDataSnapshot.ChartFormManagers.Remove(chartFormManager.DataSnapshot.ChartSerno);

                if (chartFormManager.EditorFormIsNotDisposed == false)
                {
                    chartFormManager.ScriptEditorFormConditionalInstance.Close();
                }
                //foreach (Reporter reporter in chartFormsManager.Reporters.Values) {
                //	Control reporterAsControl = reporter as Control;
                //	Control reporterParent = reporterAsControl.Parent;
                //	DockContent reporterParentForm = reporterParent as DockContent;
                //	if (chartFormsManager.FormIsNullOrDisposed(reporterParentForm)) reporterParentForm.Close();
                //}
                if (StrategiesForm.Instance.IsActivated == false)
                {
                    StrategiesForm.Instance.Activate();
                }
            } catch (Exception ex) {
                string msg = "ChartFormsManagers.Remove() didn't go trought? duplicates";
            }
        }
Beispiel #3
0
        //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);
        }
        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 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;
 }
        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);
        }
Beispiel #7
0
        public ChartFormManager FindChartFormsManagerBySerno(int chartSerno, string invokerMsig = "CALLER_UNKNOWN", bool throwIfNotFound = true)
        {
            ChartFormManager ret = null;

            if (this.ChartFormManagers.ContainsKey(chartSerno) == false)
            {
                if (throwIfNotFound)
                {
                    string msg = "CANT_DESERIALIZE_REPORTER/EDITOR_PARENT_CHART_NOT_FOUND"
                                 + " CHART_DESERIALIZATION_FAILED_OR_CHARTFORM_DOESNT_EXIST_IN_LAYOUT.XML"
                                 + " for chartSerno[" + chartSerno + "] ChartSernosInstantiated[" + this.ChartSernosInstantiatedAsString + "]";
                    throw new Exception(msg + " " + invokerMsig);
                }
                return(ret);
            }
            ret = this.ChartFormManagers[chartSerno];
            return(ret);
        }
 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);
        }