Пример #1
0
        static async void Test()
        {
            ApiClient.SetBaseUrl("http://192.168.10.242/discuz");

            var method   = new ForumIndex();
            var catalogs = await ApiClient.Execute(method);

            foreach (ForumCatalog c in catalogs)
            {
                Console.WriteLine(c.Name);

                foreach (Forum f in c.SubFourms)
                {
                    Console.WriteLine("--" + f.Name);

                    var method2 = new ForumDisplay()
                    {
                        ForumID = f.ID
                    };
                    var threads = await ApiClient.Execute(method2);

                    foreach (ThreadSummary s in threads)
                    {
                        Console.WriteLine("    ==========");
                        Console.WriteLine("    " + s.Subject);

                        var method3 = new ViewThread()
                        {
                            ThreadID = s.ID
                        };
                        var posts = await ApiClient.Execute(method3);

                        foreach (ThreadPost p in posts)
                        {
                            if (!p.IsFirst)
                            {
                                continue;
                            }

                            Console.WriteLine("      " + p.Content.Replace("\r\n", ""));

                            if (p.Attachments != null)
                            {
                                foreach (KeyValuePair <string, Attachement> a in p.Attachments)
                                {
                                    Console.WriteLine("      ** " + a.Value.Url);
                                }
                            }

                            Console.WriteLine();
                        }
                    }
                }

                Console.WriteLine();
            }
        }
Пример #2
0
        private async void LoadData() {
            //var hud = DependencyService.Get<IToast>();
            //hud.Show("正在加载");

            var method = new ForumIndex();
            var catalogs = await ApiClient.Execute(method);

            var groups = catalogs.Select(c => new ListViewGroup<ForumDetailViewModel>(c.SubFourms.Select(s => new ForumDetailViewModel(s, this.NS))) {
                Title = c.Name
            });

            this.Datas = new ObservableCollection<ListViewGroup<ForumDetailViewModel>>(groups);
            this.NotifyOfPropertyChange(() => this.Datas);

            //hud.Close();
        }
Пример #3
0
        public IActionResult Index()
        {
            var forums = _forumService.GetAll()
                         .Select(forum => new ForumListing
            {
                Id          = forum.Id,
                Name        = forum.Title,
                Description = forum.Description
            });
            var model = new ForumIndex
            {
                ForumList = forums
            };

            return(View(model));
        }
Пример #4
0
        private async void LoadData()
        {
            //var hud = DependencyService.Get<IToast>();
            //hud.Show("正在加载");

            var method   = new ForumIndex();
            var catalogs = await ApiClient.Execute(method);

            var groups = catalogs.Select(c => new ListViewGroup <ForumDetailViewModel>(c.SubFourms.Select(s => new ForumDetailViewModel(s, this.NS)))
            {
                Title = c.Name
            });

            this.Datas = new ObservableCollection <ListViewGroup <ForumDetailViewModel> >(groups);
            this.NotifyOfPropertyChange(() => this.Datas);

            //hud.Close();
        }
Пример #5
0
 public void TestIndex() {
     var method = new ForumIndex();
     var result = ApiClient.Execute(method).Result;
 }
Пример #6
0
 public void TestIndex()
 {
     var method = new ForumIndex();
     var result = ApiClient.Execute(method).Result;
 }