Exemple #1
0
        public override void Execute(object parameter)
        {
            PrivateChat privateChat = null;

            if (parameter is ItemClickEventArgs)
            {
                privateChat = ((ItemClickEventArgs)parameter).ClickedItem as PrivateChat;
            }

            if (privateChat == null)
            {
                return;
            }
            Loc.PrivateChat.CurrentPrivateChat = privateChat;

            if (!Loc.Main.Threads.Any())
            {
                Loc.Main.Threads.Add(privateChat);
            }
            else
            {
                Loc.Main.Threads[0] = privateChat;
            }
            Loc.Thread.SelectedThread = 0;

            Task.Run(async() => await ThreadFetcher.GetPosts(Loc.Thread.CurrentThread));

            if (Loc.NavigationService.CurrentView != View.Main)
            {
                Loc.NavigationService.Navigate(View.Main);
            }
        }
        public override void Execute(object parameter)
        {
            Models.Threads.Topic topic = null;
            if (parameter is ItemClickEventArgs)
            {
                var itemClick = parameter as ItemClickEventArgs;
                topic = itemClick.ClickedItem as Models.Threads.Topic;
            }
            else if (parameter is Models.Threads.Topic)
            {
                topic = (Models.Threads.Topic)parameter;
            }
            else if (parameter is IDictionary)
            {
                var elements = (Dictionary <object, object>)parameter;
                topic = elements["topic"] as Models.Threads.Topic;
                var desiredPage      = elements["page"]?.ToString();
                var desiredPageValue = 0;
                if (!int.TryParse(desiredPage, out desiredPageValue))
                {
                    return;
                }
                topic.ThreadCurrentPage = desiredPageValue;
            }

            if (topic == null)
            {
                return;
            }

            if (!Loc.Main.Threads.Any())
            {
                Loc.Main.Threads.Add(topic);
            }
            else
            {
                Loc.Main.Threads[0] = topic;
            }
            Loc.Thread.SelectedThread = 0;

            Task.Run(async() => await ThreadFetcher.GetPosts(Loc.Thread.CurrentThread));

            if (Loc.NavigationService.CurrentView != View.Main)
            {
                Loc.NavigationService.Navigate(View.Main);
            }
        }
Exemple #3
0
 public override void Execute(object parameter)
 {
     // Don't forget Index starts at 1, not 0, here.
     if (parameter is string)
     {
         var action = (string)parameter;
         if (action == "+" && Loc.Thread.CurrentThread.ThreadCurrentPage < Loc.Thread.CurrentThread.ThreadNbPage)
         {
             Loc.Thread.CurrentThread.ThreadCurrentPage = Loc.Thread.CurrentThread.ThreadCurrentPage + 1;
         }
         else if (action == "-" && Loc.Thread.CurrentThread.ThreadCurrentPage > 1)
         {
             Loc.Thread.CurrentThread.ThreadCurrentPage = Loc.Thread.CurrentThread.ThreadCurrentPage - 1;
         }
         else if (action == Strings.Last)
         {
             Loc.Thread.CurrentThread.ThreadCurrentPage = Loc.Thread.CurrentThread.ThreadNbPage;
         }
         else if (action == Strings.First)
         {
             Loc.Thread.CurrentThread.ThreadCurrentPage = 1;
         }
         else if (!string.IsNullOrEmpty(action))
         {
             int index = -1;
             if (!int.TryParse(action, out index))
             {
                 return;
             }
             if (index == 0 || index > Loc.Thread.CurrentThread.ThreadNbPage)
             {
                 return;
             }
             Loc.Thread.CurrentThread.ThreadCurrentPage = index;
         }
         Task.Run(() => ThreadFetcher.GetPosts(Loc.Thread.CurrentThread));
     }
 }
Exemple #4
0
        public async Task RefreshPage(EditorIntent editorIntent)
        {
            await ThreadUI.Invoke(() =>
            {
                switch (editorIntent)
                {
                case EditorIntent.New:
                case EditorIntent.Quote:
                case EditorIntent.MultiQuote:
                    CurrentThread.ThreadCurrentPage = CurrentThread.ThreadNbPage;
                    break;

                case EditorIntent.Edit:
                case EditorIntent.Delete:
                    break;

                default:
                    break;
                }
            });

            await Task.Run(async() => await ThreadFetcher.GetPosts(CurrentThread));
        }
Exemple #5
0
 public override void Execute(object parameter)
 {
     Task.Run(async() => await ThreadFetcher.GetPosts(Loc.Thread.CurrentThread));
 }