예제 #1
0
파일: Program.cs 프로젝트: vgomes/examples
        /// <summary>
        /// Creación de directorios y control de los threads que utiliza la aplicación
        /// </summary>
        private Program()
        {
            // Crea el directorio Discalis/Grigory en %AppData%
            if (!Directory.Exists(Data.UserFolderPath))
            {
                Directory.CreateDirectory(Data.UserFolderPath);
            }

            this.grigoriDaemon = new MonitoringDaemon();
            this.grigoriDaemon.Start();

            this.grigSyncDaemon = new SyncDaemon();
            this.grigSyncDaemon.Start();

            this.mutexThread = new Thread(new ThreadStart(this.CheckMutexThread));
            this.mutexThread.Start();
            SystemEvents.SessionEnding += new SessionEndingEventHandler(this.SessionEnding);
        }
예제 #2
0
파일: Program.cs 프로젝트: vgomes/examples
        /// <summary>
        /// Método que para todos los threads
        /// </summary>
        /// <param name="reason">Razón de la parada</param>
        private void StopAll(string reason)
        {
            Logger.Log("Stopping: " + reason);

            if (this.mutexThread != null)
            {
                this.mutexThread.Abort();
                this.mutexThread.Join();
                this.mutexThread = null;
            }

            if (this.grigoriDaemon != null)
            {
                this.grigoriDaemon.Stop();
                this.grigoriDaemon = null;
            }

            if (this.grigSyncDaemon != null)
            {
                this.grigSyncDaemon.Stop();
                this.grigSyncDaemon = null;
            }
        }