public GetAllMapsResult GetAllMaps() { var service = new DOMAService(); service.Url = WebServiceUrl; var request = new GetAllMapsRequest { Username = Username, Password = Password }; var response = service.GetAllMaps(request); var result = new GetAllMapsResult { ErrorMessage = response.ErrorMessage, Success = response.Success, }; if (response.Success) { result.Maps = new List <MapInfo>(); foreach (var map in response.Maps) { result.Maps.Add(TranslateMapInfo(map)); } } return(result); }
private GetAllMapsResult GetAllMaps() { GetAllMapsResult getAllMapsResult = mapPublisher.GetAllMaps(); if (getAllMapsResult.Success) { allMaps = getAllMapsResult.Maps; var newMap = new MapInfo { ID = 0, Name = string.Format("[{0}]", Strings.NewMap) }; allMaps.Insert(0, newMap); } return(getAllMapsResult); }
private void Connect() { mapPublisher.Password = password.Text; mapPublisher.Username = username.Text; mapPublisher.WebServiceUrl = webServiceURL.Text; allMaps.Clear(); ConnectResult connectResult; GetAllMapsResult getAllMapsResult = null; GetAllCategoriesResult getAllCategoriesResult = null; try { Cursor = Cursors.WaitCursor; connectResult = mapPublisher.Connect(); Cursor = Cursors.Default; if (connectResult.Success) { Cursor = Cursors.WaitCursor; SaveConnectionSettings(); PopulateUsernameComboBox(); getAllMapsResult = GetAllMaps(); getAllCategoriesResult = mapPublisher.GetAllCategories(); } } catch (Exception ex) { connectResult = new ConnectResult { Success = false, ErrorMessage = ex.Message, Version = null }; } Cursor = Cursors.Default; map.DataSource = allMaps; var success = true; if (!connectResult.Success) { MessageBox.Show(connectResult.ErrorMessage, Strings.Error_MapPublishCommunication, MessageBoxButtons.OK, MessageBoxIcon.Error); success = false; } if (getAllMapsResult != null && !getAllMapsResult.Success) { MessageBox.Show(getAllMapsResult.ErrorMessage, Strings.Error_MapPublishCommunication, MessageBoxButtons.OK, MessageBoxIcon.Error); success = false; } if (getAllCategoriesResult != null && !getAllCategoriesResult.Success) { MessageBox.Show(getAllCategoriesResult.ErrorMessage, Strings.Error_MapPublishCommunication, MessageBoxButtons.OK, MessageBoxIcon.Error); success = false; } if (getAllCategoriesResult != null) { category.DataSource = getAllCategoriesResult.Categories; } SetControlEnabledState(success); if (map.Items.Count > 0) { map.SelectedIndex = 0; } }