Exemplo n.º 1
0
        private void CmdTrainEdit_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e)
        {
            if (this.SelectedTrain == null)
            {
                return;
            }

            StudioContext.OpenPluginModule("8458EC08-4224-42B0-8CF5-84FCD5AAFB3C", this.SelectedTrain.ID);
        }
Exemplo n.º 2
0
        internal void AddItem()
        {
            if (this.CurrentFileType != FileType.Unknown)
            {
                switch (this.CurrentFileType)
                {
                case FileType.Categories:
                    CategoryEditorView formCategory = new CategoryEditorView();
                    formCategory.ShowDialog();
                    break;

                case FileType.Manufacturers:
                    ManufacturerEditorView formManufacturer = new ManufacturerEditorView();
                    formManufacturer.ShowDialog();
                    break;

                case FileType.Stores:
                    StoreEditorView formStore = new StoreEditorView();
                    formStore.ShowDialog();
                    break;

                case FileType.Gauges:
                    GaugeEditorView formScale = new GaugeEditorView();
                    formScale.ShowDialog();
                    break;

                case FileType.Decoders:
                    DecoderEditorView formDecoder = new DecoderEditorView();
                    formDecoder.ShowDialog();
                    break;

                case FileType.RailwayCompanies:
                    CompanyEditorView formAdmin = new CompanyEditorView();
                    formAdmin.ShowDialog();
                    break;

                default:
                    break;
                }
            }
            else if (this.CurrentCategory != null)
            {
                StudioContext.OpenPluginModule(ModelModuleDescriptor.MODULE_GUID, null);
            }

            this.Refresh();
        }
        internal void PrintDigitalReportBySections()
        {
            try
            {
                // Generate the report
                DigitalReportByModule rpt = new DigitalReportByModule();
                rpt.CreateDocument();

                // Generate the cover
                CoverReport cover = new CoverReport(rpt.DisplayName);
                cover.CreateDocument();

                // Merge the documents
                rpt.Pages.Insert(0, cover.Pages[0]);

                // Open the document into the repport viewer plug-in
                StudioContext.OpenPluginModule(PluginManager.PLUGIN_REPORTVIEWER, rpt);
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message, Application.ProductName, MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }
Exemplo n.º 4
0
        internal void EditItem()
        {
            if (grdDataView.SelectedRowsCount <= 0)
            {
                MessageBox.Show("You must select the row you want to edit.",
                                Application.ProductName, MessageBoxButtons.OK, MessageBoxIcon.Warning);
                return;
            }

            // Get the current row
            int[] rows = grdDataView.GetSelectedRows();
            ORMIdentifiableEntity row = grdDataView.GetRow(rows[0]) as ORMIdentifiableEntity;

            if (row == null)
            {
                return;
            }

            if (this.CurrentFileType != FileType.Unknown)
            {
                switch (this.CurrentFileType)
                {
                case FileType.Categories:
                    Category category = Category.Get(row.ID);
                    if (category != null)
                    {
                        CategoryEditorView formCategoryEditor = new CategoryEditorView(category);
                        formCategoryEditor.ShowDialog();
                    }
                    break;

                case FileType.Manufacturers:
                    Manufacturer manufacturer = Manufacturer.Get(row.ID);
                    if (manufacturer != null)
                    {
                        ManufacturerEditorView formStore = new ManufacturerEditorView(manufacturer);
                        formStore.ShowDialog();
                    }
                    break;

                case FileType.Stores:
                    Store store = Store.Get(row.ID);
                    if (store != null)
                    {
                        StoreEditorView formStore = new StoreEditorView(store);
                        formStore.ShowDialog();
                    }
                    break;

                case FileType.Gauges:
                    Rwm.Otc.Trains.Gauge scale = Rwm.Otc.Trains.Gauge.Get(row.ID);
                    if (scale != null)
                    {
                        GaugeEditorView formScale = new GaugeEditorView(scale);
                        formScale.ShowDialog();
                    }
                    break;

                case FileType.Decoders:
                    TrainDecoder decoder = TrainDecoder.Get(row.ID);
                    if (decoder != null)
                    {
                        DecoderEditorView formDecoder = new DecoderEditorView(decoder);
                        formDecoder.ShowDialog();
                    }
                    break;

                case FileType.RailwayCompanies:
                    Company admin = Company.Get(row.ID);
                    if (admin != null)
                    {
                        CompanyEditorView formAdmin = new CompanyEditorView(admin);
                        formAdmin.ShowDialog();
                    }
                    break;

                default:
                    break;
                }
            }
            else if (this.CurrentCategory != null)
            {
                StudioContext.OpenPluginModule(ModelModuleDescriptor.MODULE_GUID, row.ID);
            }

            this.Refresh();
        }