Ejemplo n.º 1
0
        private void btnRequest_Click(object sender, EventArgs e)
        {
            if (!((IProvider)this.provider).IsConnected)
            {
                if (MessageBox.Show((IWin32Window)this, ((IProvider)this.provider).Name + " is not connected. Do you want to connect?", "Connect " + ((IProvider)this.provider).Name, MessageBoxButtons.YesNo, MessageBoxIcon.Question) != DialogResult.Yes)
                {
                    return;
                }
                Global.ProviderHelper.Connect((IProvider)this.provider);
                if (!((IProvider)this.provider).IsConnected)
                {
                    int num = (int)MessageBox.Show((IWin32Window)this, "Unable to connect to " + ((IProvider)this.provider).Name, "Error", MessageBoxButtons.OK, MessageBoxIcon.Hand);
                    return;
                }
            }
            FIXSecurityDefinitionRequest request = new FIXSecurityDefinitionRequest((int)((IProvider)this.provider).Id == 19 ? "0" : Guid.NewGuid().ToString(), 3);

            if (this.chbFilter_InstrumentType.Checked)
            {
                request.SecurityType = APITypeConverter.InstrumentType.Convert((OpenQuant.API.InstrumentType) this.cbxFilter_InstrumentTypes.SelectedItem);
            }
            if (this.chbFilter_Exchange.Checked)
            {
                request.SecurityExchange = this.tbxFilter_Exchange.Text.Trim();
            }
            if (this.chbFilter_Symbol.Checked)
            {
                request.Symbol = this.tbxFilter_Symbol.Text.Trim();
            }
            ProcessRequestForm processRequestForm = new ProcessRequestForm();

            processRequestForm.Init(this.provider, request);
            if (processRequestForm.ShowDialog((IWin32Window)this) == DialogResult.OK)
            {
                List <FIXSecurityDefinition> list = new List <FIXSecurityDefinition>((IEnumerable <FIXSecurityDefinition>)processRequestForm.GetSecurityDefinitions());
                list.RemoveAll((Predicate <FIXSecurityDefinition>)(definition => !APITypeConverter.InstrumentType.CanConvert(definition.SecurityType)));
                this.UpdateSecurityDefinitionList(list.ToArray());
            }
            processRequestForm.Dispose();
            this.btnCheckAll.Enabled   = true;
            this.btnUncheckAll.Enabled = true;
            this.btnImport.Enabled     = true;
        }
Ejemplo n.º 2
0
    private void btnRequest_Click(object sender, EventArgs e)
    {
      if (!((IProvider) this.provider).IsConnected)
      {
        if (MessageBox.Show((IWin32Window) this, ((IProvider) this.provider).Name + " is not connected. Do you want to connect?", "Connect " + ((IProvider) this.provider).Name, MessageBoxButtons.YesNo, MessageBoxIcon.Question) != DialogResult.Yes)
          return;
        Global.ProviderHelper.Connect((IProvider) this.provider);
        if (!((IProvider) this.provider).IsConnected)
        {
					int num = (int) MessageBox.Show((IWin32Window) this, "Unable to connect to " + ((IProvider) this.provider).Name, "Error", MessageBoxButtons.OK, MessageBoxIcon.Hand);
          return;
        }
      }
      FIXSecurityDefinitionRequest request = new FIXSecurityDefinitionRequest((int) ((IProvider) this.provider).Id == 19 ? "0" : Guid.NewGuid().ToString(), 3);
      if (this.chbFilter_InstrumentType.Checked)
				request.SecurityType = APITypeConverter.InstrumentType.Convert((OpenQuant.API.InstrumentType) this.cbxFilter_InstrumentTypes.SelectedItem);
      if (this.chbFilter_Exchange.Checked)
				request.SecurityExchange = this.tbxFilter_Exchange.Text.Trim();
      if (this.chbFilter_Symbol.Checked)
				request.Symbol = this.tbxFilter_Symbol.Text.Trim();
      ProcessRequestForm processRequestForm = new ProcessRequestForm();
      processRequestForm.Init(this.provider, request);
      if (processRequestForm.ShowDialog((IWin32Window) this) == DialogResult.OK)
      {
        List<FIXSecurityDefinition> list = new List<FIXSecurityDefinition>((IEnumerable<FIXSecurityDefinition>) processRequestForm.GetSecurityDefinitions());
        list.RemoveAll((Predicate<FIXSecurityDefinition>) (definition => !APITypeConverter.InstrumentType.CanConvert(definition.SecurityType)));
        this.UpdateSecurityDefinitionList(list.ToArray());
      }
      processRequestForm.Dispose();
      this.btnCheckAll.Enabled = true;
      this.btnUncheckAll.Enabled = true;
      this.btnImport.Enabled = true;
    }