コード例 #1
0
        private async void OnToolbarItemClicked(object sender, EventArgs e)
        {
            NewsInfo        info;
            NewsToolbarItem tItem = (NewsToolbarItem)sender;

            if (tItem.Description == "rgn")
            {
                info = rgn.SelectedInfo;
                RegionProc(true);
            }
            else
            {
                info = new NewsInfo {
                    Address = tItem.Address, Description = tItem.Description
                };
                RegionProc(false);
            }
            if (toolBarItemSelected == info)
            {
                return;
            }
            toolBarItemSelected = info;
            if (!await viewModel.LoadAsync(info))
            {
                Exit();
                return;
            }
            Application.Current.Properties["Inf"] = NewsInfo.Serialize(info);
            await Application.Current.SavePropertiesAsync();

            listView.ScrollTo(((RSSItem[])listView.ItemsSource).First(), ScrollToPosition.End, true);
        }
コード例 #2
0
ファイル: App.xaml.cs プロジェクト: InveterateCoder/vKurse
 public App()
 {
     InitializeComponent();
     if (!Properties.ContainsKey("Inf"))
     {
         Properties.Add("Inf", NewsInfo.Serialize(new NewsInfo {
             Address = "https://news.yandex.ru/index.rss", Description = "Главное"
         }));
     }
     if (!Properties.ContainsKey("Rgn"))
     {
         Properties.Add("Rgn", NewsInfo.Serialize(new NewsInfo {
             Address = "https://news.yandex.ru/Barnaul/index.rss", Description = "Алтайский край"
         }));
     }
     MainPage = new NavigationPage(new MainPage());
 }
コード例 #3
0
ファイル: Region.xaml.cs プロジェクト: InveterateCoder/vKurse
        private async void RgnItemTaped(object sender, ItemTappedEventArgs e)
        {
            ListView list = (ListView)sender;

            SelectedInfo      = (NewsInfo)list.SelectedItem;
            list.SelectedItem = null;
            ((MainPage)((NavigationPage)Application.Current.MainPage).RootPage).viewModel.LoadAsync(SelectedInfo);
            Application.Current.Properties["Inf"] = Application.Current.Properties["Rgn"] = NewsInfo.Serialize(SelectedInfo);
            await Application.Current.SavePropertiesAsync();

            await Navigation.PopModalAsync();
        }