Пример #1
0
 public StatusesDetailsPage(Statuses statuses)
 {
     this.statuses = statuses;
     InitializeComponent();
     Title          = statuses.UserDisplayName + "的闪存";
     BindingContext = new StatusesDetailsViewModel(statuses);
 }
Пример #2
0
        public StatusesDetailsPage(Statuses statuses)
        {
            this.statuses = statuses;
            InitializeComponent();
            Title          = statuses.UserDisplayName + "的闪存";
            BindingContext = new StatusesDetailsViewModel(statuses);

            formsWebView.OnContentLoaded += delegate(object sender, EventArgs e)
            {
                RefreshStatuses();
            };

            formsWebView.AddLocalCallback("reload", async delegate(string obj)
            {
                if (formsWebView.LoadStatus == LoadMoreStatus.StausDefault || formsWebView.LoadStatus == LoadMoreStatus.StausError || formsWebView.LoadStatus == LoadMoreStatus.StausFail)
                {
                    var questionsComments = JsonConvert.SerializeObject(await ViewModel.ReloadCommentsAsync());
                    await formsWebView.InjectJavascriptAsync("updateComments(" + questionsComments + ");");
                }
            });
            formsWebView.AddLocalCallback("editItem", delegate(string id)
            {
                var statusesComments = ViewModel.StatusesComments.Where(n => n.Id == int.Parse(id)).FirstOrDefault();
                Device.BeginInvokeOnMainThread(async() =>
                {
                    var page = new StatusesCommentPopupPage(statuses, new Action <StatusesComments>(OnResult));
                    await Navigation.PushPopupAsync(page);
                });
            });
            formsWebView.AddLocalCallback("deleteItem", async delegate(string id)
            {
                var result = await ViewModel.DeleteStatusesCommentsAsync(int.Parse(id));
                await formsWebView.InjectJavascriptAsync("deleteComment(" + id + "," + result.ToString().ToLower() + ");");
            });
        }
 public StatusesCommentPopupPage(Statuses statuses, Action <StatusesComments> result)
 {
     this.statuses = statuses;
     this.result   = result;
     InitializeComponent();
     BindingContext = new StatusesDetailsViewModel(statuses);
     this.Comment.Focus();
 }
Пример #4
0
 public StatusesCommentPopupPage(Statuses statuses, Action <StatusesComments> result)
 {
     InitializeComponent();
     Xamarin.Forms.PlatformConfiguration.iOSSpecific.Page.SetUseSafeArea(this, true);
     this.statuses  = statuses;
     this.result    = result;
     BindingContext = new StatusesDetailsViewModel(statuses);
     this.Comment.Focus();
 }