示例#1
0
        protected override void ProcessRecord()
        {
            try
            {
                if (String.IsNullOrEmpty(AppId))
                {
                    AppId = InputHelper.GetUserInput(this, "AppId");
                }
                if (String.IsNullOrEmpty(SecretKey))
                {
                    SecretKey = InputHelper.GetUserInput(this, "SecretKey");
                }
                if (String.IsNullOrEmpty(AccountId))
                {
                    AccountId = InputHelper.GetUserInput(this, "AccountId");
                }
                if (String.IsNullOrEmpty(From))
                {
                    From = InputHelper.GetUserInput(this, "From");
                }
                if (String.IsNullOrEmpty(To))
                {
                    To = InputHelper.GetUserInput(this, "To");
                }

                Latch latch = new Latch(AppId, SecretKey);
                WriteObject(latch.History(AccountId, DateTime.Parse(From), DateTime.Parse(To)), true);
            }
            catch (Exception ex)
            {
                InvokeCommand.InvokeScript(String.Format("Write-Host Error: \"{0}\"", ex.Message));
            }
        }