private void frmMain_Load(object sender, EventArgs e) { //ставим черную иконку (загрузка программы) TrayIcons.TrayIcon(TrayIconType.Off, niMain, false); niMain.Text = "IP informer loading..."; this.Hide(); //прячем главное окно //читаем настройки settings = new appSettings(CommonFunctions.SettingsPath + CommonFunctions.AppSettingsFile); if (!settings.LoadConfig()) { //ошибка при загрузке конфигурации TrayIcons.TrayIcon(TrayIconType.Panic, niMain, false); niMain.Text = "Config Error!"; niMain.ShowBalloonTip(5000, "Config Error!", settings.ConfigError, ToolTipIcon.Error); return; } //подключаем события и запускаем следилку WatchIP.Connecting += new Informer.OnConnecting(WatchIP_Connecting); WatchIP.CountryAlarm += new Informer.OnCountryAlarm(WatchIP_CountryAlarm); WatchIP.IPOK += new Informer.OnIPOK(WatchIP_IPOK); WatchIP.NetError += new Informer.OnNetError(WatchIP_NetError); WatchIP.ScriptWarnings += new Informer.OnScriptWarnings(WatchIP_ScriptWarnings); WatchIP.FatalError += new Informer.OnFatalError(WatchIP_FatalError); WatchIP.NewIP += new Informer.OnNewIP(WatchIP_NewIP); WatchIP.StartWatch(); }
private void frmCommonSettings_Load(object sender, EventArgs e) { settings = new appSettings(CommonFunctions.SettingsPath + CommonFunctions.AppSettingsFile); if (!settings.LoadConfig()) { CommonFunctions.ErrMessage(settings.ConfigError); return; } fWorker = new FormWorker(settings, this); fWorker.FillForm(); }
//инициализируем запрашивалку private bool InitSend() { //читаем конфиг сети netSettings = new NetSettings(CommonFunctions.SettingsPath + CommonFunctions.NetSettingsFile); if (netSettings.LoadConfig() == NetConfigStatus.Error) { ErrorMessage = netSettings.ConfigError; return(false); } //создаем список для хранения текущих ip и детекции новых CurrentIPs = new List <string>(); //конфиг программы appsettings = new appSettings(CommonFunctions.SettingsPath + CommonFunctions.AppSettingsFile); if (!appsettings.LoadConfig()) { ErrorMessage = appsettings.ConfigError; return(false); } ScriptAddr = appsettings.CurrentScriptAddr; //Проверяем БД SxGeo if (!CommonFunctions.ValidateSxGeo()) { ErrorMessage = "SxGeo files missed or invalid!"; return(false); } //получаем стоп-лист stoplist = appsettings.GetStopList(); //подгатавливаем анализатор данных ipData = new IPData(); //устанавливаем параметры запроса sendReq = new SendRequest(ScriptAddr); sendReq.ConnectionType = netSettings.ConnectionType; sendReq.ProxyAddress = netSettings.ProxyAddress; sendReq.ProxyPort = netSettings.ProxyPort; sendReq.ProxyUser = netSettings.ProxyUser; sendReq.ProxyPassword = netSettings.ProxyPassword; sendReq.ConnectionTimeout = netSettings.ConnectionTimeout; return(true); }