Example #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.IMAGE_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.IMAGE_IMAGE_DEBUT:
                        XHtmlImageFile imageFile = new XHtmlImageFile();
                        imageFile.ReadProperties(buffer);
                        //Source = GetImage(imageFile);
                        break;

                    case ProprietesWpf.IMAGE_TRAITEMENT:								//type de traitement (byte)
                        byte stretchCode;
                        buffer.Get(out stretchCode);
                        stretchMode = (StretchMode)stretchCode;
                        SetStretch();
                        break;
                }

                buffer.Get(out property);
            }
        }
Example #2
0
        /// <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.FENETRE_FIN)
            {
                switch (property)
                {
                    case ProprietesWpf.FENETRE_POSITION:					// position de la fenêtre (x: ushort, y: ushort)
                        // Window lastWindow = ((App)Application.Current).Appli.StackOfWindows.Peek();
                        ushort left, top;
                        buffer.Get(out left);
                        buffer.Get(out top);
                        Left = left; //  + lastWindow.Left;
                        Top = top; //  + lastWindow.Top;
                        break;

                    case ProprietesWpf.FENETRE_TAILLE:						// taille de la fenêtre (x: ushort, y: ushort)
                        SetMinContentSize(buffer);
                        break;

                    case ProprietesWpf.FENETRE_STYLE:						// style de fenêtre (byte) : 1 = taille variable; 2 = taille fixe
                        byte resizeMode;
                        buffer.Get(out resizeMode);
                        ModeResize = (resizeMode == 2) ? ResizeMode.NoResize : ResizeMode.CanResize;
                        break;

                    case ProprietesWpf.FENETRE_COULEUR_FOND:				// identifiant de couleur (ushort)
                        ushort id;
                        buffer.Get(out id);
                        CouleurFond = id; // Application.Current.Resources["Brush-" + id] as SolidColorBrush;
                        break;

                    case ProprietesWpf.FENETRE_TITRE:						// titre de la fenêtre (string) - peut être vide
                        string title;
                        int codePage;
                        buffer.Get(out codePage);
                        buffer.GetStringCP(out title, codePage);
                        Title = title;
                        break;

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

                    default:
                        throw new XHtmlException(XHtmlErrorCodes.UnknownProperty, XHtmlErrorLocations.Window, 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>
        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 != Visibilites.Illisible) && column.Presentation.Visibilite != Visibilites.Illisible)
                            Text = text;
                        rowText = text;
                        break;

                    case ProprietesWpf.CHAMP_VALEUR_SANS_FORMAT:									// donnée non-formatée (string)
                        buffer.GetString(out rowText);
                        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);
            }
        }
Example #4
0
        public static unsafe byte[] AjouterEnteteAuDVBuffer(DVBuffer buf)
        {
            EnteteTrame entete = new EnteteTrame();
            entete.Longueur = (uint)buf.NbEcrits;

            byte[] tout = new byte[entete.Longueur + Marshal.SizeOf(typeof(EnteteTrame))];

            fixed (uint* depart = &entete.MagicNumber)
            {
                fixed (byte* arrivee = &tout[0])
                {
                    fixed (byte* adressebuf = &buf.LeBuffer[0])
                    {
                        HWConversion.Copier(arrivee, (byte*)depart, Marshal.SizeOf(typeof(EnteteTrame)));
                        HWConversion.Copier(arrivee + Marshal.SizeOf(typeof(EnteteTrame)),
                                        (byte*)adressebuf, buf.NbEcrits);
                    }
                }
            }
            return tout;
        }
        /// <summary>
        /// Création d'un Padding
        /// </summary>
        internal static void Create(DVBuffer buffer,HtmlGlobal html)
        {
            XHtmlPadding padd = new XHtmlPadding();
            html.App.PaddingCss.Add(padd);

            buffer.Get(out padd.Id);

            ProprietesWpf property;
            buffer.Get(out property);
            while (property != ProprietesWpf.PADDING_CREATION_FIN)
            {
                switch (property)
                {
                    case ProprietesWpf.PADDING_VERTICAL:		// Epaisseur de la bordure (byte)
                        byte verticalPadding;
                        buffer.Get(out verticalPadding);
                        padd.Vertical = verticalPadding;
                        padd.Vide = false;
                        //XHtmlApplication.Resources.Add("VerticalPadding-" + id, (double?)verticalPadding);
                        break;

                    case ProprietesWpf.PADDING_HORIZONTAL:		// Epaisseur de la bordure (byte)
                        byte horizontalPadding;
                        buffer.Get(out horizontalPadding);
                        padd.Horizontal = horizontalPadding;
                        padd.Vide = false;
                        //XHtmlApplication.Resources.Add("HorizontalPadding-" + id, (double?)horizontalPadding);
                        break;

                    default:
                        throw new XHtmlException(XHtmlErrorCodes.UnknownProperty, XHtmlErrorLocations.Padding, property.ToString());
                }
                buffer.Get(out property);
            }
            padd.Css = padd.GenererCss();
        }
        /// <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();
            */
        }
