Exemplo n.º 1
0
        public override void Execute(object parameter)
        {
            var context = parameter as ContentTreeContext;

            if (context == null)
            {
                return;
            }

            var item = context.SelectedItems.FirstOrDefault() as SiteTreeViewItem;

            if (item == null)
            {
                return;
            }

            var d = new UpdateServerComponentsDialog();

            d.Initialize(item.Site.DataService, item.Site.Name, item.Site.WebRootPath, item.Site, null);
            try
            {
                AppHost.Shell.ShowDialog(d);
            }
            catch (Exception ex)
            {
                AppHost.Output.LogException(ex);
            }
        }
        protected override void Process(TroubleshooterPipeline pipeline)
        {
            Debug.ArgumentNotNull(pipeline, nameof(pipeline));

            if (pipeline.Exception == null)
            {
                return;
            }

            if (!(pipeline.Exception is EndpointNotFoundException))
            {
                return;
            }

            pipeline.Abort();

            pipeline.Cancelled = true;
            pipeline.Retry     = false;

            if (pipeline.Silent)
            {
                return;
            }

            if (pipeline.DataService is HardRockWebService && !pipeline.UpdatedServerComponents)
            {
                pipeline.UpdatedServerComponents = true;

                switch (AppHost.MessageBox("The web site does not respond.\n\nThe connection is using the Hard Rock Web Server which may not yet have been installed on the server.\n\nDo you want to update server components?", Resources.Information, MessageBoxButton.YesNoCancel, MessageBoxImage.Question))
                {
                case MessageBoxResult.Yes:
                    var d = new UpdateServerComponentsDialog();

                    d.Initialize(pipeline.DataService, string.Empty, string.Empty, null, null);
                    AppHost.Shell.ShowDialog(d);

                    pipeline.Cancelled = false;
                    pipeline.Retry     = true;
                    return;

                case MessageBoxResult.Cancel:
                    pipeline.Cancelled = true;
                    pipeline.Retry     = false;
                    return;
                }
            }

            if (AppHost.MessageBox("The web site does not respond.\n\nPlease make sure the web site is up and running.\n\nDo you want to retry?", Resources.Information, MessageBoxButton.YesNo, MessageBoxImage.Information) == MessageBoxResult.Yes)
            {
                pipeline.Cancelled = false;
                pipeline.Retry     = true;
            }
        }
Exemplo n.º 3
0
        public static bool HandleExecute([NotNull] string response, [NotNull] ExecuteResult executeResult, bool silent)
        {
            Assert.ArgumentNotNull(response, nameof(response));
            Assert.ArgumentNotNull(executeResult, nameof(executeResult));

            if (executeResult.Cancelled)
            {
                return(false);
            }

            if (executeResult.Error != null)
            {
                TroubleshooterPipeline.Run().WithParameters(executeResult.DataService, false, executeResult.Error, executeResult.DataService.GetEndpoint(), silent);
                return(false);
            }

            if (!response.Contains(@"***ERROR***"))
            {
                return(true);
            }

            var message = response.Mid(12).Trim();

            AppHost.Usage.ReportServerError(message);

            if (message == @"The system cannot find the file specified. (Exception from HRESULT: 0x80070002)")
            {
                if (silent)
                {
                    return(false);
                }

                if (AppHost.MessageBox(Resources.DataService_HandleExecute_MissingFile, Resources.Error, MessageBoxButton.OKCancel, MessageBoxImage.Error) != MessageBoxResult.OK)
                {
                    return(false);
                }

                var d = new UpdateServerComponentsDialog();
                d.Initialize(executeResult.DataService, string.Empty, string.Empty, null, null);
                AppHost.Shell.ShowDialog(d);

                return(false);
            }

            if (!silent)
            {
                AppHost.MessageBox(message, Resources.Error, MessageBoxButton.OK, MessageBoxImage.Error);
            }

            return(false);
        }