/// <summary>
        /// Reads the column's "special" (unshared with the other column types) properties from the buffer
        /// </summary>
        /// <param name="buffer">DVBuffer where the properties are read</param>
        private void ReadSpecialProperties(DVBuffer buffer)
        {
            ProprietesWpf property;

            buffer.Get(out property);
            while (property != ProprietesWpf.CHAMP_FIN)
            {
                switch (property)
                {
                    case ProprietesWpf.PRESENTATION_DEBUT:								// Début présentation
                        Presentation.ReadProperties(buffer);
                        break;

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

                    case ProprietesWpf.PARAM_SAISIE_TABLE_ASSOCIEE:					// (Uniquement si le champ peut appeler un zoom)
                        IsZoomCaller = true;
                        break;

                    case ProprietesWpf.PARAM_SAISIE_TABLE_ASSOCIEE_EXT:			// (Uniquement si le champ peut appeler un zoom)
                        byte isZoomCaller;
                        buffer.Get(out isZoomCaller);
                        IsZoomCaller = (isZoomCaller != 0);
                        break;

                    case ProprietesWpf.OBJET_EN_AFFICHAGE:								// (Uniquement si le champ est en affichage seulement)
                        IsReadOnly = true;
                        break;

                    case ProprietesWpf.CHAMP_NUMERIQUE:									// (Uniquement si le champ n'accepte que des valeurs numériques)
                        isNumerical = true;
                        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;

                    default:
                        throw new XHtmlException(XHtmlErrorCodes.UnknownProperty, XHtmlErrorLocations.DataGridTextBoxColumn, property.ToString());
                }
                buffer.Get(out property);
            }
            SetTextAlignment();	// impossible ailleurs car on a besoin de "Presentation" & "IsNumerical"
        }
