Skip to content

Commit 2ed0b05

Browse files
committed
Error messages added
1 parent 67412a6 commit 2ed0b05

2 files changed

Lines changed: 13 additions & 116 deletions

File tree

Source/NETworkManager/Models/Network/DNSLookup.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -102,8 +102,8 @@ public void LookupAsync(List<string> hosts, DNSLookupOptions dnsLookupOptions)
102102
// If there was an error... return
103103
if (!string.IsNullOrEmpty(dnsResponse.Error))
104104
{
105-
// OnLookupError(new DNSLookupErrorArgs(dnsResponse.Error, resolver.DnsServer));
106-
// return;
105+
OnLookupError(new DNSLookupErrorArgs(dnsResponse.Error, resolver.DnsServer));
106+
return;
107107
}
108108

109109
// Process the results...

Source/NETworkManager/ViewModels/Applications/DNSLookupViewModel.cs

Lines changed: 11 additions & 114 deletions
Original file line numberDiff line numberDiff line change
@@ -179,90 +179,6 @@ public DateTime? EndTime
179179
}
180180
}
181181

182-
private string _dnsServerAndPort;
183-
public string DNSServerAndPort
184-
{
185-
get { return _dnsServerAndPort; }
186-
set
187-
{
188-
if (value == _dnsServerAndPort)
189-
return;
190-
191-
_dnsServerAndPort = value;
192-
OnPropertyChanged();
193-
}
194-
}
195-
196-
private int _questions;
197-
public int Questions
198-
{
199-
get { return _questions; }
200-
set
201-
{
202-
if (value == _questions)
203-
return;
204-
205-
_questions = value;
206-
OnPropertyChanged();
207-
}
208-
}
209-
210-
private int _answers;
211-
public int Answers
212-
{
213-
get { return _answers; }
214-
set
215-
{
216-
if (value == _answers)
217-
return;
218-
219-
_answers = value;
220-
OnPropertyChanged();
221-
}
222-
}
223-
224-
private int _authorities;
225-
public int Authorities
226-
{
227-
get { return _authorities; }
228-
set
229-
{
230-
if (value == _authorities)
231-
return;
232-
233-
_authorities = value;
234-
OnPropertyChanged();
235-
}
236-
}
237-
238-
private int _additionals;
239-
public int Additionals
240-
{
241-
get { return _additionals; }
242-
set
243-
{
244-
if (value == _additionals)
245-
return;
246-
247-
_additionals = value;
248-
OnPropertyChanged();
249-
}
250-
}
251-
252-
private int _messageSize;
253-
public int MessageSize
254-
{
255-
get { return _messageSize; }
256-
set
257-
{
258-
if (value == _messageSize)
259-
return;
260-
261-
_messageSize = value;
262-
OnPropertyChanged();
263-
}
264-
}
265-
266182
private bool _expandStatistics;
267183
public bool ExpandStatistics
268184
{
@@ -369,15 +285,9 @@ private void CopySelectedResultAction()
369285
private void StartLookup()
370286
{
371287
DisplayStatusMessage = false;
372-
IsLookupRunning = true;
288+
StatusMessage = string.Empty;
373289

374-
// Reset statistic
375-
DNSServerAndPort = string.Empty;
376-
Questions = 0;
377-
Answers = 0;
378-
Authorities = 0;
379-
Additionals = 0;
380-
MessageSize = 0;
290+
IsLookupRunning = true;
381291

382292
// Measure the time
383293
StartTime = DateTime.Now;
@@ -461,18 +371,21 @@ private void DNSLookup_RecordReceived(object sender, DNSLookupRecordArgs e)
461371
{
462372
DNSLookupRecordInfo DNSLookupRecordInfo = DNSLookupRecordInfo.Parse(e);
463373

464-
Application.Current.Dispatcher.BeginInvoke(System.Windows.Threading.DispatcherPriority.Send, new Action(delegate ()
465-
{
466-
LookupResult.Add(DNSLookupRecordInfo);
467-
}));
374+
Application.Current.Dispatcher.BeginInvoke(DispatcherPriority.Send, new Action(delegate ()
375+
{
376+
LookupResult.Add(DNSLookupRecordInfo);
377+
}));
468378
}
469379

470380
private void DNSLookup_LookupError(object sender, DNSLookupErrorArgs e)
471381
{
382+
if (!string.IsNullOrEmpty(StatusMessage))
383+
StatusMessage += Environment.NewLine;
384+
472385
if (e.ErrorCode == "Timeout Error")
473-
StatusMessage = string.Format(Application.Current.Resources["String_TimeoutWhenQueryingDNSServer"] as string, e.DNSServer);
386+
StatusMessage += string.Format(Application.Current.Resources["String_TimeoutWhenQueryingDNSServer"] as string, e.DNSServer);
474387
else
475-
StatusMessage = Application.Current.Resources["String_UnkownError"] as string;
388+
StatusMessage += Application.Current.Resources["String_UnkownError"] as string;
476389

477390
DisplayStatusMessage = true;
478391

@@ -484,22 +397,6 @@ private void DNSLookup_LookupComplete(object sender, EventArgs e)
484397
LookupFinished();
485398
}
486399

487-
/* private void DNSLookup_LookupComplete1(object sender, DNSLookupCompleteArgs e)
488-
{
489-
DNSServerAndPort = e.ServerAndPort;
490-
Questions = e.QuestionsCount;
491-
Answers = e.AnswersCount;
492-
Authorities = e.AuthoritiesCount;
493-
Additionals = e.AdditionalsCount;
494-
MessageSize = e.MessageSize;
495-
496-
if (e.AnswersCount == 0)
497-
{
498-
StatusMessage = string.Format(Application.Current.Resources["String_NoDNSRecordFoundCheckYourInputAndSettings"] as string, Host);
499-
DisplayStatusMessage = true;
500-
}
501-
}*/
502-
503400
private void DispatcherTimer_Tick(object sender, EventArgs e)
504401
{
505402
Duration = stopwatch.Elapsed;

0 commit comments

Comments
 (0)