Example #1
0
        public DashboardDockContainer CreateDashboardDockContainer(TableBase dbItem = null)
        {
            string json = "";
            DashboardDockContainer ret = new DashboardDockContainer(
                this,
                this.graph,
                CanEdit?new EventHandler((s, ea) => {
                //Entering edit mode.
                //Set graph to loading mode to show the loading icon.
                graph.IsLoading = true;
                //Spawn the cache thread(s) but don't block.
                //Register for OnThreadExitLocal will invoke back to this thread when all the threads have exited and refill the form.
                DashboardCache.RefreshCellTypeIfInvalid(CellType, new DashboardFilter()
                {
                    UseDateFilter = false
                }, false, false, OnThreadExitLocal);
                //Allow filtering in edit mode.
                this.ShowFilters = true;
                //Save a copy of the current settings in case user clicks cancel.
                json = GetFilterAndGraphSettings();
            }):null,
                new EventHandler((s, ea) => {
                //Ok click. Just hide the filters.
                this.ShowFilters = false;
            }),
                new EventHandler((s, ea) => {
                //Cancel click. Just hide the filters and reset to previous settings.
                this.ShowFilters = false;
                SetFilterAndGraphSettings(json);
            }),
                new EventHandler((s, ea) => {
                //Spawn the init thread whenever this control gets dropped or dragged.
                Init();
            }),
                new EventHandler((s, ea) => {
                //Refresh button was clicked, spawn the init thread and force cache refresh.
                Init(true);
            }),
                dbItem);

            return(ret);
        }
Example #2
0
 protected void OnInit(bool forceCachRefresh)
 {
     //This is occurring in a thread so it is ok to wait for Refresh to return. The UI is already loading and available on the main thread.
     DashboardCache.RefreshCellTypeIfInvalid(CellType, graph.Filter, true, forceCachRefresh, null);
 }