Rev 57 | Go to most recent revision | Show entire file | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 57 | Rev 64 | ||
---|---|---|---|
Line 1... | Line 1... | ||
1 | unit Main; |
1 | unit Main; |
2 | 2 | ||
3 | (* |
3 | (* |
4 | 4 | ||
- | 5 | # download einer primer-tabelle? |
|
- | 6 | ||
5 | bug: wenn man einen eintrag ändert oder hinzufügt, werden alle "status" auf unknown zurückgesetzt |
7 | bug: wenn man einen eintrag ändert oder hinzufügt, werden alle "status" auf unknown zurückgesetzt |
6 | td: aktualisierenbutton/f5 erlauben |
8 | td: aktualisierenbutton/f5 erlauben |
7 | del-button... |
9 | del-button... |
8 | icon: gray(internetdown),red,green |
10 | icon: gray(internetdown),red,green |
9 | reg-write fehler erkennen |
11 | reg-write fehler erkennen |
10 | 12 | ||
- | 13 | statustext einführen (format 2.0) |
|
- | 14 | ||
- | 15 | rote listeneinträge bei fehlern |
|
- | 16 | ||
- | 17 | f5 möglichkeit geben? |
|
- | 18 | ||
- | 19 | nur 1 instanz zulassen |
|
- | 20 | ||
- | 21 | spaltenindizes 0,1,2 in constanten packen |
|
- | 22 | ||
11 | Future |
23 | Future |
12 | ------ |
24 | ------ |
13 | 25 | ||
14 | - Rote Einträge bei Fehlern? (VCL Problem) |
26 | - Rote Einträge bei Fehlern? (VCL Problem) |
15 | - XP Bubble verwenden? |
27 | - XP Bubble verwenden? |
Line 104... | Line 116... | ||
104 | procedure MUpdateClick(Sender: TObject); |
116 | procedure MUpdateClick(Sender: TObject); |
105 | procedure UpdateTimerTimer(Sender: TObject); |
117 | procedure UpdateTimerTimer(Sender: TObject); |
106 | private |
118 | private |
107 | RealClose: boolean; |
119 | RealClose: boolean; |
108 | WarnAtConnectivityFailure: boolean; |
120 | WarnAtConnectivityFailure: boolean; |
- | 121 | StatCache: TStringList; |
|
109 | procedure TaskbarEvent(var Msg: TMessage); |
122 | procedure TaskbarEvent(var Msg: TMessage); |
110 | Message WM_TASKABAREVENT; |
123 | Message WM_TASKABAREVENT; |
111 | procedure OnQueryEndSession(var Msg: TWMQueryEndSession); |
124 | procedure OnQueryEndSession(var Msg: TWMQueryEndSession); |
112 | message WM_QUERYENDSESSION; |
125 | message WM_QUERYENDSESSION; |
113 | procedure OnWmQuit(var Msg: TWMQuit); |
126 | procedure OnWmQuit(var Msg: TWMQuit); |
Line 231... | Line 244... | ||
231 | Shell_NotifyIcon(dwMessage, @NotifyIconData); |
244 | Shell_NotifyIcon(dwMessage, @NotifyIconData); |
232 | end; |
245 | end; |
233 | 246 | ||
234 | procedure TMainForm.FormDestroy(Sender: TObject); |
247 | procedure TMainForm.FormDestroy(Sender: TObject); |
235 | begin |
248 | begin |
- | 249 | StatCache.Free; |
|
236 | NotifyIconChange(NIM_DELETE); |
250 | NotifyIconChange(NIM_DELETE); |
237 | end; |
251 | end; |
238 | 252 | ||
239 | procedure TMainForm.FormCreate(Sender: TObject); |
253 | procedure TMainForm.FormCreate(Sender: TObject); |
240 | begin |
254 | begin |
241 | LastCheckPanel.Caption := Format(LNG_LAST_CHECK, [LNG_LAST_CHECK_UNKNOWN]); |
255 | LastCheckPanel.Caption := Format(LNG_LAST_CHECK, [LNG_LAST_CHECK_UNKNOWN]); |
242 | 256 | ||
243 | // RightAlignHelpMenuItem; |
257 | // RightAlignHelpMenuItem; |
244 | 258 | ||
- | 259 | StatCache := TStringList.Create; |
|
- | 260 | ||
- | 261 | // Kommt sicherlich nicht in irgendeiner URL vor! |
|
- | 262 | // #0 funktioniert nicht |
|
- | 263 | StatCache.NameValueSeparator := #1; |
|
- | 264 | ||
245 | NotifyIconChange(NIM_ADD); |
265 | NotifyIconChange(NIM_ADD); |
246 | 266 | ||
247 | MonitorGrid.Rows[0].Add(LNG_COLUMN_NAME); |
267 | MonitorGrid.Rows[0].Add(LNG_COLUMN_NAME); |
248 | MonitorGrid.Rows[0].Add(LNG_COLUMN_URL); |
268 | MonitorGrid.Rows[0].Add(LNG_COLUMN_URL); |
249 | MonitorGrid.Rows[0].Add(LNG_COLUMN_STATUS); |
269 | MonitorGrid.Rows[0].Add(LNG_COLUMN_STATUS); |
Line 347... | Line 367... | ||
347 | procedure TMainForm.LoadList; |
367 | procedure TMainForm.LoadList; |
348 | var |
368 | var |
349 | reg: TRegistry; |
369 | reg: TRegistry; |
350 | st: TStringList; |
370 | st: TStringList; |
351 | i: Integer; |
371 | i: Integer; |
- | 372 | MonitorUrl, CachedStat: String; |
|
352 | begin |
373 | begin |
353 | reg := TRegistry.Create; |
374 | reg := TRegistry.Create; |
354 | st := TStringList.Create; |
375 | st := TStringList.Create; |
355 | try |
376 | try |
356 | reg.RootKey := HKEY_CURRENT_USER; |
377 | reg.RootKey := HKEY_CURRENT_USER; |
Line 362... | Line 383... | ||
362 | begin |
383 | begin |
363 | if reg.OpenKeyReadOnly(Format(REG_KEY_SERVICE, [st.Strings[i]])) then |
384 | if reg.OpenKeyReadOnly(Format(REG_KEY_SERVICE, [st.Strings[i]])) then |
364 | begin |
385 | begin |
365 | MonitorGrid.Rows[i+1].Clear; |
386 | MonitorGrid.Rows[i+1].Clear; |
366 | MonitorGrid.Rows[i+1].Add(st.Strings[i]); |
387 | MonitorGrid.Rows[i+1].Add(st.Strings[i]); |
367 | MonitorGrid.Rows[i+1].Add(reg.ReadString(REG_VAL_URL)); |
388 | MonitorUrl := reg.ReadString(REG_VAL_URL); |
368 | MonitorGrid.Rows[i+1].Add(LNG_STAT_UNKNOWN); |
389 | MonitorGrid.Rows[i+1].Add(MonitorUrl); |
- | 390 | CachedStat := StatCache.Values[MonitorUrl]; |
|
- | 391 | If CachedStat = '' then CachedStat := LNG_STAT_UNKNOWN; |
|
- | 392 | MonitorGrid.Rows[i+1].Add(CachedStat); |
|
369 | end; |
393 | end; |
370 | end; |
394 | end; |
371 | reg.CloseKey; |
395 | reg.CloseKey; |
372 | end; |
396 | end; |
373 | finally |
397 | finally |
Line 498... | Line 522... | ||
498 | MonitorUrl, ServerName: string; |
522 | MonitorUrl, ServerName: string; |
499 | begin |
523 | begin |
500 | ServerName := MonitorGrid.Rows[i].Strings[0]; |
524 | ServerName := MonitorGrid.Rows[i].Strings[0]; |
501 | MonitorUrl := MonitorGrid.Rows[i].Strings[1]; |
525 | MonitorUrl := MonitorGrid.Rows[i].Strings[1]; |
502 | 526 | ||
- | 527 | if MonitorUrl = '' then Exit; // Passiert, wenn Create() aufgehalten wird (z.B. mit ShowMessage) |
|
- | 528 | ||
503 | MonitorGrid.Rows[i].Strings[2] := LNG_STAT_CHECKING; |
529 | MonitorGrid.Rows[i].Strings[2] := LNG_STAT_CHECKING; |
504 | Application.ProcessMessages; |
530 | Application.ProcessMessages; |
505 | 531 | ||
506 | x := DeterminateMonitorState(MonitorUrl); |
532 | x := DeterminateMonitorState(MonitorUrl); |
507 | 533 | ||
508 | if x = msOK then |
534 | if x = msOK then |
509 | begin |
535 | begin |
510 | MonitorGrid.Rows[i].Strings[2] := LNG_STAT_OK; |
536 | MonitorGrid.Rows[i].Strings[2] := LNG_STAT_OK; |
- | 537 | StatCache.Values[MonitorUrl] := LNG_STAT_OK; |
|
511 | NotifyIconChange(NIM_MODIFY); |
538 | NotifyIconChange(NIM_MODIFY); |
512 | if ShowSuccess then |
539 | if ShowSuccess then |
513 | begin |
540 | begin |
514 | MessageBox(Handle, PChar(Format(LNG_ALERT_STATUS_OK, [ServerName, MonitorUrl])), PChar(LNG_CHECKALL_FINISHED_CAPTION), MB_ICONINFORMATION or MB_OK); |
541 | MessageBox(Handle, PChar(Format(LNG_ALERT_STATUS_OK, [ServerName, MonitorUrl])), PChar(LNG_CHECKALL_FINISHED_CAPTION), MB_ICONINFORMATION or MB_OK); |
515 | end; |
542 | end; |
516 | end |
543 | end |
517 | else if x = msStatusWarning then |
544 | else if x = msStatusWarning then |
518 | begin |
545 | begin |
519 | MonitorGrid.Rows[i].Strings[2] := LNG_STAT_WARNING; |
546 | MonitorGrid.Rows[i].Strings[2] := LNG_STAT_WARNING; |
- | 547 | StatCache.Values[MonitorUrl] := LNG_STAT_WARNING; |
|
520 | NotifyIconChange(NIM_MODIFY); |
548 | NotifyIconChange(NIM_MODIFY); |
521 | if MessageBox(Handle, PChar(Format(LNG_ALERT_STATUS_WARNING, [ServerName, MonitorUrl])), PChar(LNG_ALERT_CAPTION), MB_ICONWARNING or MB_YESNOCANCEL) = IDYES then |
549 | if MessageBox(Handle, PChar(Format(LNG_ALERT_STATUS_WARNING, [ServerName, MonitorUrl])), PChar(LNG_ALERT_CAPTION), MB_ICONWARNING or MB_YESNOCANCEL) = IDYES then |
522 | begin |
550 | begin |
523 | ShellExecute(Handle, 'open', PChar(MonitorUrl), '', '', SW_NORMAL); |
551 | ShellExecute(Handle, 'open', PChar(MonitorUrl), '', '', SW_NORMAL); |
524 | end; |
552 | end; |
525 | end |
553 | end |
526 | else if x = msMonitorParseError then |
554 | else if x = msMonitorParseError then |
527 | begin |
555 | begin |
528 | MonitorGrid.Rows[i].Strings[2] := LNG_STAT_PARSEERROR; |
556 | MonitorGrid.Rows[i].Strings[2] := LNG_STAT_PARSEERROR; |
- | 557 | StatCache.Values[MonitorUrl] := LNG_STAT_PARSEERROR; |
|
529 | NotifyIconChange(NIM_MODIFY); |
558 | NotifyIconChange(NIM_MODIFY); |
530 | if MessageBox(Handle, PChar(Format(LNG_ALERT_MONITOR_FAILURE, [ServerName, MonitorUrl])), PChar(LNG_ALERT_CAPTION), MB_ICONWARNING or MB_YESNOCANCEL) = IDYES then |
559 | if MessageBox(Handle, PChar(Format(LNG_ALERT_MONITOR_FAILURE, [ServerName, MonitorUrl])), PChar(LNG_ALERT_CAPTION), MB_ICONWARNING or MB_YESNOCANCEL) = IDYES then |
531 | begin |
560 | begin |
532 | ShellExecute(Handle, 'open', PChar(MonitorUrl), '', '', SW_NORMAL); |
561 | ShellExecute(Handle, 'open', PChar(MonitorUrl), '', '', SW_NORMAL); |
533 | end; |
562 | end; |
534 | end |
563 | end |
535 | else if x = msMonitorGeneralError then |
564 | else if x = msMonitorGeneralError then |
536 | begin |
565 | begin |
537 | MonitorGrid.Rows[i].Strings[2] := LNG_STAT_GENERALERROR; |
566 | MonitorGrid.Rows[i].Strings[2] := LNG_STAT_GENERALERROR; |
- | 567 | StatCache.Values[MonitorUrl] := LNG_STAT_GENERALERROR; |
|
538 | NotifyIconChange(NIM_MODIFY); |
568 | NotifyIconChange(NIM_MODIFY); |
539 | if MessageBox(Handle, PChar(Format(LNG_ALERT_MONITOR_FAILURE, [ServerName, MonitorUrl])), PChar(LNG_ALERT_CAPTION), MB_ICONWARNING or MB_YESNOCANCEL) = IDYES then |
569 | if MessageBox(Handle, PChar(Format(LNG_ALERT_MONITOR_FAILURE, [ServerName, MonitorUrl])), PChar(LNG_ALERT_CAPTION), MB_ICONWARNING or MB_YESNOCANCEL) = IDYES then |
540 | begin |
570 | begin |
541 | ShellExecute(Handle, 'open', PChar(MonitorUrl), '', '', SW_NORMAL); |
571 | ShellExecute(Handle, 'open', PChar(MonitorUrl), '', '', SW_NORMAL); |
542 | end; |
572 | end; |
543 | end |
573 | end |
544 | else if x = msServerDown then |
574 | else if x = msServerDown then |
545 | begin |
575 | begin |
546 | MonitorGrid.Rows[i].Strings[2] := LNG_STAT_SERVERDOWN; |
576 | MonitorGrid.Rows[i].Strings[2] := LNG_STAT_SERVERDOWN; |
- | 577 | StatCache.Values[MonitorUrl] := LNG_STAT_SERVERDOWN; |
|
547 | NotifyIconChange(NIM_MODIFY); |
578 | NotifyIconChange(NIM_MODIFY); |
548 | // Es besteht eine Internetverbindung, daher ist wohl was mit dem |
579 | // Es besteht eine Internetverbindung, daher ist wohl was mit dem |
549 | // Server nicht in Ordnung |
580 | // Server nicht in Ordnung |
550 | 581 | ||
551 | if MessageBox(Handle, PChar(Format(LNG_ALERT_SERVER_DOWN, [ServerName, MonitorUrl])), PChar(LNG_ALERT_CAPTION), MB_ICONWARNING or MB_YESNOCANCEL) = IDYES then |
582 | if MessageBox(Handle, PChar(Format(LNG_ALERT_SERVER_DOWN, [ServerName, MonitorUrl])), PChar(LNG_ALERT_CAPTION), MB_ICONWARNING or MB_YESNOCANCEL) = IDYES then |
Line 554... | Line 585... | ||
554 | end; |
585 | end; |
555 | end |
586 | end |
556 | else if x = msInternetBroken then |
587 | else if x = msInternetBroken then |
557 | begin |
588 | begin |
558 | MonitorGrid.Rows[i].Strings[2] := LNG_STAT_INTERNETBROKEN; |
589 | MonitorGrid.Rows[i].Strings[2] := LNG_STAT_INTERNETBROKEN; |
- | 590 | StatCache.Values[MonitorUrl] := LNG_STAT_INTERNETBROKEN; |
|
559 | NotifyIconChange(NIM_MODIFY); |
591 | NotifyIconChange(NIM_MODIFY); |
560 | if not WarnAtConnectivityFailure then |
592 | if not WarnAtConnectivityFailure then |
561 | begin |
593 | begin |
562 | if MessageBox(Handle, PChar(Format(LNG_ALERT_CONNECTIVITY_FAILURE, [ServerName, MonitorUrl])), PChar(LNG_ALERT_CAPTION), MB_ICONWARNING or MB_YESNOCANCEL) = IDYES then |
594 | if MessageBox(Handle, PChar(Format(LNG_ALERT_CONNECTIVITY_FAILURE, [ServerName, MonitorUrl])), PChar(LNG_ALERT_CAPTION), MB_ICONWARNING or MB_YESNOCANCEL) = IDYES then |
563 | begin |
595 | begin |