예제 #1
0
        // 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();
        }