コード例 #1
0
        private bool LoadWSDLFileValidation(bool bShowMessage = true)
        {
            AddAPIModelWizard.ProcessStarted();
            xBrowseLoadButton.IsEnabled = false;
            string error = string.Empty;

            mWSDLParser = new WSDLParser();

            try
            {
                if (!mWSDLParser.ValidateWSDLURL(xURLTextBox.Text, URLRadioButton.IsChecked, ref error))
                {
                    throw new Exception(error);
                }

                XmlDocument doc = null;
                string      s   = xURLTextBox.Text;

                doc                       = GetDocumentFromWeb(s);
                PreviewContent            = doc;
                xPreviewButton.Visibility = Visibility.Visible;
            }
            catch (Exception ex)
            {
                if (bShowMessage)
                {
                    Reporter.ToUser(eUserMsgKey.FileOperationError, ex.Message);
                }
                error = error + Environment.NewLine + ex.Message;
                xPreviewButton.Visibility   = Visibility.Collapsed;
                SourceRviewLable.Visibility = Visibility.Collapsed;
                XMLViewer.Visibility        = Visibility.Collapsed;
                return(false);
            }
            finally
            {
                AddAPIModelWizard.ProcessEnded();
                xBrowseLoadButton.IsEnabled = true;
            }
            if (string.IsNullOrEmpty(error))
            {
                if (bShowMessage)
                {
                    Reporter.ToUser(eUserMsgKey.StaticInfoMessage, "Success : The File Loaded successfully");
                }
                return(true);
            }
            return(false);
        }
コード例 #2
0
        private async void LoadFileValidation()
        {
            AddAPIModelWizard.ProcessStarted();
            xBrowseLoadButton.IsEnabled = false;
            string error = string.Empty;

            mWSDLParser = new WSDLParser();



            try
            {
                if (!mWSDLParser.ValidateWSDLURL(xURLTextBox.Text, URLRadioButton.IsChecked, ref error))
                {
                    throw new Exception(error);
                }

                XmlDocument doc = null;
                string      s   = xURLTextBox.Text;

                await Task.Run(() => doc = GetDocumentFromWeb(s));

                PreviewContent            = doc;
                xPreviewButton.Visibility = Visibility.Visible;
                // AddAPIModelWizard.NextEnabled = true;
            }
            catch (Exception ex)
            {
                System.Windows.MessageBox.Show("Error Details:" + Environment.NewLine + ex.Message, "General Error Occurred", System.Windows.MessageBoxButton.OK, System.Windows.MessageBoxImage.Error, System.Windows.MessageBoxResult.None);
                error = error + Environment.NewLine + ex.Message;
                xPreviewButton.Visibility   = Visibility.Collapsed;
                SourceRviewLable.Visibility = Visibility.Collapsed;
                XMLViewer.Visibility        = Visibility.Collapsed;
                // AddAPIModelWizard.NextEnabled = false;
            }
            finally
            {
                AddAPIModelWizard.ProcessEnded();
                xBrowseLoadButton.IsEnabled = true;
            }
            if (string.IsNullOrEmpty(error))
            {
                System.Windows.MessageBox.Show("The File Loaded successfully", "Success", System.Windows.MessageBoxButton.OK, System.Windows.MessageBoxImage.Information, System.Windows.MessageBoxResult.None);
            }
        }