public ZenMode() {
     InitializeComponent();
     DataContext = cloud = Connection.CurrentCloud;
     cloud.Controller.Messages.CollectionChanged += ScrollDown;
     recognizer = new SpeechRecognizer();
     doneWithZen = false;
 }
Esempio n. 2
0
        public void CopyFrom(Cloud cloud)
        {
            if (cloud.Moderators != null && cloud.Moderators.Length > 0) {
                Moderators = cloud.Moderators;
                OnPropertyChanged("IsModerator");
                OnPropertyChanged("FullMods");
                OnPropertyChanged("ShowMods");
            }

            if (cloud.Owner != null) {
                Owner = cloud.Owner;
                OnPropertyChanged("IsOwner");
                OnPropertyChanged("FullOwner");
            }

            if (cloud.avatar != null) {
                avatar = cloud.avatar;
            }

            if (cloud.description != null) {
                description = cloud.description;
            }

            if (cloud.hidden != null) {
                hidden = cloud.hidden;
            }

            if (cloud.name != null) {
                name = cloud.name;
            }

            if (cloud.rules != null) {
                rules = cloud.rules;
            }
        }
        protected override void OnNavigatedTo(NavigationEventArgs e)
        {
            while (NavigationService.BackStack.Count() > 1) {
                NavigationService.RemoveBackEntry();
            }

            if (inUserPopup) {
                userpopup.IsOpen = true;
                inUserPopup = true;
            }

            if (Connection.CurrentCloud == null) {
                NavigationService.GoBack();
                return;
            }
            LoadingPopup.IsOpen = true;
            DerpyHoovesMailCenter.VerifyCloud(Connection.CurrentCloud.id, () => LoadingPopup.IsOpen = false);

            cloudinfoback.Visibility = Visibility.Collapsed;
            Leaving = true;
            Controller.Messages.CollectionChanged += ScrollDown;
            ScrollDown(null, null);

            if (datcloud != null && datcloud != Connection.CurrentCloud) {
                NavigateCloud(Connection.CurrentCloud);
            }

            datcloud = Connection.CurrentCloud;
        }
        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();
            });
        }
        protected override void OnNavigatedTo(NavigationEventArgs e) {
            //if (ProximityDevice.GetDefault() != null) {
            //    var menuItems = ApplicationBar.MenuItems.Cast<ApplicationBarMenuItem>();
            //    menuItems.First(item => item.Text == "Tap + Send").IsEnabled = true;
            //}

            while (NavigationService.BackStack.Count() > 1) {
                NavigationService.RemoveBackEntry();
            }

            if (inUserPopup) {
                userpopup.IsOpen = true;
                inUserPopup = true;
            }

            if (Connection.CurrentCloud == null) {
                NavigationService.GoBack();
                return;
            }
            LoadingPopup.IsOpen = true;
            DerpyHoovesMailCenter.VerifyCloud(Connection.CurrentCloud.id, () => LoadingPopup.IsOpen = false);

            cloudinfoback.Visibility = Visibility.Collapsed;
            Leaving = true;
            Controller.Messages.CollectionChanged += ScrollDown;
            ScrollDown(null, null);

            if (datcloud != null && datcloud != Connection.CurrentCloud) {
                NavigateCloud(Connection.CurrentCloud);
            }

            datcloud = Connection.CurrentCloud;
        }
Esempio n. 6
0
 public Share()
 {
     InitializeComponent();
     DataContext = cloud = Connection.CurrentCloud;
 }