void dataSourceRepository_OnDataSourceRenamed(object sender, NamedObjectJsonEventArgs <DataSource> e)
 {
     if (sender == this)
     {
         this.tree.RefreshObject(this.DataSourceSelected);
     }
     else
     {
         this.tree.RefreshObject(e.Item);
         this.SelectSymbol(e.Item.Name, null);
     }
 }
Beispiel #2
0
        public NamedObjectJsonEventArgs <DATASOURCE> ItemCanBeDeleted(DATASOURCE itemStored, object sender = null)
        {
            if (sender == null)
            {
                sender = this;
            }
            var args = new NamedObjectJsonEventArgs <DATASOURCE>(itemStored);

            if (this.OnItemCanBeRemoved == null)
            {
                return(args);
            }
            this.OnItemCanBeRemoved(sender, args);
            this.ItemCanBeDeletedCascade(args, sender);
            return(args);
        }
 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;
     }
 }
Beispiel #4
0
 public override void ItemCanBeDeletedCascade(NamedObjectJsonEventArgs <DataSource> args, object sender = null)
 {
 }
 void dataSourceRepository_OnDataSourceCanBeRemoved(object sender, NamedObjectJsonEventArgs <DataSource> e)
 {
     e.DoNotDeleteItsUsedElsewhere = false;
 }
 void dataSourceRepository_OnDataSourceRemovedDone(object sender, NamedObjectJsonEventArgs <DataSource> e)
 {
     this.populateDataSourcesIntoTreeListView();
 }
 void dataSourceRepository_OnDataSourceAdded(object sender, NamedObjectJsonEventArgs <DataSource> e)
 {
     this.populateDataSourcesIntoTreeListView();                 // roots changed => this.tree.RebuildAll(true) isn't enough
     this.SelectSymbol(e.Item.Name, null);
 }
		internal void RepositoryJsonDataSource_OnDataSourceRemoved(object sender, NamedObjectJsonEventArgs<DataSource> e) {
			int a = 1;
			//if a running optimizer / backtester / streaming chart had DataSource, possibly shut them down?
		}
		internal void RepositoryJsonDataSource_OnDataSourceCanBeRemoved(object sender, NamedObjectJsonEventArgs<DataSource> e) {
			int a = 1;
			// ask them before deleting using another event and check if DataSourceEventArgs.DoNotDeleteThisDataSourceBecauseItsUsedElsewhere
		}
Beispiel #10
0
 public virtual void ItemCanBeDeletedCascade(NamedObjectJsonEventArgs <DATASOURCE> args, object sender = null)
 {
 }
		void dataSourceRepository_OnDataSourceCanBeRemoved(object sender, NamedObjectJsonEventArgs<DataSource> e) {
			e.DoNotDeleteItsUsedElsewhere = false;
		}
		void dataSourceRepository_OnDataSourceRemovedDone(object sender, NamedObjectJsonEventArgs<DataSource> e) {
			this.populateDataSourcesIntoTreeListView();
		}
		void dataSourceRepository_OnDataSourceRenamed(object sender, NamedObjectJsonEventArgs<DataSource> e) {
			if (sender == this) {
				this.tree.RefreshObject(this.DataSourceSelected);
			} else {
				this.tree.RefreshObject(e.Item);
				this.SelectSymbol(e.Item.Name, null);
			}
		}
		void dataSourceRepository_OnDataSourceAdded(object sender, NamedObjectJsonEventArgs<DataSource> e) {
			this.populateDataSourcesIntoTreeListView();	// roots changed => this.tree.RebuildAll(true) isn't enough
			this.SelectSymbol(e.Item.Name, null);
		}
 internal void RepositoryJsonDataSource_OnDataSourceRemoved(object sender, NamedObjectJsonEventArgs <DataSource> e)
 {
     int a = 1;
     //if a running optimizer / backtester / streaming chart had DataSource, possibly shut them down?
 }
 internal void RepositoryJsonDataSource_OnDataSourceCanBeRemoved(object sender, NamedObjectJsonEventArgs <DataSource> e)
 {
     int a = 1;
     // ask them before deleting using another event and check if DataSourceEventArgs.DoNotDeleteThisDataSourceBecauseItsUsedElsewhere
 }