示例#1
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;

            buffer.Get(out property);
            while (property != ProprietesWpf.ONGLET_FIN)
            {
                switch (property)
                {
                    case ProprietesWpf.PRESENTATION_DEBUT:								// Début présentation
                        if (Presentation == null) Presentation = new XHtmlPresentation(this);
                        Presentation.ReadProperties(buffer);
                        // Presentation.SetProperties();	// pas de présentation pour les onglets (ignoré)
                        break;

                    case ProprietesWpf.CODE_PAGE:											// Code page
                        buffer.Get(out codePage);
                        break;

                    case ProprietesWpf.ONGLET_LIBELLE:									// Libellé (string)
                        string text;
                        buffer.GetStringCP(out text, codePage);
                        Header = text;
                        break;

                    case ProprietesWpf.ONGLET_IMAGE_DEBUT:								// Libellé (string)
                        imageFile = new XHtmlImageFile();
                        imageFile.ReadProperties(buffer);
            //						Image = XHtmlImage.GetImage(imageFile);

                        // voir si c utile !!!!!!!!!!!!!!!!!
                        if (this.Page.Html.App.ImagesCss.FirstOrDefault(e => e.FileName == imageFile.FileName) == null)
                        {
                            imageFile.Css = imageFile.GenererCss();
                            this.Page.Html.App.ImagesCss.Add(imageFile);
                        }

                        break;

                    case ProprietesWpf.ONGLET_NUMERO_PAGE:								// Numéro de la page liée à l'onglet (byte)
                        byte pageNumber;
                        buffer.Get(out pageNumber);
                        PageNumber = pageNumber;
                        break;

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

                    case ProprietesWpf.ONGLET_BULLE:										// Texte de la bulle (string)
                        string toolTip;
                        buffer.GetStringCP(out toolTip, codePageBulle);
                        ToolTip = string.IsNullOrEmpty(toolTip) ? null : toolTip.Replace("|", "\n"); // "|" = multi-ligne
                        break;

                    case ProprietesWpf.ONGLET_COULEUR_FOND:							// Couleur du Fond (ushort)
                        ushort id;
                        buffer.Get(out id);
            //						Brush background = Application.Current.Resources["Brush-" + id] as Brush;
                        IdFond = id;
            //						if (background != null) ContentBorder.Background = background;
            //						else ContentBorder.ClearValue(Border.BackgroundProperty);
                        break;

                    case ProprietesWpf.ONGLET_VISIBILITE:								// visibilité
                        byte visibiliteValue;
                        buffer.Get(out visibiliteValue);
                        Visibilite = visibiliteValue;
                        //Visibilites visibilite = (Visibilites)visibiliteValue;
                        //switch (visibilite)	// 0 = visible, 1 = grisé, 2 = illisible, 3 = caché
                        //{
                        //	case Visibilites.Visible:
                        //		IsEnabled = true;
                        //		Visibility = Visibility.Visible;
                        //		break;

                        //	case Visibilites.Grise:
                        //		IsEnabled = false;
                        //		Visibility = Visibility.Visible;
                        //		break;

                        //	case Visibilites.Cache:
                        //		IsEnabled = false;
                        //		Visibility = Visibility.Collapsed;
                        //		break;
                        //}
                        break;

                    default:
                        throw new XHtmlException(XHtmlErrorCodes.UnknownProperty, XHtmlErrorLocations.TabItem, property.ToString());
                }

                buffer.Get(out property);
            }
        }
