示例#1
0
        internal void DataSourcesTree_OnNewChartForSymbolClicked(object sender, DataSourceSymbolEventArgs e)
        {
            ContextChart contextChart = new ContextChart("CHART_" + e.Symbol);

            contextChart.DataSourceName = e.DataSource.Name;
            contextChart.Symbol         = e.Symbol;
            contextChart.ScaleInterval  = e.DataSource.ScaleInterval;
            //this.chartCreateShowPopulateSelectorsSliders(contextChart);
            this.chartCreateShowPopulateSelectorsSlidersNoStrategy(contextChart);
        }
 void dataSourceRepository_OnSymbolRenamed(object sender, DataSourceSymbolEventArgs e)
 {
     this.tree.RefreshObject(this.DataSourceSelected);
     if (sender != this)
     {
         //RefreshObject()WORKS_FINE this.populateDataSourcesIntoTreeListView();
         this.tree.Expand(e.DataSource);
         this.SelectSymbol(e.DataSource.Name, e.Symbol);
     }
 }
示例#3
0
 internal void DataSourcesTree_OnSymbolSelected(object sender, DataSourceSymbolEventArgs e)
 {
     try {
         if ((this.mainForm.DockPanel.ActiveDocument is ChartForm) == false)
         {
             return;
         }
         // mainForm.ChartFormActive will already throw if Documents have no Charts selected; no need to check
         this.mainForm.ChartFormActive.ChartFormManager.EventManager.DataSourcesTree_OnSymbolSelected(sender, e);
     } catch (Exception ex) {
         this.mainForm.PopupException(ex);
     }
 }
		internal void DataSourcesTree_OnSymbolSelected(object sender, DataSourceSymbolEventArgs e) {
			Strategy strategyToSave = this.chartFormManager.Strategy;
			if (strategyToSave.ScriptContextCurrent.Symbol == e.Symbol) {
				string msg = "DebuggableCallback invokes ObjectListView.OnMouseUp():8266 twice, and ObjectListView.WndProc():4996 doesn't have a filter";
				Assembler.PopupException(msg);
				return;
			}
			try {
				this.chartFormManager.PopulateSelectorsFromCurrentChartOrScriptContextLoadBarsSaveBacktestIfStrategy("DataSourcesTree_OnSymbolSelected");
			} catch (Exception ex) {
				Assembler.PopupException("DataSourcesTree_OnSymbolSelected()", ex);
			}
		}
 void dataSourceRepository_OnSymbolRemovedDone(object sender, DataSourceSymbolEventArgs e)
 {
     if (sender == this)
     {
         this.tree.RebuildAll(true);
         this.tree.Expand(this.DataSourceSelected);
         this.SelectSymbol(this.DataSourceSelected.Name, null);
     }
     else
     {
         this.tree.RebuildAll(true);                     //roots not changed, no need to call this.populateDataSourcesIntoTreeListView();
         this.tree.Expand(e.DataSource);
         this.SelectSymbol(e.DataSource.Name, null);
     }
 }