Example #7
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
		}
Example #8
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.TEXTE_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.TEXTE_LIBELLE:							// Contenu du Label (string avec code page)
                        {
                            string t;
                            buffer.GetStringCP(out t, codePage);
                            text = t;
                            Content = text;
                        }
                        break;

                    case ProprietesWpf.TEXTE_ANGLE:								// Angle au sens trigo en ° (ushort)
                        ushort ang;

                        buffer.Get(out  ang); this.Presentation.angle = ang;

                        // HACK inversion des hauteurs et largeur si angle multiple de 90
                        if ((Presentation.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;

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

                buffer.Get(out property);
            }

            // gestion de l'illisibilité
            Content = (Presentation.Visibilite == Visibilites.Illisible) ? XHtmlApplication.Resources["UnreadableString"] as string : text;
        }
        internal void Analyse(DVBuffer buffer)
        {
            try { GetProperties(buffer); }
            catch (XHtmlException e) {
                SendError(e.ErrorCode, e.ErrorLocation, e.ErrorParameter); }

            //!!!!!!!!!!!!!!!!!!!! revoir tous ce cas
            if (AttenteInput) return ;								// input : attente opérateur (sauf notif immédiate)
            if (AttenteConsult) return ;							// consult : attente opérateur
            if (AttentePopupMenu) return;							// popup menu : attente opérateur
            if (AttenteGetb) return;								// get bloquant : attente opérateur
            if (responseAlreadySent) return;						// double clic / nb lignes tableau / index colonne / bulle scrollbar tableau envoyé

            //autres cas (display, ...)

            var response = new DVBuffer();
            response.Put(ProprietesWpf.CLIENTLEGER_DEBUT);

            Send(response);											// acquittement (réponse "vide")
            return;
        }
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.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);
            }
        }
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.GROUPBOX_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.GROUPBOX_FOND_GROUPE:								// fond du groupe
                        ushort id;
                        buffer.Get(out id);
                        idFondGroupe = id;
                        break;

                    case ProprietesWpf.GROUPBOX_LIBELLE:									// libellé du titre (string)
                        string header;
                        buffer.GetStringCP(out header, codePage);
                        LibelleGroupe = header;
                        break;

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

                buffer.Get(out property);
            }
        }
Example #12
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";
        }
        /// <summary>
        /// Reads the object's properties from the buffer
        /// </summary>
        /// <param name="buffer">DVBuffer where the properties are read</param>
        internal void ReadProperties(DVBuffer buffer)
        {
            ProprietesWpf property;

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

            OnALuQuelqueChose = true;

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

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

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

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

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

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

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

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

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

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

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

                    default:
                        throw new XHtmlException(XHtmlErrorCodes.UnknownProperty, XHtmlErrorLocations.DataGridPresentationCell, property.ToString());
                }
                buffer.Get(out property);
            }
        }
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.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);
            }
        }
