public Clouds() { if (Connection.CurrentCloud == null) { Dispatcher.BeginInvoke(() => NavigationService.Navigate(new Uri("/MainPage.xaml", UriKind.Relative))); return; } Controller = DerpyHoovesMailCenter.GetCloud(Connection.CurrentCloud); InitializeComponent(); if (Connection.CurrentCloudsdaleUser.Clouds.All(cloud => cloud.id != Connection.CurrentCloud.id)) { Connection.JoinCloud(Connection.CurrentCloud.id); var list = new List<Cloud>(Connection.CurrentCloudsdaleUser.clouds) { Connection.CurrentCloud }; list.Sort(PonyvilleDirectory.GetUserCloudListComparer()); Connection.CurrentCloudsdaleUser.clouds = list.ToArray(); } cloudPivot.Title = Connection.CurrentCloud.name; new Thread(() => { Thread.Sleep(75); Dispatcher.BeginInvoke(() => { Chats.ItemsSource = Controller.Messages; MediaList.ItemsSource = Controller.Drops; Ponies.DataContext = Controller.Users; ScrollDown(null, null); }); }).Start(); Wasoncloud = true; ApplicationBar.ForegroundColor = Colors.White; ApplicationBar.BackgroundColor = ((SolidColorBrush)Application.Current.Resources["PhoneChromeBrush"]).Color; }
public void NavigateCloud(Cloud cloud) { Dispatcher.BeginInvoke(() => { Controller.Messages.CollectionChanged -= ScrollDown; Connection.CurrentCloud = cloud; userpopup.IsOpen = false; inUserPopup = false; Chats.ItemsSource = new Message[0]; MediaList.ItemsSource = new Drop[0]; Ponies.DataContext = null; cloudPivot.Title = ""; new Thread(() => { Thread.Sleep(100); Dispatcher.BeginInvoke(() => { Controller = DerpyHoovesMailCenter.GetCloud(Connection.CurrentCloud); Controller.Messages.CollectionChanged += ScrollDown; if (Connection.CurrentCloudsdaleUser.Clouds.All(cloud1 => cloud1.id != Connection.CurrentCloud.id)) { Connection.JoinCloud(Connection.CurrentCloud.id); Connection.CurrentCloudsdaleUser.clouds = new List<Cloud> (Connection.CurrentCloudsdaleUser.clouds) { Connection.CurrentCloud }.ToArray(); } cloudPivot.Title = Connection.CurrentCloud.name; LoadingPopup.IsOpen = true; DerpyHoovesMailCenter.VerifyCloud(Connection.CurrentCloud.id, () => LoadingPopup.IsOpen = false); new Thread(() => { Thread.Sleep(75); Dispatcher.BeginInvoke(() => { Chats.ItemsSource = Controller.Messages; MediaList.ItemsSource = Controller.Drops; Ponies.DataContext = Controller.Users; ScrollDown(null, null); }); }).Start(); Wasoncloud = true; cloudPivot.SelectedIndex = 0; }); }).Start(); }); }