コード例 #1
0
 /// <summary>
 /// Check if the message supports the given orientation
 /// </summary>
 /// <returns>
 /// True if there is any format that supports the given orientation.
 /// </returns>
 public bool SupportsOrientation(SwrveOrientation orientation)
 {
     if (orientation == SwrveOrientation.Both)
     {
         return(true);
     }
     return(GetFormat(orientation) != null);
 }
コード例 #2
0
 public static void InitMessage(SwrveMessageFormat format, SwrveOrientation deviceOrientation)
 {
     if (Animator != null)
     {
         Animator.InitMessage(format);
         return;
     }
     format.Init(deviceOrientation);
     format.InitAnimation(new Point(0, 0), new Point(0, 0));
 }
コード例 #3
0
 public void Init(SwrveOrientation deviceOrientation)
 {
     Closing   = false;
     Dismissed = false;
     Rotate    = Orientation != deviceOrientation;
     if (MessageListener != null)
     {
         MessageListener.OnShow(this);
     }
 }
コード例 #4
0
 public void Init(SwrveOrientation deviceOrientation)
 {
     this.Closing   = false;
     this.Dismissed = false;
     this.Rotate    = (this.Orientation != deviceOrientation);
     if (this.MessageListener != null)
     {
         this.MessageListener.OnShow(this);
     }
 }
コード例 #5
0
        /// <summary>
        /// Initialize the message to be displayed.
        /// </summary>
        public void Init(SwrveOrientation deviceOrientation)
        {
            this.Closing   = false;
            this.Dismissed = false;
            // Check if we have to rotate the format
            this.Rotate = (this.Orientation != deviceOrientation);

            if (MessageListener != null)
            {
                MessageListener.OnShow(this);
            }
        }
コード例 #6
0
 public static void InitMessage(SwrveMessageFormat format, SwrveOrientation deviceOrientation)
 {
     if (SwrveMessageRenderer.Animator != null)
     {
         SwrveMessageRenderer.Animator.InitMessage(format);
     }
     else
     {
         format.Init(deviceOrientation);
         format.InitAnimation(new Point(0, 0), new Point(0, 0));
     }
 }
コード例 #7
0
        public SwrveMessageFormat GetFormat(SwrveOrientation orientation)
        {
            IEnumerator <SwrveMessageFormat> enumerator = this.Formats.GetEnumerator();

            while (enumerator.MoveNext())
            {
                if (enumerator.Current.Orientation == orientation)
                {
                    return(enumerator.Current);
                }
            }
            return(null);
        }
コード例 #8
0
        /// <summary>
        /// Get the format for the given orientation.
        /// </summary>
        /// <param name="orientation">
        /// Current orientation.
        /// </param>
        /// <returns>
        /// The format with the given orientation if available.
        /// </returns>
        public SwrveMessageFormat GetFormat(SwrveOrientation orientation)
        {
            IEnumerator <SwrveMessageFormat> formatsIt = Formats.GetEnumerator();

            while (formatsIt.MoveNext())
            {
                if (formatsIt.Current.Orientation == orientation)
                {
                    return(formatsIt.Current);
                }
            }

            return(null);
        }
コード例 #9
0
 public abstract bool SupportsOrientation(SwrveOrientation orientation);
コード例 #10
0
 public override bool SupportsOrientation(SwrveOrientation orientation)
 {
     // there is no orientation defined as part of embedded so this is purely up to the developer whether or not to display it
     return(true);
 }
コード例 #11
0
        public void InitMessage(SwrveMessageFormat format, SwrveInAppMessageConfig inAppConfig, SwrveOrientation deviceOrientation, bool afterRotation = false)
        {
            this.format = format;
            format.Init(deviceOrientation);
            renderBackgroundColor = format.BackgroundColor.HasValue;

            if (!afterRotation)
            {
                if (animator != null)
                {
                    animator.InitMessage(format);
                }
                else
                {
                    format.InitAnimation(new Point(0, 0), new Point(0, 0));
                }
            }

            // Create widgets to render and use the cached personalization values
            widgetViews = new SwrveWidgetView[format.Images.Count + format.Buttons.Count];
            int eindex = 0;

            for (int ii = 0; ii < format.Images.Count; ii++)
            {
                SwrveImage      image = format.Images[ii];
                SwrveWidgetView renderer;
                if (image.Text != null)
                {
                    // Get cached resolved template
                    string resolvedTextTemplate = templatingResolver.TextResolution[image];
                    renderer = new SwrveMessagePersonalizedWidgetView(image, resolvedTextTemplate, inAppConfig);
                }
                else
                {
                    renderer = new SwrveImageView(image);
                }
                widgetViews[eindex++] = renderer;
            }
            for (int bi = 0; bi < format.Buttons.Count; bi++)
            {
                SwrveButton     button = format.Buttons[bi];
                SwrveWidgetView renderer;
                if (button.Text != null)
                {
                    string resolvedTextTemplate = templatingResolver.TextResolution[button];
                    renderer = new SwrveMessagePersonalizedWidgetView(button, resolvedTextTemplate, inAppConfig);
                }
                else
                {
                    renderer = new SwrveButtonView(button, inAppConfig.ButtonClickTintColor);
                }
                widgetViews[eindex++] = renderer;
            }
        }
コード例 #12
0
 public override List <SwrveBaseCampaign> GetMessageCenterCampaigns(SwrveOrientation orientation)
 {
     return(new List <SwrveBaseCampaign>());
 }
コード例 #13
0
 public override void ShowMessageCenterCampaign(SwrveBaseCampaign campaign, SwrveOrientation orientation)
 {
 }
コード例 #14
0
 public bool SupportsOrientation(SwrveOrientation orientation)
 {
     return(orientation == SwrveOrientation.Both || this.GetFormat(orientation) != null);
 }
コード例 #15
0
 public override bool SupportsOrientation(SwrveOrientation orientation)
 {
     return(Messages.Any((SwrveMessage m) => m.SupportsOrientation(orientation)));
 }
コード例 #16
0
 override public bool SupportsOrientation(SwrveOrientation orientation)
 {
     return(true);
 }
コード例 #17
0
 public override bool SupportsOrientation(SwrveOrientation orientation)
 {
     return(this.Messages.Any(m => m.SupportsOrientation(orientation)));
 }