Пример #1
0
        // Static constructor for returning a TransactionResult from json
        // I abandoned static constructor from json - I am not sure this is the best way to do it, I'd prefer a standard constructor from a dictionary - athough, this was near to Dart approach
        // Std cosntructor from a dictionary - should work!!!
        public TransactionResult(Dictionary <String, Object> json)
        {
            Object outValue;

            //String wkHash = null;
            //bool wkSuccess = false;
            //TransactionError wkError;

            if (json.TryGetValue("hash", out outValue))
            {
                this.hash = outValue as String;
            }
            if (json.TryGetValue("success", out outValue))
            {
                this.success = (bool)outValue;
            }
            if (json.TryGetValue("error", out outValue))
            {
                this.error = new TransactionError(outValue as Dictionary <String, Object>);
            }
            else
            {
                this.error = null;
            }
            // return new TransactionResult(wkHash, wkSuccess, wkError);
        }
Пример #2
0
 public TransactionResult(String hash, bool success, TransactionError error)
 {
     Trace.Assert(hash != null);
     Trace.Assert((success == true) || (error != null));
     this.hash    = hash;
     this.success = success;
     this.error   = error;
 }