Example #15
0
        /// <summary>
        /// Reads the object's properties from the buffer
        /// </summary>
        /// <param name="buffer">DVBuffer where the properties are read</param>
        public void ReadProperties(DVBuffer buffer)
        {
            ProprietesWpf property;

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

                    default:
                        throw new XHtmlException(XHtmlErrorCodes.UnknownProperty, XHtmlErrorLocations.Presentation, property.ToString());
                }
                buffer.Get(out property);
            }
        }
        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;
        }
        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
        }
        // private readonly FlashModeHelper flashModeHelper = FlashModeHelper.GetInstance();
        internal void Send(DVBuffer response)
        {
            return; //!!!!!!!!!!!!!!!
            /*
            App appp = (App)Application.Current;
            var app = (App)Application.Current;

            // TODO mettre dans les logs harmony ? Ce message est intéressant car il signale une anomalie qui va mettre le bazar
            if (app.AttenteReponseEnCours)
            {
                // !!!!!!!!!! MessageBox.Show("Attention : Désynchronisation entre Xwpf et Xrtdiva");
                return;
            }

            app.AttenteReponseEnCours = true;
            AttenteConsult = false;
            AttenteInput = false;
            AttentePopupMenu = false;
            AttenteGetb = false;
            */
            //!!!!!!!!!!!			if (consultTimer != null) consultTimer.Stop();	// arrêt du timer le cas échéant
            //!!!!!!!!!!!			if (!busyTimer.IsEnabled) busyTimer.Start();		// lancement du timer pour le curseur d'attente le cas échéant.

            //!!!!!!!!!!!			XwpfWindow window = StackOfWindows.Peek();	//abandonner le focus si input en cours
            //!!!!!!!!!!!			Keyboard.Focus(window.MainCanvas);

            //!!!!!!!!!!			window.ActiveControl = null; // garde-fou: on r.à.z le contrôle actif lorsque l'appli à la main (et donc hors input).

            /* !!!!!!!!!!!!!!!!
            if (SendWindowhandler)
            {
                IntPtr hwnd = app.GetTopWindow();
                if (hwnd != (IntPtr)0)
                {
                    SendWindowhandler = false;
                    response.Put((ushort)ClientLegerProprietes.PROPCLIENTLEGER_HFENETRE);
                    response.Put((int)hwnd);
                    app.Client.FenetreMere = hwnd;
                    app.Client.Tunnel.EcrireHandlerFenetreClient(app.Client.SessionProgrammeCourant, hwnd, app.Client.IdentifiantServeur);
                }
            }
            */

            //si le menu pour l'impression d'écran a été (dé)coché, on envoie la nouvelle valeur:
            if (IsPrintPreviewUpdated)
            {
                IsPrintPreviewUpdated = false;

                response.Put(ProprietesWpf.MENU_SYSTEME_APERCU_ETAT);
                response.Put((byte)(IsPrintPreviewEnabled ? 1 : 0));	// Flag "aperçu avant impression actif ?" (byte)
                response.Put((byte)(IsPrintPreviewSaved ? 2 : 0));		// Flag "sauver aperçu avant impression ?" (byte)
            }

            response.Put(ProprietesWpf.CLIENTLEGER_FIN);

            //!!!!!!!!!!!!!!			app.Client.Transport.BufferEmission = response;
            //!!!!!!!!!!!!!!			app.Client.Transport.EnvoyerEtDemanderReveil();
        }
        /// <summary>
        /// Reads the buffer to give the input to the proper object
        /// </summary>
        /// <param name="buffer">DVBuffer where the properties are read</param>
        /// <param name="page">Page containing the object getting the input</param>
        internal void ReadInput(DVBuffer buffer, XHtmlPage page)
        {
            IXHtmlEditableObject obj;

            uint id;	// variable de stockage temporaire des identifiants d'objets

            //page.UpdateLayout();

            ProprietesWpf property;
            buffer.Get(out property);
            switch (property)
            {
                #region Bouton
                case ProprietesWpf.BOUTON_DEBUT:						// Bouton (Xwin :  objet bouton)!!!!!!!!!!!!!!!!!!!!!!!!!
                    buffer.Get(out id);
                    var button = (XHtmlButton)page.GetObject(id);

                    if (button == null)
                    {
                        button = new XHtmlButton(page) { Id = id };
                        page.Children.Add(button);
                        page.ListOfObjects.Add(button);
                    }

                    button.ReadProperties(buffer);
                    page.Window.ActiveControl = button;
            //					button.IsEnabled = true;	// impératif pour être sûr que le bouton aura bien le focus (pas évident à cause de la gestion des boutons valides non faite côté serveur)
            //					button.Focusable = true;	// garde-fou. Le Focusable est repassé à false lors du lostFocus() (pour éviter qu'un bouton ne prenne le focus sans qu'on ne l'y autorise)
            //					button.Focus();
                    button.AjouterEnvoisUnObjet(this.Html.Envois, page, StackOfWindows.Count());
                    Html.Envois.Ajouter("xmeInput", page.Id.ToString(), HtmlGlobal.CalculerId(button.Id, page.Id, StackOfWindows.Count()));

                    obj = button;
                    break;
                #endregion Bouton

                #region Case à cocher
                case ProprietesWpf.CASE_A_COCHER_DEBUT:			// CheckBox (Xwin : objet case à cocher)
                    buffer.Get(out id);
                    var checkBox = (XHtmlCheckBox)page.GetObject(id);

                    if (checkBox == null)
                    {
                        checkBox = new XHtmlCheckBox(page) { Id = id };
                        page.Children.Add(checkBox);
                        page.ListOfObjects.Add(checkBox);
                    }

                    checkBox.ReadProperties(buffer);
                    page.Window.ActiveControl = checkBox;
                    checkBox.AjouterEnvoisUnObjet(this.Html.Envois, page, StackOfWindows.Count());
                    Html.Envois.Ajouter("xmeInput", page.Id.ToString(), HtmlGlobal.CalculerId(checkBox.Id, page.Id, StackOfWindows.Count()));
            //					checkBox.Focus();
                    obj = checkBox;
                    break;
                #endregion Case à cocher

                #region Champ
                case ProprietesWpf.CHAMP_DEBUT:						// TextBox (Xwin : objet champ)
                    buffer.Get(out id);
                    var textBox = (XHtmlTextBox)page.GetObject(id);

                    if (textBox == null)
                    {
                        textBox = new XHtmlTextBox(page) { Id = id };
                        page.Children.Add(textBox);
                        page.ListOfObjects.Add(textBox);
                    }
                    textBox.ReadProperties(buffer);
                    page.Window.ActiveControl = textBox;
                    textBox.AjouterEnvoisUnObjet(this.Html.Envois, page, StackOfWindows.Count());
                    Html.Envois.Ajouter("xmeInput", page.Id.ToString(), HtmlGlobal.CalculerId(textBox.Id, page.Id, StackOfWindows.Count()));
            //					textBox.EnFocus();
                    obj = textBox;
                    break;
                #endregion Champ

                #region MultiChoix
                case ProprietesWpf.MULTICHOIX_DEBUT:				// ComboBox (Xwin : objet multichoix)
                    buffer.Get(out id);
                    var comboBox = (XHtmlComboBox)page.GetObject(id);
                    if (comboBox == null)
                    {
                        comboBox = new XHtmlComboBox(page) { Id = id };
                        page.Children.Add(comboBox);
                        page.ListOfObjects.Add(comboBox);
                    }

                    comboBox.ReadProperties(buffer);
                    page.Window.ActiveControl = comboBox;
                    comboBox.AjouterEnvoisUnObjet(this.Html.Envois, page, StackOfWindows.Count());
                    Html.Envois.Ajouter("xmeInput", page.Id.ToString(), HtmlGlobal.CalculerId(comboBox.Id, page.Id, StackOfWindows.Count()));
            //					comboBox.Focus();
                    obj = comboBox;
                    break;
                #endregion MultiChoix

                //#region Champ Caché	!!!!!!!!!!!!!!!!!!!!!!
                //case ProprietesWpf.CHAMP_CACHE_DEBUT:				// PasswordBox (Xwin : objet champ caché)
                //   buffer.Get(out id);
                //   var passwordBox = (XHtmlPasswordBox)page.GetObject(id);
                //   passwordBox.ReadProperties(buffer);
                //   page.Window.ActiveControl = passwordBox.PasswordBox;
                //   passwordBox.Focus();
                //   obj = passwordBox;
                //   break;
                //#endregion Champ Caché

                //#region Champ Date
                //case ProprietesWpf.CHAMP_DATE_DEBUT:						// TextBox (Xwin : objet champ)
                //   buffer.Get(out id);
                //   var datePicker = (XHtmlDatePicker)page.GetObject(id);
                //   datePicker.ReadProperties(buffer);
                //   page.Window.ActiveControl = datePicker;
                //   datePicker.Focus();
                //   obj = datePicker;
                //   break;
                //#endregion Champ Date

                //#region MultiChoix
                //case ProprietesWpf.MULTICHOIX_DEBUT:				// ComboBox (Xwin : objet multichoix)
                //   buffer.Get(out id);
                //   var comboBox = (XHtmlComboBox)page.GetObject(id);
                //   comboBox.ReadProperties(buffer);
                //   page.Window.ActiveControl = comboBox;
                //   comboBox.Focus();
                //   obj = comboBox;
                //   break;
                //#endregion MultiChoix

                //#region Liste
                //case ProprietesWpf.LISTECHOIX_DEBUT:				// ListBox (Xwin : objet multichoix ouvert)
                //   buffer.Get(out id);
                //   var listBox = (XHtmlListBox)page.GetObject(id);
                //   listBox.ReadProperties(buffer);
                //   page.Window.ActiveControl = listBox;
                //   listBox.Focus();
                //   obj = listBox;
                //   break;
                //#endregion Liste

                //#region Groupe Radio
                //case ProprietesWpf.GROUPE_RADIO_DEBUT:				// Radiobutton (Xwin : objet groupe radio)
                //   buffer.Get(out id);
                //   var radioGroup = (XHtmlRadioGroup)page.GetObject(id);
                //   radioGroup.ReadProperties(buffer);
                //   page.Window.ActiveControl = radioGroup;
                //   radioGroup.Focus();
                //   obj = radioGroup;
                //   break;
                //#endregion Groupe Radio

                //#region RichText
                //case ProprietesWpf.RICHTEXT_DEBUT:					// RichTextBox (Xwin : objet texte riche)
                //   buffer.Get(out id);
                //   var richText = (XHtmlRichTextBox)page.GetObject(id);
                //   richText.ReadProperties(buffer);
                //   richText.Input();
                //   page.Window.ActiveControl = richText;
                //   richText.Focus();
                //   obj = richText;
                //   break;
                //#endregion RichText

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

            //!!!!!!!!!!!!!!!!!!!!!!!!!!!!!  a faire !!!!!!!!!!!!!!!!!
            //StackOfWindows.Peek().UpdateLayout();			// force un recalcul des hauteurs/largeur pour être sûr que les valeurs dans le SetActiveGroup sont à jour
            //XHtmlTreeColumn.ResetCircles(StackOfWindows.Peek());
            //XHtmlGroupBox.SetActiveGroup((Control)obj);
            //ManageValidButtons(obj);
            //ManageValidMenuItems(obj);
            //ManageValidToolBarItems(obj);
            //ManageValidDataGrids(page.Id);
        }
        internal void SendError(XHtmlErrorCodes errorCode, XHtmlErrorLocations errorLocation, string errorParameter)
        {
            var errorBuffer = new DVBuffer();
            errorBuffer.Put(ProprietesWpf.CLIENTLEGER_DEBUT);
            errorBuffer.Put(ProprietesWpf.ERREUR_XWPF);
            errorBuffer.Put((ushort)errorCode);
            errorBuffer.Put((ushort)errorLocation);
            errorBuffer.PutString(errorParameter);
            errorBuffer.PutString("ApplicationVersion");  //!!!!!!!!!!!!!!!!!!!!!!!!!

            // Send(errorBuffer); Il faut d'abord rendre la main au navigateur qui va immédiatement revenir pour emettre ce dvbuffer
            responseAlreadySent = true;

            // je garde le DVBuffer, j'en fait une copie en profondeur
            DVBufferATransmettreImmediatement = new DVBuffer(errorBuffer.LeBuffer, 0, errorBuffer.GetTaille());
        }
Example #21
0
 /// <summary>
 /// Sets the size of the window
 /// </summary>
 /// <param name="buffer">Buffer where the properties are read</param>
 internal void SetMinContentSize(DVBuffer buffer)
 {
     buffer.Get(out minContentWidth);
     buffer.Get(out minContentHeight);
     //MainCanvas.MinWidth = minContentWidth;
     //MainCanvas.MinHeight = minContentHeight;
 }
        /// <summary>
        /// Fills the DVBuffer with the value of the given control
        /// </summary>
        /// <param name="response">Buffer containing the prepared response to the Diva program</param>
        /// <param name="typeNode"> DANS default.aspx, voir la fonction envoyerClic</param>
        internal void SetInputBuffer(DVBuffer response,string typeNode,string typeObjet,string valeurObjet,int cp)
        {
            FrameworkElement activeControl = StackOfWindows.Peek().ActiveControl;	//
            int codePage = 0;

            if (response == null) throw new ArgumentNullException("response");
            //if (activeControl == null) return; // on ne fait rien si pas de controle actif

            ProprietesWpf property = new ProprietesWpf();
            string valueString = null;
            ushort? valueUshort = null;

            //if (!AttenteInput) return; // garde-fou : on ne fait rien si l'on n'est pas en attenteInput (ne devrait pas arriver)

            if (typeNode == "BUTTON")	//!!!!!!!!!!!!!!!!tester!!!!!!!!!
                return;		// on n'envoie rien pour le bouton

            //// type d'objet + codepage + valeur
            //if (activeControl is TextBox) !!!!!!!!!!!!!!!!!!!!
            //{
            //   property = ProprietesWpf.CHAMP_VALEUR;
            //   valueString = ((XHtmlTextBox)activeControl).Text;
            //   codePage = ((XHtmlTextBox)activeControl).CodePage;		// !!!!!!!!!!!!!! stocker le codePage dans l'html
            //}

            if (typeNode == "INPUT" && typeObjet == "TEXT")
            {
                property = ProprietesWpf.CHAMP_VALEUR;
                valueString = valeurObjet;
                codePage = cp;
            }

            else if (typeNode == "INPUT" && typeObjet == "SELECT") // (activeControl is ComboBox)
            {
               property = ProprietesWpf.MULTICHOIX_VALEUR;
                valueUshort = (ushort)Convert.ToInt16(valeurObjet);
            }

            else if (typeNode == "DIV" && typeObjet == "CHECKBOX")
            {
               property = ProprietesWpf.CASE_A_COCHER_ETAT;
                valueUshort = (ushort)Convert.ToInt16(valeurObjet);
                    //(((XHtmlCheckBox)activeControl).IsChecked == true) ? (ushort)1 : (ushort)0;
            }

            // DANS default.aspx, voir la fonction envoyerClic

            //else if (activeControl is PasswordBox)
            //{
            //   property = ProprietesWpf.CHAMP_VALEUR;
            //   valueString = ((PasswordBox)activeControl).Password;
            //   codePage = ((XHtmlPasswordBox)(activeControl.DataContext)).CodePage;
            //}

            //else if (activeControl is DatePicker)
            //{
            //   property = ProprietesWpf.CHAMP_VALEUR;
            //   valueString = ((XHtmlDatePicker)activeControl).DisplayText;
            //   codePage = ((XHtmlDatePicker)activeControl).CodePage;
            //}

            //else if (activeControl is ListBox)
            //{
            //   property = ProprietesWpf.MULTICHOIX_VALEUR;
            //   valueUshort = (ushort)(((XHtmlListBox)activeControl).SelectedIndex + 1);
            //}

            //else if (activeControl is GroupBox)
            //{
            //   property = ProprietesWpf.GROUPE_RADIO_BOUTON_ACTIF;
            //   valueUshort = (ushort)(((XHtmlRadioGroup)activeControl).CurrentIndex + 1);
            //}

            //else if (activeControl is RichTextBox)
            //{
            //   property = ProprietesWpf.RICHTEXT_TEXTE;
            //   valueString = ((XHtmlRichTextBox)activeControl).GetValue();
            //}

            //else if (activeControl is DataGrid)
            //{
            //   XHtmlDataGrid dataGrid = (XHtmlDataGrid)activeControl;
            //   int currentRowIndex = dataGrid.Rows.IndexOf((XHtmlRow)dataGrid.CurrentItem);
            //   int currentColIndex = dataGrid.Columns.IndexOf(dataGrid.CurrentCellInfo.Column);
            //   dataGrid.PrepareInputCallBack(dataGrid.GetDataGridCell(currentRowIndex, currentColIndex), out property, out valueString, out valueUshort);
            //}

            response.Put(property);
            if (valueString != null) response.PutStringCP(valueString, codePage);
            else response.Put(valueUshort.Value);
        }
Example #23
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);
            }
        }
        /// <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);
        }
        /// <summary>
        /// Reads the object's properties from the buffer
        /// </summary>
        /// <param name="buffer">DVBuffer where the properties are read</param>
        public void ReadProperties(DVBuffer buffer)
        {
            ProprietesWpf property;
            ushort id;

            buffer.Get(out property);
            while (property != ProprietesWpf.GROUPE_ONGLET_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.ONGLET_POLICE:									// Police des headers d'onglets
                        ushort idFont;
                        buffer.Get(out idFont);
                        idPolice = idFont;
            //						XHtmlFont font = Application.Current.Resources["Font-" + idFont] as XHtmlFont;

                        //if (font == null)
                        //{
                        //	Debug.WriteLine("police onglet non-chargée (ressource à null)");
                        //	break;
                        //}
                        //if (font.Family != null) FontFamily = font.Family;
                        //if (font.Size != null) FontSize = font.Size.Value;
                        //if (font.Style != null) FontStyle = font.Style.Value;
                        //if (font.Weight != null) FontWeight = font.Weight.Value;
                        //if (font.Brush != null) Foreground = font.Brush;
                        break;

                    case ProprietesWpf.ONGLET_PADDING:									// padding dans les headers d'onglets
                        buffer.Get(out id);
                        idPadding = id;

                        //double? verticalPadding = Application.Current.Resources["VerticalPadding-" + idPadding] as double?;
                        //double? horizontalPadding = Application.Current.Resources["HorizontalPadding-" + idPadding] as double?;

                        //Thickness padding = Padding;
                        //if (verticalPadding.HasValue) padding.Top = padding.Bottom = verticalPadding.Value;
                        //if (horizontalPadding.HasValue) padding.Left = padding.Right = horizontalPadding.Value;
                        //Padding = padding;
                        break;

                    case ProprietesWpf.ONGLET_TAILLE_IMAGE:							// Image du bouton (ushort x ushort)
                        ushort imageHeight, imageWidth;
                        buffer.Get(out imageHeight);
                        buffer.Get(out imageWidth);
                        ImageHeight = imageHeight;
                        ImageWidth = imageWidth;
                        break;

                    case ProprietesWpf.ONGLET_MULTILIGNE:								// (Uniquement si multiligne)
                        IsMultiLine = true;
                        break;

                    case ProprietesWpf.ONGLET_COURANT:									// Onglet courant (byte)
                        buffer.Get(out currentTabPageNum);
                        //XHtmlTabItem currentTab = GetTabByPageNum(currentTabPageNum);
                        //if (currentTab != null)
                        //{
                        //	currentTab.IsSelected = true;
                        //	//UpdateLayout(); // nécessaire pour que le BringIntoView fonctionne au tout premier affichage
                        //	//currentTab.BringIntoView();
                        //}
                        break;

                    case ProprietesWpf.ONGLET_ARRET:										// Numéro du point d'arrêt (ushort)
                        buffer.Get(out stopPoint);
                        break;

                    case ProprietesWpf.ONGLET_DEBUT:
                        uint idTab;
                        buffer.Get(out idTab);
                        XHtmlTabItem tab = GetTabById(idTab);
                        if (tab == null)
                        {
                            tab = new XHtmlTabItem(this) { Id = idTab };
                            tab.Page = this.Page;
                            Items.Add(tab);
                        }
                        tab.ReadProperties(buffer);
                        break;

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

                buffer.Get(out property);
            }
        }
        // bh1
        /// <summary>
        /// Ajout dans les données de retour des fichiers joints
        /// </summary> bhficjoint
        /// <param name="reponse">dvbuffer à completer</param>
        /// <param name="fichiers">fichiers</param>
        void AjouterFichiersJoints(DVBuffer reponse, HttpFileCollection fichiers)
        {
            string nomreel, nomtemp;
            HttpPostedFile fichierposté;
            string id;

            for (int i = 0; i < fichiers.Count; i++)
            {
                id = fichiers.AllKeys[i];
                fichierposté = fichiers[i];
                nomreel = fichierposté.FileName;
                if (nomreel != "")
                {
                    nomtemp = Path.GetTempFileName();
                    fichierposté.SaveAs(nomtemp);

                    reponse.Put(Proprietes.VALEUR_SAISIE);
                    reponse.Put(id);
                    string val = "__YWEBFICJOINT1__" + nomtemp +
                                     "__YWEBFICJOINT2__" + nomreel;
                    reponse.Put(val);
                }
            }
        }
