コード例 #1
0
        public virtual Task Execute(IJobExecutionContext context)
        {
            // fwjournal.ini 수집작업 모두 멈춤
            JobDataMap dataMap       = context.JobDetail.JobDataMap;
            IScheduler crawScheduler = (IScheduler)dataMap.Get("crawlScheduler");

            if (null != crawScheduler)
            {
                crawScheduler.PauseAll();
            }

            // 영농일지 DB에서 주소 얻기
            FwjournalIniManager fwjIniManager = new FwjournalIniManager();

            fwjIniManager.ReadIni();
            List <string> addresses = new List <string>();
            DbManager     dm2       = new DbManager(fwjIniManager.IpAddress, fwjIniManager.DbName, fwjIniManager.CollectionName, fwjIniManager.Id, fwjIniManager.Pw);

            if (dm2.Connect())
            {
                addresses = dm2.ReadFwjournalLands();
            }
            else
            {
                MessageBox.Show("영농일지 DB에 접속할 수 없습니다");
            }

            // fwjournal.ini와 영농일지 DB의 주소(addresses)를 비교하여 크기가 다른 경우 fwjournal.ini 업데이트
            fwjIniManager.ReadAddress();

            if (addresses.Count > fwjIniManager.Addresses.Count ||
                addresses.Count < fwjIniManager.Addresses.Count)
            {
                // fwjournal.ini의 주소정보 모두 지움
                fwjIniManager.DeleteAddressLine();

                // 영농일지 주소 읽어서 fwjournal.ini에 주소 쓰기
                var result = RunGetGPSAndConvertNxNyAndWriteFI(addresses);
            }

            // fwjournal.ini 수집작업 모두 재가동
            if (null != crawScheduler)
            {
                crawScheduler.ResumeAll();
            }

            return(Task.FromResult(0));
        }
コード例 #2
0
ファイル: Form1.cs プロジェクト: rtothecore/WeatherCrawler
        // 현재 주소 버튼 메뉴 초기화
        private void InitializeContextMenuStripAddress()
        {
            // 이미 메뉴에 아이템이 생성되어 있다면 모두 지움
            if (0 < contextMenuStripAddress.Items.Count)
            {
                contextMenuStripAddress.Items.Clear();
            }

            // fwjournal.ini 읽어서 주소 메뉴에 추가
            FwjournalIniManager fiManager = new FwjournalIniManager();

            fiManager.ReadAddress();
            foreach (var address in fiManager.Addresses)
            {
                /*
                 * ToolStripItem addressItem = contextMenuStripAddress.Items.Add(address.Address + "               " +
                 *                                                     UtilManager.ConvertCrawlTerm(address.CrawlTerm) + "               " +
                 *                                                     UtilManager.ConvertCrawlStatus(address.CrawlStatus));
                 */
                ToolStripItem addressItem = contextMenuStripAddress.Items.Add(address.Address.PadRight(25, '-') +
                                                                              UtilManager.ConvertCrawlTerm(address.CrawlTerm).PadRight(25, '-') +
                                                                              UtilManager.ConvertCrawlStatus(address.CrawlStatus));
                addressItem.Tag       = address;
                addressItem.Click    += new EventHandler(addressItem_Click);
                addressItem.ForeColor = Color.White;
            }

            // address.ini 읽어서 메뉴에 추가
            AddressIniManager aiManager = new AddressIniManager();

            aiManager.ReadAddress();
            foreach (var address in aiManager.Addresses)
            {
                /*
                 * ToolStripItem addressItem = contextMenuStripAddress.Items.Add(address.Address + "               " +
                 *                                                     UtilManager.ConvertCrawlTerm(address.CrawlTerm) + "               " +
                 *                                                     UtilManager.ConvertCrawlStatus(address.CrawlStatus));
                 */
                ToolStripItem addressItem = contextMenuStripAddress.Items.Add(address.Address.PadRight(25, '-') +
                                                                              UtilManager.ConvertCrawlTerm(address.CrawlTerm).PadRight(25, '-') +
                                                                              UtilManager.ConvertCrawlStatus(address.CrawlStatus));
                addressItem.Tag       = address;
                addressItem.Click    += new EventHandler(addressItem_Click);
                addressItem.ForeColor = Color.White;
            }
        }
コード例 #3
0
ファイル: Form1.cs プロジェクト: rtothecore/WeatherCrawler
        // 툴바 리셋
        void ResetToolBar()
        {
            // fwjournal.ini 읽기
            FwjournalIniManager fiManager = new FwjournalIniManager();

            fiManager.ReadAddress();

            // 현재주소 버튼
            labelAddr.Text = fiManager.Addresses[0].Address;

            // 수집옵션 버튼
            labelCrawlTerm.Text = "수집간격 - " + UtilManager.ConvertCrawlTerm(fiManager.Addresses[0].CrawlTerm);

            // 수집상태 버튼
            labelRunStatus.Text = Fonts.fa.recycle + "  " + UtilManager.ConvertCrawlStatus(fiManager.Addresses[0].CrawlStatus);

            // 변수 초기화
            currentSelectedIndex     = "f0";
            currentSelectedRunStatus = fiManager.Addresses[0].CrawlStatus;
        }
