예제 #1
0
        public Dashboard()
        {
            InitializeComponent();
            DashboardControl dashboardControl = new DashboardControl();

            dashboardControl.Dock = DockStyle.Fill;
            dashboardPage.Controls.Add(dashboardControl);
        }
 public static DashboardControl GetDashboardControlInstance()
 {
     if (dashboardControl == null)
     {
         dashboardControl = new DashboardControl();
     }
     return(dashboardControl);
 }
예제 #3
0
        private void displayDashboard(UserModel userData)
        {
            DashboardControl control = new DashboardControl(userData);

            control.OnLogout += dispayLogin;

            mainContent.Content = control;
        }
예제 #4
0
 /// <summary>
 /// Constructor
 /// </summary>
 /// <param name="view">The view to attach</param>
 /// <param name="db">The database to attach</param>
 /// <param name="dashboardHelper">The dashboard helper to attach</param>
 /// <param name="dashboardControl">The dashboard control to attach</param>
 public VariablesControl(DashboardHelper dashboardHelper, DashboardControl dashboardControl)
 {
     InitializeComponent();
     this.dashboardHelper  = dashboardHelper;
     this.dashboardControl = dashboardControl;
     //txtTitle.RenderTransform = new RotateTransform(90);
     UpdateRules();
     Construct();
 }
예제 #5
0
 public DashboardUserWindow(Employee user)
 {
     InitializeComponent();
     this._employee = user;
     System.Windows.Controls.UserControl usc = null;
     GridMain.Children.Clear();
     usc = new DashboardControl(_employee);
     GridMain.Children.Add(usc);
     setup();
 }
예제 #6
0
        private void Window_Loaded(object sender, RoutedEventArgs e)
        {
            childDashboardControl.LoadDashboard("Data\\DashboardChild.xml");
            DashboardControl dParentControl = this.dControl;

            dParentControl.MasterFilterSet     += DControl_MasterFilterSet;
            dParentControl.MasterFilterCleared += DControl_MasterFilterCleared;
            dParentControl.DrillDownPerformed  += DControl_DrillDownPerformed;
            dParentControl.DrillUpPerformed    += DControl_DrillUpPerformed;
        }
예제 #7
0
        public IEnumerable <Tab <DashboardControl> > GetDashboard(string section)
        {
            var tabs = new List <Tab <DashboardControl> >();
            var i    = 1;

            // The dashboard config can contain more than one area inserted by a package.
            foreach (var dashboardSection in UmbracoConfig.For.DashboardSettings().Sections.Where(x => x.Areas.Contains(section)))
            {
                //we need to validate access to this section
                if (DashboardSecurity.AuthorizeAccess(dashboardSection, Security.CurrentUser, Services.SectionService))
                {
                    //User is authorized
                    foreach (var dashTab in dashboardSection.Tabs)
                    {
                        //we need to validate access to this tab
                        if (DashboardSecurity.AuthorizeAccess(dashTab, Security.CurrentUser, Services.SectionService))
                        {
                            var props = new List <DashboardControl>();

                            foreach (var dashCtrl in dashTab.Controls)
                            {
                                if (DashboardSecurity.AuthorizeAccess(dashCtrl, Security.CurrentUser,
                                                                      Services.SectionService))
                                {
                                    var ctrl        = new DashboardControl();
                                    var controlPath = dashCtrl.ControlPath.Trim(' ', '\r', '\n');
                                    ctrl.Path = IOHelper.FindFile(controlPath);
                                    if (controlPath.ToLower().EndsWith(".ascx"))
                                    {
                                        ctrl.ServerSide = true;
                                    }
                                    props.Add(ctrl);
                                }
                            }

                            tabs.Add(new Tab <DashboardControl>
                            {
                                Id         = i,
                                Alias      = dashTab.Caption.ToSafeAlias(),
                                IsActive   = i == 1,
                                Label      = dashTab.Caption,
                                Properties = props
                            });
                            i++;
                        }
                    }
                }
            }

            //In case there are no tabs or a user doesn't have access the empty tabs list is returned
            return(tabs);
        }
