Exemple #1
0
        /// <summary>
        /// Creates an instance of YapperChatView. This is the main page for
        /// YapperChat. The pivot view displays the chats and the contacts
        /// registered with Yapper
        /// </summary>
        public YapperChatMessagesPivot()
        {
            InitializeComponent();
            Messenger.Default.Send <SuspendTaskCountEvent>(new SuspendTaskCountEvent()
            {
                Suspend = true
            });

            YapperChatViewModel viewModel = new YapperChatViewModel(true);

            this.DataContext = viewModel;

            // subscribe to push notifications
            PushNotification.PushNotification.Instance.Setup();

            // CollectionViewSource is used so that the list of conversations is maintained in the
            // sorted order.
            this.FavoritesCollection        = new System.Windows.Data.CollectionViewSource();
            this.FavoritesCollection.Source = viewModel.AllConversations.Conversations;
            System.ComponentModel.SortDescription favoritesSort = new System.ComponentModel.SortDescription("LastPostUtcTime", System.ComponentModel.ListSortDirection.Descending);
            this.FavoritesCollection.SortDescriptions.Add(favoritesSort);
            this.FavoritesListBox.ItemsSource = this.FavoritesCollection.View;

            BuildLocalizedApplicationBar();
        }
Exemple #2
0
        private string GetConversationMessagesViewUri(ConversationModel selectedItemData)
        {
            YapperChatViewModel viewModel = (YapperChatViewModel)this.DataContext;

            viewModel.AllConversations.SelectedConversation = selectedItemData;
            string    uriString = null;
            UserModel recipient = null;

            foreach (UserModel user in selectedItemData.ConversationParticipants)
            {
                if (!user.Equals(UserSettingsModel.Instance.Me))
                {
                    recipient = user;
                }
            }

            if (recipient != null)
            {
                uriString =
                    string.Format(
                        "/Views/ConversationMessagesView.xaml?conversationId={0}&recipientName={1}&recipientId={2}&isGroup={3}",
                        selectedItemData.ConversationId, recipient.Name, recipient.Id, selectedItemData.IsGroupConversation);
            }

            return(uriString);
        }
        public YapperChatTaskPivot()
        {
            InitializeComponent();

            UserSettingsModel.Instance.LastTaskPageViewTime = DateTime.Now;
            Messenger.Default.Send <SuspendTaskCountEvent>(new SuspendTaskCountEvent()
            {
                Suspend = true
            });
            YapperChatViewModel viewModel = new YapperChatViewModel(false);

            this.DataContext = viewModel;
            PushNotification.PushNotification.Instance.Setup();
            this.TasksListSelector.ItemsSource = viewModel.Tasks.Tasks;

            this.swipeInteraction = new SwipeInteraction <MessageModel>();
            swipeInteraction.Initialize(this.TasksListSelector, itemManager, viewModel.Tasks.Tasks);

            this.tapEditInteraction = new TapEditInteraction <MessageModel>();
            tapEditInteraction.Initialize(this.TasksListSelector, itemManager, viewModel.Tasks.Tasks);
            tapEditInteraction.SaveEditText = this.SaveTaskName;

            _interactionManager.AddInteraction(swipeInteraction);
            FrameworkDispatcher.Update();

            BuildLocalizedApplicationBar();
        }
Exemple #4
0
        protected override void OnNavigatedTo(System.Windows.Navigation.NavigationEventArgs e)
        {
            base.OnNavigatedTo(e);

            YapperChatViewModel viewModel = (YapperChatViewModel)this.DataContext;

            viewModel.AllConversations.SelectedConversation = null;
            Messenger.Default.Register <SyncEvent>(this, this.HandleSyncCompleteEvent);
        }
Exemple #5
0
        private void HandleSyncCompleteEvent(SyncEvent syncComplete)
        {
            DispatcherHelper.InvokeOnUiThread(
                () =>
            {
                YapperChatViewModel viewModel = (YapperChatViewModel)this.DataContext;

                if (viewModel.AllConversations == null || viewModel.AllConversations.Conversations == null || viewModel.AllConversations.Conversations.Count == 0)
                {
                    NavigationService.Navigate(new Uri(string.Format("/Views/YapperChatContactsPivot.xaml"), UriKind.Relative));
                }
            });
        }
Exemple #6
0
        public YapperChatContactsPivot()
        {
            InitializeComponent();

            YapperChatViewModel viewModel = new YapperChatViewModel(false);

            this.DataContext = viewModel;

            this.contactsCollection        = new System.Windows.Data.CollectionViewSource();
            this.contactsCollection.Source = viewModel.RegisteredUsers.RegisteredUsers;
            System.ComponentModel.SortDescription contactsSort = new System.ComponentModel.SortDescription("FirstLetter", System.ComponentModel.ListSortDirection.Ascending);
            this.contactsCollection.SortDescriptions.Add(contactsSort);

            this.ContactsListSelector.ItemsSource = viewModel.RegisteredUsers.RegisteredUsers;

            this.groupsCollection        = new System.Windows.Data.CollectionViewSource();
            this.groupsCollection.Source = viewModel.Groups.Groups;
            System.ComponentModel.SortDescription groupsSort = new System.ComponentModel.SortDescription("Name", System.ComponentModel.ListSortDirection.Ascending);
            this.contactsCollection.SortDescriptions.Add(groupsSort);

            BuildLocalizedApplicationBar();
        }