public MessageHistoryView()
        {
            this.InitializeComponent();
            viewModel       = null;
            selectedMessage = null;

            App.notificationManager.channel.PushNotificationReceived += OnPushNotification;

            // Preserves the state of the page even after user has navigated away
            // Appreciate this line of code! It took me 2 hours find a concise
            // solution to saving the state of a page for ASP.NET UWP Windows 10!
            this.NavigationCacheMode = NavigationCacheMode.Required;
        }
Exemplo n.º 2
0
        public static void Navigate(Type sourcePage, object parameter)
        {
            if (parameter is MessageHistoryViewModel)
            {
                MessageHistoryViewModel vm = (MessageHistoryViewModel)parameter;

                if (!vm.Equals(lastContext))
                {
                    lastContext = vm;
                }
            }

            frameInstance.Navigate(sourcePage, parameter);
        }
Exemplo n.º 3
0
        public GroupsContent(GroupChat groupChat, string groupMembers)
        {
            group = groupChat;

            groupName = this.group.Name;
            groupIcon = getGroupIconChars(groupName);

            this.groupMembers = groupMembers;

            backgroundPath = null;
            imageContainer = null;
            strokes        = new InkStrokeContainer();

            messageHistoryViewModel = new MessageHistoryViewModel(this);
        }
Exemplo n.º 4
0
        public ActionResult remove_message(MessageHistoryViewModel msg)
        {
            switch (msg.Source)
            {
            case 1:
            {
                var message = db.MessageLogs.Find(msg.Id);
                db.MessageLogs.Remove(message);
            }
            break;

            case 2:
            {
                var message = db.Messages.Find(msg.Id);
                db.Messages.Remove(message);
            }
            break;
            }
            db.SaveChanges();
            return(Json(new { success = true }, JsonRequestBehavior.AllowGet));
        }
        protected override void OnNavigatedTo(NavigationEventArgs e)
        {
            if (e.Parameter == null)
            {
                MessageHistoryGrid.Visibility = Visibility.Collapsed;
            }

            if (e.Parameter != null)
            {
                if (MessageHistoryGrid.Visibility == Visibility.Collapsed)
                {
                    MessageHistoryGrid.Visibility = Visibility.Visible;
                }

                if (e.Parameter is MessageContent)
                {
                    MessageContent msg = (MessageContent)e.Parameter;
                    viewModel.addToHistory(msg);
                }
                else if (e.Parameter is MessageHistoryViewModel)
                {
                    MessageHistoryViewModel selectedViewModel = (MessageHistoryViewModel)e.Parameter;
                    viewModel = selectedViewModel;

                    if (LeftFrameNavigator.isSubFrameVisible())
                    {
                        viewModel.CanvasListButton = MessageHistoryViewModel.listImage;
                    }
                    else
                    {
                        viewModel.CanvasListButton = MessageHistoryViewModel.canvasImage;
                    }

                    this.DataContext = viewModel;
                }
            }
        }
Exemplo n.º 6
0
 public static void SetLastContext(MessageHistoryViewModel context)
 {
     lastContext = context;
 }