Ejemplo n.º 1
0
 public void RefreshSeries()
 {
     foreach (Control C in Panel.Controls)
     {
         if (C is Controllers.BaseView)
         {
             Controllers.BaseView View = (Controllers.BaseView)C;
             View.OnRefresh();
         }
     }
 }
Ejemplo n.º 2
0
 public override void OnSave()
 {
     base.OnSave();
     foreach (Control C in Panel.Controls)
     {
         if (C is Controllers.BaseView)
         {
             Controllers.BaseView View = (Controllers.BaseView)C;
             View.OnSave();
             ApsimFile.Component Comp = Controller.ApsimData.Find(View.NodePath);
             if (Comp != null)
             {
                 Comp.Contents = View.GetData();
             }
         }
     }
 }
Ejemplo n.º 3
0
        private void PositionAndRefreshGraphs()
        {
            this.Resize -= OnResize;
            int NumGraphs = Panel.Controls.Count;

            if (NumGraphs > 0)
            {
                int NumRows;
                if (NumGraphs == 1)
                {
                    NumRows = 1;
                }
                else
                {
                    NumRows = (int)Math.Sqrt(NumGraphs - 1) + 1;
                }
                int NumCols     = (int)Math.Ceiling((double)NumGraphs / NumRows);
                int Width       = Panel.Size.Width / NumCols;
                int Height      = Panel.Size.Height / NumRows - 1;
                int GraphNumber = 0;
                int Col         = 0;
                int Row         = 0;
                foreach (Control C in Panel.Controls)
                {
                    if (C is Controllers.BaseView)
                    {
                        C.Location = new Point(Col * Width, Row * Height);
                        C.Width    = Width;
                        C.Height   = Height;
                        GraphNumber++;
                        Col++;
                        if (Col >= NumCols)
                        {
                            Col = 0;
                            Row++;
                        }
                        Controllers.BaseView Graph = (Controllers.BaseView)C;
                        Graph.OnRefresh();
                    }
                }
            }
            this.Resize += OnResize;
        }