Пример #1
0
        private PWIInboxStyle GetInboxStyle()
        {
            PWIInboxStyle   style     = PWIInboxStyle.DefaultStyle();
            NSDateFormatter formatter = new NSDateFormatter
            {
                DateFormat = "dd.MM.yyyy"
            };

            style.DateFormatterBlock = (NSDate date, NSObject owner) => formatter.StringFor(date);
            style.AccentColor        = UIColor.Blue;
            style.BackgroundColor    = UIColor.White;
            style.BarAccentColor     = UIColor.Blue;
            style.BarBackgroundColor = UIColor.White;
            style.BarTextColor       = UIColor.Black;
            style.BarTitle           = "My title";
            style.DateColor          = UIColor.Black;
            style.TitleColor         = UIColor.Black;
            style.SeparatorColor     = UIColor.Gray;
            style.SelectionColor     = UIColor.Orange;
            style.DescriptionColor   = UIColor.Black;
            style.ListEmptyMessage   = "There is no inbox messages";
            style.ListErrorMessage   = "Some error happenned";
            style.DefaultImageIcon   = UIImage.FromBundle("Default");
            style.ListEmptyImage     = UIImage.FromBundle("Empty");
            style.ListErrorImage     = UIImage.FromBundle("Error");
            style.UnreadImage        = UIImage.FromBundle("Unread");
            style.TitleFont          = UIFont.SystemFontOfSize(20);
            style.DescriptionFont    = UIFont.SystemFontOfSize(18);
            style.DateFont           = UIFont.SystemFontOfSize(12);
            return(style);
        }
        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
        private void PresentInboxViewController(PWIInboxStyle style)
        {
            PWIInboxViewController inboxViewController = PWIInboxUI.CreateInboxControllerWithStyle(style);

            inboxViewController.NavigationItem.LeftBarButtonItem = new UIBarButtonItem("Close", UIBarButtonItemStyle.Plain, OnCloseInboxClick);
            inboxViewController.OnMessageClickBlock = delegate { Console.WriteLine("Message clicked"); };
            UIViewController       rootViewController   = FindRootViewController();
            UINavigationController navigationController = new UINavigationController(inboxViewController);

            rootViewController.PresentViewController(navigationController, true, null);
        }
        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);
        }
Пример #5
0
        partial void InboxButton_TouchUpInside(UIButton sender)
        {
            PWIInboxStyle style = GetInboxStyle();

            PresentInboxViewController(style);
        }