Community
Showing results for 
Search instead for 
Do you mean 
Reply

Implementing IFrameworkDashboardBoundControl

Highlighted
Tuned Listener
Posts: 24
Country: USA

Implementing IFrameworkDashboardBoundControl

Published 09 October 07 12:06 PM
 

Besides deriving from BaseComponent for creating a custom dashboard component you can just derive from UserControl and implement the IFrameworkDashboardBoundControl interface.

This interface is defined as follows:

    public interface IFrameworkDashboardBoundControl
    {
        /// <summary>
        /// Gets or sets the FrameworkComponent.
        /// </summary>
        ActFrameworkDashboardComponent FrameworkComponent
        {
            get;
            set;
        }
    }

This interface allows your component to be able to get a reference to the ActFrameworkDashboardComponent so you can sign up for it's events and get access to the ActFramework object of the logged in ACT! application.

You will want to hold on to a reference to this object for your component to be able to access the ActFramework SDK from your component.

Here is a typical implementation of this interface:

        public ActFrameworkDashboardComponent FrameworkComponent
        {
            get
            {
                return this.frameworkDashboardComponent;
            }
            set
            {
               
// The FrameworkComponent will be set to null when the dashboard component is being unloaded, so we should unregister from the events.
                if (value == null)
                {
                    try
                    {
                        if (this.frameworkDashboardComponent != null)
                        {
                            this.frameworkDashboardComponent.Connected -= new Act.Framework.ComponentModel.ActFrameworkComponent.ConnectedHandler(frameworkDashboardComponent_Connected);
                            this.frameworkDashboardComponent.Display -= new ActFrameworkDashboardComponent.DisplayHandler(frameworkDashboardComponent_Display);
                            this.frameworkDashboardComponent = value;
                        }
                    }
                    catch { }
                }
                else
                {
                    // If the value is not null then lets store it and sign up for the events we need.
                    this.frameworkDashboardComponent = value;
                    // Sign up for the connected event so the control can load it's data.
                    this.frameworkDashboardComponent.Connected += new Act.Framework.ComponentModel.ActFrameworkComponent.ConnectedHandler(frameworkDashboardComponent_Connected);
                    // Sign up for the display event so the control can display it's data.
                    this.frameworkDashboardComponent.Display += new ActFrameworkDashboardComponent.DisplayHandler(frameworkDashboardComponent_Display);
                }
            }
        }

When the dashboard loader loads a dashboard that contains your component the ActFrameworkDashboardComponent will be set on it after creation.  Upon closing the dashboard ACT! will call back on this property with null for the ActFrameworkDashboardComponent so you can detach from the events of the old ActFrameworkDashboardComponent.

All of the behavior I mentioned about the Connected and Display events in the previous blog entry apply to implementing a custom dashboard component this way as well.