示例#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;

            buffer.Get(out property);
            while (property != ProprietesWpf.BOUTON_FIN)
            {
                switch (property)
                {
                    case ProprietesWpf.PRESENTATION_DEBUT:								// Début présentation
                        if (Presentation == null) Presentation = new XHtmlPresentation(this);
                        Presentation.ReadProperties(buffer);
                        Presentation.SetProperties();
                        break;

                    case ProprietesWpf.CODE_PAGE:											// Code page
                        buffer.Get(out codePage);
                        break;

                    case ProprietesWpf.PARAM_SAISIE_SEQUENCE:							// Point de séquence (ushort)
                        ushort pointSequence;
                        buffer.Get(out pointSequence);
                        SeqPoint = pointSequence;
                        break;

                    case ProprietesWpf.OBJET_RACCOURCI:									// touche de raccourcis (byte)
                        byte shortcut;
                        buffer.Get(out shortcut);
                        Shortcut = (char)shortcut;
                        break;

                    case ProprietesWpf.BOUTONS_VALIDES_DEBUT:							// Boutons valides dans la page en cours
                        ListOfValidButtons = new Collection<string>();
                        buffer.Get(out property);
                        while (property != ProprietesWpf.BOUTONS_VALIDES_FIN)
                        {
                            string buttonName;
                            buffer.GetString(out buttonName);
                            ListOfValidButtons.Add(buttonName);
                            buffer.Get(out property);
                        }
                        break;

                    case ProprietesWpf.BOUTON_LIBELLE:									// Libellé du bouton (string)
                        buffer.GetStringCP(out text, codePage);
                        Content = text;
                        break;

                    case ProprietesWpf.BOUTON_IMAGE_DEBUT:								// Image du bouton
                        imageDuBouton = new XHtmlImageFile();
                        imageDuBouton.ReadProperties(buffer);

                        if (this.Page.Html.App.ImagesCss.FirstOrDefault(e => e.FileName == imageDuBouton.FileName) == null)
                        {
                            imageDuBouton.Css = imageDuBouton.GenererCss();
                            this.Page.Html.App.ImagesCss.Add(imageDuBouton);
                        }

                        //Content = image = new XHtmlImage(Page)
                        //{
                        //   Source = XHtmlImage.GetImage(imageFile),
                        //   HorizontalAlignment = HorizontalAlignment.Center,
                        //   VerticalAlignment = VerticalAlignment.Center,
                        //   Stretch = Stretch.Uniform,
                        //   StretchDirection = StretchDirection.DownOnly
                        //};
                        break;

                    case ProprietesWpf.BOUTON_NOM_SELECTION:							// Nom de la sélection (string)
                        buffer.GetString(out Selection);
                        break;

                    case ProprietesWpf.BOUTON_LOCAL:										// Uniquement si le bouton est local à la page
                        IsLocal = true;
                        break;

                    case ProprietesWpf.BOUTON_ACTION:									// Type d'action (byte = 1, 2 ou 3)
                        buffer.Get(out action);
                        switch (action)
                        {
                            case 1: buffer.Get(out pointTraitement); break;				// Type = 1 : point de traitement
                            case 2: buffer.Get(out pointArret); break;					// Type = 2 : point d'arrêt
                            case 3: buffer.GetString(out generatedString); break;		// Type = 3 : chaîne à générer
                        }
                        break;

                    case ProprietesWpf.BOUTON_IMAGES_ET_TITRE:
                        var backgroundImageFile = new XHtmlImageFile();							// Image fond
                        backgroundImageFile.ReadProperties(buffer);
                        //BackgroundImage = XHtmlImage.GetImage(backgroundImageFile);

                        var backgroundClickedImageFile = new XHtmlImageFile();				// Image fond au clic
                        backgroundClickedImageFile.ReadProperties(buffer);
                        //BackgroundClickedImage = XHtmlImage.GetImage(backgroundClickedImageFile);

                        buffer.GetString(out text);																// Libellé (string)
                        Content = text;

                        ushort leftMargin, topMargin, rightMargin, bottomMargin;							// Marges (ushort x 4)
                        buffer.Get(out leftMargin);
                        buffer.Get(out topMargin);
                        buffer.Get(out rightMargin);
                        buffer.Get(out bottomMargin);
            //!!!!!!!!!!!!						Padding = new Thickness(leftMargin, topMargin, rightMargin, bottomMargin);
                        break;

                    #region image survol
                    case ProprietesWpf.BOUTON_IMAGE_SURVOL_DEBUT:					// Image au survol du bouton (string)
                        var mouseOverImageFile = new XHtmlImageFile();
                        mouseOverImageFile.ReadProperties(buffer);

                        //imageMouseOver = (string.IsNullOrEmpty(mouseOverImageFile.FileName)) ? null : new Image
                        //{
                        //   Source = XHtmlImage.GetImage(mouseOverImageFile),
                        //   HorizontalAlignment = HorizontalAlignment.Center,
                        //   VerticalAlignment = VerticalAlignment.Center,
                        //   Stretch = Stretch.Uniform,
                        //   StretchDirection = StretchDirection.DownOnly
                        //};
                        break;
                    #endregion image survol

                    #region curseur survol
                    case ProprietesWpf.BOUTON_CURSEUR_SURVOL:							// Curseur au survol (string)
                        buffer.GetString(out mouseOverCursorFile);
                        //cursorMouseOver = GetCursor(mouseOverCursorFile);
                        break;
                    #endregion curseur survol

                    #region son survol
                    case ProprietesWpf.BOUTON_SON_SURVOL:								// Son au survol (string)
                        buffer.GetString(out mouseOverSoundFile);

                        //player = new MediaPlayer();
                        //soundMouseOver = GetSound(mouseOverSoundFile);
                        break;
                    #endregion son survol

                    #region son au clic
                    case ProprietesWpf.BOUTON_SON_CLIC:									// Son au clic (string)
                        buffer.GetString(out clickSoundFile);

                        //player = new MediaPlayer();
                        //soundClick = GetSound(clickSoundFile);
                        break;
                    #endregion son au clic

                    default:
                        throw new XHtmlException(XHtmlErrorCodes.UnknownProperty, XHtmlErrorLocations.Button, property.ToString());
                }

                buffer.Get(out property);
            }
        }