/// <summary>
        /// Reports error occured due to failure of the specified service.
        /// </summary>
        /// <param name="service">The name of the failed service.</param>
        /// <param name="exception">The exception occured during reports building.</param>
        private void _ReportServiceError(string service, Exception exception)
        {
            Debug.Assert(exception != null);
            Debug.Assert(service != null);

            Logger.Error(exception);

            Link   link    = null;
            string message = string.Empty;

            if (exception is AuthenticationException || exception is CommunicationException)
            {
                message = SendRoutesHelper.AddServiceMessageWithDetail(service, exception);

                if (exception is AuthenticationException)
                {
                    link = new Link((string)_app.FindResource("LicencePanelText"),
                                    ESRI.ArcLogistics.App.Pages.PagePaths.LicensePagePath,
                                    ESRI.ArcLogistics.App.LinkType.Page);
                }
            }
            else
            {
                message = Properties.Resources.UnknownError;
            }

            var details = new List <MessageDetail>()
            {
                new MessageDetail(MessageType.Error, message, link)
            };

            _app.Messenger.AddError(Properties.Resources.SendingFailedMessage, details);
        }
        /// <summary>
        /// Starts sending process.
        /// </summary>
        private void _StartSendProcess()
        {
            Cursor cursor = _app.MainWindow.Cursor;

            try
            {
                _app.MainWindow.Cursor = Cursors.Wait;
                var sendRoutesHelper = new SendRoutesHelper();
                sendRoutesHelper.Initialize(_app, this);
                sendRoutesHelper.Execute(_routesConfigs);
            }
            finally
            {
                _app.MainWindow.Cursor = cursor;
            }
        }
        /// <summary>
        /// Formats service communication error.
        /// </summary>
        /// <param name="serviceName">Service name.</param>
        /// <param name="ex">Exception.</param>
        /// <returns>Communication error string.</returns>
        private string _FormatServiceCommunicationError(string serviceName,
                                                        CommunicationException ex)
        {
            switch (ex.ErrorCode)
            {
            case CommunicationError.ServiceTemporaryUnavailable:
            {
                var message = _app.GetString("ServiceTemporaryUnavailable", serviceName);
                return(message);
            }

            case CommunicationError.ServiceResponseTimeout:
            {
                var message = _app.GetString("ServiceResponseTimeout", serviceName);
                return(message);
            }

            default:
            {
                var message = _app.GetString("ServiceConnectionError", serviceName);
                return(SendRoutesHelper.FormatCommunicationError(message, ex));
            }
            }
        }
 /// <summary>
 /// Starts sending process.
 /// </summary>
 private void _StartSendProcess()
 {
     Cursor cursor = _app.MainWindow.Cursor;
     try
     {
         _app.MainWindow.Cursor = Cursors.Wait;
         var sendRoutesHelper = new SendRoutesHelper();
         sendRoutesHelper.Initialize(_app, this);
         sendRoutesHelper.Execute(_routesConfigs);
     }
     finally
     {
         _app.MainWindow.Cursor = cursor;
     }
 }