public KbArticlesSearchPage() : base()
        {
            InitializeComponent();
            BindingContext = new SearchViewModel(2);
            this.SearchsListView.ItemSelected += async delegate
            {
                var search = SearchsListView.SelectedItem as Search;
                if (search == null)
                {
                    return;
                }
                var articles = new KbArticles()
                {
                    Author    = search.UserName,
                    Body      = "",
                    Summary   = search.Content,
                    DiggCount = search.VoteTimes,
                    Id        = int.Parse(search.Id),
                    DateAdded = search.PublishTime,
                    Title     = search.Title.Replace("<strong>", "").Replace("</strong>", ""),
                    ViewCount = search.ViewTimes
                };

                var articlesDetails = new KbArticlesDetailsPage(articles);

                await NavigationService.PushAsync(Navigation, articlesDetails);

                this.SearchsListView.SelectedItem = null;
            };
        }
Ejemplo n.º 2
0
        protected override void OnAppearing()
        {
            base.OnAppearing();

            if (!hasInitialization)
            {
                BindingContext = new KbArticlesViewModel();

                Title = "知识库";

                this.KbArticlesListView.ItemSelected += async delegate {
                    var kbarticles = KbArticlesListView.SelectedItem as KbArticles;
                    this.KbArticlesListView.SelectedItem = null;
                    if (kbarticles == null)
                    {
                        return;
                    }

                    var kbarticlesDetails = new KbArticlesDetailsPage(kbarticles);

                    await NavigationService.PushAsync(Navigation, kbarticlesDetails);
                };
                ViewModel.GetClientKbArticlesAsync();

                hasInitialization = true;
            }
            UpdatePage();
        }
        public KbArticlesPage()
        {
            InitializeComponent();
            BindingContext = new KbArticlesViewModel();

            Title = "知识库";

            this.KbArticlesListView.ItemSelected += async delegate
            {
                var kbarticles = KbArticlesListView.SelectedItem as KbArticles;
                if (kbarticles == null)
                {
                    return;
                }

                var kbarticlesDetails = new KbArticlesDetailsPage(kbarticles);

                await NavigationService.PushAsync(Navigation, kbarticlesDetails);

                this.KbArticlesListView.SelectedItem = null;
            };
            ViewModel.GetClientKbArticlesAsync();
        }
Ejemplo n.º 4
0
        public KbArticlesPage()
        {
            InitializeComponent();
            BindingContext = new KbArticlesViewModel();

            Title = "知识库";
            //Icon = "menu_kbarticles.png";

            //var cancel = new ToolbarItem
            //{
            //    Text = "搜索",
            //    Command = new Command(async () =>
            //    {
            //        await NavigationService.PushAsync(Navigation, new KbArticlesSearchPage());
            //    })
            //};
            //ToolbarItems.Add(cancel);

            //if (Device.Android == Device.RuntimePlatform)
            //    cancel.Icon = "toolbar_search.png";

            this.KbArticlesListView.ItemSelected += async delegate
            {
                var kbarticles = KbArticlesListView.SelectedItem as KbArticles;
                if (kbarticles == null)
                {
                    return;
                }

                var kbarticlesDetails = new KbArticlesDetailsPage(kbarticles);

                await NavigationService.PushAsync(Navigation, kbarticlesDetails);

                this.KbArticlesListView.SelectedItem = null;
            };
            ViewModel.GetClientKbArticlesAsync();
        }
Ejemplo n.º 5
0
        public KbArticlesPage()
        {
            InitializeComponent();
            Xamarin.Forms.PlatformConfiguration.iOSSpecific.Page.SetUseSafeArea(this, true);
            BindingContext = new KbArticlesViewModel();

            Title = "知识库";

            this.KbArticlesListView.ItemSelected += async delegate
            {
                var kbarticles = KbArticlesListView.SelectedItem as KbArticles;
                if (kbarticles == null)
                {
                    return;
                }

                var kbarticlesDetails = new KbArticlesDetailsPage(kbarticles);

                await NavigationService.PushAsync(Navigation, kbarticlesDetails);

                this.KbArticlesListView.SelectedItem = null;
            };
            ViewModel.GetClientKbArticlesAsync();
        }
Ejemplo n.º 6
0
        public KbArticlesPage()
        {
            InitializeComponent();
            BindingContext = new KbArticlesViewModel();

            var cancel = new ToolbarItem
            {
                Text    = "搜索",
                Command = new Command(async() =>
                {
                    await NavigationService.PushAsync(Navigation, new KbArticlesSearchPage());
                })
            };

            ToolbarItems.Add(cancel);

            if (Device.Android == Device.RuntimePlatform)
            {
                cancel.Icon = "toolbar_search.png";
            }

            this.KbArticlesListView.ItemSelected += async delegate
            {
                var kbarticles = KbArticlesListView.SelectedItem as KbArticles;
                if (kbarticles == null)
                {
                    return;
                }

                var kbarticlesDetails = new KbArticlesDetailsPage(kbarticles);

                await NavigationService.PushAsync(Navigation, kbarticlesDetails);

                this.KbArticlesListView.SelectedItem = null;
            };
        }