Example #1
0
        //=====================================================================


        public Form1()
        {
            InitializeComponent();
            this.onlineTView.ImageList = imageList1;
            _formInterface             = new FormInterface();
            _formInterface.InitiatlizeFormInterface(pBoxStatIndicator, onlineTView, offlineTView, btnSync, _configMenu.GetConfigInterface());

            _engine = new SyncEngine();
            _engine.InitializeEngine(_formInterface);

            offlineTView.ExpandAll();
            onlineTView.ExpandAll();
        }
Example #2
0
        public async void Init(SyncEngine engine)
        {
            // construct a scheduler factory
            NameValueCollection props = new NameValueCollection
            {
                { "quartz.serializer.type", "binary" }
            };

            _schedulerFac = new StdSchedulerFactory(props);

            // get a scheduler
            _scheduler = await _schedulerFac.GetScheduler();

            _scheduler2 = await _schedulerFac.GetScheduler();


            // define the job and tie it to SyncEngine class
            _jobDetail = JobBuilder.Create <SyncEngine>()
                         .WithIdentity("testConnJob", "group1")
                         .Build();

            _jobDetail2 = JobBuilder.Create <FormInterface>()
                          .WithIdentity("SyncJob", "group2")
                          .Build();
            // Trigger the job to run now, and then every 120 seconds
            _trigger = TriggerBuilder.Create()
                       .WithIdentity("each2minTrigger", "group1")
                       .StartNow()
                       .WithSimpleSchedule(x => x
                                           .WithIntervalInSeconds(10)
                                           .RepeatForever())
                       .Build();


            _trigger2 = TriggerBuilder.Create()
                        .WithIdentity("trigger3", "group2")
                        .StartNow()
                        .WithCronSchedule("0 0 0 29 2 ? *")
                        .Build();

            _scheduler.Context.Put("engine", engine);
            _scheduler2.Context.Put("engine", engine);

            await _scheduler.ScheduleJob(_jobDetail, _trigger);

            await _scheduler2.ScheduleJob(_jobDetail2, _trigger2);
        }