private void SwitchToDiagramView() { FlowPathwayDiagram d = null; if (this.m_DiagramTab.Control == null) { d = new FlowPathwayDiagram(); d.Load(this.DataFeed); d.IsReadOnly = (!this.m_IsEnabled); d.ConfigureShapeReadOnlySetting(); d.ZoomChanged += this.OnDiagramZoomChanged; d.MouseDoubleClick += this.OnDiagramMouseDoubleClick; this.m_DiagramTab.Control = d; } else { d = this.GetFlowDiagram(); } this.ButtonZoomIn.Enabled = true; this.ButtonZoomOut.Enabled = true; this.ScrollBarVertical.Visible = true; this.ScrollBarHorizontal.Enabled = true; this.ScrollBarVertical.Value = d.VerticalScrollValue; this.ScrollBarHorizontal.Value = d.HorizontalScrollValue; this.PanelControlHost.Width = this.PanelBottomControls.Width - this.ScrollBarVertical.Width - 2; this.ResetScrollbars(); this.SetCurrentControl(); }
protected override void Dispose(bool disposing) { if (disposing && !this.IsDisposed) { this.m_TooltipZoomOut.Dispose(); this.m_TooltipZoomIn.Dispose(); FlowPathwayDiagram d = this.GetFlowDiagram(); if (d != null) { d.ZoomChanged -= OnDiagramZoomChanged; d.MouseDoubleClick -= OnDiagramMouseDoubleClick; } if (components != null) { components.Dispose(); } this.m_DiagramTab.Dispose(); this.m_StockTab.Dispose(); this.m_FlowTab.Dispose(); } base.Dispose(disposing); }
private string CreateQuickViewTag() { StringBuilder sb = new StringBuilder(); List <int> lst = new List <int>(); FlowPathwayDiagram d = this.GetFlowDiagram(); DataSheet ds = this.DataFeed.Project.GetDataSheet(Constants.DATASHEET_STOCK_TYPE_NAME); foreach (StockTypeShape s in d.SelectedShapes) { lst.Add(s.StockTypeId); } lst.Sort(); foreach (int i in lst) { foreach (StockTypeShape s in d.SelectedShapes) { if (s.StockTypeId == i) { object v = DataTableUtilities.GetTableValue(ds.GetData(), ds.ValueMember, s.StockTypeId, ds.DisplayMember); string DisplayValue = Convert.ToString(v, CultureInfo.InvariantCulture); sb.AppendFormat(CultureInfo.InvariantCulture, "{0}-{1}:", s.StockTypeId, DisplayValue); } } } string k1 = sb.ToString().Trim(':'); return(string.Format(CultureInfo.InvariantCulture, "{0}:{1}", this.Project.Library.Connection.ConnectionString, k1)); }
private void OpenSelectedStockTypes() { List <int> lst = new List <int>(); string title = this.CreateQuickViewTitle(); string tag = this.CreateQuickViewTag(); WinFormSession sess = (WinFormSession)this.Project.Library.Session; if (sess.Application.GetView(tag) != null) { sess.Application.ActivateView(tag); } else { using (HourGlass h = new HourGlass()) { FlowPathwayDiagram d = this.GetFlowDiagram(); foreach (StockTypeShape s in d.SelectedShapes) { lst.Add(s.StockTypeId); } StockTypeQuickView v = (StockTypeQuickView)this.Session.CreateDataFeedView( typeof(StockTypeQuickView), this.Library, this.Project, this.Scenario, null); v.LoadStockTypes(this.DataFeed, lst); sess.Application.HostView(v, title, tag); } } }
public override void EnableView(bool enable) { this.m_IsEnabled = enable; FlowPathwayDiagram d = (FlowPathwayDiagram)this.m_DiagramTab.Control; if (d != null) { d.IsReadOnly = (!this.m_IsEnabled); d.ConfigureShapeReadOnlySetting(); } }
private void OnHorizontalScroll(object sender, System.Windows.Forms.ScrollEventArgs e) { if (e.NewValue == e.OldValue) { return; } if (this.TabStripMain.SelectedItem == this.m_DiagramTab) { FlowPathwayDiagram d = this.GetFlowDiagram(); d.HorizontalScrollValue = e.NewValue; d.Invalidate(); } }
private string CreateQuickViewTitle() { StringBuilder sb = new StringBuilder(); FlowPathwayDiagram d = this.GetFlowDiagram(); DataSheet ds = this.DataFeed.Project.GetDataSheet(Constants.DATASHEET_STOCK_TYPE_NAME); sb.AppendFormat(CultureInfo.InvariantCulture, "{0} - ", this.DataFeed.Scenario.DisplayName); foreach (StockTypeShape s in d.SelectedShapes) { object v = DataTableUtilities.GetTableValue(ds.GetData(), ds.ValueMember, s.StockTypeId, ds.DisplayMember); sb.AppendFormat(CultureInfo.InvariantCulture, "{0},", Convert.ToString(v, CultureInfo.InvariantCulture)); } return(sb.ToString().Trim(',')); }
public void Initialize(FlowPathwayDiagram diagram, Project project) { this.m_Diagram = diagram; this.m_Project = project; DataSheet ds = this.m_Project.GetDataSheet(Constants.DATASHEET_STOCK_TYPE_NAME); DataView dv = new DataView(ds.GetData(), null, ds.DisplayMember, DataViewRowState.CurrentRows); foreach (DataRowView drv in dv) { this.ComboBoxStocks.Items.Add( new BaseValueDisplayListItem( Convert.ToInt32(drv.Row[ds.ValueMember], CultureInfo.InvariantCulture), Convert.ToString(drv.Row[ds.DisplayMember], CultureInfo.InvariantCulture))); } Debug.Assert(dv.Count > 0); Debug.Assert(this.ComboBoxStocks.Items.Count == dv.Count); this.ComboBoxStocks.SelectedIndex = 0; }
private void OnExecuteAddStockCommand(Command cmd) { DataSheet ds = this.Project.GetDataSheet(Constants.DATASHEET_STOCK_TYPE_NAME); DataView dv = new DataView(ds.GetData(), null, ds.DisplayMember, DataViewRowState.CurrentRows); if (dv.Count == 0) { FormsUtilities.InformationMessageBox("No stock types have been defined."); return; } FlowPathwayDiagram d = GetFlowDiagram(); ChooseStockTypeForm f = new ChooseStockTypeForm(); f.Initialize(d, this.Project); if (f.ShowDialog(this) == DialogResult.OK) { using (HourGlass h = new HourGlass()) { d.AddStockTypeShape(f.StockTypeId); } } }
private void OnExecuteShowTooltipsCommand(Command cmd) { FlowPathwayDiagram d = this.GetFlowDiagram(); d.ShowToolTips = (!d.ShowToolTips); }
private void OnExecuteShowGridCommand(Command cmd) { FlowPathwayDiagram d = this.GetFlowDiagram(); d.ShowGrid = (!d.ShowGrid); }