Ejemplo n.º 1
0
        /// <summary>
        /// Gets the RSS Information For the Registered Subscriptions From the Web Service
        /// ServiceDashboard/Feeds/?anonuser=test
        /// </summary>
        /// <param name="callback">Callback after successful response.</param>
        /// <param name="exceptionCallback">Callback if there is an exception.</param>
        /// <param name="state">State Information To Preserve Across Callbacks</param>
        public void FetchSince(AsyncCallback callback, AsyncCallback exceptionCallback, ServiceDashboardRequest state)
        {
            Uri uri = new Uri(String.Format(WebServiceDomain + "/ServiceDashboard/FetchSince/?anonuser={0}&issueage={1}&fetchall={2}&appversion={3}&summary={4}", HttpUtility.UrlEncode(state.User), state.IssueAge, state.FetchAllIncludingEmpties, state.AppVersion,state.Summary));
            //            Uri uri = new Uri(String.Format(WebServiceDomain + "/ServiceDashboard/GetAll/?anonuser={0}&issueage={1}&fetchall={2}&appversion={3}", HttpUtility.UrlEncode(state.User), state.IssueAge, state.FetchAllIncludingEmpties, state.AppVersion));

            HttpWebRequest httpWebRequest = (HttpWebRequest)WebRequest.Create(uri);
            httpWebRequest.AllowAutoRedirect = false;

            // WWB: Setup Timer for tracking Http request time out
            HttpWebRequestTimer httpRequestTimer = new HttpWebRequestTimer(httpWebRequest, httpRequestTimeOut);

            // WWB: If The Timer Ticks, This Is The Method That Handles the Timeout
            httpRequestTimer.Elapsed += new ElapsedEventHandler(httpRequestTimer_Tick);

            // Create a Packet Of Information To Surive The Aysnc Call
            InternalRequestState<ServiceDashboardRequest> requestState = new InternalRequestState<ServiceDashboardRequest>()
            {
                ExternalRequestState = state, // has service code and location
                HttpWebRequest = httpWebRequest, // has uri
                Callback = callback,
                ExceptionCallback = exceptionCallback,
                HttpWebRequestTimer = httpRequestTimer
            };

            // WWB: Start The Time Out Timer
            httpRequestTimer.Start();

            // Make the Actual HTTP Request on A Background Worker Thread
            IAsyncResult asyncResult = httpWebRequest.BeginGetResponse(new AsyncCallback(HttpWebResponseServiceDashboardCallback), requestState);
        }
Ejemplo n.º 2
0
        public void AppExceptionCall(AsyncCallback callback, AsyncCallback exceptionCallback, ExceptionRequest state)
        {
            String stringURL = this.WebServiceDomain;
            stringURL += "/App/Exception/?";

            stringURL += "login="******"&appversion=" + HttpUtility.UrlEncode(state.AppVersion);
            stringURL += "&appname=" + HttpUtility.UrlEncode(state.AppName);
            stringURL += "&phoneid=" + HttpUtility.UrlEncode(state.PhoneId);
            stringURL += "&exception=" + HttpUtility.UrlEncode(state.Exception);

            Uri uri = new Uri(stringURL);

            HttpWebRequest httpWebRequest = (HttpWebRequest)WebRequest.Create(uri);
            httpWebRequest.AllowAutoRedirect = false;

            // WWB: Setup Timer for tracking Http request time out
            HttpWebRequestTimer httpRequestTimer = new HttpWebRequestTimer(httpWebRequest, httpRequestTimeOut);

            // WWB: If The Timer Ticks, This Is The Method That Handles the Timeout
            httpRequestTimer.Elapsed += new ElapsedEventHandler(httpRequestTimer_Tick);

            // Create a Packet Of Information To Surive The Aysnc Call
            InternalRequestState<ExceptionRequest> requestState = new InternalRequestState<ExceptionRequest>()
            {
                ExternalRequestState = state,
                HttpWebRequest = httpWebRequest,
                Callback = callback,
                ExceptionCallback = exceptionCallback,
                HttpWebRequestTimer = httpRequestTimer
            };

            // WWB: Start The Time Out Timer
            httpRequestTimer.Start();

            // Make the Actual HTTP Request on A Background Worker Thread
            IAsyncResult asyncResult = httpWebRequest.BeginGetResponse(new AsyncCallback(AppExceptionCallback), requestState);
            //IAsyncResult asyncResult = httpWebRequest.BeginGetResponse(null, requestState);
        }