Example #2
0
		public void ReadProperties(DVBuffer buffer)
		{
			ProprietesWpf property;
			uint idObj;	// variable de stockage temporaire des identifiants d'objets

			buffer.Get(out property);
			while (property != ProprietesWpf.PAGE_FIN)
			{
				switch (property)
				{
					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);
						Presentation.GridId = gridId;
						Presentation.CellIndex = cellIndex;
						break;

					case ProprietesWpf.PAGE_POSITION:				// position en x (ushort) et position en y (ushort)
						PositionLue = true;
						buffer.Get(out left);
						buffer.Get(out top);
						break;

					case ProprietesWpf.PAGE_TAILLE:					// largeur (ushort) et hauteur (ushort)
						TailleLue = true;
						buffer.Get(out OriginalWidth);
						buffer.Get(out OriginalHeight);
						break;

					case ProprietesWpf.PAGE_EFFACEMENT:				// type d'effacement (byte)
						byte overlapping;
						buffer.Get(out overlapping);
						this.Effacement = overlapping;
						SetOverlapping(overlapping);
						break;

					case ProprietesWpf.PAGE_ATTACHEMENT_DROITE:	// (uniquement si attachement à droite)
						attachementDroite = true;
						break;

					case ProprietesWpf.PAGE_ATTACHEMENT_BAS:		// (uniquement si attachement en bas)
						attachementBas = true;
						break;

					case ProprietesWpf.PAGE_LARGEUR_EXTENSIBLE:	// (uniquement si largeur variable)
						largeurVariable = true;
						break;

					case ProprietesWpf.PAGE_HAUTEUR_EXTENSIBLE:	// (uniquement si hauteur variable)
						hauteurVariable = true;
						break;

					case ProprietesWpf.PAGE_ARRET_SAISIE:			// numéro de point d'arrêt "Demande de saisie" (ushort)
						buffer.Get(out StopPoint);
						break;

					case ProprietesWpf.PAGE_COULEUR_FOND:			// identifiant de couleur (ushort)
						ushort idColor;
						buffer.Get(out idColor);
						CouleurDeFond = idColor;
//!!!!!!!!!!!						Brush background = Application.Current.Resources["Brush-" + idColor] as Brush;
//!!!!!!!!!!!!!						if (background != null) Background = background;
						break;


					case ProprietesWpf.BOUTON_DEBUT:						// Bouton (Xwin :  objet bouton)
						buffer.Get(out idObj);
						//!!!!!!!!!!!!!!!!!!!!!!!!!
						XHtmlButton button = (XHtmlButton)GetObject(idObj);
						if (button == null)
						{
							button = new XHtmlButton(this) { Id = idObj };
							Children.Add(button);
							ListOfObjects.Add(button);
						}
						button.ReadProperties(buffer);

						button.AjouterEnvoisUnObjet(Html.Envois, this, Html.App.StackOfWindows.Count());

						break;


					case ProprietesWpf.TEXTE_DEBUT:						// Label (Xwin : objet texte)
						{
							buffer.Get(out idObj);
							XHtmlLabel label = (XHtmlLabel)GetObject(idObj);
							if (label == null)
							{
								label = new XHtmlLabel(this) { Id = idObj };
								Children.Add(label);
								ListOfObjects.Add(label);
							}
							label.ReadProperties(buffer);
							label.AjouterEnvoisUnObjet(Html.Envois, this, Html.App.StackOfWindows.Count());
						}
						break;

					case ProprietesWpf.GROUPBOX_DEBUT:
						{
							buffer.Get(out idObj);
							XHtmlGroupBox groupe = (XHtmlGroupBox)GetObject(idObj);
							if (groupe == null)
							{
								groupe = new XHtmlGroupBox(this) { Id = idObj };
								Children.Add(groupe);
								ListOfObjects.Add(groupe);
							}
							groupe.ReadProperties(buffer);
							groupe.AjouterEnvoisUnObjet(Html.Envois, this, Html.App.StackOfWindows.Count());
						}
						break;

					#region Champ
					case ProprietesWpf.CHAMP_DEBUT:						// TextBox (Xwin : objet champ)
						buffer.Get(out idObj);
						XHtmlTextBox textBox = (XHtmlTextBox)GetObject(idObj);
						if (textBox == null)
						{
							textBox = new XHtmlTextBox(this) { Id = idObj };
							Children.Add(textBox);
							ListOfObjects.Add(textBox);
						}
						textBox.ReadProperties(buffer);
						textBox.AjouterEnvoisUnObjet(Html.Envois, this, Html.App.StackOfWindows.Count());
						break;
					#endregion Champ

					#region Multichoix
					case ProprietesWpf.MULTICHOIX_DEBUT:				// ComboBox (Xwin : objet multichoix)
						buffer.Get(out idObj);
						XHtmlComboBox comboBox = (XHtmlComboBox)GetObject(idObj);
						if (comboBox == null)
						{
							comboBox = new XHtmlComboBox(this) { Id = idObj };
							Children.Add(comboBox);
							ListOfObjects.Add(comboBox);
						}
						comboBox.ReadProperties(buffer);
						comboBox.AjouterEnvoisUnObjet(Html.Envois, this, Html.App.StackOfWindows.Count());
						break;
					#endregion Multichoix

					#region Case à cocher
					case ProprietesWpf.CASE_A_COCHER_DEBUT:			// CheckBox (Xwin : objet case à cocher)
						buffer.Get(out idObj);
						XHtmlCheckBox checkBox = (XHtmlCheckBox)GetObject(idObj);
						if (checkBox == null)
						{
							checkBox = new XHtmlCheckBox(this) { Id = idObj };
							Children.Add(checkBox);
							ListOfObjects.Add(checkBox);
						}
						checkBox.ReadProperties(buffer);
						checkBox.AjouterEnvoisUnObjet(Html.Envois, this, Html.App.StackOfWindows.Count());
						break;
					#endregion Case à cocher

					#region Groupe d'onglets
					case ProprietesWpf.GROUPE_ONGLET_DEBUT:					
						uint idTc;
						buffer.Get(out idTc);
						XHtmlTabControl tabControl; //  = Window.ListOfTabControls.FirstOrDefault(tc => (tc.Page.NumMasque == NumMasque && tc.Id == idTc));
//						if (tabControl == null)
						{
							tabControl = new XHtmlTabControl(this) { Id = idTc };
							// Window.ListOfTabControls.Add(tabControl);
						}
						//else
						//{
						//	tabControl.Page.Children.Remove(tabControl);
						//	tabControl.Page = this;
						//}
						Children.Add(tabControl); // on ajoute les groupes d'onglets à la page elle-même et non à InternalGrid pour pouvoir justement décaler InternalGrid par rapport aux onglets
						ListOfObjects.Add(tabControl); // !!!!!!!!!!!!!! bh je l'ai ajouté mais je ne sais pas si c utile
						tabControl.ReadProperties(buffer);
						tabControl.AjouterEnvoisUnObjet(Html.Envois, this, Html.App.StackOfWindows.Count());
						break;
					#endregion Groupe d'onglets


					case ProprietesWpf.GRILLE_DEBUT:									// Grille(s)
						SetGrid(buffer);
						break;

					#region Page panel
					case ProprietesWpf.PAGE_DEBUT:
						{
							string idPage;
							bool nouvelle = false;

							buffer.GetString(out idPage); // Id Page (string)

							XHtmlPage page = Window.GetPage(idPage);

							if (page == null)
							{
								nouvelle = true;
								page = new XHtmlPage(Window,this.Html) { Id = idPage, ParentPage = this };
								this.Html.Envois.Ajouter("nouveauPanel", this.Html.CalculerIdPage(page.Id));
								this.Html.Envois.Ajouter("pageCourante", Html.CalculerIdPage(page.Id)) ; // , page.StopPoint.ToString(), page.NumPage.ToString());
								page.ReadProperties(buffer);
								Window.ListOfPages.Add(page);
								page.JeSuisAffichee = true;

							}
							else
							{
								nouvelle = false;
								this.Html.Envois.Ajouter("pageCourante", Html.CalculerIdPage(page.Id)); // , page.StopPoint.ToString(), page.NumPage.ToString());
								page.ReadProperties(buffer);
								//!!!!!!!!!!!!!!!!!! que faut il faire ici ?
								// rien je pense : je envoie les objets modifiés
							}

							page.EnvoyerCouleurPositionAttachement(true);
							this.Html.Envois.Ajouter("pageCourante", Html.CalculerIdPage(page.Id), page.StopPoint.ToString(), page.NumPage.ToString());




							//ajout de la page panel à la cellule de grille (elle peut avoir été supprimée : cas des onglets)
							// bh on le fait de l'autre coté
							//if (page.Parent == null) AddToGrid(page);
							string p = "{" +
								        "\"idPanel\":\"" + this.Html.CalculerIdPage(page.Id) + "\"," +
										  "\"idMere\":\"" + Html.CalculerIdPage(this.Id) + "\"," +
										  "\"idGrille\":\"" + HtmlGlobal.CalculerId(page.Presentation.GridId, this.Id, this.Html.App.StackOfWindows.Count()) + "\"," +
										  "\"iCellule\":" + page.Presentation.CellIndex +
										  "}";

							this.Html.Envois.Ajouter("ajouterPanelAGrilleSiPasDedans",p);



						}
						break;
					#endregion Page panel



					#region Tableau
					case ProprietesWpf.TABLEAU_DEBUT:					// DataGrid (Xwin : objet tableau)
						buffer.Get(out idObj);
						XHtmlDataGrid dataGrid = (XHtmlDataGrid)GetObject(idObj);
						if (dataGrid == null)
						{
							dataGrid = new XHtmlDataGrid(this) { Id = idObj };
							Children.Add(dataGrid);
							ListOfObjects.Add(dataGrid);
						}
						dataGrid.ReadProperties(buffer);
						dataGrid.AjouterEnvoisUnObjet(Html.Envois, this, Html.App.StackOfWindows.Count());
						break;
					#endregion Tableau



					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;

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

				buffer.Get(out property);
			}

			SetSize(); // Mise à jour de la taille
			SetPosition(); // Mise à jour de la position
		}
        /// <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)
        {
            ushort id;		//temporaire pour stockage des identifiants de propriétés (polices, couleurs, etc...)

            ProprietesWpf property;

            buffer.Get(out property);
            while (property != ProprietesWpf.COLONNE_FIN)
            {
                switch (property)
                {
                    #region header
                    case ProprietesWpf.COLONNE_ENTETE_POLICE:						// paramètres habituels pour la police de l’en-tête
                        buffer.Get(out id);
                        ColumnHeader.idPolice = id; //  Application.Current.Resources["Font-" + id] as XHtmlFont;
                        break;

                    case ProprietesWpf.COLONNE_ENTETE_FOND:						// paramètres habituels pour la couleur de fond de l’en-tête
                        buffer.Get(out id);
                        //						ColumnHeader.Background = Application.Current.Resources["Brush-" + id] as SolidColorBrush;
                        ColumnHeader.idFond = id; // Application.Current.Resources["Brush-" + id] as SolidColorBrush;
                        break;

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

                    case ProprietesWpf.COLONNE_ENTETE_LIBELLE:					// libellé de l’en-tête (string)
                        string headerText;
                        buffer.GetStringCP(out headerText, codePage);
                        ColumnHeader.Text = headerText;
                        if (headerText.StartsWith("<hog>", StringComparison.OrdinalIgnoreCase))
                        {
                            //Ajout FA 13.05.2011, recupération des images, nouvelle mouture
                            string command = headerText.Remove(0, 5);
                            //!!!!!!!!!!!!!! XHtmlObjetGraphique.LoadHogImagesInCommand(command);

                            ColumnHeader.HogCommand = command;
                            ColumnHeader.IsHog = true;
                        }
                        else ColumnHeader.IsHog = false;
                        ColumnHeader.IsImage = false;
                        break;

                    case ProprietesWpf.COLONNE_ENTETE_BITMAP_DEBUT:				// image d'entête colonne (pour rempalcer le texte)
                        XHtmlImageFile imageFile = new XHtmlImageFile();
                        imageFile.ReadProperties(buffer);
                        // !!!!!!!!!!!!!!!! a voir ColumnHeader.Image = XHtmlImage.GetImage(imageFile);
                        ColumnHeader.IsImage = true;
                        break;

                    case ProprietesWpf.COLONNE_ENTETE_IMAGE_FILTRE:				// colonne filtrée ou non
                        byte filtered;
                        buffer.Get(out filtered);
                        ColumnHeader.IsFiltered = (filtered > 0);
                        break;

                    case ProprietesWpf.COLONNE_ENTETE_IMAGE_TRI:					// colonne triée ou non + ordre et sens de tri
                        byte sorted, sortOrder, sortDirection;
                        buffer.Get(out sorted);
                        buffer.Get(out sortOrder);
                        buffer.Get(out sortDirection);
                        ColumnHeader.IsSorted = (sorted > 0);
                        ColumnHeader.SortOrder = sortOrder;
                        ColumnHeader.SortDescending = (sortDirection == 2);
                        break;

                    case ProprietesWpf.COLONNE_ENTETE_BITMAP_AVANT:				// image de gauche
                        byte flagImageLeft;
                        buffer.Get(out flagImageLeft);

                        if (flagImageLeft == 0) ColumnHeader.LeftImage = null;	// on efface l'image
                        else																		// on récupère l'image et on l'affecte
                        {
                            XHtmlImageFile leftImageFile = new XHtmlImageFile();
                            leftImageFile.ReadProperties(buffer);
                            //!!!!!!!!!!!!!!!!!! a voir ColumnHeader.LeftImage = XHtmlImage.GetImage(leftImageFile);
                        }
                        break;

                    case ProprietesWpf.COLONNE_ENTETE_BITMAP_APRES:				// image de droite
                        byte flagImageRight;
                        buffer.Get(out flagImageRight);

                        if (flagImageRight == 0) ColumnHeader.RightImage = null;	// on efface l'image
                        else																		// on récupère l'image et on l'affecte
                        {
                            XHtmlImageFile rightImageFile = new XHtmlImageFile();
                            rightImageFile.ReadProperties(buffer);
                            //!!!!!!!!!!!!!!!!!!! a voir ColumnHeader.RightImage = XHtmlImage.GetImage(rightImageFile);
                        }
                        break;
                    #endregion header

                    #region colonne
                    case ProprietesWpf.COLONNE_TRAIT_AUTOUR:						// Si trait entre les colonnes (avant et après colonne en cours)
                        BorderThickness = new Thickness(1, 0, 1, 0);
                        break;

                    case ProprietesWpf.COLONNE_FLAG_AFFICHAGE:					//flag affichage (byte)
                        byte flagDisplay;
                        buffer.Get(out flagDisplay);

                        // 1 = « Toujours » (la colonne est toujours affichée, l’utilisateur ne peut pas l’ôter)
                        // 2 = « Oui par défaut » (la colonne est affichée au départ, l’utilisateur peut l’ôter)
                        // 3 = « Non par défaut » (la colonne n’est pas affichée au départ, l’utilisateur peut l’ajouter)

                        IsMandatory = (flagDisplay == 1);
                        isHiddenByDefault = (flagDisplay == 3);
                        break;

                    case ProprietesWpf.COLONNE_LARGEUR:								// Largeur de la colonne (ushort)
                        ushort width;
                        buffer.Get(out width);
                        Width = width + 2;
                        //!!!!!!!!!!!!!if ((bool)Application.Current.Properties["IgnoreUserSettings"] || WidthIsAuto) Width = width + 2; // + 2 pour la bordure
                        break;

                    case ProprietesWpf.COLONNE_TYPE_FOND:							// paramètres habituels pour la couleur de fond de la colonne
                        byte type;
                        buffer.Get(out type);
                        //if (type == 1) ColumnBackground = "HighlightedDataGridBackground";		// couleur windows
                        // sinon : traité dans le "case ProprietesWpf.COLONNE_FOND"
                        break;

                    case ProprietesWpf.COLONNE_FOND:
                        buffer.Get(out id);
                        ColumnBackground = id;
                        break;

                    case ProprietesWpf.COLONNE_POLICE:								// paramètres habituels pour la police de la colonne
                        buffer.Get(out id);
                        ColumnFont = id; // "Font-" + id;
                        break;

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

                    case ProprietesWpf.COLONNE_BULLE:								// Bulle sur la colonne (string)
                        string toolTip;
                        buffer.GetStringCP(out toolTip, codePageBulle);
                        ToolTip = string.IsNullOrEmpty(toolTip) ? null : toolTip.Replace("|", "\n"); // "|" = multi-ligne
                        break;
                    #endregion colonne

                    #region Drag & Drop
                    case ProprietesWpf.COLONNE_NOMS_ENREG_DONNEE:				// nom de l’enregistrement et de la donnée (2 string)
                        string recordName, dataName;
                        buffer.GetString(out recordName);
                        buffer.GetString(out dataName);
                        RecordName = recordName;
                        DataName = dataName;
                        break;

                    case ProprietesWpf.COLONNE_INDICES_DONNEE:					// indices donnée (4 ushort)
                        ushort index1, index2, index3, index4;
                        buffer.Get(out index1);
                        buffer.Get(out index2);
                        buffer.Get(out index3);
                        buffer.Get(out index4);
                        Indexes = new int[] { index1, index2, index3, index4 };
                        break;
                    #endregion Drag & Drop

                    case ProprietesWpf.CHAMP_DEBUT:
                        ushort numCol;
                        uint idCol;
                        buffer.Get(out numCol);
                        buffer.Get(out idCol);

                        ReadSpecialProperties(buffer);
                        break;

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

            SetVisibility(); // à la fin pour pouvoir tenir compte de l'attribut ET du choix de l'utilisateur

            /*/!!!!!!!!!!!!!!!!
            foreach (XHtmlRow row in ((XHtmlDataGrid)DataGridOwner).Rows)
                ((XHtmlTextBoxCell)row[DataGridOwner.Columns.IndexOf(this)]).SetStyle();
            */
        }
        public void GetProperties(DVBuffer buffer)
        {
            string idPage; //stockage temporaire des id page, menuItem et toolbarItem
            ProprietesWpf property;
            XHtmlWindow window;
            XHtmlPage page = null;
            XHtmlDataGrid dataGrid;
            ushort? index = null; //pour renvoi d'un index colonne dans un tableau
            ushort? nbRows = null; //pour renvoi du nombre de lignes affichées dans un tableau
            string horizontalScrollbarTooltip = null; //pour renvoi de la bulle de l'ascenseur horizontal dans un tableau
            string verticalScrollbarTooltip = null; //pour renvoi de la bulle de l'ascenseur vertical dans un tableau
            int codepageBulleAscHor = 0, codepageBulleAscVer = 0;

            buffer.Get(out property);

            while (property != ProprietesWpf.CLIENTLEGER_FIN)
            {
                switch (property)
                {
                    case ProprietesWpf.CLIENTLEGER_DEBUT:
                        break;

                    case ProprietesWpf.MENU_SYSTEME_APERCU_ETAT:
                        byte printPreview;
                        buffer.Get(out printPreview);
                        IsPrintPreviewEnabled = (printPreview == 1);
            //						if (StackOfWindows.Any()) StackOfWindows.ToList()[0].UpdatePrintPreviewItem(IsPrintPreviewEnabled);
                        break;

                    case ProprietesWpf.MENU_SYSTEME_TRADUCTIONS:
                        buffer.GetString(out PrintPreviewText);
                        buffer.GetString(out CloseAllText);
                        buffer.GetString(out PrintCloseAllText);
                        buffer.GetString(out SavePrintPreviewText);
                        break;

                    case ProprietesWpf.COULEUR_CREATION_DEBUT:
                        XHtmlColor.Create(buffer,this.Html);
                        break;

                    case ProprietesWpf.POLICE_CREATION_DEBUT:
                        XHtmlFont.Create(buffer,this.Html);
                        break;

                    case ProprietesWpf.BORDURE_CREATION_DEBUT:
                        XHtmlBorder.Create(buffer,this.Html);
                        break;

                    case ProprietesWpf.PADDING_CREATION_DEBUT:
                        XHtmlPadding.Create(buffer,this.Html);
                        break;

                    #region Fenêtre
                    case ProprietesWpf.FENETRE_DEBUT:					// Id Masque (ushort) et Id Page (byte)
                        // ne concerne que les "vraies" fenêtres (i.e. : les fenêtres autres que la toute première, ouverte dans app.xaml.cs)

                        //Window lastWindow = StackOfWindows.Peek();
                        //if (!lastWindow.IsVisible) lastWindow.Show();
                        //lastWindow.IsEnabled = false;

                        window = new XHtmlWindow(); //  { Owner = lastWindow, ShowInTaskbar = false };
                        buffer.GetString(out window.MaskName);
                        buffer.Get(out window.PageNum);
                        window.ReadProperties(buffer);
                        window.Id = window.MaskName.Replace('.', '_') + "_" + window.PageNum.ToString() + "_" + (StackOfWindows.Count + 1).ToString();
                        StackOfWindows.Push(window);

                        ListeParametresComplementaires lc = new ListeParametresComplementaires();
                        lc.Ajouter("ty", window.minContentHeight.ToString());
                        lc.Ajouter("tx", window.minContentWidth.ToString());
                        lc.Ajouter("idFen", window.Id);
                        lc.Ajouter("libelle", window.MaskName);
                        lc.Ajouter("numpage", window.PageNum.ToString());

                        lc.Ajouter("tailleFixe", (window.ModeResize == System.Windows.ResizeMode.NoResize) ? "true" : "false");
                        lc.Ajouter("couleurFond", XHtmlColor.PrefixeCssFond + window.CouleurFond.ToString());
                        lc.Ajouter("titre", window.Title);
                        if (window.icon != null)
                            lc.Ajouter("icone", window.icon.Css);

                        string chaineFenetre = HtmlGlobal.ToJsonString(lc, this.Html.JsonParamCompl, false);
                        {
                            UnParametreEnvoye p = new UnParametreEnvoye();
                            p.commande = "ouvrirFenetre";
                            this.Html.Envois.commandes.Add(p);
                            p.valeur = chaineFenetre;
                        }
                        break;

                    case ProprietesWpf.FENETRE_TITRE:					// Titre de la fenêtre (string)
                        {
                            string title;
                            int codePage;
                            buffer.Get(out codePage);
                            buffer.GetStringCP(out title, codePage);
                            StackOfWindows.Peek().Title = title;

                            UnParametreEnvoye p = new UnParametreEnvoye();
                            p.commande = "xmeTitle";
                            this.Html.Envois.commandes.Add(p);
                            p.valeur = title;
                        }
                        break;

                    case ProprietesWpf.FENETRE_ICONE:					// Titre de la fenêtre (string)
                        var icon = new XHtmlImageFile();
                        icon.ReadProperties(buffer);
                        // StackOfWindows.Peek().SetIcon(icon);
                        break;

                    case ProprietesWpf.FENETRE_TAILLE_INITIALE:		// Taille de référence pour les calculs d'attachement - Hauteur (ushort) x Largeur (ushort)
                        window = StackOfWindows.Peek();
                        buffer.GetString(out window.MaskName);
                        buffer.Get(out window.PageNum);
                        window.SetMinContentSize(buffer);

                        this.Html.Envois.Ajouter("fenetreTailleInitiale",
                                window.MaskName + "," +
                                window.PageNum.ToString() + "," +
                                window.minContentWidth.ToString() + "," +
                                window.minContentHeight.ToString()
                            );

                        break;

                    case ProprietesWpf.FENETRE_FERMETURE:				// Pour fermer la fenêtre en cours
                        window = StackOfWindows.Pop();

                        this.Html.Envois.Ajouter("fermerFenetre", window.Id);

                        //FenetresADepiler.Push(window);
                        //window.Closing -= window.ClosingHandler;
                        //StackOfWindows.Peek().IsEnabled = true; // ne pas remplacer par "window": le StackOfWindow.Peek a changé de valeur à cause du pop() !
                        // window.Close();

                        break;
                    #endregion Fenêtre

                    case ProprietesWpf.PAGE_DEBUT:
                        buffer.GetString(out idPage); // Id Page (string)

                        window = StackOfWindows.Peek();
                        page = window.GetPage(idPage);
                        if (page == null)
                        {
                            window.ListOfPages.Add(page = new XHtmlPage(window,this.Html) { Id = idPage });
                            this.Html.Envois.Ajouter("nouvellePage", this.Html.CalculerIdPage(page.Id));
                            page.JeSuisAffichee = true;
                        }
                        // une page peut être supprimée (dans la gestion de l'effacement d'une autre page), il faut donc la remettre dans la fenêtre le cas échéant
                        //if (!window.MainCanvas.Children.Contains(page)) window.MainCanvas.Children.Add(page);
                        if (page.JeSuisAffichee == false)
                        {
                            this.Html.Envois.Ajouter("remettrePage", this.Html.CalculerIdPage(page.Id));
                        }
                        // cette ligne était plus bas, mais trop tard
                        this.Html.Envois.Ajouter("pageCourante", Html.CalculerIdPage(page.Id), page.StopPoint.ToString(), page.NumPage.ToString());
                        page.JeSuisAffichee = true;
                        // - lecture de la page et des objets
                        page.ReadProperties(buffer);

                        // je la remet aussi ici car avec les panels ca bouge !
                        this.Html.Envois.Ajouter("pageCourante", Html.CalculerIdPage(page.Id), page.StopPoint.ToString(), page.NumPage.ToString());
                        page.EnvoyerCouleurPositionAttachement(false);

                        // on affiche la fenêtre si c'est la toute première page et si la fenêtre n'est pas masquée (application sans fenêtre)
                        // !!!!!!!!!!if (!page.Window.IsVisible && application.Client.FenetreMereHide == 0)
                        // !!!!!!!!!!	page.Window.Show();
                        break;

                    case ProprietesWpf.TABLEAU_DEBUT:								// Mise à jour d'une propriété du tableau

                        dataGrid = GetDataGrid(buffer,out page);
                        dataGrid.ReadProperties(buffer);
                        dataGrid.AjouterEnvoisUnObjet(Html.Envois, page, Html.App.StackOfWindows.Count());
                        break;

                    case ProprietesWpf.TABLEAU_ASCHOR_A_GAUCHE:					// retour au début de la ligne d'un tableau
                        dataGrid = GetDataGrid(buffer,out page);
                        // ScrollIntoView sur la colonne dont le DisplayIndex est = FrozenColumnCount pour mettre l'ascenseur à gauche.
                        // (en tenant compte des colonnes figées)
                        // attention : le tableau peut être vide, d'où le "if Rows.Count > 0"
                        var column = dataGrid.Columns.FirstOrDefault(col => col.DisplayIndex == dataGrid.FrozenColumnCount);
                        //!!!!!!!!!!if (dataGrid.Rows.Count > 0 && column != null)
                        //!!!!!!!!!!	dataGrid.ScrollIntoView(dataGrid.Rows[0], column);
                        break;

                    case ProprietesWpf.TABLEAU_REMPLISSAGE_DEBUT:				// Remplissage du tableau
                        dataGrid = GetDataGrid(buffer,out page);
                        dataGrid.Fill(buffer);
                        dataGrid.AjouterEnvoisUnObjetRemplissageTableau(Html.Envois, page, Html.App.StackOfWindows.Count());
                        break;

                    #region Fonctions Get du tableau
                    case ProprietesWpf.TABLEAU_ASCHOR_GET_BULLE:					// Demande le texte de la bulle de l'ascenseur horizontal
                        dataGrid = GetDataGrid(buffer,out page);
                        horizontalScrollbarTooltip = dataGrid.HorizontalScrollBarToolTip;
                        codepageBulleAscHor = dataGrid.CodepageBulleAscHor;
                        break;

                    case ProprietesWpf.TABLEAU_ASCVER_GET_BULLE:					// Demande le texte de la bulle de l'ascenseur vertical
                        dataGrid = GetDataGrid(buffer,out page);
                        verticalScrollbarTooltip = dataGrid.VerticalScrollBarToolTip;
                        codepageBulleAscVer = dataGrid.CodepageBulleAscVer;
                        break;

                    case ProprietesWpf.TABLEAU_GET_NOMBRE_LIGNES:				// Demande du nombre de lignes affichables dans le tableau
                        {
                            string id = GetIdentDataGrid(buffer);
                            // dataGrid = GetDataGrid(buffer);
                            //!!!!!!!!!! dataGrid.UpdateLayout();	// indispensable, sinon le nombre de lignes envoyé au premier affichage du tableau est potentiellement faux (peut poser pb par la suite)
                            nbRows = 32; //  dataGrid.GetRowCount();
                            Html.Envois.Ajouter("tabGetNbLig", id);
                        }
                        break;

                    case ProprietesWpf.TABLEAU_GET_COL_SAISIE_PREMIERE:		// Demande le numéro de la première colonne en saisie dans la ligne donnée
                        dataGrid = GetDataGrid(buffer,out page);
                        index = dataGrid.GetFirstColumnIndex(buffer);
                        break;

                    case ProprietesWpf.TABLEAU_GET_COL_SAISIE_DERNIERE:		// Demande le numéro de la dernière colonne en saisie dans la ligne donnée
                        dataGrid = GetDataGrid(buffer,out page);
                        index = dataGrid.GetLastColumnIndex(buffer);
                        break;

                    case ProprietesWpf.TABLEAU_GET_COL_SAISIE_PRECEDENTE:		// Demande le numéro de la colonne précédente en saisie dans la ligne donnée
                        dataGrid = GetDataGrid(buffer,out page);
                        index = dataGrid.GetPreviousColumnIndex(buffer);
                        break;

                    case ProprietesWpf.TABLEAU_GET_COL_SAISIE_SUIVANTE:		// Demande le numéro de la colonne suivante en saisie dans la ligne donnée
                        dataGrid = GetDataGrid(buffer,out page);
                        index = dataGrid.GetNextColumnIndex(buffer);
                        break;
                    #endregion Fonctions Get du tableau

                    #region Input
                    case ProprietesWpf.XMEINPUT:
                        AsynchronousResponse = null; // garde-fou
                        buffer.GetString(out idPage);
                        window = StackOfWindows.Peek();
                        window.CurrentPage = window.GetPage(idPage);

                    //!!!!!!!!!!!!!!!!!!!!!!! idem pour consult etc....
            //						this.Html.Envois.Ajouter("pageCourante", Html.CalculerIdPage(window.CurrentPage.Id), window.CurrentPage.StopPoint.ToString(), page.NumPage.ToString());
                        this.Html.Envois.Ajouter("pageCourante", Html.CalculerIdPage(window.CurrentPage.Id), window.CurrentPage.StopPoint.ToString(), window.CurrentPage.NumPage.ToString());

                        ReadInput(buffer, window.CurrentPage);
            //						busyTimer.Stop();
            //						window.Cursor = null;
                        AttenteInput = true; // nécessairement à la fin pour que le HeightChanging potentiellement
                        // envoyé lors du UpdateLayout() contenu dans le readInput soit pris en compte et envoyé en différé
                        break;
                    #endregion Input

                    case ProprietesWpf.XMECONSULT:
                        buffer.GetString(out idPage);
                        Consult(idPage, null);
                        Html.Envois.Ajouter("xmeConsult", idPage);
                        break;

                    #region List Consult
                    case ProprietesWpf.XMELISTCONSULT:
                        {
                            uint idDataGrid;
                            buffer.GetString(out idPage);
                            buffer.Get(out idDataGrid);
                            Consult(idPage, null);
                            Html.Envois.Ajouter("xmeConsult", idPage);

                            string id = Html.CalculerIdDataGrid(idDataGrid, idPage);

                            //dataGrid = Consult(idPage, idDataGrid) as XHtmlDataGrid;
                            //dataGrid.SetIsActive(true); // nécessairement APRES le ManageValidDataGrids() dans le consult car ce dernier RAZ toutes les DataGrids affichées

                            // traitement des ronds dans l'entête de la colonne arbre le cas échéant
                            byte treeCount;
                            buffer.Get(out treeCount);
                            if (treeCount > 0)
                            {
                               byte treeCurrent;
                               buffer.Get(out treeCurrent);
                            //   XHtmlTreeColumn treeColumn = dataGrid.Columns.FirstOrDefault(col => ((IXHtmlDataGridColumn)col).ColumnType == ColumnType.Arbre) as XHtmlTreeColumn;
                            //   if (treeColumn != null) treeColumn.SetCircles(treeCount, treeCurrent);
                            }
                        }
                        break;
                    #endregion List Consult

                    case (ProprietesWpf)161 :
            //		ClientLegerProprietes.PROPCLIENTLEGER_AFFICHEERREUR:
                        AfficherErreurTransmise(buffer);
                        break;

                    case ProprietesWpf.FENETRE_ATTACHER_TOOLBARS_DEBUT:		// Bordel des toolbars
                        buffer.Get(out property);
                        while (property != ProprietesWpf.FENETRE_ATTACHER_TOOLBARS_FIN)
                        {
                            //switch (property)
                            {
                                //case ProprietesWpf.TOOLBAR_DEBUT:							// Création de toolbar

                                //   buffer.Get(out idToolBar);
                                //   toolBar = GetXwpfToolBar(idToolBar);

                                //   if (toolBar == null) listOfToolBars.Add(toolBar = new XwpfToolBar { Id = idToolBar });

                                //   toolBar.ReadProperties(buffer);
                                //   break;

                                //case ProprietesWpf.TOOLBAR_RECONSTRUCTION_DEBUT:							// Reconstruction de toolbar
                                //   buffer.Get(out idToolBar);
                                //   toolBar = GetXwpfToolBar(idToolBar);

                                //   if (toolBar == null) listOfToolBars.Add(toolBar = new XwpfToolBar { Id = idToolBar });

                                //   toolBar.ItemsList.Clear();
                                //   toolBar.ReadProperties(buffer);
                                //   foreach (XwpfWindow windowFromStack in StackOfWindows)
                                //   {
                                //      ToolBarTray toolBarTray = (toolBar.Primary) ? windowFromStack.PrimaryToolBarTray : windowFromStack.SecondaryToolBarTray;

                                //      ToolBar toolBarInList = toolBarTray.ToolBars.FirstOrDefault(tb => tb.DataContext == toolBar);
                                //      if (toolBarInList != null) toolBar.Display(windowFromStack, toolBarInList);
                                //   }
                                //   break;

                                //case ProprietesWpf.FENETRE_ATTACHER_TOOLBAR:				// Pour attacher une toolbar (identifiant menu: ushort)
                                //   buffer.Get(out idToolBar);
                                //   GetXwpfToolBar(idToolBar).Display(StackOfWindows.Peek());
                                //   break;

                                //case ProprietesWpf.FENETRE_DETTACHER_TOOLBAR:			// Pour supprimer une toolbar (identifiant menu: ushort)
                                //   buffer.Get(out idToolBar);
                                //   XwpfToolBar.Remove(idToolBar);
                                //   break;

                                //default:
                                //	throw new XwpfException(XwpfErrorCodes.UnknownProperty, XwpfErrorLocations.Application, property.ToString());
                            }
                            buffer.Get(out property);
                        }
                        break;

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

            var response = new DVBuffer();

            #region Réponse asynchrone
            //if (AsynchronousResponse != null && AttenteInput)	 // impossible d'avoir un double-clic en input
            //   AsynchronousResponse = null;
            //if (AsynchronousResponse != null && AttenteConsult)
            //{
            //   SetInputBuffer(AsynchronousResponse);
            //   Send(AsynchronousResponse); // response déjà replie dans le Handler mais pas encore envoyée pour synchronisation
            //   AsynchronousResponse = null;
            //   responseAlreadySent = true; // Pour bloquer le Send(response) vide dans Analyse()
            //   return;
            //}
            #endregion Réponse asynchrone

            #region Réponse asynchrone intertâche
            //if (interTaskResponses.Count > 0) // si réveil intertâche en attente
            //{
            //   if (AttenteInput) interTaskResponses.Clear(); // en input : r.à.z. de la liste des dialogues intertâches en attente
            //   else if (AttenteConsult || AttenteGetb)
            //   {
            //      SendInterTaskResponse();
            //      responseAlreadySent = true; // Pour bloquer le Send(response) vide dans Analyse()
            //      return;
            //   }
            //}
            #endregion Réponse asynchrone intertâche

            #region nb lignes tableau

            // positionne responseAlreadySend et c'est tout

            if (nbRows.HasValue)
            {
                //response.Put(ProprietesWpf.CLIENTLEGER_DEBUT);
                //response.Put(ProprietesWpf.TABLEAU_NOMBRE_LIGNES);
                //response.Put(nbRows.Value);
                //Send(response);
                responseAlreadySent = true;					// Pour bloquer le Emettre(response) vide dans Analyser()
                return;
            }
            #endregion nb lignes tableau

            #region index colonne tableau
            if (index.HasValue)
            {
                response.Put(ProprietesWpf.CLIENTLEGER_DEBUT);
                response.Put(ProprietesWpf.TABLEAU_COLONNE_SAISIE);
                response.Put(index.Value);
                Send(response);
                responseAlreadySent = true;							// Pour bloquer le Emettre(response) vide dans Analyser()
                return;
            }
            #endregion index colonne tableau

            #region bulle scrollbar horizontale tableau
            if (horizontalScrollbarTooltip != null)
            {
                response.Put(ProprietesWpf.CLIENTLEGER_DEBUT);
                response.Put(ProprietesWpf.TABLEAU_ASCHOR_BULLE);
                response.PutStringCP(horizontalScrollbarTooltip, codepageBulleAscHor);
                Send(response);
                responseAlreadySent = true;						// Pour bloquer le Emettre(response) vide dans Analyser()
                return;
            }
            #endregion bulle scrollbar horizontale tableau

            #region bulle scrollbar verticale tableau
            if (verticalScrollbarTooltip != null)
            {
                response.Put(ProprietesWpf.CLIENTLEGER_DEBUT);
                response.Put(ProprietesWpf.TABLEAU_ASCVER_BULLE);
                response.PutStringCP(verticalScrollbarTooltip, codepageBulleAscVer);
                Send(response);
                responseAlreadySent = true;						// Pour bloquer le Emettre(response) vide dans Analyser()
                return;
            }
            #endregion bulle scrollbar verticale tableau

            #region Retour Fonction YGraph (FA)
            //retour normal (ident ou retour par defaut)
            //if (yDrawingOperationRet.HasValue)
            //{
            //   response.Put(ProprietesWpf.CLIENTLEGER_DEBUT);
            //   response.Put(yDrawingIsCreation ? yDrawingOperationRet.Value : (int)yDrawingOperationRet.Value);					//	pas de propriétéWPF identifiant la valeur de retour (14/09/2011)
            //   Send(response);
            //   responseAlreadySent = true;					// Pour bloquer le Emettre(response) vide dans Analyser()
            //   return;
            //}
            ////retour de la taille ecran
            //if (yScreenSize.HasValue)
            //{
            //   response.Put(ProprietesWpf.CLIENTLEGER_DEBUT);
            //   response.Put((int)yScreenSize.Value.Width);					//	pas de propriétéWPF identifiant la valeur de retour (21/09/2011)
            //   response.Put((int)yScreenSize.Value.Height);

            //   Send(response);
            //   responseAlreadySent = true;					// Pour bloquer le Emettre(response) vide dans Analyser()
            //   return;
            //}
            #endregion //Retour Fonction YGraph (FA)

            #region Paramètres Initiaux Agenda
            //if (responseCalendarInit != null)
            //{
            //   Send(responseCalendarInit);
            //   responseAlreadySent = true;					// Pour bloquer le Emettre(response) vide dans Analyser()
            //}
            #endregion Paramètres Initiaux Agenda
        }
        /// <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)
        {
            if (buffer == null) throw new ArgumentNullException("buffer");

            ProprietesWpf property;

            buffer.Get(out property);
            while (property != ProprietesWpf.CHAMP_FIN)
            {
                switch (property)
                {
                    case ProprietesWpf.CELLULE_PRESENTATION_DEBUT:								// Début présentation
                        Presentation.ReadProperties(buffer);
                        SetStyle();
                        break;

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

                    case ProprietesWpf.CHAMP_VALEUR:													// Contenu du champ (string)
                        buffer.GetStringCP(out text, CodePage);
                //		if ((!Presentation.VisibilityFlag || Presentation.Visibilite != Visibilite.Illisible) && column.Presentation.Visibilite != Visibilite.Illisible)
                            Text = text;
                        rowText = text;
                        ValeurSpecifiee = true;
                        break;

                    case ProprietesWpf.CHAMP_VALEUR_SANS_FORMAT:									// donnée non-formatée (string)
                        buffer.GetString(out rowText);
                        ValeurSpecifiee = true;
                        break;

                    case ProprietesWpf.CHAMP_LONGUEUR_SAISIE:										// Longueur de saisie autorisée (ushort)
                        ushort maxLength;
                        buffer.Get(out maxLength);
                        MaxLength = maxLength;
                        break;

                    default:
                        throw new XHtmlException(XHtmlErrorCodes.UnknownProperty, XHtmlErrorLocations.DataGridTextBoxCell, property.ToString());
                }
                buffer.Get(out property);
            }
        }
        /// <summary>
        /// Reads the buffer for a page ID and a XwpfDataGrid Id and returns the corresponding XwpfDataGrid instance
        /// </summary>
        /// <param name="buffer">DVBuffer where the page and XwpfDataGrid IDs are read</param>
        /// <returns>instance of XwpfDataGrid matching the given page and XwpfDataGrid IDs</returns>
        private XHtmlDataGrid GetDataGrid(DVBuffer buffer, out XHtmlPage page)
        {
            XHtmlDataGrid retour,dataGrid;
            string idPage;
            uint idDataGrid;
            buffer.GetString(out idPage);			// Identifiant de la page (string)
            buffer.Get(out idDataGrid);			// Identifiant du tableau (uint)

            page = StackOfWindows.Peek().GetPage(idPage);

            retour = page.GetObject(idDataGrid) as XHtmlDataGrid;
            if (retour != null)
                return retour;

            // BH, si on ne le trouve pas, on le créée
            page = StackOfWindows.Peek().GetPage(idPage);

            dataGrid = new XHtmlDataGrid(page) { Id = idDataGrid };        // est ce que c'est le bon id ?
            page.Children.Add(dataGrid);
            page.ListOfObjects.Add(dataGrid);
            return dataGrid;
        }
        public string GetIdentDataGrid(DVBuffer buffer)
        {
            string idPage;
            uint idDataGrid;
            buffer.GetString(out idPage);			// Identifiant de la page (string)
            buffer.Get(out idDataGrid);			// Identifiant du tableau (uint)

            //			return idPage + "_" + idDataGrid.ToString() + "_" + StackOfWindows.Count.ToString();

            return Html.CalculerIdDataGrid(idDataGrid,idPage);

            //return StackOfWindows.Peek().GetPage(idPage).GetObject(idDataGrid) as XHtmlDataGrid;
        }
        /// <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.CASE_A_COCHER_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 seqPoint;
                        buffer.Get(out seqPoint);
                        SeqPoint = seqPoint;
                        break;

                    case ProprietesWpf.CASE_A_COCHER_CADRAGE_TEXTE:					// Position du texte par rapport à la case (byte)
                        byte cadrage;
                        buffer.Get(out cadrage);
                        TexteAGauche = cadrage == 1;
                        break;

                    case ProprietesWpf.OBJET_NOTIFIER_SI_MODIF:						// Envoyé si la notification est demandée ==> il faudra "réveiller" Ymeg si l'utilisateur clique sur la case
                        //Checked += ValueChangedHandler;		// traitement de la notification
                        //Unchecked += ValueChangedHandler;	// traitement de la notification
                        NotificationSiModif = true;
                        break;

                    case ProprietesWpf.CASE_A_COCHER_LIBELLE:							// Libellé de la case (string)
                        string content;
                        buffer.GetStringCP(out content, codePage);
                        Libelle = content;
                        break;

                    case ProprietesWpf.OBJET_EN_AFFICHAGE:								// (Uniquement si la case est en affichage seulement)
                        IsReadOnly = true;
                        break;

                    case ProprietesWpf.CASE_A_COCHER_ETAT:								// Etat de la case (byte : 0=non cochée ; 1=cochée)
                        ushort etat;
                        buffer.Get(out etat);
                        IsChecked = (etat == 1);
                        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;

                    default:
                        throw new XHtmlException(XHtmlErrorCodes.UnknownProperty, XHtmlErrorLocations.CheckBox, property.ToString());
                }
                buffer.Get(out property);
            }
        }
        /// <summary>
        /// Affichage de la boite des erreurs standard A finaliser
        /// </summary>
        private void AfficherErreurTransmise(DVBuffer rec)
        {
            bool fatale;
            ushort code;
            ushort codesys;
            ushort codecompljour;
            ushort lieujour;
            uint adresse;
            string details;
            string prog;
            string module;
            string texte;
            string titre;
            StructLangueEtCode langue = new StructLangueEtCode();
            string date, heure;

            rec.Get(out fatale);
            rec.GetString(out date);
            rec.GetString(out heure);
            rec.GetString(out texte);
            rec.Get(out lieujour);
            rec.Get(out codecompljour);
            rec.Get(out code);
            rec.Get(out codesys);
            rec.Get(out adresse);
            rec.GetString(out prog);
            rec.GetString(out module);
            rec.GetString(out titre);
            rec.GetString(out details);

            if (module == prog)
                module = "---";

            //			this.DelegueAfficherErreur(fatale, titre, texte, code, codesys, codecompljour, lieujour, adresse, prog, module, date + " " + heure, details);
        }
Example #10
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.CHAMP_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.PARAM_SAISIE_SEQUENCE:							// Point de séquence (ushort)
                        ushort pointSequence;
                        buffer.Get(out pointSequence);
                        SeqPoint = pointSequence;
                        break;

                    case ProprietesWpf.PARAM_SAISIE_TABLE_ASSOCIEE:					// (Uniquement si le champ peut appeler un zoom)
                        IsZoomCaller = true;
                        break;

                    case ProprietesWpf.PARAM_SAISIE_TABLE_ASSOCIEE_EXT:			// (Uniquement si le champ peut appeler un zoom)
                        byte isZoomCaller;
                        buffer.Get(out isZoomCaller);
                        IsZoomCaller = (isZoomCaller != 0);
                        break;

                    case ProprietesWpf.OBJET_EN_AFFICHAGE:								// (Uniquement si le champ est en affichage seulement)
                        IsReadOnly = true;
                        break;

                    case ProprietesWpf.CHAMP_OBLIGATOIRE:								// (Uniquement si le champ est obligatoire)
                        byte isMandatory;
                        buffer.Get(out isMandatory);
                        IsMandatory = (isMandatory != 0);
                        break;

                    case ProprietesWpf.CHAMP_NUMERIQUE:									// (Uniquement si le champ n'accepte que des valeurs numériques)
                        isNumerical = true;
            //						PreviewTextInput += (s, e) => { e.Handled = !IsValidNumericChar(e.Text); }; // Limitations aux caractères numériques + opérateurs pour la saisie
                        break;

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

                    case ProprietesWpf.CHAMP_VALEUR:										// Contenu du champ (string)
                        string wt;
                        buffer.GetStringCP(out wt, CodePage);
                        Text = wt;
                        break;

                    case ProprietesWpf.CHAMP_LONGUEUR_SAISIE:							// Longueur de saisie autorisée (ushort)
                        ushort maxLength;
                        buffer.Get(out maxLength);
                        MaxLengthProperty = (int)maxLength;
            //					SetCurrentValue(MaxLengthProperty, (int)maxLength);
                        break;

                    case ProprietesWpf.TEXTE_ANGLE:										// Angle au sens trigo en ° (ushort)
                        buffer.Get(out angle);

                        // HACK inversion des hauteurs et largeur si angle multiple de 90
                        if ((angle + 90) % 180 == 0)
                        {
                            Presentation.Left += (Width - Height) / 2;
                            Presentation.Top -= (Width - Height) / 2;

                            var horizontalPaddingTemp = Presentation.HorizontalPadding;
                            Presentation.HorizontalPadding = Presentation.VerticalPadding;
                            Presentation.VerticalPadding = horizontalPaddingTemp;

                            var widthTemp = Presentation.OriginalWidth;
                            Presentation.OriginalWidth = Presentation.OriginalHeight;
                            Presentation.OriginalHeight = widthTemp;
                            Presentation.SetProperties();
                        }

            //						RenderTransform = new RotateTransform(-angle, Width / 2, Height / 2);
                        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;

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

                buffer.Get(out property);
            }

            // numérique aligné à droite en affichage
            if (isNumerical && Presentation != null && Presentation.Cadrage == Cadrage.Defaut)
                TextAlignment = TextAlignment.Right;

            // gestion de l'illisibilité
            //if (textHasValue && Presentation != null && Presentation.Visibilite == Visibilites.Illisible)
            //	Text = "xxxxxxxxxxxxxx";
        }
