示例#1
0
        public static void BackupInstance(InstallWizardArgs args)
        {
            var id = MainWindowHelper.GetListItemID(args.Instance.ID);

            Assert.IsTrue(id >= 0, "id ({0}) should be >= 0".FormatWith(id));
            WizardPipelineManager.Start("backup", args.WizardWindow, new BackupArgs(args.Instance, ProfileManager.GetConnectionString(), null, true, true), null, ignore => MainWindowHelper.MakeInstanceSelected(id), () => new BackupSettingsWizardArgs(args.Instance));
        }
示例#2
0
        public static void PublishSite(InstallWizardArgs args)
        {
            MainWindowHelper.RefreshInstances();
            var instance = InstanceManager.Default.GetInstance(args.InstanceName);

            new PublishButton().OnClick(MainWindow.Instance, instance);
        }
        public void OnClick(Window mainWindow, Instance instance)
        {
            using (new ProfileSection("Refresh main window instances", this))
            {
                ProfileSection.Argument("mainWindow", mainWindow);
                ProfileSection.Argument("instance", instance);

                var refreshMode = this.GetMode(mainWindow);
                switch (refreshMode)
                {
                case RefreshMode.Instances:
                    MainWindowHelper.RefreshInstances();
                    return;

                case RefreshMode.Installer:
                    MainWindowHelper.RefreshInstaller();
                    return;

                case RefreshMode.Caches:
                    MainWindowHelper.RefreshCaches();
                    return;

                case RefreshMode.Everything:
                    MainWindowHelper.RefreshEverything();
                    return;
                }
            }
        }
        public static void BackupInstance(InstallWizardArgs args)
        {
            int id = MainWindowHelper.GetListItemID(args.Instance.ID);

            Assert.IsTrue(id >= 0, "id ({0}) should be >= 0".FormatWith(id));
            WizardPipelineManager.Start("backup", args.WizardWindow, new BackupArgs(args.Instance, null, true, true), null, () => MainWindowHelper.MakeInstanceSelected(id), args.Instance);
        }
示例#5
0
        public MainWindow()
        {
            InitializeComponent();
            var factory = new AppWindowWidgetFactory();

            MainWindowHelper.configure(this, Panel, factory);
        }
示例#6
0
        public MainWindow()
        {
            InitializeComponent();
            MainWindowHelper vm = MainWindowHelper.Instance;

            vm.CloseAction = new Action(this.Hide);
        }
 public void OnClick(Window mainWindow, Instance instance)
 {
     WindowHelper.ShowDialog <SettingsDialog>(null, mainWindow);
     if (!LifeManager.IsRestarting)
     {
         MainWindowHelper.Initialize();
     }
 }
 public void OnClick(Window mainWindow, Instance instance)
 {
     if (instance != null)
     {
         var id = MainWindowHelper.GetListItemID(instance.ID);
         WizardPipelineManager.Start("backup", mainWindow, new BackupArgs(instance, ProfileManager.GetConnectionString()), null, ignore => MainWindowHelper.MakeInstanceSelected(id), () => new BackupSettingsWizardArgs(instance));
     }
 }
示例#9
0
 public void OnClick(Window mainWindow, Instance instance)
 {
     if (instance != null)
     {
         var id = MainWindowHelper.GetListItemID(instance.ID);
         WizardPipelineManager.Start("export", mainWindow, new ExportArgs(instance, false, true, true, true, false, false, false, false, false), null, ignore => MainWindowHelper.MakeInstanceSelected(id), () => new ExportWizardArgs(instance, string.Empty));
     }
 }
 public void OnClick(Window mainWindow, Instance instance)
 {
     if (instance != null)
     {
         var id = MainWindowHelper.GetListItemID(instance.ID);
         WizardPipelineManager.Start("installmodules", mainWindow, null, null, ignore => MainWindowHelper.MakeInstanceSelected(id), () => new InstallModulesWizardArgs(instance));
     }
 }
 public void OnClick(Window mainWindow, Instance instance)
 {
     if (instance != null)
     {
         var id = MainWindowHelper.GetListItemID(instance.ID);
         WizardPipelineManager.Start("backup", mainWindow, new BackupArgs(instance), null, () => MainWindowHelper.MakeInstanceSelected(id), instance);
     }
 }