示例#6
0
        public DataSourceSymbolEventArgs SymbolCanBeDeleted(DataSource dataSource, string symbolToDelete, object sender = null)
        {
            if (sender == null)
            {
                sender = this;
            }
            var args = new DataSourceSymbolEventArgs(dataSource, symbolToDelete);

            if (this.OnSymbolCanBeRemoved == null)
            {
                return(args);
            }
            this.OnSymbolCanBeRemoved(sender, args);
            return(args);
        }
 void dataSourceRepository_OnSymbolAdded(object sender, DataSourceSymbolEventArgs e)
 {
     if (sender == this)
     {
         this.tree.RefreshObject(this.DataSourceSelected);
         this.tree.Expand(e.DataSource);
     }
     else
     {
         //this.populateDataSourcesIntoTreeListView();
         this.tree.RebuildAll(true);
         this.tree.Expand(e.DataSource);
         this.SelectSymbol(e.DataSource.Name, e.Symbol);
     }
 }
        internal void DataSourcesTree_OnSymbolSelected(object sender, DataSourceSymbolEventArgs e)
        {
            Strategy strategyToSave = this.chartFormManager.Strategy;

            if (strategyToSave.ScriptContextCurrent.Symbol == e.Symbol)
            {
                string msg = "DebuggableCallback invokes ObjectListView.OnMouseUp():8266 twice, and ObjectListView.WndProc():4996 doesn't have a filter";
                Assembler.PopupException(msg);
                return;
            }
            try {
                this.chartFormManager.PopulateSelectorsFromCurrentChartOrScriptContextLoadBarsSaveBacktestIfStrategy("DataSourcesTree_OnSymbolSelected");
            } catch (Exception ex) {
                Assembler.PopupException("DataSourcesTree_OnSymbolSelected()", ex);
            }
        }
 void tree_CellRightClick(object sender, CellRightClickEventArgs e)
 {
     if (e.RowIndex == -1)               // empty tree, no datasources added yet
     {
         this.ContextMenuStrip = this.ctxDataSource;
         return;
     }
     this.syncSymbolAndDataSourceSelectedFromRowIndexClicked(e.RowIndex);
     if (this.SymbolSelected != null)
     {
         if (this.DataSourceSelected == null)
         {
             throw new Exception("DATASOURCE_NOT_SELECTED_WHILE_SYMBOL_SELECTED");
         }
         this.ContextMenuStrip = this.ctxSymbol;
         //string dataSourceName = base.SelectedNode.Parent.Text;
         //string chartTitlePartial = " - " + symbol + " (" + dataSourceName + ")";
         //ChartForm chart = MainModule.Instance.MainForm.findByChartTitlePartialIfOpen(chartTitlePartial);
         string newExisting = (true) ? "New" : "Existing";                       //chart != null
         this.mniNewChartSymbol.Text     = newExisting + " Chart for " + this.SymbolSelected;
         this.mniBarsAnalyzerSymbol.Text = "Bars Analyzer for " + this.SymbolSelected;
         this.mniOpenStrategySymbol.Text = "New Strategy for " + this.SymbolSelected;
         this.mniRemoveSymbol.Text       = "Remove [" + this.SymbolSelected + "] from [" + this.DataSourceSelected.Name + "]";
         DataSourceSymbolEventArgs subscribersPolled =
             this.dataSourceRepository.SymbolCanBeDeleted(this.DataSourceSelected, this.SymbolSelected, this);
         this.mniRemoveSymbol.Enabled = (subscribersPolled.DoNotDeleteItsUsedElsewhere == false);
         //int imageIndex = getProviderImageIndexForDataSource(this.DataSourceSelected);
         //if (imageIndex == -1) return;
         //Image providerIcon = this.tree.SmallImageList.Images[imageIndex];
         //if (providerIcon != null) {
         //    this.mniNewChartSymbol.Image = providerIcon;
         //    this.mniOpenStrategySymbol.Image = providerIcon;
         //}
     }
     else
     {
         NamedObjectJsonEventArgs <DataSource> subscribersPolled =
             this.dataSourceRepository.ItemCanBeDeleted(this.DataSourceSelected, this);
         this.mniDataSourceEdit.Enabled   = (subscribersPolled.DoNotDeleteItsUsedElsewhere == false);
         this.mniDataSourceDelete.Enabled = (subscribersPolled.DoNotDeleteItsUsedElsewhere == false);
         this.mniDataSourceEdit.Text      = "Edit DataSource [" + this.DataSourceSelected.Name + "]";
         this.mniDataSourceDelete.Text    = "Delete DataSource [" + this.DataSourceSelected.Name + "]";
         this.ContextMenuStrip            = this.ctxDataSource;
     }
 }
示例#10
0
        public void SymbolRemove(DataSource dataSource, string symbolToDelete, object sender = null)
        {
            if (sender == null)
            {
                sender = this;
            }
            string msig = " RepositoryJsonDataSource.SymbolRemove(" + symbolToDelete + "): ";
            DataSourceSymbolEventArgs args = null;

            try {
                args = this.SymbolCanBeDeleted(dataSource, symbolToDelete, sender);
                if (args.DoNotDeleteItsUsedElsewhere)
                {
                    string msg = "DoNotDeleteReason=[" + args.DoNotDeleteReason + "] for ItemDelete(" + dataSource.ToString() + ")";
                    throw new Exception(msg);
                }
                dataSource.SymbolRemove(symbolToDelete);                                // can throw FILE_ALREADY_DELETED
            } catch (Exception ex) {
                Assembler.PopupException(msig, ex);
            }
            // sorry for the mess
            try {
                base.SerializeSingle(dataSource);
                if (args != null)
                {
                    if (this.OnSymbolRemovedDone == null)
                    {
                        return;
                    }
                    // since you answered DataSourceEventArgs.DoNotDeleteThisDataSourceBecauseItsUsedElsewhere=false,
                    // you were aware that OnItemRemovedDone is invoked on a detached object
                    this.OnSymbolRemovedDone(sender, args);
                }
            } catch (Exception ex) {
                Assembler.PopupException(msig, ex);
            }
        }
		internal void DataSourcesTree_OnBarsAnalyzerClicked(object sender, DataSourceSymbolEventArgs e) {
		}
 void dataSourceRepository_OnSymbolCanBeRemoved(object sender, DataSourceSymbolEventArgs e)
 {
     //e.DoNotDeleteItsUsedElsewhere = !e.DataSource.StaticProvider.CanModifySymbols;
     e.DoNotDeleteItsUsedElsewhere = false;
 }
