Example #1
0
        public async Task Test(MusicEndpoint endpoint)
        {
            string     userFeedback = null;
            RemoteBase session      = null;

            try {
                switch (endpoint.EndpointType)
                {
                case EndpointTypes.Local:
                    break;

                case EndpointTypes.MusicPimp:
                    session = ProviderService.Instance.NewPimpSession(endpoint);
                    break;

                case EndpointTypes.PimpCloud:
                    session = new CloudSession(endpoint);
                    break;

                case EndpointTypes.Subsonic:
                    session = new SubsonicSession(endpoint);
                    break;
                }
                if (session != null)
                {
                    try {
                        FeedbackMessage = String.Empty;
                        IsLoading       = true;
                        await session.TestConnectivity();

                        userFeedback = "Connection successfully established.";
                    } finally {
                        IsLoading = false;
                    }
                }
            } catch (UnauthorizedException) {
                userFeedback = "Check your credentials.";
            } catch (ConnectivityException) {
                userFeedback = GetFeedback(endpoint, session);
            } catch (NotFoundException) {
                userFeedback = GetFeedback(endpoint, session);
            } catch (PimpException pe) {
                userFeedback = pe.Message;
            } catch (ServerResponseException sre) {
                userFeedback = sre.Message;
            } catch (HttpRequestException) {
                userFeedback = GetFeedback(endpoint, session);
            } catch (Exception) {
                userFeedback = "Something went wrong. Please check that all the fields are filled in properly.";
            }

            if (userFeedback != null)
            {
                OnFeedback(userFeedback);
            }
        }
Example #2
0
        protected override void DoDeploy(CloudSession session, string id, CloudTemplate template, IConfigSectionNode customData)
        {
            var aSession = (AzureSession)session;

            doDeploy(aSession.SubscriptionID, aSession.AccessToken, id, (AzureTemplate)template, customData);
        }