예제 #8
0
        /// <summary>
        /// Creates a new instance of Type t (which must be an IDashboardableControl derrived ultimately from UserControl) which is then hydrated with an empty collection and a database
        /// record is created which can be used to save it's collection state for the lifetime of the control (allowing you to restore the state later)
        /// </summary>
        /// <param name="forLayout"></param>
        /// <param name="t"></param>
        /// <param name="theControlCreated"></param>
        /// <returns></returns>
        public DashboardControl Create(DashboardLayout forLayout, Type t, out DashboardableControlHostPanel theControlCreated)
        {
            var instance = CreateControl(t);

            //get the default size requirements of the control as it exists post construction
            int w = instance.Width;
            int h = instance.Height;

            var dbRecord = new DashboardControl(_activator.RepositoryLocator.CatalogueRepository, forLayout, t, _startLocationForNewControls.X, _startLocationForNewControls.Y, w, h, "");

            theControlCreated = Hydrate((IDashboardableControl)instance, dbRecord);

            return(dbRecord);
        }
예제 #9
0
 public override void UnInstall()
 {
     try
     {
         DashboardControl dashboardControl = DashboardController.GetDashboardControlByPackageId(Package.PackageID);
         if (dashboardControl != null)
         {
             DashboardController.DeleteControl(dashboardControl);
         }
         Log.AddInfo(dashboardControl.DashboardControlKey + " " + Util.DASHBOARD_UnRegistered);
     }
     catch (Exception ex)
     {
         Log.AddFailure(ex);
     }
 }
 // The GanttControl.OnSizeChanged event is handled to update the Gantt control.
 public virtual void OnSizeChanged(SizeChangedEventArgs args)
 {
     if (IsEmpty)
     {
         DependencyObject source           = (DependencyObject)args.OriginalSource;
         DashboardControl dashboardControl = LayoutTreeHelper.GetVisualParents(source).OfType <DashboardControl>().First();
         Action           updateGantt      = () => {
             string itemName = GetItemName(source);
             ConfigureGantt(dashboardControl, itemName);
         };
         dashboardControl.MasterFilterSet += (s, e) => {
             updateGantt.Invoke();
         };
         updateGantt.Invoke();
     }
 }
예제 #11
0
 private void DeleteDashboard()
 {
     try
     {
         DashboardControl dashboardControl = DashboardController.GetDashboardControlByPackageId(Package.PackageID);
         if (dashboardControl != null)
         {
             DashboardController.DeleteControl(dashboardControl);
         }
         Log.AddInfo(dashboardControl.DashboardControlKey + " " + Util.AUTHENTICATION_UnRegistered);
     }
     catch (Exception ex)
     {
         Log.AddFailure(ex);
     }
 }
        public void ConfigureGantt(DashboardControl dashboardControl, string name)
        {
            Func <bool> func = () => dashboardControl.DashboardViewModel.GetItemModel(name).IsLoaded;
            // Wait until the dashoard item data is ready and convert the data to the Gantt format.
            Dispatcher dispatcher = Dispatcher.CurrentDispatcher;
            bool       result     = false;

            while (!result)
            {
                var operation = dispatcher.BeginInvoke(DispatcherPriority.SystemIdle, func);
                operation.Wait();
                result = (bool)operation.Result;
            }
            MultiDimensionalData data = dashboardControl.GetItemData(name);

            GanttTasks = ConfigureGanttTasks(data);
        }
예제 #13
0
        public UserControl GetControl(Navigation navigation)
        {
            UserControl res = null;

            switch (navigation)
            {
            case Navigation.None:
                UserControls.Clear();
                break;

            case Navigation.Back:
                if (UserControls.Count() > 0)
                {
                    res = UserControls.Pop();
                }
                if (UserControls.Count() > 0)
                {
                    res = UserControls.Pop();
                }
                break;

            case Navigation.FoodBrowser:
                res = new FoodBrowser();
                break;

            case Navigation.Dashboard:
                UserControls.Clear();
                res = new DashboardControl();
                break;

            case Navigation.AddMeal:
                res = new AddMealControl();
                break;

            case Navigation.AccountInfo:
                res = new GoalsControl();
                break;

            case Navigation.Meals:
                res = new MealsControl();
                break;
            }

            return(res);
        }
        public DashboardableControlHostPanel(IActivateItems activator, DashboardControl databaseRecord, IDashboardableControl hostedControl)
        {
            SetItemActivator(activator);

            _databaseRecord = databaseRecord;
            HostedControl = hostedControl;
            InitializeComponent();
            
            pbDelete.Image = FamFamFamIcons.delete;

            Margin = Padding.Empty;

            pbDelete.Visible = false;
            
            this.Controls.Add((Control)HostedControl);
            
            AdjustControlLocation();
        }
