// View life cycle public override void ViewDidLoad() { base.ViewDidLoad(); NavigationController.NavigationBar.Translucent = false; // Setup tool bar with custom buttons setupToolBar(); Subject.Text = message.Title; Sender.Text = "Expéditeur : " + message.From; // Category Category.Text = (message.Category != null) ? message.Category : ""; Category.BackgroundColor = InBoxTools.colorForCategory(message.Category); ReceiptDate.Text = "Reçu : " + InBoxTools.labelTextForDate(message.Date); Details.Text = message.Text; switch (content.Type) { case AccengageInboxMessageContentType.Text: Webview.Hidden = true; TextView.Text = content.Body; break; case AccengageInboxMessageContentType.Web: TextView.Hidden = true; Loader.StartAnimating(); Webview.Alpha = 0; Webview.ScrollView.Bounces = false; Webview.Delegate = new WebviewDelegate(Webview, Loader); Webview.LoadRequest(new NSUrlRequest(new NSUrl(content.Body))); break; } if (message.IconUrl.Length > 0) { NSMutableUrlRequest request = new NSMutableUrlRequest(new NSUrl(message.IconUrl)); NSUrlConnection.SendAsynchronousRequest(request, NSOperationQueue.MainQueue, (response, data, error) => { if (error == null) { IconMsg.Image = UIImage.LoadFromData(data); } }); } else { IconMsg.Hidden = true; } NSNotificationCenter.DefaultCenter.AddObserver(UIApplication.DidChangeStatusBarOrientationNotification, deviceOrientationDidChangeNotification); updateForDeviceOrientation(); }
public void setMessage(AccengageInboxMessage msg) { Subject.Text = msg.Title; Content.Text = msg.Text; Date.Text = InBoxTools.labelTextForDate(msg.Date); string categorie = msg.Category; Category.Text = (categorie != null) ? categorie : ""; Category.BackgroundColor = InBoxTools.colorForCategory(Category.Text); if (msg.Read) { Subject.TextColor = UIColor.FromWhiteAlpha(0.4f, 1.0f); Content.TextColor = UIColor.FromWhiteAlpha(0.4f, 1.0f); StatusMessage.BackgroundColor = UIColor.White; } else { Subject.TextColor = UIColor.Black; Content.TextColor = UIColor.Black; StatusMessage.BackgroundColor = UIColor.FromRGB(0, 121, 255); } if (msg.Archived) { StatusMessage.BackgroundColor = UIColor.Red; } string iconUrl = msg.IconUrl; if (iconUrl.Length > 0) { IconMsg.Hidden = false; var request = NSUrlRequest.FromUrl(new NSUrl(iconUrl)); NSUrlConnection.SendAsynchronousRequest(request, NSOperationQueue.MainQueue, (response, data, error) => { if (error == null) { IconMsg.Image = UIImage.LoadFromData(data); } }); } else { IconMsg.Hidden = true; } }