private void listItems_MouseDown(object sender, MouseEventArgs e)
        {
            int i = listItems.IndexFromPoint(new Point(e.X, e.Y));

            if (i < 0)
            {
                return;
            }
            if (listItems.SelectedItem == null || !(listItems.SelectedItem is DashboardListItem))
            {
                return;
            }
            DashboardDockContainer holder = new GraphQuantityOverTimeFilter(((DashboardListItem)listItems.SelectedItem).CellType).CreateDashboardDockContainer();

            holder.Contr.DoDragDrop(holder, DragDropEffects.All);
        }
Example #2
0
        ///<summary>Get all the graphs associated to the current dashboardLayout.
        ///For each row and column, get the chart and associate it to it's location.</summary>
        public Dictionary <Point, Chart> GetGraphsAsDictionary()
        {
            Dictionary <Point, Chart> ret = new Dictionary <Point, Chart>();

            for (int rows = 0; rows < Rows; rows++)
            {
                for (int cols = 0; cols < Columns; cols++)
                {
                    GraphQuantityOverTimeFilter graph = GetGraphAtPoint(rows, cols);
                    if (graph != null)
                    {
                        ret.Add(new Point(rows, cols), graph.Graph.GetChartForPrinting());
                    }
                }
            }
            return(ret);
        }
Example #3
0
 public void SetCellLayout(int rows, int columns, List <DashboardCell> cells, GraphQuantityOverTime.OnGetColorFromSeriesGraphTypeArgs onGetSeriesColor, GraphQuantityOverTimeFilter.GetGraphPointsForHQArgs onGetODGraphPointsArgs)
 {
     try {
         tableLayoutPanel.SuspendLayout();
         tableLayoutPanel.Controls.Clear();
         tableLayoutPanel.RowStyles.Clear();
         tableLayoutPanel.ColumnStyles.Clear();
         tableLayoutPanel.RowCount    = rows;
         tableLayoutPanel.ColumnCount = columns;
         for (int rowIndex = 0; rowIndex < rows; rowIndex++)
         {
             tableLayoutPanel.RowStyles.Add(new RowStyle(SizeType.Percent));
             tableLayoutPanel.RowStyles[rowIndex].Height = 100 / (float)rows;
         }
         for (int columnIndex = 0; columnIndex < columns; columnIndex++)
         {
             tableLayoutPanel.ColumnStyles.Add(new ColumnStyle(SizeType.Percent));
             tableLayoutPanel.ColumnStyles[columnIndex].Width = 100 / (float)columns;
         }
         for (int rowIndex = 0; rowIndex < rows; rowIndex++)
         {
             for (int columnIndex = 0; columnIndex < columns; columnIndex++)
             {
                 DashboardCell          cell       = cells.FirstOrDefault(x => x.CellColumn == columnIndex && x.CellRow == rowIndex);
                 DashboardDockContainer cellHolder = null;
                 if (cell != null)
                 {
                     //Currently all CellTypes return GraphQuantityOverTimeFilter. Add a switch here if we ever want to dock a different control type.
                     cellHolder = new GraphQuantityOverTimeFilter(cell.CellType, cell.CellSettings, onGetSeriesColor, onGetODGraphPointsArgs).CreateDashboardDockContainer(cell);
                 }
                 AddCell(columnIndex, rowIndex, cellHolder);
             }
         }
     }
     finally {
         tableLayoutPanel.ResumeLayout();
     }
 }