예제 #15
0
        private void ListViewMenu_SelectionChanged(object sender, SelectionChangedEventArgs e)
        {
            System.Windows.Controls.UserControl usc;
            GridMain.Children.Clear();

            switch (((ListViewItem)((ListView)sender).SelectedItem).Name)
            {
            case "ItemHome":
                usc = new DashboardControl(_employee);
                GridMain.Children.Add(usc);
                break;

            case "ItemHistory":
                usc = new HistoryControl(_employee);
                GridMain.Children.Add(usc);
                break;
            }
        }
예제 #16
0
        public override void Install()
        {
            bool bAdd = Null.NullBoolean;

            try
            {
                //Attempt to get the Dashboard
                TempDashboardControl = DashboardController.GetDashboardControlByKey(Key);
                var dashboardControl = new DashboardControl();

                if (TempDashboardControl == null)
                {
                    dashboardControl.IsEnabled = true;
                    bAdd = true;
                }
                else
                {
                    dashboardControl.DashboardControlID = TempDashboardControl.DashboardControlID;
                    dashboardControl.IsEnabled          = TempDashboardControl.IsEnabled;
                }
                dashboardControl.DashboardControlKey            = Key;
                dashboardControl.PackageID                      = Package.PackageID;
                dashboardControl.DashboardControlSrc            = Src;
                dashboardControl.DashboardControlLocalResources = LocalResources;
                dashboardControl.ControllerClass                = ControllerClass;
                dashboardControl.ViewOrder                      = ViewOrder;
                if (bAdd)
                {
                    //Add new Dashboard
                    DashboardController.AddDashboardControl(dashboardControl);
                }
                else
                {
                    //Update Dashboard
                    DashboardController.UpdateDashboardControl(dashboardControl);
                }
                Completed = true;
                Log.AddInfo(dashboardControl.DashboardControlKey + " " + Util.DASHBOARD_Registered);
            }
            catch (Exception ex)
            {
                Log.AddFailure(ex);
            }
        }
예제 #17
0
        public IPersistableObjectCollection ConstructEmptyCollection(DashboardControl databaseRecord)
        {
            _dashboardControlDatabaseRecord = databaseRecord;

            return(new GoodBadCataloguePieChartObjectCollection());
        }
예제 #18
0
        public IPersistableObjectCollection ConstructEmptyCollection(DashboardControl databaseRecord)
        {
            _dashboardControlDatabaseRecord = databaseRecord;

            return(new DatasetRacewayObjectCollection());
        }
예제 #19
0
        // note:
        // in dashboard.config we have 'sections' which define 'tabs' for 'areas'
        // and 'areas' are the true UI sections - and each tab can have more than
        // one control
        // in a manifest, we directly have 'dashboards' which map to a unique
        // control in a tab

        // gets all tabs & controls from the config file
        private List <Tab <DashboardControl> > GetDashboardsFromConfig(ref int tabId, string section, IUser currentUser)
        {
            var tabs = new List <Tab <DashboardControl> >();

            // disable packages section dashboard
            if (section == "packages")
            {
                return(tabs);
            }

            foreach (var dashboardSection in _dashboardSection.Sections.Where(x => x.Areas.InvariantContains(section)))
            {
                // validate access to this section
                if (!DashboardSecurity.AuthorizeAccess(dashboardSection, currentUser, _sectionService))
                {
                    continue;
                }

                foreach (var tab in dashboardSection.Tabs)
                {
                    // validate access to this tab
                    if (!DashboardSecurity.AuthorizeAccess(tab, currentUser, _sectionService))
                    {
                        continue;
                    }

                    var dashboardControls = new List <DashboardControl>();

                    foreach (var control in tab.Controls)
                    {
                        // validate access to this control
                        if (!DashboardSecurity.AuthorizeAccess(control, currentUser, _sectionService))
                        {
                            continue;
                        }

                        // create and add control
                        var dashboardControl = new DashboardControl
                        {
                            Caption = control.PanelCaption,
                            Path    = IOHelper.FindFile(control.ControlPath.Trim())
                        };

                        if (dashboardControl.Path.InvariantEndsWith(".ascx"))
                        {
                            throw new NotSupportedException("Legacy UserControl (.ascx) dashboards are no longer supported.");
                        }

                        dashboardControls.Add(dashboardControl);
                    }

                    // create and add tab
                    tabs.Add(new Tab <DashboardControl>
                    {
                        Id         = tabId++,
                        Alias      = tab.Caption.ToSafeAlias(),
                        Label      = tab.Caption,
                        Properties = dashboardControls
                    });
                }
            }

            return(tabs);
        }
 public StandardTextControl(DashboardHelper dashboardHelper, DashboardControl dashboardControl)
 {
     InitializeComponent();
     Construct();
 }