コード例 #4
0
        public void RunTasks()
        {
            // fwjournal.ini 읽어서 수집시작
            FwjournalIniManager fIManager = new FwjournalIniManager();

            fIManager.ReadAddress();
            foreach (var address in fIManager.Addresses)
            {
                TaskFJJob(address.IndexNo, address.Address, address.Nx, address.Ny, address.CrawlTerm, address.CrawlStatus).GetAwaiter();
                // TaskFJJob(address.IndexNo, address.Address, address.CrawlTerm).GetAwaiter().GetResult();
            }

            // address.ini 읽어서 수집시작
            AddressIniManager aIManager = new AddressIniManager();

            aIManager.ReadAddress();
            foreach (var address in aIManager.Addresses)
            {
                TaskAddrJob(address.IndexNo, address.Address, address.Nx, address.Ny, address.CrawlTerm, address.CrawlStatus).GetAwaiter();
            }
        }
コード例 #5
0
ファイル: Form1.cs プロジェクト: rtothecore/WeatherCrawler
        // 툴바 초기화
        void InitializeToolBar()
        {
            // fwjournal.ini 읽기
            FwjournalIniManager fiManager = new FwjournalIniManager();

            fiManager.ReadAddress();

            // 현재주소 버튼
            labelCurrentAddr.Parent    = buttonAddr;
            labelCurrentAddr.BackColor = Color.Transparent;
            Fonts.Reload(16);
            labelCurrentAddr.Font        = Fonts.FontAwesome;
            labelCurrentAddr.Text        = "현재주소                       " + Fonts.fa.sort_down;
            labelCurrentAddr.MouseEnter += OnMouseEnterButtonAddr;
            labelCurrentAddr.MouseLeave += OnMouseLeaveButtonAddr;

            labelAddr.Parent      = buttonAddr;
            labelAddr.BackColor   = Color.Transparent;
            labelAddr.MouseEnter += OnMouseEnterButtonAddr;
            labelAddr.MouseLeave += OnMouseLeaveButtonAddr;

            buttonAddr.BackColor   = Color.FromArgb(45, 45, 48);
            buttonAddr.MouseEnter += OnMouseEnterButtonAddr;
            buttonAddr.MouseLeave += OnMouseLeaveButtonAddr;

            if (0 < fiManager.Addresses.Count)
            {
                labelAddr.Text = fiManager.Addresses[0].Address;
            }

            // 수집옵션 버튼
            labelCrawlOption.Parent      = buttonCrawlOption;
            labelCrawlOption.BackColor   = Color.Transparent;
            labelCrawlOption.Font        = Fonts.FontAwesome;
            labelCrawlOption.Text        = Fonts.fa.cogs + "  수집옵션";
            labelCrawlOption.MouseEnter += OnMouseEnterButtonCrawlOption;
            labelCrawlOption.MouseLeave += OnMouseLeaveButtonCrawlOption;

            labelCrawlTerm.Parent      = buttonCrawlOption;
            labelCrawlTerm.BackColor   = Color.Transparent;
            labelCrawlTerm.MouseEnter += OnMouseEnterButtonCrawlOption;
            labelCrawlTerm.MouseLeave += OnMouseLeaveButtonCrawlOption;

            buttonCrawlOption.BackColor   = Color.FromArgb(45, 45, 48);
            buttonCrawlOption.MouseEnter += OnMouseEnterButtonCrawlOption;
            buttonCrawlOption.MouseLeave += OnMouseLeaveButtonCrawlOption;

            if (0 < fiManager.Addresses.Count)
            {
                labelCrawlTerm.Text = "수집간격 - " + UtilManager.ConvertCrawlTerm(fiManager.Addresses[0].CrawlTerm);
            }

            // 수집상태 버튼
            labelRunStatus.Parent    = buttonRunStatus;
            labelRunStatus.BackColor = Color.Transparent;
            labelRunStatus.Font      = Fonts.FontAwesome;
            // labelRunStatus.Text = Fonts.fa.recycle + "  " + "수집중";
            labelRunStatus.MouseEnter += OnMouseEnterButtonRunStatus;
            labelRunStatus.MouseLeave += OnMouseLeaveButtonRunStatus;

            labelRunLastTime.Parent      = buttonRunStatus;
            labelRunLastTime.BackColor   = Color.Transparent;
            labelRunLastTime.MouseEnter += OnMouseEnterButtonRunStatus;
            labelRunLastTime.MouseLeave += OnMouseLeaveButtonRunStatus;

            buttonRunStatus.BackColor   = Color.FromArgb(45, 45, 48);
            buttonRunStatus.MouseEnter += OnMouseEnterButtonRunStatus;
            buttonRunStatus.MouseLeave += OnMouseLeaveButtonRunStatus;

            if (0 < fiManager.Addresses.Count)
            {
                labelRunStatus.Text = Fonts.fa.recycle + "  " + UtilManager.ConvertCrawlStatus(fiManager.Addresses[0].CrawlStatus);
            }

            // 변수 초기화
            currentSelectedIndex = "f0";
            if (0 < fiManager.Addresses.Count)
            {
                currentSelectedRunStatus = fiManager.Addresses[0].CrawlStatus;
            }
        }