NEW FEATURE: Status Viewer Control

81 views
Skip to first unread message

Rishi Oberoi

unread,
Jan 18, 2011, 5:36:41 AM1/18/11
to nro...@googlegroups.com
In similar vein to the WaitIndicator control I've added a StatusViewer control - it basically allows you to show one or more status updates, somewhat visually akin to the the information bars seen in browsers. 

Further, to allow MVVM style use the StatusViewer control supports access via the following contract:
    public interface IShowStatusViewService
    {
        IDisposable ShowStatus(string status);

        IDisposable ShowStatus(string status, TimeSpan timeout);

        IDisposable ShowStatus(string status, Action acknowledgementCallback);

        IDisposable ShowStatus(string status, TimeSpan timeout, Action acknowledgementCallback);
    }
As you can tell it provides an option to specify a timeout and an acknowledgement callback in addition to the status message itself. The timeout basically counts down and expires the status view post-showing, and if an acknowledgement callback is specified and the user clicks or touches the status bar it hides the status and raises the callback. Like elsewhere the returned IDisposable token allows you to cancel the status at anytime. 

Further, the StatusViewer supports multiple concurrent users by queuing up statuses - and so as one status timeouts / is cancelled / is acknowledged another one appears. Again the intended use-case is to have one of these at the shell level, and allow multiple Views/ViewModels to use it at the same time. To ensure no memory leaks occur, the StatusViewer keeps a weak-reference to the status token so in case the update is queued indefinitely it won't inevitably "leak" the caller.

And, just like with the WaitIndicator there is a companion behavior to allow registering the StatusViewer as a named and/or default ViewService of IShowStatusViewService type:
    	<n:StatusViewer ToolTipService.ToolTip="Click to Dismiss">
     <i:Interaction.Behaviors>
     <n:StatusViewServiceBehavior IsDefault="True"/>
     </i:Interaction.Behaviors>
     </n:StatusViewer>
Lastly, you can also use the StatusViewer individually without the using IShowStatusViewService contract by binding to the status property directly:
    	<n:StatusViewer ToolTipService.ToolTip="Click to Dismiss" Status="{Binding Message}"/>
What happens is that when the status message is not null or empty it will show the status visuals, which BTW are fully templatable/customizable. 

Cheers,
Rishi
Reply all
Reply to author
Forward
0 new messages