/// <summary>
        /// Reads the object's properties from the buffer
        /// </summary>
        /// <param name="buffer">DVBuffer where the properties are read</param>
        internal void ReadProperties(DVBuffer buffer)
        {
            ProprietesWpf property;

            byte flag; // flag pour chaque propriété, indique quelle valeur prendre pour la propriété concernée (0 / 1)
            ushort id; // variables temporaires pour les récupérations de couleurs/bordures/polices

            OnALuQuelqueChose = true;

            buffer.Get(out property);
            while (property != ProprietesWpf.CELLULE_PRESENTATION_FIN)
            {
                switch (property)
                {
                    #region Fond
                    case ProprietesWpf.CELLULE_PRESENTATION_FOND:						// Couleur du Fond (ushort)
                        buffer.Get(out id);
                        this.idFond = id;
                        break;

                    case ProprietesWpf.CELLULE_PRESENTATION_DYN_FOND:
                        buffer.Get(out flag);
                        BackgroundFlag = (flag == 1);
                        break;
                    #endregion Fond

                    #region Police
                    case ProprietesWpf.CELLULE_PRESENTATION_POLICE:					// Police (ushort)
                        buffer.Get(out id);
                        idPolice = id; // Application.Current.Resources["Font-" + id] as XHtmlFont;
                        break;

                    case ProprietesWpf.CELLULE_PRESENTATION_DYN_POLICE:
                        buffer.Get(out flag);
                        FontFlag = (flag == 1);
                        break;
                    #endregion Police

                    #region Bulle
                    case ProprietesWpf.CODE_PAGE_BULLE:										// Code page bulle
                        buffer.Get(out CodePageBulle);
                        break;

                    case ProprietesWpf.CELLULE_PRESENTATION_BULLE:						// Contenu de l'infobulle (string)
                        buffer.GetStringCP(out ToolTip, CodePageBulle);
                        ToolTip = ToolTip.Replace("|", "\n"); // "|" = multi-ligne
                        break;

                    case ProprietesWpf.CELLULE_PRESENTATION_DYN_BULLE:
                        buffer.Get(out flag);
                        ToolTipFlag = (flag == 1);
                        break;
                    #endregion Bulle

                    #region Visibilité
                    case ProprietesWpf.CELLULE_PRESENTATION_VISIBILITE:				// Visibilité (byte)
                        byte visibilite;
                        buffer.Get(out visibilite);
                        Visibilite = (Visibilites)visibilite;
                        Visibility = (Visibilite == Visibilites.Cache) ? Visibility.Hidden : Visibility.Visible;
                        IsEnabled = (Visibilite != Visibilites.Grise);
                        break;

                    case ProprietesWpf.CELLULE_PRESENTATION_DYN_VISIBILITE:
                        buffer.Get(out flag);
                        VisibilityFlag = (flag == 1);
                        break;
                    #endregion Visibilité

                    #region Cadrage
                    case ProprietesWpf.CELLULE_PRESENTATION_CADRAGE:					// Alignement du contenu (byte)
                        byte cadrageCode;
                        buffer.Get(out cadrageCode);
                        Cadrage = (Cadrage)cadrageCode;
                        switch (Cadrage)
                        {
                            case Cadrage.Defaut: // Default = Left
                            case Cadrage.Gauche: TextAlignment = TextAlignment.Left; break;
                            case Cadrage.Droite: TextAlignment = TextAlignment.Right; break;
                            case Cadrage.Centre: TextAlignment = TextAlignment.Center; break;
                        }
                        break;

                    case ProprietesWpf.CELLULE_PRESENTATION_DYN_CADRAGE:
                        buffer.Get(out flag);
                        TextAlignmentFlag = (flag == 1);
                        break;
                    #endregion Cadrage

                    default:
                        throw new XHtmlException(XHtmlErrorCodes.UnknownProperty, XHtmlErrorLocations.DataGridPresentationCell, property.ToString());
                }
                buffer.Get(out property);
            }
        }
