Exemplo n.º 1
0
        internal (ErrStruct, jobstatus) AwaitCompletion(int id, MainFormClass mainForm)
        {
            string     ConversionStatus = string.Empty;
            jobstatus  StatusUpdate;
            RestClient client = new RestClient(ZServer + "jobs/");

            client.Authenticator = new HttpBasicAuthenticator(apiKey, "");
            RestRequest      request      = new RestRequest(id.ToString(), DataFormat.Json);
            JsonDeserializer deserializer = new JsonDeserializer();

            do
            {
                System.Threading.Thread.Sleep(10000);
                IRestResponse response = client.Get(request);
                if (response.StatusCode != HttpStatusCode.OK)
                {
                    ErrStruct err = deserializer.Deserialize <ErrStruct>(response);
                    return(err, new jobstatus());
                }
                //Console.WriteLine(response.Content);
                StatusUpdate     = deserializer.Deserialize <jobstatus>(response);
                ConversionStatus = StatusUpdate.status;
                string msg = string.Format("Conversion status = {0} at {1:HH:mm:ss}", ConversionStatus, DateTime.Now);
                mainForm.Log(msg);
                Console.WriteLine("Conversion status = " + ConversionStatus);
            } while (ConversionStatus != "successful");
            return(new ErrStruct(), StatusUpdate);
        }
Exemplo n.º 2
0
 public MainFormClass()
 {
     MainForm = this;
     this.PlaceOnDesktop(50, 50);
     this.ClientSize      = new Size(410, 400);
     this.FormBorderStyle = FormBorderStyle.FixedDialog; // no resize
     this.MaximizeBox     = false;
     this.Text            = "File Conversion by Zamzar.com";
     Application.Idle    += Initialize;
 }