protected override void OnCreate(Bundle savedInstanceState) { base.OnCreate(savedInstanceState); id = Intent.GetIntExtra("id", 0); handler = new Handler(); dailyPresenter = new DailyPresenter(this); toolbar = FindViewById <Toolbar>(Resource.Id.toolbar); toolbar.SetNavigationIcon(Resource.Drawable.back_24dp); SetSupportActionBar(toolbar); SupportActionBar.SetDisplayHomeAsUpEnabled(true); toolbar.SetNavigationOnClickListener(this); toolbar.SetOnMenuItemClickListener(this); coordinatorLayout = FindViewById <CoordinatorLayout>(Resource.Id.main_content); collapsingToolbar = FindViewById <CollapsingToolbarLayout>(Resource.Id.collapsingtoolbar); collapsingToolbar.SetTitle(""); appbar = FindViewById <AppBarLayout>(Resource.Id.appbar); appbar.AddOnOffsetChangedListener(this); swipeRefreshLayout = FindViewById <SwipeRefreshLayout>(Resource.Id.swipeRefreshLayout); swipeRefreshLayout.SetColorSchemeResources(Resource.Color.primary); swipeRefreshLayout.SetOnRefreshListener(this); scrollView = FindViewById <NestedScrollView>(Resource.Id.scrollView); scrollView.ViewTreeObserver.AddOnScrollChangedListener(this); toolbarTitle = FindViewById <TextView>(Resource.Id.toolbarTitle); txtTitle = FindViewById <TextView>(Resource.Id.txtTitle); txtAuthor = FindViewById <TextView>(Resource.Id.txtAuthor); titleImage = FindViewById <ImageView>(Resource.Id.titleImage); body = FindViewById <DailyWebView>(Resource.Id.body); txtGood = FindViewById <TextView>(Resource.Id.txtGood); txtComments = FindViewById <TextView>(Resource.Id.txtComments); swipeRefreshLayout.Post(async() => { await dailyPresenter.GetClientDaily(id); await dailyPresenter.GetClientDailyExtra(id); }); }
public override async Task InitializeAsync(object navigationData) { if (IsInitialize == true) { return; } model = await dailyPresenter.GetClientDaily(Id); //从本地数据库获取 modelEx = await dailyPresenter.GetClientDailyExtra(Id); //从本地数据库获取 IsProgressing |= await RenewDailyUI(model, modelEx) == false; ProgressBarRunning(); if (model.title == "" || model.updatetime.AddMinutes(15) < DateTime.Now) { model = await dailyPresenter.GetServiceDaily(Id); modelEx = await dailyPresenter.GetServiceDailyExtra(Id); await RenewDailyUI(model, modelEx); IsProgressing = false; } IsInitialize = true; }