示例#12
0
 public void OnClick(Window mainWindow, Instance instance)
 {
     if (instance != null)
     {
         var args = new RestoreArgs(instance);
         var id   = MainWindowHelper.GetListItemID(instance.ID);
         WizardPipelineManager.Start("restore", mainWindow, args, null, () => MainWindowHelper.MakeInstanceSelected(id), instance);
     }
 }
 public void OnClick(Window mainWindow, Instance instance)
 {
     if (instance != null)
     {
         var args = new RestoreArgs(instance, new SqlConnectionStringBuilder(Profile.Read(new RealFileSystem()).ConnectionString));
         var id   = MainWindowHelper.GetListItemID(instance.ID);
         WizardPipelineManager.Start("restore", mainWindow, args, null, ignore => MainWindowHelper.MakeInstanceSelected(id), () => new RestoreWizardArgs(instance));
     }
 }
        private static void OnWizardCompleted(int index, bool hasInstallationBeenCompleted)
        {
            if (hasInstallationBeenCompleted)
            {
                MainWindowHelper.SoftlyRefreshInstances();
            }

            MainWindowHelper.MakeInstanceSelected(index);
        }
示例#15
0
        public void OnClick(Window mainWindow, Instance instance)
        {
            var result = WindowHelper.ShowDialog <SettingsDialog>(null, mainWindow);

            if (result != null)
            {
                MainWindowHelper.Initialize();
            }
        }
        public void OnClick(Window mainWindow, Instance instance)
        {
            Analytics.TrackEvent("InstallModules");

            if (instance != null)
            {
                var id = MainWindowHelper.GetListItemID(instance.ID);
                WizardPipelineManager.Start("installmodules", mainWindow, null, null, ignore => MainWindowHelper.MakeInstanceSelected(id), instance);
            }
        }
示例#17
0
        public void OnClick(Window mainWindow, Instance instance)
        {
            Analytics.TrackEvent("Backup");

            if (instance != null)
            {
                var id = MainWindowHelper.GetListItemID(instance.ID);
                WizardPipelineManager.Start("backup", mainWindow, new BackupArgs(instance), null, ignore => MainWindowHelper.MakeInstanceSelected(id), () => new BackupSettingsWizardArgs(instance));
            }
        }
        public void OnClick(Window mainWindow, Instance instance)
        {
            Analytics.TrackEvent("Export");

            if (instance != null)
            {
                var id = MainWindowHelper.GetListItemID(instance.ID);
                WizardPipelineManager.Start("export", mainWindow, new ExportArgs(instance, false, true, true, true, false, false, false, false, false), null, () => MainWindowHelper.MakeInstanceSelected(id), instance, string.Empty);
            }
        }
        public void OnClick(Window mainWindow, Instance instance)
        {
            Assert.ArgumentNotNull(mainWindow, nameof(mainWindow));

            Analytics.TrackEvent("Import");

            var fileDialog = new OpenFileDialog
            {
                Title       = "Select zip file of exported solution",
                Multiselect = false,
                DefaultExt  = ".zip"
            };

            fileDialog.ShowDialog();
            var filePath = fileDialog.FileName;

            if (string.IsNullOrEmpty(filePath))
            {
                return;
            }

            Log.Info($"Importing solution from {filePath}");
            var fileSystem = new RealFileSystem();
            var file       = fileSystem.ParseFile(filePath);

            using (var zipFile = new RealZipFile(fileSystem.ParseFile(file.FullName)))
            {
                const string AppPoolFileName = "AppPoolSettings.xml";
                var          appPool         = zipFile.Entries.Contains(AppPoolFileName);
                if (!appPool)
                {
                    WindowHelper.ShowMessage("Wrong package for import. The package does not contain the {0} file.".FormatWith(AppPoolFileName));
                    return;
                }

                const string WebsiteSettingsFileName = "WebsiteSettings.xml";
                var          websiteSettings         = zipFile.Entries.Contains(WebsiteSettingsFileName);
                if (!websiteSettings)
                {
                    WindowHelper.ShowMessage("Wrong package for import. The package does not contain the {0} file.".FormatWith(WebsiteSettingsFileName));

                    return;
                }

                const string WebConfigFileName = @"Website/Web.config";
                if (!zipFile.Entries.Contains(WebConfigFileName))
                {
                    WindowHelper.ShowMessage("Wrong package for import. The package does not contain the {0} file.".FormatWith(WebConfigFileName));

                    return;
                }
            }

            WizardPipelineManager.Start("import", mainWindow, null, null, ignore => MainWindowHelper.SoftlyRefreshInstances(), () => new ImportWizardArgs(file.FullName));
        }
