public FormPnLTransferTool(List <FillHub> fillHubs) { InitializeComponent(); this.Icon = Ambre.PositionViewer.Properties.Resources.user_female; // Create my local fillHub list. foreach (FillHub fillHub in fillHubs) { string name = fillHub.ServiceName; // this should always be unique in future. string uniqueName = name; int n = 0; while (m_FillHubs.ContainsKey(uniqueName)) { uniqueName = string.Format("{0}{1}", name, n++); } m_FillHubs.Add(uniqueName, fillHub); } // Create the left panel. m_LeftControl = new ControlPnLTransferTool(fillHubs); this.Controls.Add(m_LeftControl); m_LeftControl.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left) | System.Windows.Forms.AnchorStyles.Top))); m_LeftControl.Location = new System.Drawing.Point(0, 0); int width = m_LeftControl.Size.Width; m_LeftControl.ButtonClick += new EventHandler(ControlPanel_ButtonClicked); m_RightControl = new ControlPnLTransferTool(fillHubs); this.Controls.Add(m_RightControl); m_RightControl.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left) | System.Windows.Forms.AnchorStyles.Top))); m_RightControl.Location = new System.Drawing.Point(1 + width, 0); m_RightControl.Visible = false; m_RightControl.Description = "[transfer to]"; m_RightControl.AllowSubmit = false; // this control can't manually submit changes. int maxY = m_LeftControl.Location.Y + m_LeftControl.Size.Height; this.ClientSize = new System.Drawing.Size(this.ClientSize.Width, maxY); UpdateLocationAndViewOfControls(); }
// private void CollectStateInfo(ControlPnLTransferTool control, out FillHub leftFillHub, out InstrumentName leftInstrumentName, out List <double> leftDoubles) { leftFillHub = null; leftInstrumentName = new InstrumentName(); leftDoubles = new List <double>(); int ptr = 0; List <object> leftStates = control.GetCurrentState(); string fillHubName = leftStates[ptr].ToString(); ptr++; if (!m_FillHubs.TryGetValue(fillHubName, out leftFillHub)) { return; } //bool leftInstrumentSelected = false; if (leftStates[ptr] is InstrumentName) { leftInstrumentName = (InstrumentName)leftStates[ptr]; //leftInstrumentSelected = true; } else { leftInstrumentName = new InstrumentName(); } ptr++; // Load all the remaining numbers in data set. while (ptr < leftStates.Count) { double x = double.NaN; if (double.TryParse(leftStates[ptr].ToString(), out x)) { leftDoubles.Add(x); } ptr++; } }