当前位置: 首页>>代码示例>>C#>>正文


C# Session.DoAction方法代码示例

本文整理汇总了C#中Microsoft.Deployment.WindowsInstaller.Session.DoAction方法的典型用法代码示例。如果您正苦于以下问题:C# Session.DoAction方法的具体用法?C# Session.DoAction怎么用?C# Session.DoAction使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Microsoft.Deployment.WindowsInstaller.Session的用法示例。


在下文中一共展示了Session.DoAction方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: SwhowPathInstall

        public static ActionResult SwhowPathInstall(Session session)
        {
            try
            {
                //  Active message only for debugging developing
                //  MessageBox.Show("SwhowPathInstall: For debugging , the Debug menu, ' Attach to process ' ate processes : msiexec.exe y rundll32.exe.",
                //    "Depurar: SwhowPathInstall", MessageBoxButtons.OK, MessageBoxIcon.Information);

                bool isCustomActionData = false;
                List<DataBasePathTO> listPaths;
                List<FeatureInstallTO> listFeactureScripts;
                var listFeactureNames = new List<string>();

                InstallUtilities.WriteLogInstall(session, "Initialised SwhowPathInstall ...", null, true);
                if (session == null)
                {
                    throw new ArgumentNullException("session");
                }

                // Setup Routes taken from CustomTable Id = " TABLE_DATABASE_PATHS " and set default route
                listPaths = GetCustomTableDataBasePaths(session, isCustomActionData);

                // Open the user form to change installation paths database .
                var frmA = new frmPaths(listPaths);
                if (frmA.ShowDialog() != DialogResult.OK)
                {
                    throw new InstallerException("Configuración de rutas de instalación no realizada");
                }

                // / Prepare CustomActionData for deferred CustomAction 
                var data = new CustomActionData();

                // Update CustomTable Id = " TABLE_DATABASE_PATHS " with modified routes
                // UpdateCustomTableDataBasePaths (session , listPaths , isCustomActionData );

                // Prepare list of paths to be sent to CustomActionData for deferred CustomAction
                data.AddObject("DATABASE_PATHS", listPaths);

                // Add the route list as a session property
                // Data.Add ( " DATABASE_PATHS " JsonConvert.SerializeObject ( listPaths ) ) ;

                // To retrieve the serialized property
                // List <DataBasePathTO> JsonConvert.DeserializeObject listPaths = < List <DataBasePathTO> > ( session.CustomActionData [" DATABASE_PATHS "] );

                // Prepare properties to be sent to CustomActionData for deferred CustomAction
                SetCustomActionData(session, "INSTALLLOCATION", data);
                SetCustomActionData(session, "DATABASE_SERVERNAME", data);
                SetCustomActionData(session, "DATABASE_NAME", data);
                SetCustomActionData(session, "DATABASE_WINDOWSAUTHENTICATION", data);
                SetCustomActionData(session, "DATABASE_AUTHENTICATEDATABASE", data);
                SetCustomActionData(session, "DATABASE_EXECUTESCRIPTS", data);
                SetCustomActionData(session, "DATABASE_USERNAME", data);
                SetCustomActionData(session, "DATABASE_PASSWORD", data);
                SetCustomActionData(session, "DATABASE_PROXYPASSWORD", data);
                SetCustomActionData(session, "DATABASE_MAILPROFILENAME", data);
                SetCustomActionData(session, "DATABASE_MAILBOX", data);
                SetCustomActionData(session, "DATABASE_MAILIP", data);
                SetCustomActionData(session, "DATABASE_OPERATORNAMENAME", data);
                SetCustomActionData(session, "DATABASE_OPERATORMAILBOX", data);
                SetCustomActionData(session, "DATABASE_PROXYWINDOWSUSER", data);

                // / Database Scripts to be installed, taken from the MSI  Feature using sql files * .
                foreach (FeatureInfo fi in session.Features)
                {
                    if (fi.RequestState == InstallState.Local || fi.RequestState == InstallState.Source ||
                        fi.RequestState == InstallState.Default)
                    {
                        listFeactureNames.Add(fi.Name);
                        InstallUtilities.WriteLogInstall(session,
                            "FEATURE fi.Name: " + fi.Name + ", fi.CurrentState: " + fi.CurrentState +
                            ", fi.RequestState:" + fi.RequestState, null, false);
                    }
                }
                listFeactureScripts = GetFeatureScriptDataBase(session, listFeactureNames);
                data.AddObject("DATABASE_FEACTURESCRIPTS", listFeactureScripts);

                // Add all the properties in a single variable
                //session["CUSTOMACTIONDATA_PROPERTIES"] = data.ToString();

                // Schedule deferred actions 
                session.DoAction("CA_DataBaseExecuteScripts", data);

                return ActionResult.Success;
            }
            catch (Exception ex)
            {
                InstallUtilities.WriteLogInstall(session,
                    "Exception to establish installation paths for database.", ex, true);
                return ActionResult.Failure;
            }
        }
