/// <summary> /// Launches the Criteria Form and makes the request to IQFeed based on user input. /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void btnCriteria_Click(object sender, EventArgs e) { // clear the listboxes before the next request is made. lstPuts.Items.Clear(); lstCalls.Items.Clear(); // validate a symbol was entered if (txtSymbol.Text.Equals("")) { MessageBox.Show("Please enter a symbol"); } else { // Display criteria message box CriteriaForm frmCriteria = new CriteriaForm(); if (frmCriteria.ShowDialog(this) == DialogResult.Cancel) { // cancel button or 'X' was pressed. Do nothing } else { // build and make request string sCommand = ""; // I have manually added the following properties to the criteriaForm: // security Type, FilterType, MonthCodes, NearMonths, Leaps, Years, Filter1, and Filter2 // To view how these properties are populated based upon user input, view criteria.cs if (frmCriteria.SecurityType.Equals("ieoption")) { sCommand = String.Format("CEO,{0},{1},{2},{3},{4},{5},{6},{7},{8}\r\n", txtSymbol.Text, frmCriteria.PutsCalls, frmCriteria.MonthCodes, frmCriteria.NearMonths.ToString(), frmCriteria.Binary, frmCriteria.FilterType.ToString(), frmCriteria.Filter1.ToString(), frmCriteria.Filter2.ToString(), txtRequestID.Text); } else if (frmCriteria.SecurityType.Equals("future")) { sCommand = String.Format("CFU,{0},{1},{2},{3},{4}\r\n", txtSymbol.Text, frmCriteria.MonthCodes, frmCriteria.Years, frmCriteria.NearMonths.ToString(), txtRequestID.Text); } else if (frmCriteria.SecurityType.Equals("foption")) { sCommand = String.Format("CFO,{0},{1},{2},{3},{4},{5}\r\n", txtSymbol.Text, frmCriteria.PutsCalls, frmCriteria.MonthCodes, frmCriteria.Years, frmCriteria.NearMonths.ToString(), txtRequestID.Text); } else if (frmCriteria.SecurityType.Equals("fspread")) { sCommand = String.Format("CFS,{0},{1},{2},{3},{4}\r\n", txtSymbol.Text, frmCriteria.MonthCodes, frmCriteria.Years, frmCriteria.NearMonths.ToString(), txtRequestID.Text); } else { MessageBox.Show("There was a problem with the Request type specified on the Criteria Form."); } if (sCommand.Length > 0) { // send it to the feed via the socket SendRequestToIQFeed(sCommand); // call wait for data to notify the socket that we are ready to receive data WaitForData("Chains"); } } frmCriteria.Dispose(); } }
private void CriteriaButton_Click(object sender, EventArgs e) { CriteriaForm criteriaForm = new CriteriaForm(); criteriaForm.Show(); }