|
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Diagnostics;
using System.ServiceProcess;
using System.Text;
namespace SystemTrayIconInSvc
{
public partial class Svc : ServiceBase
{
private SensAdvisor m_Advisor = new SensAdvisor();
private List<SettingDlg> m_Dlgs = new List<SettingDlg>();
public Svc()
{
InitializeComponent();
m_Advisor.OnShellStarted += this.PostShell;
}
internal void DebugStart()
{
OnStart(null);
}
protected override void OnStart(string[] args)
{
// if the service started after the windows logon
m_Dlgs.Add(SettingDlg.StartUIThread());
}
protected override void OnStop()
{
foreach (SettingDlg dlg in m_Dlgs)
{
try
{
dlg.Close();
dlg.Dispose();
}
catch { }
}
m_Dlgs.Clear();
}
/// <summary>
/// Called when the shell is ready
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
public void PostShell(object sender, SensLogon2EventArgs e)
{
m_Dlgs.Add(SettingDlg.StartUIThread());
}
}
}
|
By viewing downloads associated with this article you agree to the Terms of Service and the article's licence.
If a file you wish to view isn't highlighted, and is a text file (not binary), please
let us know and we'll add colourisation support for it.
Jerry is from China. He was captivated by computer programming since 13 years old when first time played with Q-Basic.
- Windows / Linux & C++
- iOS & Obj-C
- .Net & C#
- Flex/Flash & ActionScript
- HTML / CSS / Javascript
- Gaming Server programming / video, audio processing / image & graphics
Contact: vcer(at)qq.com
Chinese Blog: http://blog.csdn.net/wangjia184