Example #27
0
		/// <summary>
		/// initialise la grille
		/// </summary>
		/// <param name="buffer"></param>
		private void SetGrid(DVBuffer buffer)
		{
			ProprietesWpf property;
			XHtmlPresentation gridPresentation = new XHtmlPresentation();
			bool newGrid = false;
			uint gridId;
			ushort cellsCount;
			byte orientation;

			buffer.Get(out gridId);					// Ident Unique de la grille (uint)
			buffer.Get(out cellsCount);			// Nb de cellules (ushort)
			buffer.Get(out orientation);			// Sens (byte : 1 = Vertical, 2 = Horizontal)

			buffer.Get(out property);				// PRESENTATION_DEBUT
			gridPresentation.ReadProperties(buffer);

			Grid grid=null; 

			//grid = GetGrid(gridId); BHGRILLE
			// BH c'est inutle si je ne garde pas les grilles coté serveur

			if (grid == null)	// les pages et leur contenu peuvent être perdues côté XrtDiva => pour ne pas recréer systématiquement ici, on teste
			{
				grid = new Grid (this)
				{
					Id = gridId,
					Tag = gridPresentation,
					Orientation = orientation
				};

				//// pour résoudre le pb de rebarres qui étaient bloquées par la taille min des cellules (idem pour les pages panel ci-dessous)
				//grid.Loaded += (s, e) =>
				//{
				//	var sv = TreeHelper.FindAncestor<ScrollViewer>(grid);
				//	if (sv.Name != "ScrollViewer") // pour exclure le scrollviewer de la fenêtre (sinon comportement non désiré)
				//	{
				//		grid.SetBinding(MaxHeightProperty, new Binding("ActualHeight") { Source = sv });
				//		grid.SetBinding(MaxWidthProperty, new Binding("ActualWidth") { Source = sv });
				//	}
				//};

				//	Grid parent = GetGrid(gridPresentation.GridId);

				//	if (parent != null)	// on ajoute dans la grille trouvée
				//	{
				//		// placement dans la cellule de la grille parent le cas échéant (en ligne ou colonne)
				//		ScrollViewer sv = null;
				//		// grille verticale
				//		if (parent.RowDefinitions.Count > 0 && gridPresentation.CellIndex < parent.RowDefinitions.Count)
				//			sv = parent.Children.OfType<ScrollViewer>().FirstOrDefault(s => GetRow(s) == gridPresentation.CellIndex);
				//		// grille horizontale
				//		else if (parent.ColumnDefinitions.Count > 0 && gridPresentation.CellIndex < parent.ColumnDefinitions.Count)
				//			sv = parent.Children.OfType<ScrollViewer>().FirstOrDefault(s => GetColumn(s) == gridPresentation.CellIndex);

				//		var children = ((Grid)sv.Content).Children;
				//		if (children.Count > 0 && children[0] is XHtmlPage) children.Clear();	// garde-fou
				//		children.Add(grid);
				//	}
				//	else
				//	{
				//		// on doit recalculer les marges pour le cas des onglets (uniquement lorsque la grille est enfant d'une page)
				//		grid.Margin = new Thickness(
				//			gridPresentation.OriginalLeft,
				//			gridPresentation.OriginalTop,
				//			Presentation.OriginalWidth - gridPresentation.OriginalLeft - gridPresentation.OriginalWidth,
				//			Presentation.OriginalHeight - gridPresentation.OriginalTop - gridPresentation.OriginalHeight
				//		);
				//		Children.Add(grid);	// sinon on ajoute dans la page en cours
				//	}
				//	listOfGrids.Add(grid);
				//	newGrid = true;
				//}

				// je saute tout le passage au dessus. je traite ca de l'autre coté.
				newGrid = true;
				listOfGrids.Add(grid);
				Children.Add(grid);

			}

			// ajout des cellules
			for (int i = 0; i < cellsCount; i++)
			{
				XHtmlPresentation cellPresentation = new XHtmlPresentation();
				byte canResizeCell;

				buffer.Get(out property);				// GRILLE_CELLULE_DEBUT
				buffer.Get(out canResizeCell);		// Redimensionnable (byte : 0 ou 1)
				buffer.Get(out property);				// PRESENTATION_DEBUT
				cellPresentation.ReadProperties(buffer);
				buffer.Get(out property);				// GRILLE_CELLULE_FIN

				if (newGrid)
					SetGridCell(gridPresentation, cellPresentation, orientation, grid, canResizeCell, i == cellsCount - 1);
			}

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


			buffer.Get(out property);				// GRILLE_FIN

			#region restauration des paramètres utilisateur stockés dans le registre
			//if (newGrid && !(bool)Application.Current.Properties["IgnoreUserSettings"])
			//{
			//	RegistryKey key = Registry.CurrentUser.CreateSubKey(@"Software\Divalto\V7\Grilles\" + Window.MaskName + "-" + NumPage + "-" + gridId);
			//	if (key == null) return;

			//	// si l'orienation de la grille ne correspond pas à ce qui est stocké dans le registre : on r.à.z.
			//	var gridOrientation = key.GetValue("GridOrientation") as string;
			//	if (gridOrientation != null && gridOrientation != orientation.ToString(CultureInfo.InvariantCulture))
			//	{
			//		key.DeleteValue("GridOrientation");
			//		return;
			//	}

			//	// si la taille de la grille ne correspond pas à ce qui est stocké dans le registre : on r.à.z.
			//	var gridSize = key.GetValue("GridSize") as string;
			//	if (gridSize != null && gridSize != ((orientation == 1) ? gridPresentation.OriginalHeight : gridPresentation.OriginalWidth).ToString(CultureInfo.InvariantCulture))
			//	{
			//		key.DeleteValue("GridSize");
			//		return;
			//	}

			//	// récupération des données en elles-mêmes si tout est ok
			//	var gridCellSizes = key.GetValue("GridCellSizes") as string;
			//	if (gridCellSizes != null)
			//	{
			//		// si le nombre de cellules ne correspond pas à ce qui est stocké dans le registre : on r.à.z.
			//		string[] storedGridCellSizes = gridCellSizes.Split(';');
			//		if (storedGridCellSizes.Length != cellsCount)
			//		{
			//			key.DeleteValue("GridCellSizes");
			//			return;
			//		}

			//		if (orientation == 1) // grille verticale
			//		{
			//			for (int i = 0; i < storedGridCellSizes.Length; i++)
			//			{
			//				try { grid.RowDefinitions[i].Height = (GridLength)new GridLengthConverter().ConvertFromString(storedGridCellSizes[i]); }
			//				catch (FormatException)
			//				{
			//					key.DeleteValue("GridCellSizes");
			//					return;
			//				}
			//			}
			//		}
			//		else // grille horizontale
			//		{
			//			for (int i = 0; i < storedGridCellSizes.Length; i++)
			//			{
			//				try { grid.ColumnDefinitions[i].Width = (GridLength)new GridLengthConverter().ConvertFromString(storedGridCellSizes[i]); }
			//				catch (FormatException)
			//				{
			//					key.DeleteValue("GridCellSizes");
			//					return;
			//				}
			//			}
			//		}
			//	}

			//}
			#endregion restauration des paramètres utilisateur stockés dans le registre

		}
        /// <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;
        }
        /// <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"
        }
        /// <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);
            }
        }