private void ListComboLists()
        {
            ImageComboBoxItem item;
            List <string>     deviceModels = 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 (FeedbackEncoder decoder in FeedbackEncoder.FindAll())
            {
                if (!deviceModels.Contains(decoder.Name))
                {
                    item             = new ImageComboBoxItem();
                    item.Value       = decoder.Name;
                    item.Description = decoder.Name;
                    item.ImageIndex  = 2;

                    cboModel.Properties.Items.Add(item);
                }
            }
        }
        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);
                }
            }
        }
示例#3
0
        private void ListComboLists()
        {
            ImageComboBoxItem item;

            // 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 (string stritem in OTCContext.Project.GetDeviceModels())
            {
                item             = new ImageComboBoxItem();
                item.Value       = stritem;
                item.Description = stritem;
                item.ImageIndex  = 2;

                cboModel.Properties.Items.Add(item);
            }
        }
示例#4
0
        private void FillItems(Manufacturer selected)
        {
            ImageComboBoxItem item;

            // Create an image collection
            if (this.Properties.SmallImages == null)
            {
                this.ImageList = new ImageList();
                this.ImageList.Images.Add(Common.Properties.Resources.ICO_COMPANY_OFF_16);
                this.ImageList.Images.Add(Manufacturer.SmallIcon);
                this.Properties.SmallImages = this.ImageList;
            }

            this.Properties.Items.Clear();

            if (OTCContext.Project != null)
            {
                item = new ImageComboBoxItem("Not specified", null, 0);
                this.Properties.Items.Add(item);

                foreach (Manufacturer manufacturer in Manufacturer.FindAll())
                {
                    item = new ImageComboBoxItem(manufacturer.Name, manufacturer, 1);
                    this.Properties.Items.Add(item);

                    if (selected != null && manufacturer == selected)
                    {
                        this.EditValue = item;
                    }
                }

                if (selected == null || this.EditValue == null)
                {
                    this.EditValue = this.Properties.Items[0];
                }
            }
        }
