コード例 #1
0
        public static bool Execute([NotNull] DataService dataService, [NotNull] string serverName, [NotNull] string webRootPath, [CanBeNull] Site site)
        {
            Assert.ArgumentNotNull(dataService, nameof(dataService));
            Assert.ArgumentNotNull(serverName, nameof(serverName));
            Assert.ArgumentNotNull(webRootPath, nameof(webRootPath));

            var d = new UpdateServerComponentsDialog();

            d.Initialize(dataService, serverName, webRootPath, site, null);

            return(AppHost.Shell.ShowDialog(d) == true);
        }
コード例 #2
0
        public static void AutomaticUpdate([NotNull] DataService dataService, [NotNull] string serverName, [NotNull] string webRootPath, [NotNull] Site site)
        {
            Assert.ArgumentNotNull(dataService, nameof(dataService));
            Assert.ArgumentNotNull(serverName, nameof(serverName));
            Assert.ArgumentNotNull(webRootPath, nameof(webRootPath));

            var d = new UpdateServerComponentsDialog();

            Action completed = delegate
            {
                if (!d.Updates.Any(info => info.IsChecked))
                {
                    return;
                }

                Action a = delegate
                {
                    if (d.Updates.Any(info => info.IsChecked))
                    {
                        AppHost.Shell.ShowDialog(d);
                    }
                };

                try
                {
                    d.DoInstall(a);
                }
                catch (Exception ex)
                {
                    AppHost.Shell.HandleException(ex);

                    // AppHost.MessageBox("Failed to update.\n\nMessage: " + ex.Message, "Error", MessageBoxButton.OK, MessageBoxImage.Error);
                }
            };

            d.Initialize(dataService, serverName, webRootPath, site, completed);
        }