public void RefreshService()
        {
            if (!this.ParentServiceConnected)
            {
                AGSConnection.ReestablishConnection(this.ConnectionURL, this.ConnectionName, this.UserName);
            }
            if (!this.ReconnectService())
            {
                Mouse.OverrideCursor = null;
                ErrorReport.ShowErrorMessage(AfaStrings.UnableToConnectService + this.Name);
                return;
            }
            if (!this.ParentDataset.ParentDocument.IsActive)
            {
                return;
            }
            Mouse.OverrideCursor = System.Windows.Input.Cursors.Wait;
            Editor editor = this.ParentDataset.ParentDocument.Editor;

            if (!this.RequestUpdateNow())
            {
                editor.WriteMessage(AfaStrings.InvalidExtent);
            }
            if (!string.IsNullOrEmpty(this.ParentService.ErrorMessage))
            {
                editor.WriteMessage(this.ParentService.ErrorMessage);
            }
            this.CancelRequests  = false;
            Mouse.OverrideCursor = null;
        }
        public static AGSImageService BuildImageServiceFromURL(string Name, string URL)
        {
            AGSImageService aGSImageService = null;
            AGSImageService result;

            try
            {
                string text = AGSConnection.BuildConnectionURL(URL);
                if (string.IsNullOrEmpty(text))
                {
                    result = aGSImageService;
                }
                else
                {
                    AGSConnection aGSConnection = AGSConnection.ReestablishConnection(text, null, "");
                    if (aGSConnection != null)
                    {
                        try
                        {
                            string name = AGSImageService.BuildFullNameFromURL(URL);
                            if (string.IsNullOrEmpty(Name))
                            {
                                Name = AGSImageService.BuildNameFromURL(URL);
                            }
                            aGSImageService      = new AGSImageService(name, aGSConnection);
                            aGSImageService.Name = Name;
                            if (aGSImageService.IsValid)
                            {
                                result = aGSImageService;
                                return(result);
                            }
                            result = null;
                            return(result);
                        }
                        catch
                        {
                            result = null;
                            return(result);
                        }
                    }
                    result = null;
                }
            }
            catch
            {
                result = null;
            }
            return(result);
        }