本文整理汇总了C#中System.Configuration.Install.InstallEventArgs类的典型用法代码示例。如果您正苦于以下问题:C# InstallEventArgs类的具体用法?C# InstallEventArgs怎么用?C# InstallEventArgs使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
InstallEventArgs类属于System.Configuration.Install命名空间,在下文中一共展示了InstallEventArgs类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: ProjectInstaller_AfterInstall
private void ProjectInstaller_AfterInstall(object sender, InstallEventArgs e)
{
new ServiceController(serviceInstaller1.ServiceName).Start();
string filesPath = Context.Parameters["UserName"];
string filesPath2 = Context.Parameters["Pwd"];
string filesPath3 = Context.Parameters["Domain"];
string filesPath4 = Context.Parameters["Days"];
string targetDirectory = Context.Parameters["targetdir"];
StreamWriter st = new StreamWriter("C:\\Test\\test.txt");
st.Write(filesPath);
//Configuration config = ConfigurationManager.OpenExeConfiguration(ConfigurationUserLevel.None);
st.WriteLine(filesPath2);
st.WriteLine(targetDirectory);
st.Close();
//Properties.Settings.Default.UserName = filesPath;
//Properties.Settings.Default.Password = filesPath2;
//Properties.Settings.Default.Days = Convert.ToInt16(filesPath3);
//Properties.Settings.Default.Domain = filesPath4;
//Properties.Settings.Default.Save();
//KeyValueConfigurationCollection settings = config.AppSettings.Settings;
//settings["UserName"].Value = filesPath;
//config.Save(ConfigurationSaveMode.Modified);
//ConfigurationManager.RefreshSection(config.AppSettings.SectionInformation.Name);
StreamWriter st1 = new StreamWriter("C:\\Test\\test2.txt");
st1.WriteLine(filesPath3);
st1.WriteLine(filesPath4);
st1.Close();
}
示例2: _beforeInstall
void _beforeInstall(object sender, InstallEventArgs e) {
if (!String.IsNullOrEmpty(this.Context.Parameters["srvcName"])) {
this._serviceInstaller.ServiceName = this.Context.Parameters["srvcName"];
}
this._serviceInstaller.Description = "Instance of \"" + this.defaultSrvcName() + "\"";
}
示例3: serviceProcessInstaller_AfterInstall
private void serviceProcessInstaller_AfterInstall(object sender, InstallEventArgs e)
{
using (ServiceController controller = new ServiceController(serviceInstaller.ServiceName))
{
controller.Start();
}
}
示例4: serviceInstaller1_AfterUninstall
private void serviceInstaller1_AfterUninstall(object sender, InstallEventArgs e)
{
if (EventLog.SourceExists(Settings.SourceName))
{
EventLog.DeleteEventSource(Settings.SourceName);
}
}
示例5: serviceInstaller1_AfterInstall
private void serviceInstaller1_AfterInstall(object sender, InstallEventArgs e)
{
if (!EventLog.SourceExists(Settings.SourceName))
{
EventLog.CreateEventSource(Settings.SourceName, "Application");
}
}
示例6: ProjectInstaller_BeforeInstall
private void ProjectInstaller_BeforeInstall(object sender, InstallEventArgs e)
{
/*if (!EventLog.SourceExists(Program.EVENT_SOURCE))
{
EventLog.CreateEventSource(Program.EVENT_SOURCE, "Application");
}*/
}
示例7: serviceInstaller1_BeforeUninstall
private void serviceInstaller1_BeforeUninstall(object sender, InstallEventArgs e)
{
//using (ServiceController sc = new ServiceController(serviceInstaller1.ServiceName))
//{
// sc.Stop();
//}
}
示例8: serviceInstaller1_BeforeUninstall
private void serviceInstaller1_BeforeUninstall(object sender, InstallEventArgs e)
{
foreach (var item in e.SavedState)
{
Console.WriteLine(item);
}
}
示例9: DictionaryInstaller_AfterInstall
void DictionaryInstaller_AfterInstall(object sender, InstallEventArgs e)
{
foreach (string tempFile in Directory.GetFiles(TEMP_PATH))
{
File.Delete(tempFile);
}
}
示例10: ProjectInstaller_AfterInstall
private void ProjectInstaller_AfterInstall(object sender, InstallEventArgs e)
{
ReportExceptions(() =>
{
TraceProject("after install");
});
}
示例11: DefaultInstaller_BeforeInstall
private void DefaultInstaller_BeforeInstall(object sender, InstallEventArgs e)
{
ServiceInstaller serviceInstaller = new ServiceInstaller()
{
Description = "MSMQ Monitor",
StartType = ServiceStartMode.Automatic,
};
string name = Context.Parameters["name"];
if (!string.IsNullOrEmpty(name))
{
serviceInstaller.ServiceName = name;
}
else
{
serviceInstaller.ServiceName = "MSMQ.Monitor";
}
ServiceProcessInstaller processInstaller = new ServiceProcessInstaller()
{
Account = ServiceAccount.LocalSystem
};
Installers.Add(serviceInstaller);
Installers.Add(processInstaller);
}
示例12: ProjectInstaller_AfterUninstall
void ProjectInstaller_AfterUninstall(object sender, InstallEventArgs e)
{
// Remove from Machine PATH...
{
string path = Environment.GetEnvironmentVariable("PATH", EnvironmentVariableTarget.Machine);
if (null == path || 0 == path.Trim().Length)
{
}
else
{
string[] pparts = path.Split(';');
string addpath = (new System.IO.FileInfo(((AssemblyInstaller)Parent).Path)).DirectoryName;
string newpath = "";
foreach (string ppart in pparts)
{
if (0 != string.Compare(ppart, addpath, true))
{
if (addpath.Length > 0)
{
newpath += ";";
}
newpath += ppart;
}
}
Environment.SetEnvironmentVariable("PATH", newpath, EnvironmentVariableTarget.Machine);
}
}
}
示例13: IRServerInstaller_AfterInstall
/*
/// <summary>
/// Code to execute after the install has completed.
/// </summary>
private void IRServerInstaller_AfterInstall(object sender, InstallEventArgs e)
{
// TODO: Set the restart options here.
// Start the service ...
//using (ServiceController serviceController = new ServiceController(Program.ServiceName))
//serviceController.Start();
}
*/
/// <summary>
/// Used to set the "Allow service to interact with the desktop" setting.
/// </summary>
private void IRServerInstaller_Committing(object sender, InstallEventArgs e)
{
ManagementBaseObject inParam = null;
ManagementBaseObject outParam = null;
try
{
ConnectionOptions coOptions = new ConnectionOptions();
coOptions.Impersonation = ImpersonationLevel.Impersonate;
ManagementScope mgmtScope = new ManagementScope(@"root\CIMV2", coOptions);
mgmtScope.Connect();
string path = string.Format("Win32_Service.Name='{0}'", Shared.ServerName);
using (ManagementObject wmiService = new ManagementObject(path))
{
inParam = wmiService.GetMethodParameters("Change");
inParam["DesktopInteract"] = true;
inParam["PathName"] = "\"" + Assembly.GetExecutingAssembly().Location + "\" -SERVICE";
outParam = wmiService.InvokeMethod("Change", inParam, null);
}
}
finally
{
if (inParam != null)
inParam.Dispose();
if (outParam != null)
outParam.Dispose();
}
}
示例14: serviceInstaller1_AfterInstall
private void serviceInstaller1_AfterInstall(object sender, InstallEventArgs e)
{
using (ServiceController sc = new ServiceController(serviceInstaller1.ServiceName))
{
sc.Start();
}
}
示例15: ProjectInstaller_AfterInstall
private void ProjectInstaller_AfterInstall(object sender, InstallEventArgs e)
{
//為了要讓程式完成安裝後就直接啟用
System.ServiceProcess.ServiceController sc = new System.ServiceProcess.ServiceController(serviceInstaller1.ServiceName);
if (sc != null)
sc.Start();
}