private void addControlFor(WeightedTenorPoint def_)
 {
   var contrl = new CMTStructurePointEditor();
   flowLayoutPanel1.Controls.Add(contrl);
   subscribe(contrl);
   contrl.Bind(def_);
   sortOutPositioning();
 }
    internal void Bind(WeightedTenorPoint def_)
    {
      Definition = def_;

      tbMult.Bind(Definition, "Multiplier", new Validators.DoubleValidator("##0.0##"));
      tbPoint.Bind(Definition, "Tenor", new Validators.IntValidator());

      if(cmbMarket.Items.Count==0)
        cmbMarket.AddItems(LiveMarkets.Markets);
      cmbMarket.Bind(Definition, "Market", new Validators.EnumDescValidator(BondMarket.DE));
    }
Ejemplo n.º 3
0
    public static WeightedTenorPoint[] InterpretQuickInputString_old(string input_)
    {
      var matches = regex.Matches(input_.ToUpper());

      if (matches.Count == 0) return null;

      var arr = new WeightedTenorPoint[matches.Count];

      for (int i = 0; i < arr.Length; ++i)
      {
        var match = matches[i];

        BondMarket market;

        if (!Enum.TryParse(match.Groups["Market"].Value, out market))
          return null;

        int tenor = int.Parse(match.Groups["Point"].Value);

        if (tenor < 1 || tenor > 30)
          return null;

        arr[i] = new WeightedTenorPoint()
        {
          Market = market,
          Tenor = tenor
        };
      }

      switch (arr.Length)
      {
        case 1:
          arr[0].Multiplier = 1d;
          break;
        case 2:
          arr[0].Multiplier = -1d;
          arr[1].Multiplier = 1d;
          break;
        case 3:
          arr[0].Multiplier = -1d;
          arr[1].Multiplier = 2d;
          arr[2].Multiplier = -1d;
          break;
        default:
          Array.ForEach(arr, x => x.Multiplier = 1d);
          break;
      }

      return arr;
    }
 private void add()
 {
   var item = new WeightedTenorPoint();
   m_points.Add(item);
   addControlFor(item);
 }