private void Load() { Task.Factory.StartNew(() => { Thread.Sleep(500); try { RegistryKey key = Registry.CurrentUser.OpenSubKey(@"Software\" + GlobalAssemblyInfo.AssemblyName + @"\Accounts"); string[] accounts = key.GetSubKeyNames(); foreach (string each in accounts) { string[] subAccounts = key.OpenSubKey(each).GetSubKeyNames(); foreach (string sub in subAccounts) { Dispatcher.Invoke(() => { AccountDisplay display = new AccountDisplay(new BitmapImage(new Uri("pack://application:,,,/Daytimer.Images;component/Images/google.png", UriKind.Absolute)), each, sub); servicesPanel.Children.Add(display); }); } } } catch { } }); }
private void AddGoogleService() { GoogleSignIn gSignIn = new GoogleSignIn(); gSignIn.Owner = Window.GetWindow(this); if (gSignIn.ShowDialog() == true) { AccountDisplay display = new AccountDisplay(new BitmapImage(new Uri("pack://application:,,,/Daytimer.Images;component/Images/google.png", UriKind.Absolute)), "Google", gSignIn.Email); servicesPanel.Children.Add(display); if (SyncDatabase.GetSyncObject(gSignIn.Email) == null) { SyncDatabase.Add(new SyncObject(gSignIn.Email, DateTime.Now, SyncType.EntireAccount)); } } }