Exemple #1
0
 public MainViewModel()
 {
     _oldConnections = new OldConnectionsViewModel(_settings);
     _connections = new ConnectionsViewModel(_settings);
     _settingsViewModel = new SettingsViewModel(_settings);
     _listReplies.CollectionChanged += (s, e) =>
     {
         string replies = "";
         foreach (int item in _listReplies)
         {
             if (item != -1)
             {
                 replies += item.ToString() + Localization.Localization.Ping_Microseconds + "\n";
                 
             }
             else
             {
                 replies += Localization.Localization.Ping_RequestTimedOut + "\n";
             }
         }
         Replies = replies;
     };                                                
     _pingExecuted = false;
     _currentOldConnectionIsInvalid = false;
     CurrentPingState = PingState.PingStopped;
     AddValidationRule(new ValidationRule("CurrentOldConnectionText", () => 
     {
         string result = null;
         if (Uri.CheckHostName(CurrentOldConnectionText) == UriHostNameType.Unknown)
         {
             result = Localization.Localization.AddressIsInvalid;
             CurrentOldConnectionIsInvalid = true;
         }
         else
         {
             CurrentOldConnectionIsInvalid = false;
         }
         return result;
     }));
 }
Exemple #2
0
 public MainViewModel()
 {
     _oldConnections                 = new OldConnectionsViewModel(_settings);
     _connections                    = new ConnectionsViewModel(_settings);
     _settingsViewModel              = new SettingsViewModel(_settings);
     _listReplies.CollectionChanged += (s, e) =>
     {
         string replies = "";
         foreach (int item in _listReplies)
         {
             if (item != -1)
             {
                 replies += item.ToString() + Localization.Localization.Ping_Microseconds + "\n";
             }
             else
             {
                 replies += Localization.Localization.Ping_RequestTimedOut + "\n";
             }
         }
         Replies = replies;
     };
     _pingExecuted = false;
     _currentOldConnectionIsInvalid = false;
     CurrentPingState = PingState.PingStopped;
     AddValidationRule(new ValidationRule("CurrentOldConnectionText", () =>
     {
         string result = null;
         if (Uri.CheckHostName(CurrentOldConnectionText) == UriHostNameType.Unknown)
         {
             result = Localization.Localization.AddressIsInvalid;
             CurrentOldConnectionIsInvalid = true;
         }
         else
         {
             CurrentOldConnectionIsInvalid = false;
         }
         return(result);
     }));
 }