Exemplo n.º 1
0
        public ReadMessage(string sessionID, string server, Messages message)
        {
            Date.Text               = message.date;
            From.Text               = message.from;
            To.Text                 = message.to;
            Subject.Text            = message.subject;
            Message.Text            = message.body;
            Message.BackgroundColor = Color.FromRgb(0, 0, 128);
            var mainLayout = new StackLayout
            {
                Children =
                {
                    Date, From,    To,      Subject,
                    new ScrollView {
                        Content         = Message,
                        VerticalOptions = LayoutOptions.FillAndExpand,
                    },
                    new StackLayout {
                        Orientation     = StackOrientation.Horizontal,
                        Children        = { Reply, Archive, Forward, Delete },
                        VerticalOptions = LayoutOptions.End,
                        BackgroundColor = Color.FromRgb(0,0,    128),
                    }
                }
            };

            Content = mainLayout;
            if (Device.OS == TargetPlatform.iOS)
            {
                mainLayout.Padding = new Thickness(0, 20, 0, 0);
            }

            Reply.Clicked += async(sender, e) => {
                //await Navigation.PopAsync();
                await Navigation.PushAsync(new ComposeReply(sessionID, server, message, "Re: "));
            };
            Archive.Clicked += async(sender, e) =>
            {
                var json     = Inbox.ArchiveMessages(1, sessionID, message.id);
                var s        = new LacunaExpress.Data.Server();
                var response = await s.GetHttpResultAsync(server, Inbox.url, json);

                await Navigation.PopAsync();
            };
            Forward.Clicked += async(sender, e) =>
            {
                //await Navigation.PopAsync();
                await Navigation.PushAsync(new ComposeReply(sessionID, server, message, "Fw: "));
            };
            Delete.Clicked += async(sender, e) => {
                var json     = Inbox.TrashMessages(1, sessionID, message.id);
                var s        = new LacunaExpress.Data.Server();
                var response = await s.GetHttpResultAsync(server, Inbox.url, json);

                await Navigation.PopAsync();
            };
        }