Ejemplo n.º 1
0
        static ActionResult DispatcherUI(Session session, string methodName)
        {
            CustomActionProperties properties = new CustomActionProperties(session);
              SqlWorkersFactory factory = new SqlWorkersFactory();

              switch (methodName)
              {
            case "InstallerInitializeUI":
              //System.Diagnostics.Debugger.Launch();
              // Добавляем общие действия.
              CommonInitialization(session, properties);
              // Определяем сервера и путь к exe-файлам экземплярам серверов.
              ActionEngine.Instance.AddWorker(new ActionDefineSqlServerPathWorker(session, factory));
              // Определяем список установленных баз данных на различных серверах.
              ActionEngine.Instance.AddWorker(new ActionSelectDatabasesWorker(session, ActionSelectDatabasesWorkerMode.Initialization, properties.SelectDatabases, factory));
              // Инициализируем компоненты.
              // Заполняем серверами.
              ActionEngine.Instance.AddWorker(new ActionServerUIControlWorker(session, properties.ServerUIControl));
              // Заполняем базами данных.
              ActionEngine.Instance.AddWorker(new ActionDatabaseUIControlWorker(session, properties.DatabaseUIControl));
              // Создание элемента управления на стандартной форме для доступа к файлу отчета.
              ActionEngine.Instance.AddWorker(new ActionWidgetCreaterWorker(session, properties.WidgetCreater));
              break;
            case "AddDatabaseToList":
              //System.Diagnostics.Debugger.Launch();
              ActionEngine.Instance.AddWorker(new ActionSelectDatabasesWorker(session, ActionSelectDatabasesWorkerMode.AddingNew, properties.SelectDatabases, factory));
              // Заново заполним компонент.
              ActionEngine.Instance.AddWorker(new ActionDatabaseUIControlWorker(session, properties.DatabaseUIControl));
              break;
            case "AddExistDatabaseToList":
              //System.Diagnostics.Debugger.Launch();
              ActionEngine.Instance.AddWorker(new ActionSelectDatabasesWorker(session, ActionSelectDatabasesWorkerMode.AddingExisting, properties.SelectDatabases, factory));
              // Заново заполним компонент.
              ActionEngine.Instance.AddWorker(new ActionDatabaseUIControlWorker(session, properties.DatabaseUIControl));
              break;
            case "DeleteDatabaseFromList":
              //System.Diagnostics.Debugger.Launch();
              // Удаляем из сессии информацию о базе данных.
              ActionEngine.Instance.AddWorker(new ActionSelectDatabasesWorker(session, ActionSelectDatabasesWorkerMode.Deleting, properties.SelectDatabases, factory));
              // Заново заполним компонент.
              ActionEngine.Instance.AddWorker(new ActionDatabaseUIControlWorker(session, properties.DatabaseUIControl));
              break;
            case "CheckConnectionDatabaseNotExist":
              //System.Diagnostics.Debugger.Launch();
              ActionEngine.Instance.AddWorker(new ActionCheckConnectionWorker(session, CheckConnectionType.DatabaseMustNotExist, properties.CheckConnection, factory));
              break;
            case "InitializationFinishInfo":
              //System.Diagnostics.Debugger.Launch();
              // Вывод сводной информации об установке
              ActionEngine.Instance.AddWorker(new ActionInitializationFinishInfoWorker(session, properties.InitializationFinishInfo, false));
              break;
            case "ClearFinishInfo":
              //System.Diagnostics.Debugger.Launch();
              // Очистка информации об установке
              ActionEngine.Instance.AddWorker(new ActionInitializationFinishInfoWorker(session, properties.InitializationFinishInfo, true));
              break;
              }

              return ActionEngine.Instance.Run();
        }
