Exemplo n.º 1
0
      public override async Task Action()
      {
        using (var editor = new EnterUserListNameDialog { OkButtonText = "Rename", Name = OwnerButton.ListName })
        {
          var result = editor.DisplayInShowFormDialog(string.Format("Rename list '{0}'", OwnerButton.ListName), OwnerButton);

          if (result == DialogResult.Cancel) return;

          var name = editor.Name;

          if (string.IsNullOrEmpty(name)) return;

          var updatedOnServer = await UserConfig.UserListCache.Instance().UpdateListName(OwnerButton.ListName, name);

          if (updatedOnServer)
          {
            OwnerButton.ListName = name;
            OwnerButton.OnClick(EventArgs.Empty);
          }
        }
      }
    private void pbAdd_Click(object sender, EventArgs e)
    {
//#if DEBUG
//      BuildingBlocks.xYyY.Get(CurveNames.PLN6M, 5, 5).A_Prices.GetEndValues(200).DisplayLineChart("PLN 5y5y");

//      var dates = new[] { new DateTime(2016,6,14), new DateTime(2016, 6, 16), new DateTime(2016, 6, 20) };

//      var dfs =
//        BuildingBlocks.DFsCache.Instance()
//          .FindFirstOrDefaultInInnerList(x => x.Curvename.Equals(CurveNames.CARBON_PLN_WIBOR));

//      var pln = new Curves.Defs.PLN6mWibor();

//      var hols = BuildingBlocks.TenorDatesCache.Instance()
//        .FindFirstOrDefaultInInnerList(x => x.HolidayCode.Equals(pln.OTHolidayCode));

//      var lineChart = new SI.Controls.LineChartDataDisplay();
//      foreach (var date in dates)
//      {
//        var series = dfs.DFValues.ValueOnDate(date);
//        lineChart.AddSeries(series.Dates, series.Data, string.Format("PLN on {0}", date.ToString("dd-MMM-yyyy")))
//          .AxisX.TickmarkStyle = Infragistics.UltraChart.Shared.Styles.AxisTickStyle.Smart;

//        series.DisplayInGrid(string.Format("DFs on {0}", date.ToString("dd-MMM-yyyy")));

//        var val = pln.CalculateSwapValue(
//          startDate_: hols.Dates.GetValue(date, 5),
//          forwardDate_: hols.Dates.GetValue(date, 10),
//          discCurveDates_: series.Dates,
//          discCurveValues_: series.Data,
//          forecastCurveDates_: series.Dates,
//          forecastCurveValues_: series.Data);

//        Logger.Info(string.Format("Value on {0} is {1}", date.ToString("dd-MMM-yyyy"), val*100d),
//          typeof (ProfileManageDisplay));

//      }
//      lineChart.DisplayInShowForm("PLN DFs");
//#else

      string name = null;

      using (var editor = new EnterUserListNameDialog { OkButtonText = "Create" })
      {
        var result = editor.DisplayInShowFormDialog("Create New List", this);

        if (result == DialogResult.Cancel) return;

        name = editor.Name;
      }

      if (string.IsNullOrEmpty(name))
        return;

      name = name.Trim();

      var f = UserListCache.Instance().FindFirstOrDefaultInInnerList(x => String.CompareOrdinal(name, x.ListName) == 0);

      if (f != null)
      {
        Logger.Info(string.Format("Not adding list with name = {0} as one already exists", name),
          typeof (UserListManageDisplay));
        return;
      }

      addButtonForProfile(name);
//#endif
    }