private void SetInboxStyle()
        {
            PushwooshInboxStyle style = PushwooshInboxStyle.Instance;

            style.DateFormatter = new CustomDateFormatter();

            style.AccentColor          = new Integer(Color.ParseColor("#ff00ff"));
            style.BackgroundColor      = new Integer(Color.GhostWhite);
            style.BarAccentColor       = new Integer(Color.NavajoWhite);
            style.BarBackgroundColor   = new Integer(Color.MediumPurple);
            style.BarTextColor         = new Integer(Color.Black);
            style.DateColor            = new Integer(Color.DarkGray);
            style.DescriptionColor     = new Integer(Color.Black);
            style.DividerColor         = new Integer(Color.ParseColor("#ff00ff"));
            style.HighlightColor       = new Integer(Color.ParseColor("#ff00ff"));
            style.ImageTypeColor       = new Integer(Color.Honeydew);
            style.ReadDateColor        = new Integer(Color.DarkGray);
            style.ReadDescriptionColor = new Integer(Color.ParseColor("#ff44ff"));
            style.ReadImageTypeColor   = new Integer(Color.ParseColor("#ff44ff"));
            style.ReadTitleColor       = new Integer(Color.ParseColor("#ff44ff"));
            style.TitleColor           = new Integer(Color.ParseColor("#ff00ff"));

            style.BarTitle         = "My title";
            style.ListEmptyText    = "There is no messages here";
            style.ListErrorMessage = "Some error happenned";

            style.DefaultImageIcon    = Resource.Drawable.inbox_message;
            style.ListEmptyImage      = Resource.Drawable.inbox_empty;
            style.ListErrorImage      = Resource.Drawable.inbox_error;
            style.TitleTextSize       = new Float(20);
            style.DescriptionTextSize = new Float(18);
            style.DateTextSize        = new Float(12);
        }
        public override void PresentInboxUI(PushwooshInboxStyle style)
        {
            PWIInboxStyle          nativeStyle         = GetNativeStyle(style);
            PWIInboxViewController inboxViewController = PWIInboxUI.CreateInboxControllerWithStyle(nativeStyle);

            inboxViewController.NavigationItem.LeftBarButtonItem = new UIBarButtonItem("Close", UIBarButtonItemStyle.Plain, OnCloseInboxClick);
            UIViewController       rootViewController   = FindRootViewController();
            UINavigationController navigationController = new UINavigationController(inboxViewController);

            rootViewController.PresentViewController(navigationController, true, null);
        }
예제 #3
0
        protected override void OnStart()
        {
            PushManager.Instance.Register();

            PushManager.Instance.InAppManager.PostEventAsync("test", null);

            GeozonesManager.Instance.StartLocationTracking();

            PushManager.Instance.PushAccepted += (object sender, PushNotificationEventArgs e) => {
                MainPage.DisplayAlert("Push Accepted", e.Notification.Payload, "OK");
            };
            PushManager.Instance.PushReceived += (object sender, PushNotificationEventArgs e) => {
                MainPage.DisplayAlert("Push Received", e.Notification.Payload, "OK");
            };
            PushwooshInboxStyle inboxStyle = new PushwooshInboxStyle
            {
                AccentColor        = Color.Violet,
                BackgroundColor    = Color.White,
                BarAccentColor     = Color.Blue,
                BarBackgroundColor = Color.WhiteSmoke,
                BarTextColor       = Color.DarkGray,
                DateColor          = Color.Violet,
                DefaultTextColor   = Color.DarkBlue,
                DescriptionColor   = Color.DarkBlue,
                SelectionColor     = Color.Crimson,
                SeparatorColor     = Color.Crimson,
                TitleColor         = Color.DarkKhaki,

                DefaultImageName   = "inbox_message",
                ListEmptyImageName = "inbox_empty",
                ListErrorImageName = "inbox_error",
                UnreadImageName    = "inbox_unread",

                BarTitle         = "My custom title",
                ListEmptyMessage = "There are no inbox messages yet",
                ListErrorMessage = "Some error happened",

                DateFormat = "dd.MM.yyyy",

                TitleTextSize       = 20,
                DateTextSize        = 12,
                DescriptionTextSize = 18
            };

            InboxManager.Instance.PresentInboxUI(inboxStyle);
        }
        private PWIInboxStyle GetNativeStyle(PushwooshInboxStyle style)
        {
            PWIInboxStyle nativeStyle = PWIInboxStyle.DefaultStyle();

            if (style.AccentColor != Color.Default)
            {
                nativeStyle.AccentColor = GetUIColor(style.AccentColor);
            }
            if (style.BackgroundColor != Color.Default)
            {
                nativeStyle.BackgroundColor = GetUIColor(style.BackgroundColor);
            }
            if (style.BarAccentColor != Color.Default)
            {
                nativeStyle.BarAccentColor = GetUIColor(style.BarAccentColor);
            }
            if (style.BarBackgroundColor != Color.Default)
            {
                nativeStyle.BarBackgroundColor = GetUIColor(style.BarBackgroundColor);
            }
            if (style.BarTextColor != Color.Default)
            {
                nativeStyle.BarTextColor = GetUIColor(style.BarTextColor);
            }
            if (!string.IsNullOrEmpty(style.BarTitle))
            {
                nativeStyle.BarTitle = style.BarTitle;
            }
            if (style.DateColor != Color.Default)
            {
                nativeStyle.DateColor = GetUIColor(style.DateColor);
            }
            if (!string.IsNullOrEmpty(style.DateFormat))
            {
                NSDateFormatter formatter = new NSDateFormatter
                {
                    DateFormat = style.DateFormat
                };
                nativeStyle.DateFormatterBlock = (NSDate date, NSObject owner) => formatter.StringFor(date);
            }
            if (!string.IsNullOrEmpty(style.DefaultImageName))
            {
                nativeStyle.DefaultImageIcon = GetUIImage(style.DefaultImageName);
            }

            if (style.DescriptionColor != Color.Default)
            {
                nativeStyle.DescriptionColor = GetUIColor(style.DescriptionColor);
            }

            if (!string.IsNullOrEmpty(style.ListEmptyImageName))
            {
                nativeStyle.ListEmptyImage = GetUIImage(style.ListEmptyImageName);
            }

            if (!string.IsNullOrEmpty(style.ListEmptyMessage))
            {
                nativeStyle.ListEmptyMessage = style.ListEmptyMessage;
            }

            if (!string.IsNullOrEmpty(style.ListErrorImageName))
            {
                nativeStyle.ListErrorImage = GetUIImage(style.ListErrorImageName);
            }

            if (!string.IsNullOrEmpty(style.ListErrorMessage))
            {
                nativeStyle.ListErrorMessage = style.ListErrorMessage;
            }

            if (style.SeparatorColor != Color.Default)
            {
                nativeStyle.SeparatorColor = GetUIColor(style.SeparatorColor);
            }

            if (style.TitleColor != Color.Default)
            {
                nativeStyle.TitleColor = GetUIColor(style.TitleColor);
            }
            if (style.TitleTextSize > 0)
            {
                nativeStyle.TitleFont = UIFont.SystemFontOfSize(style.TitleTextSize);
            }
            if (style.DateTextSize > 0)
            {
                nativeStyle.DateFont = UIFont.SystemFontOfSize(style.DateTextSize);
            }
            if (style.DescriptionTextSize > 0)
            {
                nativeStyle.DescriptionFont = UIFont.SystemFontOfSize(style.DescriptionTextSize);
            }
            return(nativeStyle);
        }