Пример #1
0
        public MainClass()
        {
            mainService              = new MainService(this);
            mainService.ServiceName  = "Sync VOD";
            mainService.MessageLog  += mainService_MessageLog;
            mainService.OnGetConfig += mainService_OnGetConfig;
            mainService.OnSetConfig += mainService_OnSetConfig;

            #region Lấy cấu hình
            var location      = System.Reflection.Assembly.GetEntryAssembly().Location;
            var directoryPath = Path.GetDirectoryName(location);

            config     = new Config();
            configPath = Path.Combine(directoryPath, "VODConfig.xml");
            if (File.Exists(configPath))
            {
                try
                {
                    config = Utils.GetObject <Config>(configPath);
                }
                catch (Exception ex)
                {
                    AddLog("Lỗi đọc cấu hình:" + ex.Message);
                }
            }
            #endregion

            thrEmail = new EmailThread(this);
            thrEmail.OnBusyChanged += thread_OnBusyChanged;

            mainService.AddThread(new ServiceInfo(this));

            mainService.AddThread(new ImportAsRunLog(this));

            mainService.AddThread(new ExportVOD(this));

            Begin();
        }