Beispiel #1
0
 protected virtual async void NewProfile(IProfile newProfile)
 {
     await dispatcher.RunAsync(CoreDispatcherPriority.Normal, () =>
     {
         if (!saved.Contains(newProfile))
         {
             if (!connected.Contains(newProfile))
             {
                 connected.Add(newProfile);
             }
             else
             {
                 IProfile existedProfile = connected.Find((profile) => profile.Equals(newProfile));
                 existedProfile.CopyInformation(newProfile);
             }
         }
         else
         {
             IProfile savedProfile = saved.Find((profile) => profile.Equals(newProfile));
             if (!connected.Contains(newProfile))
             {
                 savedProfile.CopyData(newProfile);
                 connected.Add(savedProfile);
             }
             else
             {
                 savedProfile.CopyInformation(newProfile);
             }
         }
     });
 }
        async void client_NewAvailableProfile(object sender, TClientProfile newProfile)
        {
            await dispatcher.RunAsync(CoreDispatcherPriority.Normal, () =>
            {
                if (available.Contains(newProfile))
                {
                    return;
                }

                TClientProfile existedProfile = (TClientProfile)saved.Find((profile) => profile.Equals(newProfile));
                if (existedProfile == null)
                {
                    existedProfile = (TClientProfile)connected.Find((profile) => profile.Equals(newProfile));
                }

                if (existedProfile != null)
                {
                    existedProfile.CopyInformation(newProfile);
                    available.Add(existedProfile);
                }
                else
                {
                    available.Add(newProfile);
                }
            });
        }