예제 #21
0
        private DashboardableControlHostPanel Hydrate(IDashboardableControl theControlCreated, DashboardControl dbRecord)
        {
            var emptyCollection = theControlCreated.ConstructEmptyCollection(dbRecord);

            foreach (DashboardObjectUse objectUse in dbRecord.ObjectsUsed)
            {
                var o = _activator.RepositoryLocator.GetArbitraryDatabaseObject(objectUse.ReferencedObjectRepositoryType, objectUse.ReferencedObjectType, objectUse.ReferencedObjectID);
                emptyCollection.DatabaseObjects.Add(o);
            }
            try
            {
                emptyCollection.LoadExtraText(dbRecord.PersistenceString);
            }
            catch (Exception e)
            {
                throw new DashboardControlHydrationException("Could not resolve extra text persistence string for control '" + theControlCreated.GetType() + "'", e);
            }

            theControlCreated.SetCollection(_activator, emptyCollection);

            var host = new DashboardableControlHostPanel(_activator, dbRecord, theControlCreated);

            host.Location = new Point(dbRecord.X, dbRecord.Y);
            host.Width    = dbRecord.Width;
            host.Height   = dbRecord.Height;

            return(host);
        }
예제 #22
0
 public ChildWindow(DashboardControl dControl)
 {
     InitializeComponent();
     this.dControl = dControl;
 }
        /// <summary>
        /// Constructor
        /// </summary>
        /// <param name="dashboardHelper">The dashboard helper to attach</param>
        public PropertiesControl(DashboardHelper dashboardHelper, DashboardControl dashboardControl)
        {
            InitializeComponent();

            this.dashboardHelper  = dashboardHelper;
            this.dashboardControl = dashboardControl;

            imgClose.MouseEnter += new MouseEventHandler(imgClose_MouseEnter);
            imgClose.MouseLeave += new MouseEventHandler(imgClose_MouseLeave);
            imgClose.MouseDown  += new MouseButtonEventHandler(imgClose_MouseDown);

            ConfigGrid.MaxWidth = 500;

            pnlError.Visibility   = System.Windows.Visibility.Collapsed;
            pnlWarning.Visibility = System.Windows.Visibility.Collapsed;
            pnlSave.Visibility    = System.Windows.Visibility.Collapsed;

            cmbTableName.Items.Clear();
            // Data Source Properties
            if (dashboardHelper.IsUsingEpiProject)
            {
                txtProjectPath.Visibility       = System.Windows.Visibility.Visible;
                tblockProjectPath.Visibility    = System.Windows.Visibility.Visible;
                btnProjectPathBrowse.Visibility = System.Windows.Visibility.Visible;

                tblockTableName.Visibility = System.Windows.Visibility.Visible;
                cmbTableName.Visibility    = System.Windows.Visibility.Visible;

                txtDataSource.Visibility          = System.Windows.Visibility.Collapsed;
                tblockConnectionString.Visibility = System.Windows.Visibility.Collapsed;

                txtSQLQuery.Visibility    = System.Windows.Visibility.Collapsed;
                tblockSQLQuery.Visibility = System.Windows.Visibility.Collapsed;

                txtProjectPath.Text = dashboardHelper.View.Project.FilePath;

                if (System.IO.File.Exists(txtProjectPath.Text))
                {
                    Project project = new Project(txtProjectPath.Text);
                    foreach (View view in project.Views)
                    {
                        cmbTableName.Items.Add(view.Name);
                    }
                }

                cmbTableName.Text = dashboardHelper.View.Name;
            }
            else
            {
                grdDataSource.Visibility = System.Windows.Visibility.Collapsed;

                txtProjectPath.Visibility       = System.Windows.Visibility.Collapsed;
                tblockProjectPath.Visibility    = System.Windows.Visibility.Collapsed;
                btnProjectPathBrowse.Visibility = System.Windows.Visibility.Collapsed;

                tblockTableName.Visibility = System.Windows.Visibility.Collapsed;
                cmbTableName.Visibility    = System.Windows.Visibility.Collapsed;

                txtDataSource.Visibility          = System.Windows.Visibility.Visible;
                tblockConnectionString.Visibility = System.Windows.Visibility.Visible;

                if (!string.IsNullOrEmpty(dashboardHelper.CustomQuery))
                {
                    grdDataSource.Visibility = System.Windows.Visibility.Visible;

                    txtDataSource.Visibility          = System.Windows.Visibility.Collapsed;
                    tblockConnectionString.Visibility = System.Windows.Visibility.Collapsed;

                    txtSQLQuery.Visibility    = System.Windows.Visibility.Visible;
                    tblockSQLQuery.Visibility = System.Windows.Visibility.Visible;
                    txtSQLQuery.Text          = dashboardHelper.CustomQuery;
                }
                else
                {
                    txtSQLQuery.Visibility    = System.Windows.Visibility.Collapsed;
                    tblockSQLQuery.Visibility = System.Windows.Visibility.Collapsed;
                    txtSQLQuery.Text          = string.Empty;
                }
                //txtDataSource.Text = dashboardHelper.Database.ConnectionString;
            }

            if (dashboardHelper.ConnectionsForRelate.Count > 0)
            {
                grdRelatedDataSources.Visibility = System.Windows.Visibility.Visible;
                // Related Data
                foreach (RelatedConnection rConn in dashboardHelper.ConnectionsForRelate)
                {
                    RowDefinition rowDefHeader = new RowDefinition();
                    grdRelatedDataSourceList.RowDefinitions.Add(rowDefHeader);

                    //Image imgRemove = new Image();
                    //imgRemove.Source = imgClose.Source;
                    //imgRemove.Width = 16;
                    //imgRemove.Height = 16;
                    //Grid.SetRow(imgRemove, grdRelatedDataSourceList.RowDefinitions.Count - 1);
                    //Grid.SetColumn(imgRemove, 0);
                    //grdRelatedDataSourceList.Children.Add(imgRemove);

                    TextBlock tblockCount = new TextBlock();
                    tblockCount.Text     = grdRelatedDataSourceList.RowDefinitions.Count.ToString();
                    tblockCount.MaxWidth = 300;
                    Grid.SetRow(tblockCount, grdRelatedDataSourceList.RowDefinitions.Count - 1);
                    Grid.SetColumn(tblockCount, 0);
                    grdRelatedDataSourceList.Children.Add(tblockCount);

                    TextBlock tblockRelatedData = new TextBlock();
                    tblockRelatedData.Text     = rConn.db.ConnectionString;
                    tblockRelatedData.MaxWidth = 300;
                    Grid.SetRow(tblockRelatedData, grdRelatedDataSourceList.RowDefinitions.Count - 1);
                    Grid.SetColumn(tblockRelatedData, 2);
                    grdRelatedDataSourceList.Children.Add(tblockRelatedData);
                }
            }
            else
            {
                grdRelatedDataSources.Visibility = System.Windows.Visibility.Collapsed;
            }

            // HTML Output Properties
            txtTitle.Text      = dashboardControl.CustomOutputHeading;
            txtSummary.Text    = dashboardControl.CustomOutputSummaryText;
            txtConclusion.Text = dashboardControl.CustomOutputConclusionText;
            checkboxGadgetHeadings.IsChecked  = dashboardControl.ShowGadgetHeadingsInOutput;
            checkboxGadgetSettings.IsChecked  = dashboardControl.ShowGadgetSettingsInOutput;
            checkboxAlternateColors.IsChecked = dashboardControl.UseAlternatingColorsInOutput;
            checkboxCanvasSummary.IsChecked   = dashboardControl.ShowCanvasSummaryInfoInOutput;

            // Misc info
            tblockRows.Text             = dashboardHelper.DataSet.Tables[0].Rows.Count.ToString() + " unfiltered rows";
            tblockColumns.Text          = dashboardHelper.DataSet.Tables[0].Columns.Count.ToString() + " columns";
            tblockCacheDateTime.Text    = "Data last cached at " + dashboardHelper.LastCacheTime.ToShortDateString() + " " + dashboardHelper.LastCacheTime.ToShortTimeString();
            tblockCacheTimeElapsed.Text = "Took " + dashboardHelper.TimeToCache + " to locally cache data";

            Epi.ApplicationIdentity appId = new Epi.ApplicationIdentity(typeof(Configuration).Assembly);
            tblockCurrentEpiVersion.Text = "Epi Info " + appId.Version;

            cmbTableName.SelectionChanged += new SelectionChangedEventHandler(cmbTableName_SelectionChanged);
            txtProjectPath.TextChanged    += new TextChangedEventHandler(txtProjectPath_TextChanged);
        }
예제 #24
0
파일: DataLoadsGraph.cs 프로젝트: rkm/RDMP
 public IPersistableObjectCollection ConstructEmptyCollection(DashboardControl databaseRecord)
 {
     return(new DataLoadsGraphObjectCollection());
 }