protected override async void NewProfile(IProfile newProfile)
        {
            await dispatcher.RunAsync(CoreDispatcherPriority.Normal, () =>
            {
                if (connected.Contains(newProfile))
                {
                    return;
                }

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

                if (existedProfile != null)
                {
                    existedProfile.CopyData(newProfile);
                    connected.Add(existedProfile);
                }
                else
                {
                    connected.Add(newProfile);
                }
            });
        }
Exemple #2
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);
             }
         }
     });
 }