Exemplo n.º 1
0
        /// <summary>
        /// Starts the management service.
        /// </summary>
        public void StartService()
        {
            commManager = new CommManager();
            commManager.Start();

            // create service lock file
            FileStream _lock = File.Open(lockFile, FileMode.Create);

            // create stream writer and write this processes PID to the lock file
            StreamWriter stream = new StreamWriter(_lock);
            Process      proc   = Process.GetCurrentProcess();

            stream.WriteLine(proc.Id);
            stream.Flush();

            // dispose the file stream
            _lock.Dispose();
            HasCompletedStartup = true;
            Messages.Trace("started service");
        }