Exemple #1
0
        public AirSupplyForm()
        {
            InitializeComponent();

            if (this.enableLoggingToolStripMenuItem.Checked)
            {
                C50Communication.ShouldWeLog = true;
            }

            this.TheConfig              = new RoomConfigForm();
            this.TheConfig.FormClosing += new FormClosingEventHandler(this.TheConfig_FormClosing);
            this.TheTempConfig          = new TemperatureConfigForm();

            foreach (Room aRoom in this.TheConfig.AllRooms)
            {
                RoomStatus aStatus = new RoomStatus(aRoom);
                this.AllUnits.Add(aStatus);
            }

            this.lastUpdateLbl.Text = "Last Updated: All Units at " + DateTime.Now.ToShortTimeString();

            //bind the UI to the List of Units
            this.mainDataGrid.AutoGenerateColumns     = false;
            this.mainDataGrid.DataSource              = this.AllUnits;
            this.mainDataGrid.AutoSize                = true;
            this.mainDataGrid.AllowUserToOrderColumns = false;

            //add all the columns
            this.mainDataGrid.Columns.Add(this.CreateTextBoxColumn("UnitID", "Group"));
            this.mainDataGrid.Columns.Add(this.CreateTextBoxColumn("RoomName", "Room Name"));
            this.mainDataGrid.Columns.Add(this.CreateTextBoxColumn("RoomNumber", "Number"));
            this.mainDataGrid.Columns.Add(this.CreateTextBoxColumn("RoomFloor", "Floor"));

            this.mainDataGrid.Columns.Add(this.CreateTextBoxColumn("Status", "Status"));
            this.mainDataGrid.Columns.Add(this.CreateComboBoxColumn(new Enums.Drive(), "Drive", "Drive"));
            this.mainDataGrid.Columns.Add(this.CreateComboBoxColumn(new Enums.Mode(), "Mode", "Mode"));

            //handle temperature by itself as C# doesn't like number only enums
            //the range, 62 to 82 is restricted by the unit specifications...not me
            DataGridViewComboBoxColumn temperatureCol = new DataGridViewComboBoxColumn();
            List <string> tempOptions = Enumerable.Range(54, 29).Select(n => n.ToString()).ToList();

            tempOptions.Insert(0, "0");
            temperatureCol.DataSource       = tempOptions;
            temperatureCol.DisplayStyle     = DataGridViewComboBoxDisplayStyle.DropDownButton;
            temperatureCol.DataPropertyName = "SetTemp";
            temperatureCol.Name             = "Set Temp";
            this.mainDataGrid.Columns.Add(temperatureCol);

            this.mainDataGrid.Columns.Add(this.CreateTextBoxColumn("InletTemp", "Inlet Temp"));
            this.mainDataGrid.Columns.Add(this.CreateComboBoxColumn(new Enums.AirDirection(), "AirDirection", "Air Direction"));
            this.mainDataGrid.Columns.Add(this.CreateComboBoxColumn(new Enums.FanSpeed(), "FanSpeed", "Fan Speed"));
            this.mainDataGrid.Columns.Add(this.CreateComboBoxColumn(new Enums.FilterSign(), "FilterSign", "Filter Sign"));
            this.mainDataGrid.Columns.Add(this.CreateTextBoxColumn("ErrorSign", "Error Sign"));

            //update a unit every 15 seconds
            this.theUpdateTimer.Tick    += new EventHandler(this.UnitUpdateProcessor);
            this.theUpdateTimer.Interval = 1000;
            this.theUpdateTimer.Start();
        }
Exemple #2
0
        private void roomToUnitsAssignmentsToolStripMenuItem_Click(object sender, EventArgs e)
        {
            if (this.TheConfig == null || this.TheConfig.IsDisposed)
            {
                this.TheConfig              = new RoomConfigForm();
                this.TheConfig.FormClosing += new FormClosingEventHandler(this.TheConfig_FormClosing);
            }

            this.TheConfig.Show();
        }