コード例 #1
0
        /// <summary>
        /// Responde al cambio en un bloque del esquema.
        /// </summary>
        protected virtual void schema_OnBlockChange(OTCSchemaEventArgs args)
        {
            // Si no existe grid seleccionado, omite el evento
            if (SelectedGrid == null)
            {
                return;
            }

            // Actualiza la celda correspondiente al bloque que ha cambiado o se ha eliminado
            if (args.Deleted)
            {
                SelectedGrid.Rows[args.Block.Y].Cells[args.Block.X].Value = _library.GetBlockImage();
            }
            else
            {
                if (_mode == PanelModes.Design)
                {
                    Bitmap blockimg = _library.GetBlockImage(args.Block.LibraryBlock.Id, OTCLibrary.ImageTypes.Bitmap, args.Block.Rotation, OTCBlockStatus.None);
                    blockimg.MakeTransparent(_library.BgColor);
                    SelectedGrid.Rows[args.Block.Y].Cells[args.Block.X].Value = blockimg;
                }
                else
                {
                    SelectedGrid.Rows[args.Block.Y].Cells[args.Block.X].Value = _library.GetBlockImage(args.Block.LibraryBlock.Id, OTCLibrary.ImageTypes.Bitmap, args.Block.Rotation, args.Block.Status);
                }

                // Almacena el identificador del bloque
                SelectedGrid.Rows[args.Block.Y].Cells[args.Block.X].Tag = args.Block.Id;
            }
        }
コード例 #2
0
        /// <summary>
        /// Responde al cambio de estado en un bloque del esquema.
        /// </summary>
        protected virtual void schema_OnBlockStatusChange(object sender, OTCSchemaEventArgs e)
        {
            // En modos distintos a Operation no se lanzan los eventos.
            if (_mode != PanelModes.Operation)
            {
                return;
            }

            // Evita lanzar eventos sin argumentos
            if (e == null || e.Block == null)
            {
                return;
            }

            // Lanza el evento para que lo consuma el software que incluye el control
            if (OnBlockStatusChange != null)
            {
                OnBlockStatusChange(sender, e);
            }
        }
コード例 #3
0
 /// <summary>
 /// Se produce cuando el usuario actualiza las propiedades de un bloque.
 /// </summary>
 private void BlockEditor_OnBlockUpdated(OTCSchemaEventArgs args)
 {
     SelectedSchema.Blocks[SelectedSchema.GetBlockIndex(args.Block.Id)] = args.Block;
 }