Ejemplo n.º 2
0
        /// <summary>
        /// Reads the object's properties from the buffer
        /// </summary>
        /// <param name="buffer">DVBuffer where the properties are read</param>
        public void ReadProperties(DVBuffer buffer)
        {
            ProprietesWpf property;

            ushort id; // variables temporaires pour les récupérations de couleurs/bordures/polices

            buffer.Get(out property);
            while (property != ProprietesWpf.PRESENTATION_FIN)
            {
                switch (property)
                {
                    #region Présentation

                    case ProprietesWpf.PRESENTATION_GRILLE_MERE:				// Ident unique de la grille (unint) + Numéro de la cellule (début à 0)
                        uint gridId;
                        ushort cellIndex;
                        buffer.Get(out gridId);
                        buffer.Get(out cellIndex);
                        GridId = gridId;
                        CellIndex = cellIndex;
                        break;

                    case ProprietesWpf.PRESENTATION_POSITION:					// Position en x (ushort) et position en y (ushort)
                        ushort left, top;
                        buffer.Get(out left);
                        buffer.Get(out top);
                        Left = left;
                        Top = top;
                        break;

                    case ProprietesWpf.PRESENTATION_TAILLE:					// Largeur (ushort) et hauteur (ushort)
                        ushort width, height;
                        buffer.Get(out width);
                        buffer.Get(out height);
                        OriginalWidth = width;
                        OriginalHeight = height;
                        break;

                    case ProprietesWpf.PRESENTATION_VISIBILITE:				// Visibilité (byte)
                        byte visibilite;
                        buffer.Get(out visibilite);
                        Visibilite = (Visibilites)visibilite;
                        SetVisibility();
                        break;

                    case ProprietesWpf.PRESENTATION_CADRAGE:					// Alignement du contenu (byte)
                        byte cadrageCode;
                        buffer.Get(out cadrageCode);
                        Cadrage = (Cadrage)cadrageCode;
                        SetCadrage();
                        break;

                    case ProprietesWpf.CODE_PAGE_BULLE:							// Code page bulle
                        buffer.Get(out codePageBulle);
                        break;

                    case ProprietesWpf.PRESENTATION_BULLE:						// Contenu de l'infobulle (string)
                        string toolTip;
                        buffer.GetStringCP(out toolTip, codePageBulle);
                        frameworkElement.ToolTip = string.IsNullOrEmpty(toolTip) ? null : toolTip.Replace("|", "\n"); // "|" = multi-ligne
                        break;

                    case ProprietesWpf.PRESENTATION_ATTACHEMENT_DROITE:	// (Uniquement si attachement à droite)
                        AttachementDroite = true;
                        break;

                    case ProprietesWpf.PRESENTATION_ATTACHEMENT_BAS:		// (Uniquement si attachement en bas)
                        AttachementBas = true;
                        break;

                    case ProprietesWpf.PRESENTATION_LARGEUR_EXTENSIBLE:	// (Uniquement si largeur variable)
                        LargeurVariable = true;
                        break;

                    case ProprietesWpf.PRESENTATION_HAUTEUR_EXTENSIBLE:	// (Uniquement si hauteur variable)
                        HauteurVariable = true;
                        break;
                    #endregion Présentation

                    #region Style
                    case ProprietesWpf.PRESENTATION_TRAIT:						// Couleur du Cadre (ushort)
                        buffer.Get(out id);
            //!!!!!!!!!!!!!						stroke = Application.Current.Resources["Brush-" + id] as SolidColorBrush;
                        break;

                    case ProprietesWpf.PRESENTATION_FOND:						// Couleur du Fond (ushort)
                        buffer.Get(out id);
                        idFond = id;
            //!!!!!!!!!!!!!!!						background = Application.Current.Resources["Brush-" + id] as SolidColorBrush;
                        break;

                    case ProprietesWpf.PRESENTATION_BORDURE:					// Bordure (ushort)
                        buffer.Get(out id);
                        idBordure = id;
            //!!!!!!!!!!!!!						borderBrush = Application.Current.Resources["BorderBrush-" + id] as SolidColorBrush;
            //!!!!!!!!!!!!!						borderThickness = Application.Current.Resources["BorderThickness-" + id] as double?;
                        break;

                    case ProprietesWpf.PRESENTATION_PADDING:					// Bordure (ushort)
                        buffer.Get(out id);
                        idPadding = id;
            //!!!!!!!!!!!!						VerticalPadding = Application.Current.Resources["VerticalPadding-" + id] as double?;
            //!!!!!!!!!!!!						HorizontalPadding = Application.Current.Resources["HorizontalPadding-" + id] as double?;
                        break;

                    case ProprietesWpf.PRESENTATION_POLICE:					// Police (ushort)
                        buffer.Get(out id);
                        idPolice = id;
                        //!!!!!!!!!!!!							font = Application.Current.Resources["Font-" + id] as XHtmlFont;
                        break;
                    #endregion Style

                    default:
                        throw new XHtmlException(XHtmlErrorCodes.UnknownProperty, XHtmlErrorLocations.Presentation, property.ToString());
                }
                buffer.Get(out property);
            }
        }