public void alterRowAndColumnCount()
        {
            ColumnStyles.Clear();
            RowStyles.Clear();
            var count = Controls.Count;

            if (count != 0)
            {
                ColumnCount = (int)Math.Floor(Math.Log(count, 2)) + 1;
                RowCount    = (int)Math.Ceiling((double)count / ColumnCount);
                for (int i = 1; i <= this.RowCount; i++)
                {
                    //RowStyles.Add(new RowStyle(SizeType.AutoSize, StudentCell.MINIMUM_SIZE.Height));
                    RowStyles.Add(new RowStyle()
                    {
                        Height = 100 / RowCount, SizeType = SizeType.Percent
                    });
                }
                for (int i = 1; i <= this.ColumnCount; i++)
                {
                    //ColumnStyles.Add(new ColumnStyle(SizeType.Absolute, Width / ColumnCount));
                    ColumnStyles.Add(new ColumnStyle()
                    {
                        Width = 100 / ColumnCount, SizeType = SizeType.Percent
                    });
                }
            }
        }
Beispiel #2
0
 public void clearProperties()
 {
     SuspendLayout();
     Controls.Clear();
     ColumnCount = 1;
     RowCount    = 0;
     ColumnStyles.Clear();
     ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 100F));
     RowStyles.Clear();
     RowStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 100F));
     ResumeLayout();
 }
 void nomalizeColStyles()
 {   // set all rows to absolute and the last one to percent=100!
     if (colWidths.Length <= 0)
     {
         return;
     }
     colWidths = GetColumnWidths();
     ColumnStyles.Clear();
     for (int i = 0; i < ColumnCount - 1; i++)
     {
         ColumnStyle cs = new ColumnStyle(SizeType.Absolute, colWidths[i]);
         ColumnStyles.Add(cs);
     }
     ColumnStyles.Add(new ColumnStyle(SizeType.Percent, 100));
     isNormalCol = true;
 }
Beispiel #4
0
 private void ResetLayout()
 {
     RowCount    = _configuration.Rows;
     ColumnCount = _configuration.Columns;
     ColumnStyles.Clear();
     RowStyles.Clear();
     for (var i = 0; i < ColumnCount; i++)
     {
         ColumnStyles.Add(new ColumnStyle(SizeType.Percent, (int)(100m / ColumnCount)));
     }
     for (var i = 0; i < RowCount; i++)
     {
         RowStyles.Add(new RowStyle(SizeType.Percent, (int)(100m / RowCount)));
     }
     ResetViews();
 }
Beispiel #5
0
        /// <summary>
        /// Initialize the visible field
        /// </summary>
        /// <param name="rows">
        /// Number of rows the game will have
        /// </param>
        /// <param name="cols">
        /// Number of columns the game will have
        /// </param>
        private void InitializeField(int rows, int cols)
        {
            RowStyles.Clear();
            ColumnStyles.Clear();

            RowCount    = rows + 1;
            ColumnCount = cols;

            for (int i = 0; i <= rows; i++)
            {
                RowStyles.Add(new RowStyle(SizeType.Percent, 100));
            }
            for (int i = 0; i < cols; i++)
            {
                ColumnStyles.Add(new ColumnStyle(SizeType.Percent, 100));
                Marker marker = new Marker(i);
                marker.MouseClick += Marker_Clicked;
                Controls.Add(marker, i, 0);
            }
        }
Beispiel #6
0
 /// <summary>
 /// Create a new board control
 /// </summary>
 /// <param name="board">board</param>
 /// <param name="colors">colors for each index</param>
 public BoardControl(Board board, Color[] colors)
 {
     Dock        = DockStyle.Fill;
     this.colors = colors;
     RowCount    = board.Size + 1;
     ColumnCount = board.Size + 1;
     RowStyles.Clear();
     ColumnStyles.Clear();
     for (int i = 0; i < board.Size; i++)
     {
         RowStyles.Add(new RowStyle(SizeType.Absolute, (float)500 / board.Size));
         ColumnStyles.Add(new ColumnStyle(SizeType.Absolute, (float)500 / board.Size));
     }
     for (int i = 0; i < board.Size; i++)
     {
         for (int j = 0; j < board.Size; j++)
         {
             var pbox = new CellControl(board[i, j]);
             pbox.BackColor = colors[pbox.Cell.Color];
             pbox.Click    += (_, __) => { CellClick(_, __); };
             Controls.Add(pbox, j, i);
         }
     }
 }