示例#20
0
 public void OnClick(Window mainWindow, Instance instance)
 {
     if (instance != null)
     {
         var connectionString = ProfileManager.GetConnectionString();
         var args             = new DeleteArgs(instance, connectionString);
         args.OnCompleted += () => mainWindow.Dispatcher.Invoke(() => OnPipelineCompleted(args.RootPath));
         var index = MainWindowHelper.GetListItemID(instance.ID);
         WizardPipelineManager.Start("delete", mainWindow, args, null, (ignore) => OnWizardCompleted(index), () => null);
     }
 }
        public void OnClick(Window mainWindow, Instance instance)
        {
            Analytics.TrackEvent("Restore");

            if (instance != null)
            {
                var args = new RestoreArgs(instance);
                var id   = MainWindowHelper.GetListItemID(instance.ID);
                WizardPipelineManager.Start("restore", mainWindow, args, null, ignore => MainWindowHelper.MakeInstanceSelected(id), () => new RestoreWizardArgs(instance));
            }
        }
示例#22
0
        private void LogOff_Clicked(object sender, RoutedEventArgs e)
        {
            MessageBoxResult messageBoxResult = System.Windows.MessageBox.Show("Are you sure?", "Log off confirmation", System.Windows.MessageBoxButton.YesNo);

            if (messageBoxResult == MessageBoxResult.Yes)
            {
                MainWindowHelper vm          = MainWindowHelper.Instance;
                AdminUserHelper  adminHelper = AdminUserHelper.Instance;
                adminHelper.admin = null;
                MainWindow mw = new MainWindow();
                mw.Show();
                this.Close();
            }
        }
示例#23
0
        public void OnClick(Window mainWindow, Instance instance)
        {
            if (instance != null)
            {
                if (this.StopMode)
                {
                    instance.Stop();
                    return;
                }

                if (this.StartMode)
                {
                    instance.Start();
                    return;
                }

                if (this.RecycleMode)
                {
                    instance.Recycle();
                    return;
                }

                if (this.KillMode)
                {
                    MainWindowHelper.KillProcess(instance);
                    return;
                }

                if (this.ChangeMode)
                {
                    this.DoChangeMode(mainWindow, instance);
                    return;
                }

                // if (this.FavoriteMode)
                // {
                // InstanceHelperEx.ToggleFavorite(mainWindow, instance);
                // return;
                // }

                // if (this.DisabledMode)
                // {
                // instance.IsDisabled = !instance.IsDisabled;
                // return;
                // }
                Assert.IsTrue(false, "Impossible");
            }
        }
        public void OnClick(Window mainWindow, Instance instance)
        {
            if (instance != null)
            {
                if (!MainWindowHelper.IsInstallerReady())
                {
                    WindowHelper.ShowMessage(@"The installer isn't ready - check the Settings window", MessageBoxButton.OK, MessageBoxImage.Exclamation, MessageBoxResult.OK);
                    return;
                }

                string license = ProfileManager.Profile.License;
                Assert.IsNotNull(license, @"The license file isn't set in the Settings window");
                FileSystem.FileSystem.Local.File.AssertExists(license, "The {0} file is missing".FormatWith(license));

                MainWindowHelper.ReinstallInstance(instance, mainWindow, license, ProfileManager.GetConnectionString());
            }
        }
        public void OnClick(Window mainWindow, Instance instance)
        {
            var path = ExpandPath(instance).Replace("/", "\\");

            if (!FileSystem.FileSystem.Local.Directory.Exists(path))
            {
                var answer = WindowHelper.ShowMessage("The folder does not exist. Would you create it?\n\n" + path, MessageBoxButton.OKCancel, MessageBoxImage.Asterisk);
                if (answer != MessageBoxResult.OK)
                {
                    return;
                }

                FileSystem.FileSystem.Local.Directory.CreateDirectory(path);
            }

            MainWindowHelper.OpenFolder(path);
        }
        public void OnClick([NotNull] Window mainWindow, [CanBeNull] Instance instance)
        {
            WizardPipelineManager.Start("install9", mainWindow, null, null, (args) =>
            {
                if (args == null)
                {
                    return;
                }

                var install = (InstallWizardArgs)args;
                var product = install.Product;

                if (install.HasInstallationBeenCompleted)
                {
                    MainWindowHelper.SoftlyRefreshInstances();
                }
            }, () => new Install9WizardArgs());
        }
