Exemplo n.º 1
0
        private void SetModelList(string selected)
        {
            ImageComboBoxItem item;
            List <string>     models = new List <string>();

            // Fill models list
            cboModel.Properties.Items.Clear();
            foreach (AccessoryDecoder decoder in AccessoryDecoder.FindAll())
            {
                if (!string.IsNullOrEmpty(decoder.Model) && !models.Contains(decoder.Model))
                {
                    item             = new ImageComboBoxItem();
                    item.Value       = decoder.Model;
                    item.Description = decoder.Model;
                    item.ImageIndex  = 2;

                    cboModel.Properties.Items.Add(item);
                    models.Add(decoder.Model);
                }
            }

            if (selected != null)
            {
                cboModel.Text = selected;
            }
        }
        private void ListComboLists()
        {
            ImageComboBoxItem item;
            List <string>     models  = new List <string>();
            List <string>     modules = new List <string>();

            // Fill manufacturers list
            foreach (Manufacturer manufacturer in Manufacturer.FindAll())
            {
                item             = new ImageComboBoxItem();
                item.Value       = manufacturer;
                item.Description = manufacturer.Name;
                item.ImageIndex  = 1;

                cboManufacturer.Properties.Items.Add(item);
            }

            // Fill models list
            foreach (AccessoryDecoder decoder in AccessoryDecoder.FindAll())
            {
                if (!string.IsNullOrEmpty(decoder.Model) && !models.Contains(decoder.Model))
                {
                    item             = new ImageComboBoxItem();
                    item.Value       = decoder.Model;
                    item.Description = decoder.Model;
                    item.ImageIndex  = 2;

                    cboModel.Properties.Items.Add(item);
                }
            }
        }
Exemplo n.º 3
0
        private void ListAccessoryDecoders()
        {
            try
            {
                grdAcc.BeginUpdate();

                grdAccView.OptionsBehavior.AutoPopulateColumns = false;
                grdAccView.Columns.Clear();

                grdAccView.Columns.Add(new GridColumn()
                {
                    Caption = "Device", Visible = true, FieldName = "Name"
                });
                grdAccView.Columns.Add(new GridColumn()
                {
                    Caption = "Connections", Visible = true, FieldName = "ConnectionsCount", Width = 45
                });

                grdAccView.Columns["ConnectionsCount"].AppearanceHeader.TextOptions.HAlignment = DevExpress.Utils.HorzAlignment.Center;
                grdAccView.Columns["ConnectionsCount"].AppearanceCell.TextOptions.HAlignment   = DevExpress.Utils.HorzAlignment.Center;

                grdAcc.DataSource = AccessoryDecoder.FindAll();

                grdAcc.EndUpdate();
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message, Application.ProductName, MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }
Exemplo n.º 4
0
        public override void Refresh()
        {
            try
            {
                grdModule.BeginUpdate();

                grdModuleView.Columns.Clear();
                grdModuleView.Columns.Add(new GridColumn()
                {
                    Caption = "Device", Visible = true, FieldName = "Name"
                });
                grdModuleView.Columns.Add(new GridColumn()
                {
                    Caption = "Connections", Visible = true, FieldName = "ConnectionsCount", Width = 45
                });

                grdModuleView.Columns["ConnectionsCount"].AppearanceHeader.TextOptions.HAlignment = DevExpress.Utils.HorzAlignment.Center;
                grdModuleView.Columns["ConnectionsCount"].AppearanceCell.TextOptions.HAlignment   = DevExpress.Utils.HorzAlignment.Center;

                grdModule.DataSource = AccessoryDecoder.FindAll();

                grdModule.EndUpdate();
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message, Application.ProductName, MessageBoxButtons.OK, MessageBoxIcon.Error);
            }

            base.Refresh();
        }