开发者ID:IcodeNet,项目名称:WixDatabaseInstaller,代码行数:91,代码来源:DataBaseCustomAction.cs

示例2: UpdateIISPropsWithSelectedWebSite

        public static ActionResult UpdateIISPropsWithSelectedWebSite(Session session)
        {
            try
            {
				if (session["WEBSITE_TYPE"] == "EXISTING")
				{
					string selectedWebSiteId = session[WebSiteProperty];
					Log.Info(session, "Found web site id: " + selectedWebSiteId);

					using (var availableWebSitesView = session.Database.OpenView(SpecificSite + selectedWebSiteId))
					{
						availableWebSitesView.Execute();

						using (var record = availableWebSitesView.Fetch())
						{
							if ((record[1].ToString()) == selectedWebSiteId)
							{
								session["WEBSITE_ID"] = selectedWebSiteId;
								session["WEBSITE_DESCRIPTION"] = (string)record[2];
								session["WEBSITE_PATH"] = (string)record[3];
								session["WEBSITE_DEFAULT_APPPOOL"] = (string)record[4];
							}
						}
					}
				}
				else
				{
					session["WEBSITE_ID"] = AsteriskSiteId;
					session["WEBSITE_DEFAULT_APPPOOL"] = "DefaultAppPool";
				}
				session.DoAction("SetIISInstallFolder");

                return ActionResult.Success;
            }
            catch (Exception ex)
            {
				Log.Error(session, "Exception was thrown during UpdateIISPropsWithSelectedWebSite execution" + ex);
	            return ActionResult.Failure;
            }
        }
开发者ID:925coder,项目名称:ravendb,代码行数:40,代码来源:IISActions.cs

示例3: UpdatePropsWithSelectedWebSite

        public static ActionResult UpdatePropsWithSelectedWebSite(Session session)
        {
            ActionResult result = ActionResult.Failure;

            try
            {
                if (session == null) { throw new ArgumentNullException("session"); }

                string selectedWebSiteId = session[SessionEntry];
                session.Log("CA: Found web site id: " + selectedWebSiteId);

                using (View availableWebSitesView = session.Database.OpenView(
                    SpecificSite + selectedWebSiteId))
                {
                    availableWebSitesView.Execute();

                    using (Record record = availableWebSitesView.Fetch())
                    {
                        if ((record[1].ToString()) == selectedWebSiteId)
                        {
                            session["WEBSITE_ID"] = selectedWebSiteId;
                            session["WEBSITE_DESCRIPTION"] = (string)record[2];
                            session["WEBSITE_PATH"] = (string)record[3];
                            session.DoAction("SetApplicationRootDirectory");
                        }
                    }
                }

                result = ActionResult.Success;
            }
            catch (Exception ex)
            {
                if (session != null)
                {
                    session.Log(CustomActionException + ex.ToString());
                }
            }

            return result;
        }
开发者ID:ynosa,项目名称:KanbanBoard,代码行数:40,代码来源:CustomAction.cs

示例4: OpenWebSiteDirectoryChooser

		public static ActionResult OpenWebSiteDirectoryChooser(Session session)
		{
			try
			{
				var task = new Thread(() =>
				{
					var fileDialog = new FolderBrowserDialog { ShowNewFolderButton = true };
					if (fileDialog.ShowDialog() == DialogResult.OK)
					{
						session["WEBSITE_PATH"] = fileDialog.SelectedPath;
					}

					session.DoAction("SetNewWebSiteDirectory");
				});
				task.SetApartmentState(ApartmentState.STA);
				task.Start();
				task.Join();

				return ActionResult.Success;
			}
			catch (Exception ex)
			{
				Log.Error(session, "Error occurred during OpenWebSiteDirectoryChooser. Exception: " + ex);
				return ActionResult.Failure;
			}
			
		}
开发者ID:925coder,项目名称:ravendb,代码行数:27,代码来源:IISActions.cs

示例5: Server

 public static ActionResult Server(Session session)
 {
     try
     {
         var customActionData = new CustomActionData();
         customActionData.Add(INSTALLFOLDER, session[INSTALLFOLDER]);
         session.DoAction("DeferredServerAction", customActionData);
         return ActionResult.Success;
     }
     catch (Exception ex)
     {
         session.Log("Exception Occured during custom action details:" + ex.Message);
         return ActionResult.Failure;
     }
 }
开发者ID:kendadk,项目名称:Installer,代码行数:15,代码来源:CustomAction.cs


注:本文中的Microsoft.Deployment.WindowsInstaller.Session.DoAction方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。