private void CreateClientActionButtons(XElement xactions) { IEnumerable <XNode> childNodes = xactions.Nodes(); int totalNodes = childNodes.Count(); double theSize = (80 * totalNodes) + 12; if (theSize < this.Width) { theSize = this.Width; } this.Width = theSize; XElement buttonElt = (XElement)xactions.FirstNode; while (buttonElt != null) { string label = buttonElt.Attribute(Common.UIMessage.label).Value; string request = ""; string response = ""; if (buttonElt.Nodes().Count() > 0) { if (((XElement)buttonElt.FirstNode).Name == Common.UIMessage.Request) { request = ((XElement)buttonElt.FirstNode).FirstNode.ToString();//.InnerXml; } else if (((XElement)buttonElt.FirstNode).Name == Common.UIMessage.Response) { response = ((XElement)buttonElt.FirstNode).FirstNode.ToString(); } } ClientMessageButton theButton = CreateAndInitClientMessageButton(); theButton.ButtonRequest = request; theButton.ButtonResponse = response; theButton.TabIndex = 0; theButton.Content = label; XAttribute selOption = buttonElt.Attribute(Common.UIMessage.selectedOption); if (selOption != null && Common.boolValue(selOption.Value)) { theButton.Tag = Common.UIMessage.selectedOption; } //XAttribute defaultAttr = buttonElt.Attribute("default"); //if (label.ToUpper() == "OK" || (defaultAttr != null && Common.boolValue(defaultAttr.Value))) //{ //} //XAttribute cancelAttr = buttonElt.Attribute("cancel"); //if (label.ToUpper() == "CANCEL" || (cancelAttr != null && Common.boolValue(cancelAttr.Value))) //{ //} ActionButtonsContainer.Children.Add(theButton); buttonElt = (XElement)buttonElt.NextNode; } }
private ClientMessageButton CreateAndInitClientMessageButton() { ClientMessageButton theButton = new ClientMessageButton(this); theButton.HorizontalAlignment = HorizontalAlignment.Right; theButton.Margin = new Thickness(0, 0, 10, 5); theButton.Width = 75; theButton.Click += new RoutedEventHandler(theButton_Click); //Grid.SetRow(theButton, 1); return theButton; }
private ClientMessageButton CreateAndInitClientMessageButton() { ClientMessageButton theButton = new ClientMessageButton(this); theButton.HorizontalAlignment = HorizontalAlignment.Right; theButton.Margin = new Thickness(0, 0, 10, 5); theButton.Width = 75; theButton.Click += new RoutedEventHandler(theButton_Click); //Grid.SetRow(theButton, 1); return(theButton); }