示例#1
0
        private void btnSaveGraph_Click(object sender, EventArgs e)
        {
            btnSaveGraph.Enabled = false;
            Application.DoEvents();

            try
            {
                CheckGraph();
                _serverGraphInfo = CreateServerGraphInfo();

                //Send message to the server and get response
                var message = _controller.SendMessageAndGetResponse(
                    new UpdateServerGraphMessage {
                    ServerGraph = _serverGraphInfo
                }
                    );

                //Check response message
                if (message.MessageTypeId != ControlMessageFactory.MessageTypeIdOperationResultMessage)
                {
                    throw new MDSException("Response message to UpdateServerGraphMessage must be a OperationResultMessage");
                }

                var updateResponseMessage = message as OperationResultMessage;
                if (updateResponseMessage == null)
                {
                    throw new MDSException("Incorrect message type. MessageTypeId = " + message.MessageTypeId + ", but Type of object: " + message.GetType().Name);
                }

                //Inform user about update result
                if (updateResponseMessage.Success)
                {
                    MDSGuiHelper.ShowInfoDialog("Server graph is successfully updated on server", "Success.");
                }
                else
                {
                    MDSGuiHelper.ShowErrorMessage(
                        "Server graph can not be updated on server. Reason: " + updateResponseMessage.ResultMessage,
                        "Failed!");
                }
            }
            catch (Exception ex)
            {
                MDSGuiHelper.ShowWarningMessage("Can not save graph. " + ex.Message);
            }
            finally
            {
                btnSaveGraph.Enabled = true;
            }
        }
示例#2
0
        private void btnGenerateCode_Click(object sender, EventArgs e)
        {
            btnGenerateCode.Enabled = false;
            Application.DoEvents();

            try
            {
                GenerateCode();
                MDSGuiHelper.ShowInfoDialog("Proxy classes are generated.", "Success.");
            }
            catch (Exception ex)
            {
                MDSGuiHelper.ShowErrorMessage(ex.Message);
            }
            finally
            {
                btnGenerateCode.Enabled = true;
            }
        }
示例#3
0
        /// <summary>
        /// Sends new web service list to server.
        /// </summary>
        private void SendChangesToServer()
        {
            try
            {
                var wsList = new ApplicationWebServiceInfo[_webServicesList.Count];
                for (var i = 0; i < _webServicesList.Count; i++)
                {
                    wsList[i] = new ApplicationWebServiceInfo {
                        Url = _webServicesList[i].Url
                    };
                }

                var responseMessage = _controller.SendMessageAndGetResponse(new UpdateApplicationWebServicesMessage {
                    ApplicationName = txtAppName.Text, WebServices = wsList
                });
                if (responseMessage.MessageTypeId != ControlMessageFactory.MessageTypeIdOperationResultMessage)
                {
                    throw new MDSException("Response message to UpdateApplicationWebServicesMessage must be a OperationResultMessage");
                }

                var operationResultMessage = responseMessage as OperationResultMessage;
                if (operationResultMessage == null)
                {
                    throw new MDSException("Incorrect message type. MessageTypeId = " + responseMessage.MessageTypeId + ", but Type of object: " + responseMessage.GetType().Name);
                }

                //Check result
                if (!operationResultMessage.Success)
                {
                    MDSGuiHelper.ShowWarningMessage(operationResultMessage.ResultMessage);
                    return;
                }

                //Success
                MDSGuiHelper.ShowInfoDialog("Updated web services for application '" + txtAppName.Text + "'.", "Success");
            }
            catch (Exception ex)
            {
                Logger.Error(ex.Message, ex);
                MDSGuiHelper.ShowErrorMessage("Error occured while sending web service list to server. Error detail: " + ex.Message);
            }
        }