Ejemplo n.º 2
0
        static ActionResult DispatcherExecute(Session session, string methodName)
        {
            CustomActionProperties properties = new CustomActionProperties(session);
              SqlWorkersFactory factory = new SqlWorkersFactory();

              switch (methodName)
              {
            case "AfterInstallInitializeImmediate":
              //System.Diagnostics.Debugger.Launch();
              // Добавляем общие действия.
              CommonInitialization(session, properties);
              // Пишем в отчет о старте установки (самым первым после установки UIType).
              ActionEngine.Instance.AddWorker(new ActionInstallReportWorker(session, ActionInstallReportWorkerMode.Start));
              // До выполнения плагинов (так как это действие выполяется первым), необходимо создать временную директорию в данном действии.
              ActionEngine.Instance.AddWorker(new ActionTempDirectoryControlWorker(session, ActionTempDirectoryControlWorkerMode.Create));
              ActionEngine.Instance.AddWorker(new ActionMefControlWorker(session, true));
              break;
            case "AfterInstallInitializeDeferred":
              //System.Diagnostics.Debugger.Launch();
              ActionEngine.Instance.AddWorker(new ActionMefControlWorker(session));
              break;
            case "AfterInstallInitializeRollback":
              //System.Diagnostics.Debugger.Launch();
              // Пишем в отчет об отмене установки (самым первым).
              ActionEngine.Instance.AddWorker(new ActionInstallReportWorker(session, ActionInstallReportWorkerMode.IsNotFinished));
              ActionEngine.Instance.AddWorker(new ActionMefControlWorker(session));
              // В случае сбоя необходимо удалить временную директорию.
              ActionEngine.Instance.AddWorker(new ActionTempDirectoryControlWorker(session, ActionTempDirectoryControlWorkerMode.Delete));
              break;
            case "BeforeInstallFinalizeImmediate":
              //System.Diagnostics.Debugger.Launch();
              ActionEngine.Instance.AddWorker(new ActionMefControlWorker(session));
              break;
            case "BeforeInstallFinalizeDeferred":
              //System.Diagnostics.Debugger.Launch();
              ActionEngine.Instance.AddWorker(new ActionMefControlWorker(session));
              // После выполнения плагинов, необходимо удалить временную директорию.
              ActionEngine.Instance.AddWorker(new ActionTempDirectoryControlWorker(session, ActionTempDirectoryControlWorkerMode.Delete));
              // Пишем в отчет об окончании установки (самым последним).
              ActionEngine.Instance.AddWorker(new ActionInstallReportWorker(session, ActionInstallReportWorkerMode.IsFinished));
              break;
            case "BeforeInstallFinalizeRollback":
              //System.Diagnostics.Debugger.Launch();
              ActionEngine.Instance.AddWorker(new ActionMefControlWorker(session));
              break;
            case "RestoringDataBaseImmediate":
              //System.Diagnostics.Debugger.Launch();
              ActionEngine.Instance.AddWorker(new ActionRestoringDatabaseWorker(session, factory, new string[] { "RestoringDataBaseDeferred", "RestoringDataBaseRollback" }));
              break;
            case "RestoringDataBaseDeferred":
              //System.Diagnostics.Debugger.Launch();
              ActionEngine.Instance.AddWorker(new ActionRestoringDatabaseWorker(session, factory));
              break;
            case "RestoringDataBaseRollback":
              //System.Diagnostics.Debugger.Launch();
              ActionEngine.Instance.AddWorker(new ActionRestoringDatabaseWorker(session, factory));
              break;
            case "RunSqlScriptImmediate":
              //System.Diagnostics.Debugger.Launch();
              ActionEngine.Instance.AddWorker(new ActionRunSqlScriptNewDbWorker(session, factory, new string[] { "RunSqlScriptDeferred", "RunSqlScriptRollback" }));
              ActionEngine.Instance.AddWorker(new ActionRunSqlScriptExistingDbWorker(session, factory, properties.RunSqlScriptExistingDb, new string[] { "RunSqlScriptDeferred", "RunSqlScriptRollback" }));
              break;
            case "RunSqlScriptDeferred":
              //System.Diagnostics.Debugger.Launch();
              ActionEngine.Instance.AddWorker(new ActionRunSqlScriptNewDbWorker(session, factory));
              ActionEngine.Instance.AddWorker(new ActionRunSqlScriptExistingDbWorker(session, factory));
              break;
            case "RunSqlScriptRollback":
              //System.Diagnostics.Debugger.Launch();
              ActionEngine.Instance.AddWorker(new ActionRunSqlScriptNewDbWorker(session, factory));
              ActionEngine.Instance.AddWorker(new ActionRunSqlScriptExistingDbWorker(session, factory));
              break;
            case "InstallingExtendedProceduresImmediate":
              //System.Diagnostics.Debugger.Launch();
              ActionEngine.Instance.AddWorker(new ActionInstallingExtendedProceduresWorker(session, new string[] { "InstallingExtendedProceduresDeferred", "InstallingExtendedProceduresRollback" }));
              break;
            case "InstallingExtendedProceduresDeferred":
              //System.Diagnostics.Debugger.Launch();
              ActionEngine.Instance.AddWorker(new ActionInstallingExtendedProceduresWorker(session));
              break;
            case "InstallingExtendedProceduresRollback":
              //System.Diagnostics.Debugger.Launch();
              ActionEngine.Instance.AddWorker(new ActionInstallingExtendedProceduresWorker(session));
              break;
              }

              return ActionEngine.Instance.Run();
        }
Ejemplo n.º 3
0
 private static void CommonInitialization(Session session, CustomActionProperties properties)
 {
     // Определения режима инсталлятора: клиент или сервер на основе элемента UIType.
       // При повторном вызове (т. е. если тип установки определен), действие не будет выполнятся.
       ActionEngine.Instance.AddWorker(new ActionUITypeWorker(session, properties.UIType));
 }