private void removeWebServiceToolStripMenuItem_Click(object sender, EventArgs e) { //Check if user selected any web service to remove if (gwWebServices.SelectedRows.Count <= 0) { return; } var selectedIndex = gwWebServices.SelectedRows[0].Index; if ((selectedIndex < 0) || (selectedIndex >= _webServicesList.Count)) { return; } //Get selected web service item var selectedItem = _webServicesList[selectedIndex]; //Confirm removing var dialogResult = MDSGuiHelper.ShowQuestionDialog( "Are you sure to remove web service: " + selectedItem.Url, "Comfirm removing?"); if (dialogResult != DialogResult.Yes) { return; } _webServicesList.RemoveAt(selectedIndex); }
private void ServerRightMenu_RemoveServer_Click(object sender, EventArgs e) { var removingServer = GetSelectedServer(); if (removingServer == null) { return; } if (removingServer.ServerInfo.Name == _thisServer.ServerInfo.Name) { MDSGuiHelper.ShowWarningMessage("You can not remove this server from graph!", "Attention!"); return; } var dialogResult = MDSGuiHelper.ShowQuestionDialog( "Are you sure to remove MDS Server " + removingServer.ServerInfo.Name + " (" + removingServer.ServerInfo.IpAddress + ") from graph.", "Confirm removing server!"); if (dialogResult != DialogResult.Yes) { return; } foreach (var adjacent in removingServer.Adjacents) { if (adjacent.Adjacents.Contains(removingServer)) { adjacent.Adjacents.Remove(removingServer); } } _servers.Remove(removingServer); pnlDesign.Controls.Remove(removingServer.LabelOfServer); _selectedLabel = null; pnlDesign.Invalidate(); }
private void btnRemoveApplication_Click(object sender, EventArgs e) { lock (_applicationList) { //Check if user selected any application to remove if (gwApplicationList.SelectedRows.Count <= 0) { return; } var selectedIndex = gwApplicationList.SelectedRows[0].Index; if ((selectedIndex < 0) || (selectedIndex >= _applicationList.Count)) { return; } //Get confirmation from user to remove application. var applicationName = _applicationList[selectedIndex].ApplicationName; var dialogResult = MDSGuiHelper.ShowQuestionDialog("Are you sure to remove '" + applicationName + "' application from MDS", "Attention! You are removing an application", MessageBoxDefaultButton.Button2); if (dialogResult != DialogResult.Yes) { return; } try { //Send RemoveApplicationMessage to MDS server var message = _controller.SendMessageAndGetResponse( new RemoveApplicationMessage { ApplicationName = applicationName }); //Check response message if (message.MessageTypeId != ControlMessageFactory.MessageTypeIdRemoveApplicationResponseMessage) { throw new MDSException("Response message to RemoveApplicationMessage must be as RemoveApplicationResponseMessage"); } var responseMessage = message as RemoveApplicationResponseMessage; if (responseMessage == null) { throw new MDSException("Incorrect type. MessageTypeId = " + message.MessageTypeId + ", but Type of object: " + message.GetType().Name); } //Evaluate response message if (responseMessage.Removed) { RemoveApplicationFromList(responseMessage.ApplicationName); } else { MDSGuiHelper.ShowWarningMessage(responseMessage.ResultMessage, applicationName + " application can not be removed!"); } } catch (Exception ex) { Logger.Error(ex.Message, ex); MDSGuiHelper.ShowErrorMessage(applicationName + " application can not be removed. Detail: " + ex.Message); } } }