wasvcmgmntapi /MyVMPortal/GetOperationStatus.aspx.cs

Language C# Lines 40
MD5 Hash 2eab5cf2a02ad48a5ea311be9ee910d9
Repository https://github.com/mwasham/wasvcmgmntapi.git View Raw File
 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
using SMLibrary;
using System;
using System.Collections.Generic;
using System.Configuration;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Xml.Linq;

namespace MyVMPortal
{
    public partial class GetOperationStatus : System.Web.UI.Page
    {
        async protected void Page_Load(object sender, EventArgs e)
        {

            if (Request.QueryString["requestid"] != null)
            {
                VMManager vmm = GetVMM();
                String requestID = Request.QueryString["requestid"];
                XElement status = await vmm.GetOperationStatus(requestID);
                String strStatus = status.Element(vmm.ns + "Status").Value;
                String strMessage = String.Empty;
                if (status.Descendants(vmm.ns + "Message").FirstOrDefault() != null)
                    strMessage = status.Descendants(vmm.ns + "Message").FirstOrDefault().Value;

                String osStatus = String.Format("Status: {0}, Message: {1}",strStatus, strMessage );
                lblStatus.Text = osStatus;
            }
        }


        private VMManager GetVMM()
        {
            return new VMManager(ConfigurationManager.AppSettings["SubcriptionID"], ConfigurationManager.AppSettings["CertificateThumbprint"]);
        }

    }
}
Back to Top