示例#1
0
        /// <summary> </summary>
        /// <param name="context"></param>
        protected override void DoWork(CodeActivityContext context)
        {
            string                  localStatus               = "FAILED";
            string                  _dcmInstanceId            = UnitId.Get(context);
            int                     nDcmInstanceId            = Convert.ToInt32(_dcmInstanceId);
            byte                    nRegistrationType         = RegistrationType.Get(context);
            string                  _manufacturer             = Manufacturer.Get(context);
            string                  _model                    = ModelName.Get(context);
            string                  _softwareVersion          = SoftwareVersions.Get(context);
            IList <string>          sourceFrameOfReferenceUid = SourceFrameOfReferenceUID.Get(context);
            string                  targetFrameOfReferenceUid = TargetFrameOfReferenceUID.Get(context);
            IList <IList <double> > transformationMatrix      = TransformationMatrix.Get(context);
            IList <string>          transformationComment     = TransformationMatrixComment.Get(context);
            string                  _offsetId                 = OffsetID.Get(context);
            int                     nOffsetId                 = 0;

            if (_offsetId.Length > 0)
            {
                nOffsetId = Convert.ToInt32(_offsetId);
            }

            context.GetExtension <CompositionContainer>().SatisfyImportsOnce(this);

            try
            {
                _processSpatialRegistrationObject.CreateRegistrationRecord(nDcmInstanceId, transformationMatrix, transformationComment, sourceFrameOfReferenceUid, targetFrameOfReferenceUid, nRegistrationType, _manufacturer, _model, _softwareVersion, nOffsetId);
                localStatus = "SUCCESS";
                ActivityStatus.Set(context, localStatus);
            }
            catch (Exception ex)
            {
                ActivityStatus.Set(context, localStatus);
            }
        }
示例#2
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();
        }