public ResourceTransferValue(TransferManager transferManager, PartResourceDefinition resourceInfo, object transferTo, object transferFrom)
        {
            this.transferManager = transferManager;
            this.resourceInfo    = resourceInfo;
            this.transferTo      = transferTo;
            this.transferFrom    = transferFrom;

            DetermineTypes();
            InitializeSuffixes();

            Status = TransferManager.TransferStatus.Inactive; // Last because the setter for Status prints some of the values calculated above to the log
        }
 private void InitializeSuffixes()
 {
     AddSuffix("GOAL", new Suffix <ScalarValue>(() => amount ?? -1));
     AddSuffix("TRANSFERRED", new Suffix <ScalarValue>(() => transferredAmount));
     AddSuffix("STATUS", new Suffix <StringValue>(() => Status.ToString()));
     AddSuffix("MESSAGE", new Suffix <StringValue>(() => StatusMessage));
     AddSuffix("RESOURCE", new Suffix <StringValue>(() => resourceInfo.name));
     AddSuffix("ACTIVE", new SetSuffix <BooleanValue>(() => Status == TransferManager.TransferStatus.Transferring,
                                                      value => {
         Status = value ? TransferManager.TransferStatus.Transferring : TransferManager.TransferStatus.Inactive;
     }));
 }
示例#3
0
        public ResourceTransferValue(TransferManager transferManager, PartResourceDefinition resourceInfo, object transferTo, object transferFrom)
        {
            this.transferManager = transferManager;
            this.resourceInfo = resourceInfo;
            this.transferTo = transferTo;
            this.transferFrom = transferFrom;

            DetermineTypes();
            InitializeSuffixes();

            Status = TransferManager.TransferStatus.Inactive; // Last because the setter for Status prints some of the values calculated above to the log
        }
 private void MarkFinished()
 {
     transferredAmount = Math.Round(transferredAmount, 5);
     StatusMessage     = string.Format("Transferred: {0}", transferredAmount);
     Status            = TransferManager.TransferStatus.Finished;
 }
 private void MarkFailed(string message)
 {
     SafeHouse.Logger.LogError(message);
     StatusMessage = message;
     Status        = TransferManager.TransferStatus.Failed;
 }
示例#6
0
 private void InitializeSuffixes()
 {
     AddSuffix("GOAL", new Suffix<double>(() => amount ?? -1));
     AddSuffix("TRANSFERRED", new Suffix<double>(() => transferredAmount));
     AddSuffix("STATUS", new Suffix<string>(() => Status.ToString()));
     AddSuffix("MESSAGE", new Suffix<string>(() => StatusMessage));
     AddSuffix("RESOURCE", new Suffix<string>(() => resourceInfo.name));
     AddSuffix("ACTIVE", new SetSuffix<bool>(() => Status == TransferManager.TransferStatus.Transferring, 
     value => {
         Status = value ? TransferManager.TransferStatus.Transferring : TransferManager.TransferStatus.Inactive;
     }));
 }
示例#7
0
 private void MarkFinished()
 {
     transferredAmount = Math.Round(transferredAmount, 5);
     StatusMessage = string.Format("Transferred: {0}", transferredAmount);
     Status = TransferManager.TransferStatus.Finished;
 }
示例#8
0
 private void MarkFailed(string message)
 {
     StatusMessage = message;
     Status = TransferManager.TransferStatus.Failed;
 }
示例#9
0
 private void MarkFailed(string message)
 {
     StatusMessage = message;
     Status        = TransferManager.TransferStatus.Failed;
 }