示例#27
0
        public void OnClick(Window mainWindow, Instance instance)
        {
            using (new ProfileSection("Publish", this))
            {
                ProfileSection.Argument("mainWindow", mainWindow);
                ProfileSection.Argument("instance", instance);

                var modeText = GetMode(mainWindow);

                if (modeText == null || modeText == CancelOption)
                {
                    return;
                }

                var mode = ParseMode(modeText);
                MainWindowHelper.Publish(instance, mainWindow, mode);
            }
        }
        public void OnClick(Window mainWindow, Instance instance)
        {
            if (instance != null)
            {
                var connectionString = ProfileManager.GetConnectionString();
                var args             = new DeleteArgs(instance, connectionString);
                args.OnCompleted += () => mainWindow.Dispatcher.Invoke(() => OnPipelineCompleted(args));
                var index = MainWindowHelper.GetListItemID(instance.ID);
                int version;
                if (int.TryParse(instance.Product.ShortVersion, out version) && version < 90)
                {
                    WizardPipelineManager.Start("delete", mainWindow, args, null, (ignore) => OnWizardCompleted(index, args.HasInstallationBeenCompleted), () => null);
                }
                else
                {
                    string uninstallPath    = string.Empty;
                    SitecoreEnvironment env = SitecoreEnvironmentHelper.GetExistingSitecoreEnvironment(instance.Name);
                    if (!string.IsNullOrEmpty(env?.UnInstallDataPath))
                    {
                        uninstallPath = env.UnInstallDataPath;
                    }
                    else
                    {
                        foreach (string installName in Directory.GetDirectories(ApplicationManager.UnInstallParamsFolder).OrderByDescending(s => s.Length))
                        {
                            if (instance.Name.StartsWith(Path.GetFileName(installName)))
                            {
                                uninstallPath = installName;
                                break;
                            }
                        }
                    }
                    if (string.IsNullOrEmpty(uninstallPath))
                    {
                        WindowHelper.ShowMessage("UnInstall files not found.");
                        return;
                    }

                    Delete9WizardArgs delete9WizardArgsargs = new Delete9WizardArgs(instance, connectionString, uninstallPath);
                    WizardPipelineManager.Start("delete9", mainWindow, null, null, (ignore) => OnWizardCompleted(index, delete9WizardArgsargs.HasInstallationBeenCompleted), () => delete9WizardArgsargs);
                }
            }
        }
示例#29
0
        private async void button_Click(object sender, RoutedEventArgs e)
        {
            MainWindowHelper vm        = MainWindowHelper.Instance;
            string           okMessage = "\"ok\"";
            string           url       = baseUrl + "LogIn";
            var logInContent           = new JObject();

            logInContent.Add("Email", emailField.Text);
            logInContent.Add("Password", passwordField.Password);
            HttpContent content      = new StringContent(logInContent.ToString(), Encoding.UTF8, "application/json");
            var         responseBody = client.PostAsJsonAsync(url, logInContent).Result;
            string      response     = await responseBody.Content.ReadAsStringAsync();

            if (okMessage.Equals(response))
            {
                string uri   = baseUrl + "Info";
                var    email = new JObject();
                email.Add("email", emailField.Text);
                HttpContent content2  = new StringContent(email.ToString(), Encoding.UTF8, "application/json");
                var         response2 = client.PostAsync(uri, content2).Result;
                if (response2.IsSuccessStatusCode)
                {
                    var responseJsonString = await response2.Content.ReadAsStringAsync();

                    var             deserialized = JsonConvert.DeserializeObject <AdministratorCast>(responseJsonString);
                    AdminUserHelper adminHelper  = AdminUserHelper.Instance;
                    adminHelper.admin = deserialized;
                    AdministratorWindow administratorWindow = new AdministratorWindow();
                    administratorWindow.Show();
                    vm.CloseAction();
                }
                else
                {
                    MessageBox.Show(response2.ReasonPhrase);
                }
            }
            else
            {
                responseBox.Content = response;
            }
        }
示例#30
0
        public void OnClick(Window mainWindow, Instance instance)
        {
            Analytics.TrackEvent("Install");

            Assert.IsTrue(ProfileManager.IsValid, "Some of configuration settings are invalid - please fix them in Settings dialog and try again");
            Assert.IsTrue(ProductManager.StandaloneProducts.Any(),
                          $@"You don't have any standalone product package in your repository. Options to solve:

1. (recommended) Use Ribbon -> Home -> Bundled Tools -> Download Sitecores button to download them.

2. If you already have them then you can either: 

* change the local repository folder (Ribbon -> Home -> Settings button) to the one that contains the files 

* put the files into the current local repository folder: 
{ProfileManager.Profile.LocalRepository}");

            if (EnvironmentHelper.CheckSqlServer())
            {
                WizardPipelineManager.Start("install", mainWindow, null, null, (args) =>
                {
                    MainWindowHelper.SoftlyRefreshInstances();

                    if (args == null)
                    {
                        return;
                    }

                    var install = (InstallWizardArgs)args;
                    var product = install.Product;
                    if (product == null)
                    {
                        return;
                    }

                    Analytics.TrackEvent($"install-{product.Version}");
                }, () => new InstallWizardArgs());
            }
        }