private void OnStartup(object sender, StartupEventArgs eventArgs) { //AppDomain.CurrentDomain.UnhandledException += (o, args) => OnGlobalException(args.ExceptionObject == null ? (Exception)args.ExceptionObject : null); //DispatcherUnhandledException += (o, args) => OnGlobalException(args.Exception); //TaskScheduler.UnobservedTaskException += (o, args) => OnGlobalException(args.Exception); _commandManager = CommandManager.GetInstance(); _databaseManager = DatabaseManager.GetInstance(); _logManager = LogManager.GetInstance(); _networkManager = NetworkManager.GetInstance(); _serverManager = ServerManager.GetInstance(); _windowManager = WindowManager.GetInstance(); _crawlManager = CrawlManager.GetInstance(); WindowManager.ShowMainWindow(); DatabaseManager.GetInstance().StartDatabase(); ServerManager.GetInstance().StartWebServer(); //CommandManager.StartCommandServer(); //CommandManager.ConnectMasterServer(); }
private static void InitializeCrawlerWindow() { if (_crawlerView == null) { return; } _crawlerHeaderPower = (TextBlock)_crawlerView.FindName("CrawlerHeaderPower"); _crawlerHeaderStatus = (TextBlock)_crawlerView.FindName("CrawlerHeaderStatus"); _crawlerHeaderTime = (TextBlock)_crawlerView.FindName("CrawlerHeaderTime"); _crawlerHeaderCount = (TextBlock)_crawlerView.FindName("CrawlerHeaderCount"); if (_crawlerHeaderPower == null || _crawlerHeaderStatus == null || _crawlerHeaderTime == null || _crawlerHeaderCount == null) { return; } _crawlerDataView = (DataGrid)_crawlerView.FindName("CrawlerDataView"); if (_crawlerDataView == null) { return; } _crawlerCheckSync = (CheckBox)_crawlerView.FindName("CrawlerSync"); _crawlerComboBox1 = (ComboBox)_crawlerView.FindName("CrawlerType1"); _crawlerComboBox2 = (ComboBox)_crawlerView.FindName("CrawlerType2"); _crawlerComboBox3 = (ComboBox)_crawlerView.FindName("CrawlerType3"); _crawlerNameBox = (TextBox)_crawlerView.FindName("CrawlerType4"); if (_crawlerCheckSync == null || _crawlerComboBox1 == null || _crawlerComboBox2 == null || _crawlerComboBox3 == null || _crawlerNameBox == null) { return; } _crawlerButtonStop = (Button)_crawlerView.FindName("CrawlerButtonStop"); _crawlerButtonStart = (Button)_crawlerView.FindName("CrawlerButtonStart"); if (_crawlerButtonStop == null || _crawlerButtonStart == null) { return; } _crawlerComboBox1.ItemsSource = CrawlManager.SiDoDictionary.Keys; _crawlerComboBox1.SelectedItem = CrawlManager.SiDoDictionary.First().Key; _crawlerComboBox1.Items.Refresh(); _crawlerComboBox3.ItemsSource = CrawlManager.TypeDictionary.Keys; _crawlerComboBox3.SelectedItem = CrawlManager.TypeDictionary.First().Key; _crawlerComboBox3.Items.Refresh(); _crawlerComboBox1.SelectionChanged += (sender, args) => { Dictionary <string, int> subData = CrawlManager.SiGunGuDictionary[CrawlManager.SiDoDictionary[_crawlerComboBox1.SelectedItem.ToString()]]; _crawlerComboBox2.ItemsSource = subData.Keys; if (CrawlManager.FilterSiDo != CrawlManager.SiDoDictionary[_crawlerComboBox1.SelectedItem.ToString()]) { _crawlerComboBox2.SelectedItem = subData.First().Key; } _crawlerComboBox2.Items.Refresh(); CrawlManager.FilterSiDo = CrawlManager.SiDoDictionary[_crawlerComboBox1.SelectedItem.ToString()]; }; _crawlerComboBox2.SelectionChanged += (sender, args) => { if (_crawlerComboBox2.SelectedItem == null) { return; } CrawlManager.FilterSiGunGu = CrawlManager.SiGunGuDictionary[CrawlManager.FilterSiDo][_crawlerComboBox2.SelectedItem.ToString()]; }; _crawlerComboBox3.SelectionChanged += (sender, args) => { CrawlManager.FilterType = _crawlerComboBox3.SelectedItem.ToString(); }; _crawlerCheckSync.Checked += (sender, args) => { CrawlManager.ModuleSync = true; }; _crawlerCheckSync.Unchecked += (sender, args) => { CrawlManager.ModuleSync = false; }; _crawlerNameBox.TextChanged += (sender, args) => { CrawlManager.FilterName = _crawlerNameBox.Text; }; _crawlerButtonStop.Click += (sender, args) => { CrawlManager.StopCrawlZeroPay(); }; _crawlerButtonStart.Click += (sender, args) => { CrawlManager.StartCrawlZeroPay(); }; UpdateCrawlData(); LoadCrawlSetting(); }
public static CrawlManager GetInstance() { return(_instance ?? (_instance = new CrawlManager())); }