C# Class MessageBar.MessageBarManager

Inheritance: NSObject, IStyleSheetProvider
Show file Open project: prashantvc/Xamarin.iOS-MessageBar Class Usage Examples

Private Properties

Property Type Description
DismissMessage void
DismissMessage void
GetMessageBarViewController MessageBarViewController
GetNextMessage MessageView
InvokeDismissEvent void
IsEqualLastMessage bool
MessageBarManager System
MessageTapped void
ShowNextMessage void

Public Methods

Method Description
HideAll ( ) : void

Hides all currently-displayed messages, and discards the Message queue.

ShowMessage ( string title, string description, MessageType type, System.TimeSpan duration = null, System.Action onTapped = null, System.Action onDismiss = null ) : void

Shows the message.

Adds a new message to the queue, and shows it when all previous messages has finished showing. If no messages exists in the queue, will (obviously) be displayed instantly.

StyleSheetForMessageView ( MessageView messageView ) : MessageBarStyleSheet

Stylesheet for message view.

Protected Methods

Method Description
Dispose ( bool disposing ) : void

Releases the resources used by the NSObject object.

This Dispose method releases the resources used by the NSObject class.

This method is called by both the Dispose() method and the object finalizer (Finalize). When invoked by the Dispose method, the parameter disposing disposing is set to and any managed object references that this object holds are also disposed or released; when invoked by the object finalizer, on the finalizer thread the value is set to .

Calling the Dispose method when you are finished using the NSObject ensures that all external resources used by this managed object are released as soon as possible. Once you have invoked the Dispose method, the object is no longer useful and you should no longer make any calls to it.

For more information on how to override this method and on the Dispose/IDisposable pattern, read the ``Implementing a Dispose Method'' document at http://msdn.microsoft.com/en-us/library/fs2xkftw.aspx

Private Methods

Method Description
DismissMessage ( MessageView messageView, bool dismissedByTap ) : void

Dismisses the message.

DismissMessage ( object messageView ) : void

Invoked when the message is dismissed by the timer.

GetMessageBarViewController ( ) : MessageBarViewController

Gets the message bar view controller.

GetNextMessage ( ) : MessageView

Gets the next message.

InvokeDismissEvent ( MessageView messageView, bool dismissedByTap ) : void

Invokes the correct dismiss event, depending on the dismissedByTap value.

IsEqualLastMessage ( MessageView message ) : bool

Determines whether the specified message is equal to the last message handled.

MessageBarManager ( ) : System

Prevents a default instance of the MessageBarManager class from being created.

An init message is coupled with an alloc (or allocWithZone:) message in the same line of code:

An object isn’t ready to be used until it has been initialized. The init method defined in the NSObject class does no initialization; it simply returns self.

In a custom implementation of this method, you must invoke super’s designated initializer then initialize and return the new object. If the new object can’t be initialized, the method should return nil. For example, a hypothetical BuiltInCamera class might return nil from its init method if run on a device that has no camera.

In some cases, an init method might return a substitute object. You must therefore always use the object returned by init, and not the one returned by alloc or allocWithZone:, in subsequent code.

MessageTapped ( UIGestureRecognizer recognizer ) : void

Invoked when the message is Tapped.

ShowNextMessage ( ) : void

Attempts to retrieve the next message, and if successful, shows it. If no message is found, does nothing.

Method Details

Dispose() protected method

Releases the resources used by the NSObject object.

This Dispose method releases the resources used by the NSObject class.

This method is called by both the Dispose() method and the object finalizer (Finalize). When invoked by the Dispose method, the parameter disposing disposing is set to and any managed object references that this object holds are also disposed or released; when invoked by the object finalizer, on the finalizer thread the value is set to .

Calling the Dispose method when you are finished using the NSObject ensures that all external resources used by this managed object are released as soon as possible. Once you have invoked the Dispose method, the object is no longer useful and you should no longer make any calls to it.

For more information on how to override this method and on the Dispose/IDisposable pattern, read the ``Implementing a Dispose Method'' document at http://msdn.microsoft.com/en-us/library/fs2xkftw.aspx

protected Dispose ( bool disposing ) : void
disposing bool /// If set to , the method is invoked directly and will dispose manage and /// unmanaged resources; If set to the method is being called by the garbage collector /// finalizer and should only release unmanaged resources. ///
return void

HideAll() public method

Hides all currently-displayed messages, and discards the Message queue.
public HideAll ( ) : void
return void

ShowMessage() public method

Shows the message.

Adds a new message to the queue, and shows it when all previous messages has finished showing. If no messages exists in the queue, will (obviously) be displayed instantly.

public ShowMessage ( string title, string description, MessageType type, System.TimeSpan duration = null, System.Action onTapped = null, System.Action onDismiss = null ) : void
title string /// Message Bar title ///
description string /// Message Bar description ///
type MessageType /// Message type ///
duration System.TimeSpan /// The duration. Default (null) is 3 Seconds. ///
onTapped System.Action /// OnTapped callback. ///
onDismiss System.Action /// OnDismiss callback ///
return void

StyleSheetForMessageView() public method

Stylesheet for message view.
public StyleSheetForMessageView ( MessageView messageView ) : MessageBarStyleSheet
messageView MessageView /// Message view. ///
return MessageBarStyleSheet