示例#5
0
        public override void Refresh()
        {
            try
            {
                Cursor.Current = Cursors.WaitCursor;

                // Clear list data
                grdData.BeginUpdate();
                grdData.DataSource = null;
                grdDataView.Columns.Clear();

                this.CurrentFileType = FileType.Unknown;
                this.CurrentCategory = null;

                if (tlsFolders.Selection.Count <= 0)
                {
                    return;
                }
                else if (tlsFolders.Selection[0].ParentNode == null)
                {
                    return;
                }
                else if (tlsFolders.Selection[0].Tag?.GetType() == typeof(FileType))
                {
                    this.CurrentFileType = (FileType)tlsFolders.Selection[0].Tag;

                    grdDataView.RowHeight = -1;

                    switch (this.CurrentFileType)
                    {
                    case FileType.Categories:
                        grdDataView.OptionsBehavior.AutoPopulateColumns = false;
                        grdDataView.Columns.Add(new GridColumn()
                        {
                            Caption = "ID", Visible = false, FieldName = "ID"
                        });
                        grdDataView.Columns.Add(new GridColumn()
                        {
                            Caption = "Name", Visible = true, FieldName = "Name", Width = 250
                        });
                        grdDataView.Columns.Add(new GridColumn()
                        {
                            Caption = "Maintenance", Visible = true, FieldName = "HaveMaintenance", Width = 90
                        });
                        grdData.DataSource = Category.FindAll();
                        break;

                    case FileType.Manufacturers:
                        grdDataView.OptionsBehavior.AutoPopulateColumns = false;
                        grdDataView.Columns.Add(new GridColumn()
                        {
                            Caption = "ID", Visible = false, FieldName = "ID"
                        });
                        grdDataView.Columns.Add(new GridColumn()
                        {
                            Caption = "Name", Visible = true, FieldName = "Name", Width = 250
                        });
                        grdDataView.Columns.Add(new GridColumn()
                        {
                            Caption = "URL", Visible = true, FieldName = "URL", Width = 350
                        });
                        grdData.DataSource = Manufacturer.FindAll();
                        break;

                    case FileType.Stores:
                        grdDataView.OptionsBehavior.AutoPopulateColumns = false;
                        grdDataView.Columns.Add(new GridColumn()
                        {
                            Caption = "ID", Visible = false, FieldName = "ID"
                        });
                        grdDataView.Columns.Add(new GridColumn()
                        {
                            Caption = "Name", Visible = true, FieldName = "Name", Width = 250
                        });
                        grdDataView.Columns.Add(new GridColumn()
                        {
                            Caption = "Adress", Visible = true, FieldName = "Adress", Width = 250
                        });
                        grdDataView.Columns.Add(new GridColumn()
                        {
                            Caption = "URL", Visible = true, FieldName = "URL", Width = 350
                        });
                        grdData.DataSource = Store.FindAll();
                        break;

                    case FileType.Gauges:
                        grdDataView.OptionsBehavior.AutoPopulateColumns = false;
                        grdDataView.Columns.Add(new GridColumn()
                        {
                            Caption = "ID", Visible = false, FieldName = "ID"
                        });
                        grdDataView.Columns.Add(new GridColumn()
                        {
                            Caption = "Name", Visible = true, FieldName = "Name", Width = 100
                        });
                        grdDataView.Columns.Add(new GridColumn()
                        {
                            Caption = "Notation", Visible = true, FieldName = "ScaleNotation", Width = 100
                        });
                        grdData.DataSource = Rwm.Otc.Trains.Gauge.FindAll();
                        break;

                    case FileType.RailwayCompanies:
                        grdDataView.RowHeight = 35;
                        grdDataView.OptionsBehavior.AutoPopulateColumns = false;
                        grdDataView.Columns.Add(new GridColumn()
                        {
                            Caption = "ID", Visible = false, FieldName = "ID"
                        });
                        grdDataView.Columns.Add(new GridColumn()
                        {
                            Caption = "Logo", Visible = true, FieldName = "LogoImage", Width = 100
                        });
                        grdDataView.Columns.Add(new GridColumn()
                        {
                            Caption = "Name", Visible = true, FieldName = "Name", Width = 300
                        });
                        grdDataView.Columns.Add(new GridColumn()
                        {
                            Caption = "Acronym", Visible = true, FieldName = "Acronym", Width = 100
                        });
                        grdDataView.Columns.Add(new GridColumn()
                        {
                            Caption = "URL", Visible = true, FieldName = "URL", Width = 350
                        });
                        grdData.DataSource = Company.FindAll();
                        break;

                    case FileType.Decoders:
                        grdDataView.OptionsBehavior.AutoPopulateColumns = false;
                        grdDataView.Columns.Add(new GridColumn()
                        {
                            Caption = "ID", Visible = false, FieldName = "ID"
                        });
                        grdDataView.Columns.Add(new GridColumn()
                        {
                            Caption = "Name", Visible = true, FieldName = "Name", Width = 250
                        });
                        grdDataView.Columns.Add(new GridColumn()
                        {
                            Caption = "URL", Visible = true, FieldName = "URL", Width = 350
                        });
                        grdData.DataSource = TrainDecoder.FindAll();
                        break;
                    }
                }
                else if (tlsFolders.Selection[0].Tag?.GetType() == typeof(Category))
                {
                    this.CurrentCategory = (Category)tlsFolders.Selection[0].Tag;

                    grdDataView.RowHeight = 35;
                    grdDataView.OptionsBehavior.AutoPopulateColumns = false;
                    grdDataView.Columns.Add(new GridColumn()
                    {
                        Caption = "ID", Visible = false, FieldName = "ID"
                    });
                    grdDataView.Columns.Add(new GridColumn()
                    {
                        Caption = "Image", Visible = true, FieldName = "Picture", Width = 130
                    });
                    grdDataView.Columns.Add(new GridColumn()
                    {
                        Caption = "Name", Visible = true, FieldName = "Name", Width = 150
                    });
                    grdDataView.Columns.Add(new GridColumn()
                    {
                        Caption = "Company", Visible = true, FieldName = "Company.Name", Width = 220
                    });
                    grdDataView.Columns.Add(new GridColumn()
                    {
                        Caption = "Manufacturer", Visible = true, FieldName = "Manufacturer.Name", Width = 120
                    });
                    grdDataView.Columns.Add(new GridColumn()
                    {
                        Caption = "Art.No.", Visible = true, FieldName = "Reference", Width = 100
                    });
                    grdDataView.Columns.Add(new GridColumn()
                    {
                        Caption = "Units", Visible = true, FieldName = "Units", Width = 50
                    });
                    grdDataView.Columns.Add(new GridColumn()
                    {
                        Caption = "Properties", Visible = true, FieldName = "Pictograms", Width = 200
                    });

                    grdDataView.Columns[6].AppearanceCell.TextOptions.HAlignment   = DevExpress.Utils.HorzAlignment.Center;
                    grdDataView.Columns[6].AppearanceHeader.TextOptions.HAlignment = DevExpress.Utils.HorzAlignment.Center;
                    grdDataView.Columns[7].AppearanceCell.Font = new System.Drawing.Font("Maerklin Piktos", 20);

                    if (this.CurrentCategory.ID > 0)
                    {
                        grdData.DataSource = Train.FindBy("Category", this.CurrentCategory);
                    }
                    else
                    {
                        grdData.DataSource = Train.FindAll();
                    }
                }
            }
            catch (Exception ex)
            {
                Cursor.Current = Cursors.Default;

                MessageBox.Show("ERROR retrieving data: " + Environment.NewLine + Environment.NewLine + ex.Message,
                                Application.ProductName, MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
            finally
            {
                grdData.EndUpdate();
            }

            base.Refresh();

            Cursor.Current = Cursors.Default;
        }