示例#13
0
 internal void DataSourcesTree_OnOpenStrategyForSymbolClicked(object sender, DataSourceSymbolEventArgs e)
 {
 }
示例#14
0
 void dataSourcesTree1_OnSymbolSelected(object sender, DataSourceSymbolEventArgs e)
 {
     this.targetDataSource    = e.DataSource;
     this.targetSymbolClicked = e.Symbol;
     this.syncImportButton();
 }
		internal void DataSourcesTree_OnSymbolSelected(object sender, DataSourceSymbolEventArgs e) {
			try {
				if ((this.mainForm.DockPanel.ActiveDocument is ChartForm) == false) {
					return;
				}
				// mainForm.ChartFormActive will already throw if Documents have no Charts selected; no need to check
				this.mainForm.ChartFormActive.ChartFormManager.EventManager.DataSourcesTree_OnSymbolSelected(sender, e);
			} catch (Exception ex) {
				this.mainForm.PopupException(ex);
			}
		}
		void dataSourceRepository_OnSymbolAdded(object sender, DataSourceSymbolEventArgs e) {
			if (sender == this) {
				this.tree.RefreshObject(this.DataSourceSelected);
				this.tree.Expand(e.DataSource);
			} else {
				//this.populateDataSourcesIntoTreeListView();
				this.tree.RebuildAll(true);
				this.tree.Expand(e.DataSource);
				this.SelectSymbol(e.DataSource.Name, e.Symbol);
			}
		}
		void dataSourceRepository_OnSymbolRenamed(object sender, DataSourceSymbolEventArgs e) {
			this.tree.RefreshObject(this.DataSourceSelected);
			if (sender != this) {
				//RefreshObject()WORKS_FINE this.populateDataSourcesIntoTreeListView();
				this.tree.Expand(e.DataSource);
				this.SelectSymbol(e.DataSource.Name, e.Symbol);
			}
		}
		void dataSourceRepository_OnSymbolRemovedDone(object sender, DataSourceSymbolEventArgs e) {
			if (sender == this) {
				this.tree.RebuildAll(true);
				this.tree.Expand(this.DataSourceSelected);
				this.SelectSymbol(this.DataSourceSelected.Name, null);
			} else {
				this.tree.RebuildAll(true);	//roots not changed, no need to call this.populateDataSourcesIntoTreeListView();
				this.tree.Expand(e.DataSource);
				this.SelectSymbol(e.DataSource.Name, null);
			}
		}
		void dataSourceRepository_OnSymbolCanBeRemoved(object sender, DataSourceSymbolEventArgs e) {
			//e.DoNotDeleteItsUsedElsewhere = !e.DataSource.StaticProvider.CanModifySymbols;
			e.DoNotDeleteItsUsedElsewhere = false;
		}
		void dataSourcesTree1_OnSymbolSelected(object sender, DataSourceSymbolEventArgs e) {
			this.targetDataSource = e.DataSource;
			this.targetSymbolClicked = e.Symbol;
			this.syncImportButton();
		}
		internal void DataSourcesTree_OnNewChartForSymbolClicked(object sender, DataSourceSymbolEventArgs e) {
			ContextChart contextChart = new ContextChart("CHART_" + e.Symbol);
			contextChart.DataSourceName = e.DataSource.Name;
			contextChart.Symbol = e.Symbol;
			contextChart.ScaleInterval = e.DataSource.ScaleInterval;
			//this.chartCreateShowPopulateSelectorsSliders(contextChart);
			this.chartCreateShowPopulateSelectorsSlidersNoStrategy(contextChart);
		}
		internal void DataSourcesTree_OnOpenStrategyForSymbolClicked(object sender, DataSourceSymbolEventArgs e) {
		}
示例#23
0
 internal void DataSourcesTree_OnBarsAnalyzerClicked(object sender, DataSourceSymbolEventArgs e)
 {
 }