Ejemplo n.º 3
0
        /// <summary>
        /// Start/Stop/Delete (Swap handled in different method)
        /// </summary>
        /// <param name="callback"></param>
        /// <param name="exceptionCallback"></param>
        /// <param name="state"></param>
        public void UpdateDeploymentStatus(AsyncCallback callback, AsyncCallback exceptionCallback, UpdateDeploymentStatusRequest state)
        {
            // OLD CALL
            // Uri uri = new Uri(String.Format("{0}/Deployment/{1}/{2}?login={3}&password={4}&HostedServiceName={5}&DeploymentName={6}&trial=0&AppVersion={7}", this.WebServiceDomain, state.Status, state.SubscriptionId, state.Login.Trim(), state.Password, state.ServiceName, state.DeploymentName, state.AppVersion));

            // NEW CALL
            Uri uri = new Uri(String.Format("{0}/Deployment/{1}Mango/{2}?login={3}&password={4}&HostedServiceName={5}&DeploymentName={6}&trial=0&AppVersion={7}", this.WebServiceDomain, state.Status, state.SubscriptionId, state.Login.Trim(), state.Password, state.ServiceName, state.DeploymentName, state.AppVersion));

            HttpWebRequest httpWebRequest = (HttpWebRequest)WebRequest.Create(uri);
            httpWebRequest.AllowAutoRedirect = false;

            // WWB: Setup Timer for tracking Http request time out
            HttpWebRequestTimer httpRequestTimer = new HttpWebRequestTimer(httpWebRequest, httpRequestTimeOut);

            // WWB: If The Timer Ticks, This Is The Method That Handles the Timeout
            httpRequestTimer.Elapsed += new ElapsedEventHandler(httpRequestTimer_Tick);

            // Create a Packet Of Information To Surive The Aysnc Call
            InternalRequestState<UpdateDeploymentStatusRequest> requestState = new InternalRequestState<UpdateDeploymentStatusRequest>()
            {
                ExternalRequestState = state,
                HttpWebRequest = httpWebRequest,
                Callback = callback,
                ExceptionCallback = exceptionCallback,
                HttpWebRequestTimer = httpRequestTimer
            };

            // WWB: Start The Time Out Timer
            httpRequestTimer.Start();

            // Make the Actual HTTP Request on A Background Worker Thread
            IAsyncResult asyncResult = httpWebRequest.BeginGetResponse(new AsyncCallback(HttpWebResponseUpdateDeploymentCallback), requestState);
        }
Ejemplo n.º 4
0
        /// <summary>
        /// 
        /// </summary>
        /// <param name="callback"></param>
        /// <param name="exceptionCallback"></param>
        /// <param name="state"></param>
        public void Reinstance(AsyncCallback callback, AsyncCallback exceptionCallback, DeploymentReinstanceRequest state)
        {
            String stringURL = this.WebServiceDomain;

            if (state.InstanceAction == "reboot")
            {
                // stringURL += "/Deployment/ReInstance/"; // OLD CALL
                stringURL += "/Deployment/RebootMango/";  // NEW CALL
            }
            else
            { // reimage
                // stringURL += "/Deployment/ReInstance/"; // OLD CALL
                stringURL += "/Deployment/ReimageMango/";  // NEW CALL
            }

            stringURL += HttpUtility.UrlEncode(state.SubscriptionId.ToString());
            stringURL += "?login="******"&password="******"&HostedServiceName=" + HttpUtility.UrlEncode(state.ServiceName);
            stringURL += "&DeploymentName=" + HttpUtility.UrlEncode(state.Deployment.ToString());
            stringURL += "&AppVersion=" + HttpUtility.UrlEncode(state.AppVersion);
            stringURL += "&RoleInstanceName=" + HttpUtility.UrlEncode(state.Instance);
            stringURL += "&InstanceAction=" + HttpUtility.UrlEncode(state.InstanceAction);

            Uri uri = new Uri(stringURL);

            //Uri uri = new Uri(String.Format("{0}/Deployment/Reinstace/{1}?login={2}&password={3}&HostedServiceName={4}&DeploymentName={6}&AppVersion={7}&RoleInstanceName{8}&InstanceAction={9}", this.WebServiceDomain, state.SubscriptionId, state.Login.Trim(), state.Password, state.ServiceName, state.Deployment, state.AppVersion, state.Instance, state.InstanceAction));

            HttpWebRequest httpWebRequest = (HttpWebRequest)WebRequest.Create(uri);
            httpWebRequest.AllowAutoRedirect = false;

            // WWB: Setup Timer for tracking Http request time out
            HttpWebRequestTimer httpRequestTimer = new HttpWebRequestTimer(httpWebRequest, httpRequestTimeOut);

            // WWB: If The Timer Ticks, This Is The Method That Handles the Timeout
            httpRequestTimer.Elapsed += new ElapsedEventHandler(httpRequestTimer_Tick);

            // Create a Packet Of Information To Surive The Aysnc Call
            InternalRequestState<DeploymentReinstanceRequest> requestState = new InternalRequestState<DeploymentReinstanceRequest>()
            {
                ExternalRequestState = state,
                HttpWebRequest = httpWebRequest,
                Callback = callback,
                ExceptionCallback = exceptionCallback,
                HttpWebRequestTimer = httpRequestTimer
            };

            // WWB: Start The Time Out Timer
            httpRequestTimer.Start();

            // Make the Actual HTTP Request on A Background Worker Thread
            IAsyncResult asyncResult = httpWebRequest.BeginGetResponse(new AsyncCallback(HttpWebResponseReinstanceCallback), requestState);
        }