Beispiel #7
0
        public RaportsForOperators()
        {
            try
            {
                RowStyles.Clear();
                ColumnStyles.Clear();
                RowStyles.Add(new RowStyle(SizeType.Absolute, 120f));
                RowStyles.Add(new RowStyle(SizeType.Absolute, 120f));
                RowStyles.Add(new RowStyle(SizeType.Absolute, 200f));
                RowStyles.Add(new RowStyle(SizeType.Absolute, 150f));

                Dock = DockStyle.Fill;

                Controls.Add(new GroupBox()
                {
                    Name = "202ReportGroupBox",
                    Dock = DockStyle.Fill,
                    Text = "Отчёт для 202",
                }, 0, 0);

                Controls.Add(new GroupBox()
                {
                    Name = "203ReportGroupBox",
                    Dock = DockStyle.Fill,
                    Text = "Отчёт для 203",
                }, 0, 1);

                Controls.Add(new GroupBox()
                {
                    Name = "HistoryGroupBox",
                    Dock = DockStyle.Fill,
                    Text = "История включений",
                }, 0, 2);

                Controls.Add(new Panel()
                {
                    Dock = DockStyle.Fill,
                }, 0, 3);

                Controls.Find("HistoryGroupBox", true).FirstOrDefault().Controls.Add(new Panel()
                {
                    Name   = "HistoryPanel",
                    Dock   = DockStyle.Top,
                    Text   = "Получить историю",
                    Height = 25,
                });

                Controls.Find("HistoryPanel", true).FirstOrDefault().Controls.Add(new Button()
                {
                    Name = "HistoryButton",
                    Dock = DockStyle.Fill,
                    Text = "Получить историю",
                });

                Controls.Find("HistoryPanel", true).FirstOrDefault().Controls.Add(new Button()
                {
                    Name  = "HistoryButton1",
                    Dock  = DockStyle.Right,
                    Text  = "Получить min/max",
                    Width = 120,
                });

                Controls.Find("HistoryGroupBox", true).FirstOrDefault().Controls.Add(new DateTimePicker()
                {
                    Name = "HistoryDateTimePicker2",
                    Dock = DockStyle.Top,
                });

                Controls.Find("HistoryGroupBox", true).FirstOrDefault().Controls.Add(new DateTimePicker()
                {
                    Top  = 5,
                    Name = "HistoryDateTimePicker1",
                    Dock = DockStyle.Top,
                });

                Controls.Find("HistoryGroupBox", true).FirstOrDefault().Controls.Add(new GroupBox()
                {
                    Name   = "HistoryPolarizationGroupBox",
                    Dock   = DockStyle.Top,
                    Text   = "Поляризация",
                    Height = 37,
                });

                Controls.Find("HistoryGroupBox", true).FirstOrDefault().Controls.Add(new GroupBox()
                {
                    Name   = "HistoryBeamGroupBox",
                    Dock   = DockStyle.Top,
                    Text   = "Диапазон",
                    Height = 37,
                });

                Controls.Find("HistoryGroupBox", true).FirstOrDefault().Controls.Add(new GroupBox()
                {
                    Name   = "HistorySatelliteGroupBox",
                    Dock   = DockStyle.Top,
                    Text   = "Спутник",
                    Height = 37,
                });

                Controls.Find("HistoryPolarizationGroupBox", true).FirstOrDefault().Controls.Add(new ComboBox()
                {
                    Name          = "HistoryPolarizationComboBox",
                    Dock          = DockStyle.Fill,
                    DropDownStyle = ComboBoxStyle.DropDownList,
                });
                Controls.Find("HistoryBeamGroupBox", true).FirstOrDefault().Controls.Add(new ComboBox()
                {
                    Name          = "HistoryBeamComboBox",
                    Dock          = DockStyle.Fill,
                    DropDownStyle = ComboBoxStyle.DropDownList,
                });
                Controls.Find("HistorySatelliteGroupBox", true).FirstOrDefault().Controls.Add(new ComboBox()
                {
                    Name          = "HistorySatelliteComboBox",
                    Dock          = DockStyle.Fill,
                    DropDownStyle = ComboBoxStyle.DropDownList,
                });


                (Controls.Find("HistoryPolarizationComboBox", true).FirstOrDefault() as ComboBox).Items.Add("L");
                (Controls.Find("HistoryPolarizationComboBox", true).FirstOrDefault() as ComboBox).Items.Add("R");
                (Controls.Find("HistoryPolarizationComboBox", true).FirstOrDefault() as ComboBox).Items.Add("V");
                (Controls.Find("HistoryPolarizationComboBox", true).FirstOrDefault() as ComboBox).Items.Add("H");

                foreach (string be in dataBase.SimpleData("FrequencyBand").Rows.Cast <DataRow>().Select(x => x["Наименование диапазона"].ToString()).OrderBy(x => x).ToList())
                {
                    (Controls.Find("HistoryBeamComboBox", true).FirstOrDefault() as ComboBox).Items.Add(be);
                }

                foreach (string be in dataBase.SimpleData("SatelliteList").Rows.Cast <DataRow>().Select(x => x["НаименованиеИСЗ"].ToString()).OrderBy(x => x).ToList())
                {
                    (Controls.Find("HistorySatelliteComboBox", true).FirstOrDefault() as ComboBox).Items.Add(be);
                }


                (Controls.Find("HistoryButton", true).FirstOrDefault() as Button).Click += (s, e) =>
                {
                    Documentation.WorkingHistory((Controls.Find("HistorySatelliteComboBox", true).FirstOrDefault() as ComboBox).SelectedItem.ToString(),
                                                 (Controls.Find("HistoryBeamComboBox", true).FirstOrDefault() as ComboBox).SelectedItem.ToString(),
                                                 (Controls.Find("HistoryPolarizationComboBox", true).FirstOrDefault() as ComboBox).SelectedItem.ToString(),
                                                 (Controls.Find("HistoryDateTimePicker1", true).FirstOrDefault() as DateTimePicker).Value,
                                                 Convert.ToInt32(((Controls.Find("HistoryDateTimePicker2", true).FirstOrDefault() as DateTimePicker).Value -
                                                                  (Controls.Find("HistoryDateTimePicker1", true).FirstOrDefault() as DateTimePicker).Value).TotalDays));
                };

                (Controls.Find("HistoryButton1", true).FirstOrDefault() as Button).Click += (s, e) =>
                {
                    Documentation.WorkingHistoryMinMax((Controls.Find("HistorySatelliteComboBox", true).FirstOrDefault() as ComboBox).SelectedItem.ToString(),
                                                       (Controls.Find("HistoryBeamComboBox", true).FirstOrDefault() as ComboBox).SelectedItem.ToString(),
                                                       (Controls.Find("HistoryPolarizationComboBox", true).FirstOrDefault() as ComboBox).SelectedItem.ToString(),
                                                       (Controls.Find("HistoryDateTimePicker1", true).FirstOrDefault() as DateTimePicker).Value,
                                                       (Controls.Find("HistoryDateTimePicker2", true).FirstOrDefault() as DateTimePicker).Value);
                };

                Controls.Find("202ReportGroupBox", true).FirstOrDefault().Controls.Add(new FlowLayoutPanel()
                {
                    Name = "202ReportGroupBoxFlowLayoutPanel",
                    Dock = DockStyle.Fill,
                });

                Controls.Find("202ReportGroupBoxFlowLayoutPanel", true).FirstOrDefault().Controls.Add(new TableLayoutPanel()
                {
                    Name   = "DailyRaport202TableLayoutPanel",
                    Height = 30,
                });

                (Controls.Find("DailyRaport202TableLayoutPanel", true).FirstOrDefault() as TableLayoutPanel).ColumnStyles.Clear();
                (Controls.Find("DailyRaport202TableLayoutPanel", true).FirstOrDefault() as TableLayoutPanel).RowStyles.Clear();
                (Controls.Find("DailyRaport202TableLayoutPanel", true).FirstOrDefault() as TableLayoutPanel).ColumnStyles.Add(new ColumnStyle(SizeType.Percent, 90f));
                (Controls.Find("DailyRaport202TableLayoutPanel", true).FirstOrDefault() as TableLayoutPanel).ColumnStyles.Add(new ColumnStyle(SizeType.Percent, 10f));

                (Controls.Find("DailyRaport202TableLayoutPanel", true).FirstOrDefault() as TableLayoutPanel).Controls.Add(new DateTimePicker()
                {
                    Name = "DailyRaport202DateTimePicker1",
                }, 0, 0);

                (Controls.Find("DailyRaport202TableLayoutPanel", true).FirstOrDefault() as TableLayoutPanel).Controls.Add(new CheckBox()
                {
                    Name = "DailyRaport202CheckBox",
                }, 1, 0);

                Controls.Find("202ReportGroupBoxFlowLayoutPanel", true).FirstOrDefault().Controls.Add(new DateTimePicker()
                {
                    Name    = "DailyRaport202DateTimePicker2",
                    Enabled = false,
                });

                (Controls.Find("DailyRaport202CheckBox", true).FirstOrDefault() as CheckBox).CheckedChanged += (s, e) =>
                {
                    try
                    {
                        if ((Controls.Find("DailyRaport202CheckBox", true).FirstOrDefault() as CheckBox).Checked)
                        {
                            (Controls.Find("DailyRaport202DateTimePicker2", true).FirstOrDefault() as DateTimePicker).Enabled = true;
                            (Controls.Find("TodayReport", true).FirstOrDefault() as Button).Text = "Отчёт за период";
                        }
                        else
                        {
                            (Controls.Find("DailyRaport202DateTimePicker2", true).FirstOrDefault() as DateTimePicker).Enabled = false;
                            (Controls.Find("TodayReport", true).FirstOrDefault() as Button).Text = "Ежедневный отчёт";
                        }
                    }
                    catch (Exception ex)
                    {
                        MessageBoxTi.Show("RaportsForOperators.DailyRaport202CheckBox " + ex.Message);
                    }
                };

                Controls.Find("202ReportGroupBoxFlowLayoutPanel", true).FirstOrDefault().Controls.Add(new Button()
                {
                    Name      = "TodayReport",
                    Text      = "Ежедневный отчёт",
                    AutoSize  = true,
                    FlatStyle = FlatStyle.Flat,
                    BackColor = Supports.headGrey,
                    Width     = 200,
                });

                (Controls.Find("TodayReport", true).FirstOrDefault() as Button).Click += (s, e) =>
                {
                    try
                    {
                        if (!(Controls.Find("DailyRaport202CheckBox", true).FirstOrDefault() as CheckBox).Checked)
                        {
                            Documentation.Daily202Report((Controls.Find("DailyRaport202DateTimePicker1", true).FirstOrDefault() as DateTimePicker).Value.Date);
                        }
                        else
                        {
                            int days = Convert.ToInt32(((Controls.Find("DailyRaport202DateTimePicker2", true).FirstOrDefault() as DateTimePicker).Value.Date - (Controls.Find("DailyRaport202DateTimePicker1", true).FirstOrDefault() as DateTimePicker).Value.Date).TotalDays);
                            if (days < 0)
                            {
                                MessageBoxTi.Show("Неверно введён период");
                                return;
                            }
                            Documentation.Daily202Report((Controls.Find("DailyRaport202DateTimePicker1", true).FirstOrDefault() as DateTimePicker).Value.Date, days);
                        }
                    }
                    catch (Exception ex)
                    {
                        MessageBoxTi.Show("RaportsForOperators.TodayReport " + ex.Message);
                    }
                };

                Controls.Find("203ReportGroupBox", true).FirstOrDefault().Controls.Add(new FlowLayoutPanel()
                {
                    Name = "203ReportGroupBoxFlowLayoutPanel",
                    Dock = DockStyle.Fill,
                });

                Controls.Find("203ReportGroupBoxFlowLayoutPanel", true).FirstOrDefault().Controls.Add(new TableLayoutPanel()
                {
                    Name   = "Raport203TableLayoutPanel",
                    Height = 30,
                });

                (Controls.Find("Raport203TableLayoutPanel", true).FirstOrDefault() as TableLayoutPanel).ColumnStyles.Clear();
                (Controls.Find("Raport203TableLayoutPanel", true).FirstOrDefault() as TableLayoutPanel).RowStyles.Clear();
                (Controls.Find("Raport203TableLayoutPanel", true).FirstOrDefault() as TableLayoutPanel).ColumnStyles.Add(new ColumnStyle(SizeType.Percent, 90f));
                (Controls.Find("Raport203TableLayoutPanel", true).FirstOrDefault() as TableLayoutPanel).ColumnStyles.Add(new ColumnStyle(SizeType.Percent, 10f));

                (Controls.Find("Raport203TableLayoutPanel", true).FirstOrDefault() as TableLayoutPanel).Controls.Add(new DateTimePicker()
                {
                    Name = "Raport203DateTimePicker1",
                }, 0, 0);

                (Controls.Find("Raport203TableLayoutPanel", true).FirstOrDefault() as TableLayoutPanel).Controls.Add(new CheckBox()
                {
                    Name = "Raport203CheckBox",
                }, 1, 0);

                Controls.Find("203ReportGroupBoxFlowLayoutPanel", true).FirstOrDefault().Controls.Add(new DateTimePicker()
                {
                    Name    = "Raport203DateTimePicker2",
                    Enabled = false,
                });

                (Controls.Find("Raport203CheckBox", true).FirstOrDefault() as CheckBox).CheckedChanged += (s, e) =>
                {
                    try
                    {
                        if ((Controls.Find("Raport203CheckBox", true).FirstOrDefault() as CheckBox).Checked)
                        {
                            (Controls.Find("Raport203DateTimePicker2", true).FirstOrDefault() as DateTimePicker).Enabled = true;
                            (Controls.Find("Report203", true).FirstOrDefault() as Button).Text = "Отчёт за период";
                        }
                        else
                        {
                            (Controls.Find("Raport203DateTimePicker2", true).FirstOrDefault() as DateTimePicker).Enabled = false;
                            (Controls.Find("Report203", true).FirstOrDefault() as Button).Text = "Отчёт";
                        }
                    }
                    catch (Exception ex)
                    {
                        MessageBoxTi.Show("RaportsForOperators.Raport203CheckBox " + ex.Message);
                    }
                };

                Controls.Find("203ReportGroupBoxFlowLayoutPanel", true).FirstOrDefault().Controls.Add(new Button()
                {
                    Name      = "Report203",
                    Text      = "Отчёт",
                    AutoSize  = true,
                    FlatStyle = FlatStyle.Flat,
                    BackColor = Supports.headGrey,
                    Width     = 200,
                });

                (Controls.Find("Report203", true).FirstOrDefault() as Button).Click += (s, e) =>
                {
                    try
                    {
                        if (!(Controls.Find("Raport203CheckBox", true).FirstOrDefault() as CheckBox).Checked)
                        {
                            Documentation.TillCalledFor203Report((Controls.Find("Raport203DateTimePicker1", true).FirstOrDefault() as DateTimePicker).Value.Date);
                        }
                        else
                        {
                            int days = Convert.ToInt32(((Controls.Find("Raport203DateTimePicker2", true).FirstOrDefault() as DateTimePicker).Value.Date - (Controls.Find("Raport203DateTimePicker1", true).FirstOrDefault() as DateTimePicker).Value.Date).TotalDays);
                            if (days < 0)
                            {
                                MessageBoxTi.Show("Неверно введён период");
                                return;
                            }
                            Documentation.TillCalledFor203Report((Controls.Find("Raport203DateTimePicker1", true).FirstOrDefault() as DateTimePicker).Value.Date, days);
                        }
                    }
                    catch (Exception ex)
                    {
                        MessageBoxTi.Show("RaportsForOperators.Report203Button " + ex.Message);
                    }
                };
            }
            catch (Exception e)
            {
                MessageBoxTi.Show("RaportsForOperators " + e.Message);
            }
        }