Example #11
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.MULTICHOIX_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.PARAM_SAISIE_SEQUENCE:							// Point de séquence (ushort)
                        ushort pointSequence;
                        buffer.Get(out pointSequence);
                        SeqPoint = pointSequence;
                        break;

                    case ProprietesWpf.PARAM_SAISIE_TABLE_ASSOCIEE:					// (Uniquement si le multichoix peut appeler un zoom)
                        IsZoomCaller = true;
                        break;

                    case ProprietesWpf.PARAM_SAISIE_TABLE_ASSOCIEE_EXT:			// (Uniquement si le multichoix peut appeler un zoom)
                        byte isZoomCaller;
                        buffer.Get(out isZoomCaller);
                        IsZoomCaller = (isZoomCaller != 0);
                        break;

                    case ProprietesWpf.OBJET_NOTIFIER_SI_MODIF:						// Envoyé si la notification est demandée ==> il faudra "réveiller" Ymeg si l'utilisateur change de choix actif
                        this.Notification = true;
                        break;

                    case ProprietesWpf.OBJET_EN_AFFICHAGE:								// (Uniquement si le champ est en affichage seulement)
                        IsReadOnly = true;
                        break;

                    case ProprietesWpf.MULTICHOIX_BITMAP:								// Uniquement si c'est un multichoix bitmap
                        imageComboBox = true;
                        HorizontalContentAlignment = HorizontalAlignment.Center;
                        break;

                    case ProprietesWpf.MULTICHOIX_LIBELLES:							// Liste des libellés
                        ignoreValueChanged = true; // pour ne pas notifier lors du réaffichage de la liste en Input
                        int codepageChoix;
                        buffer.Get(out codepageChoix);
                        ushort nbItems;
                        buffer.Get(out nbItems);
                        int valueSaved = SelectedIndex;

                        //construction de la liste d'items :
                        Items.Clear(); // Garde-fou

                        for (int i = 0; i < nbItems; i++)
                        {
                            var item = new UnItemMultiChoix();
                            if (imageComboBox)
                            {
                                buffer.Get(out property); // MULTICHOIX_IMAGE
                                var imageFile = new XHtmlImageFile();
                                imageFile.ReadProperties(buffer);
                                item.Libelle = imageFile.FileName;
                            //!!!!!!!!!!!	item.Content = new Image { Source = XHtmlImage.GetImage(imageFile), Stretch = Stretch.None };
                            }
                            else
                            {
                                string itemContent;
                                buffer.GetStringCP(out itemContent, codepageChoix);
                                item.Libelle = itemContent;
                            }
                            Items.Add(item);
                        }
                        SelectedIndex = valueSaved;
                        ignoreValueChanged = false;
                        break;

                    case ProprietesWpf.MULTICHOIX_VALEUR:								// Valeur sélectionnée (ushort)
                        ushort valeur;
                        buffer.Get(out valeur);
                        ignoreValueChanged = true;											// on ne notifie pas le chagement de valeur
                        PositionRecue = valeur - 1;
                        //SetValue(SelectedIndexProperty, valeur - 1);
                        ignoreValueChanged = false;
                        break;

                    case ProprietesWpf.MULTICHOIX_OUVERTURE_AUTO:					// Si la comboBox doit s'ouvrir lors du passage en Input
                        autoOpen = true;
                        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;

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

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

            buffer.Get(out property);
            while (property != ProprietesWpf.IMAGE_FICHIER_FIN)
            {
                switch (property)
                {
                    case ProprietesWpf.IMAGE_FICHIER_TYPE:								// Type d’image (byte)
                        byte type;
                        buffer.Get(out type);
                        Type = type;
                        break;

                    case ProprietesWpf.IMAGE_FICHIER_NOM:								// Nom du fichier image (string)
                        string fileName;
                        buffer.GetString(out fileName);
                        FileName = fileName;
                        break;

                    case ProprietesWpf.IMAGE_FICHIER_INDICE:							// Indice d’icône (int)
                        int iconIndex;
                        buffer.Get(out iconIndex);
                        IconIndex = iconIndex;
                        break;

                    case ProprietesWpf.IMAGE_FICHIER_SMALL_ICON:						// petite icône (byte = 0 ou 1)
                        byte iconSize;
                        buffer.Get(out iconSize);
                        IsSmallIcon = (iconSize == 1);
                        break;

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

                buffer.Get(out property);
            }
        }
        internal void ReadProperties(DVBuffer buffer)
        {
            ProprietesWpf property;

            buffer.Get(out property);
            while (property != ProprietesWpf.POLICE_CREATION_FIN)
            {
                switch (property)
                {
                    case ProprietesWpf.POLICE_COULEUR:			// Couleur de la police : Rouge (byte); Vert (byte); Bleu (byte)
                        byte r, g, b;
                        buffer.Get(out r);
                        buffer.Get(out g);
                        buffer.Get(out b);
                        R = r;
                        G = g;
                        B = b;
                        Vide = false;
                        // Brush = new SolidColorBrush(Color.FromArgb(255, r, g, b));
                        // Brush.Freeze();
                        break;

                    case ProprietesWpf.POLICE_FONTE:				// Nom de la police (string)
                        string name;
                        buffer.GetString(out name);
                        Family = name; // !!!!!!!!!!new FontFamily(name);
                        HasFamily = true;
                        Vide = false;
                        break;

                    case ProprietesWpf.POLICE_TAILLE:			// Taille de la police (ushort)
                        ushort size;
                        buffer.Get(out size);
                        Size = size;
                        Vide = false;
                        break;

                    case ProprietesWpf.POLICE_GRAS:				// (Uniquement si gras modifiée)
                        byte bold;
                        buffer.Get(out bold);
                        Bold = bold;
                        Vide = false;
                        // Weight = (bold == 1) ? FontWeights.Bold : SystemFonts.MessageFontWeight;
                        break;

                    case ProprietesWpf.POLICE_ITALIQUE:			// (Uniquement si italique modifié)
                        byte italic;
                        buffer.Get(out italic);
                    //	Style = (italic == 1) ? FontStyles.Italic : SystemFonts.MessageFontStyle;
                        Italic = italic;
                        Vide = false;
                        break;

                    case ProprietesWpf.POLICE_SOULIGNE:			// (Uniquement si souligné modifié)
                        byte underline;
                        buffer.Get(out underline);
                        //if (Decorations == null) Decorations = new TextDecorationCollection();
                        //if (underline == 1) Decorations.Add(TextDecorations.Underline);
                        Underline = underline;
                        Vide = false;
                        break;

                    case ProprietesWpf.POLICE_BARRE:				// (Uniquement si barré modifié)
                        byte strikethrough;
                        buffer.Get(out strikethrough);
                        Strikethrough = strikethrough;
                        Vide = false;
            //						if (Decorations == null) Decorations = new TextDecorationCollection();
            //					if (strikethrough == 1) Decorations.Add(TextDecorations.Strikethrough);
                        break;

                    default:
                        throw new XHtmlException(XHtmlErrorCodes.UnknownProperty, XHtmlErrorLocations.Font, property.ToString());
                }
                buffer.Get(out property);
            }
        }
Example #14
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);
            }
        }