Ejemplo n.º 5
0
        /// <summary>
        /// Gets the Deployment Information For the Registered Subscriptions From the Web Service
        /// </summary>
        /// <param name="callback">Callback after successful response.</param>
        /// <param name="exceptionCallback">Callback if there is an exception.</param>
        /// <param name="state">State Information To Preserve Across Callbacks</param>
        public void GetDeploymentsFromWebService(AsyncCallback callback, AsyncCallback exceptionCallback, DeploymentRequest state)
        {
            // DFB: Trial flag is only on Get Deployments - always pass trial
            String stringUri = String.Format("{0}/Subscription/Deployments/?login={1}&password={2}&trial={3}&AppVersion={4}", this.WebServiceDomain, state.Login.Trim(), state.Password, state.TrialRemaining,state.AppVersion);

            Uri uri = new Uri(stringUri);

            HttpWebRequest httpWebRequest = (HttpWebRequest)WebRequest.Create(uri);
            httpWebRequest.AllowAutoRedirect = false;

            // WWB: Setup Timer for tracking Http request time out
            HttpWebRequestTimer httpRequestTimer = new HttpWebRequestTimer(httpWebRequest, httpRequestTimeOut);

            // WWB: If The Timer Ticks, This Is The Method That Handles the Timeout
            httpRequestTimer.Elapsed += new ElapsedEventHandler(httpRequestTimer_Tick);

            // Create a Packet Of Information To Surive The Aysnc Call
            InternalRequestState<DeploymentRequest> requestState = new InternalRequestState<DeploymentRequest>()
            {
                ExternalRequestState = state,
                HttpWebRequest = httpWebRequest,
                Callback = callback,
                ExceptionCallback = exceptionCallback,
                HttpWebRequestTimer = httpRequestTimer
            };

            // WWB: Start The Time Out Timer
            httpRequestTimer.Start();

            // Make the Actual HTTP Request on A Background Worker Thread
            IAsyncResult asyncResult = httpWebRequest.BeginGetResponse(new AsyncCallback(HttpWebResponseDeploymentsCallback), requestState);
        }
Ejemplo n.º 6
0
        /// <summary>
        /// Gets the RSS Information For the Registered Subscriptions From the Web Service
        /// </summary>
        /// <param name="callback">Callback after successful response.</param>
        /// <param name="exceptionCallback">Callback if there is an exception.</param>
        /// <param name="state">State Information To Preserve Across Callbacks</param>
        public void GetRSSFromWebService(AsyncCallback callback, AsyncCallback exceptionCallback, RSSRequest state)
        {
            if (state == null)
                throw new ArgumentNullException("state is null");

            if (String.IsNullOrEmpty(state.ServiceCode))
                throw new ArgumentNullException("state.servicecode is null");

            Uri uri = new Uri(String.Format("http://www.microsoft.com/windowsazure/support/status/RSSFeed.aspx?RSSFeedCode={0}", state.ServiceCode));

            HttpWebRequest httpWebRequest = (HttpWebRequest)WebRequest.Create(uri);
            httpWebRequest.AllowAutoRedirect = false;

            // WWB: Setup Timer for tracking Http request time out
            HttpWebRequestTimer httpRequestTimer = new HttpWebRequestTimer(httpWebRequest, httpRequestTimeOut);

            // WWB: If The Timer Ticks, This Is The Method That Handles the Timeout
            httpRequestTimer.Elapsed += new ElapsedEventHandler(httpRequestTimer_Tick);

            // Create a Packet Of Information To Surive The Aysnc Call
            InternalRequestState<RSSRequest> requestState = new InternalRequestState<RSSRequest>()
            {
                ExternalRequestState = state, // has service code and location
                HttpWebRequest = httpWebRequest, // has uri
                Callback = callback,
                ExceptionCallback = exceptionCallback,
                HttpWebRequestTimer = httpRequestTimer
            };

            // WWB: Start The Time Out Timer
            httpRequestTimer.Start();

            // Make the Actual HTTP Request on A Background Worker Thread
            IAsyncResult asyncResult = httpWebRequest.BeginGetResponse(new AsyncCallback(HttpWebResponseRSSCallback), requestState);
        }