예제 #1
0
    public void loadData(Action<CachedDS> callback, LinkedListNode<CachedDS> next) {
      var v_cli = new JsonStoreClient {
        AjaxMng = ajaxMng,
        BioCode = bioCode
      };
      v_cli.Load(bioParams, (s, a) => {
        if (a.Response.Success) {
          if (v_cli.JSMetadata.Fields.Count > 1) {
            this.metadata = v_cli.JSMetadata;
            this.data = v_cli.DS;
          }
          
          var eve = this.OnLoaded;
          if (eve != null)
            eve(this, new EventArgs());
          
          if (callback != null)
            callback(this);

          if (next != null)
            next.Value.loadData(callback, next.Next);

        }
      });
    }
예제 #2
0
    protected override Boolean setCboSelectedItem(Object value) {
      var rslt = base.setCboSelectedItem(value);
      if (!rslt) {
        if (this._attrs == null)
          throw new Exception(String.Format("Для {0} необходимо описать {1}.", this.GetType().Name, typeof(ComboBoxRmtEditorAttribute).Name));
        var v_cli = new JsonStoreClient {
          AjaxMng = BioEnvironment.Instance.AjaxMng,
          BioCode = this._attrs.BioCode
        };
        this.cbo.Items.Clear();
        this.cbo.Items.Add(new EnumWrapper {
          Name = "загрузка...",
          Value = 0
        });
        this.cbo.SelectedValue = 0;
        v_cli.Load(null, (s, a) => {
          if (a.Response.Success) {
            var rsp = a.Response as JsonStoreResponse;
            if (rsp != null) {
              var values = new List<Object>();
              foreach (var r in ((JsonStoreClient) s).DS) {
                values.Add(new EnumWrapper {
                  Value = r.GetValue(this._attrs.ValueFieldName),
                  Name = r.GetValue<String>(this._attrs.DisplayFieldName)
                });
              }
              this.LoadItems(values);
              base.setCboSelectedItem(value);
            }
          } else
            this.cbo.Items.Clear();
        });

      }
      return rslt;
    }