Exemplo n.º 1
0
        private void EnterOwnerBtn_Click(object sender, EventArgs e)
        {
            SqlCommand    command;
            SqlDataReader dataReader;
            String        query;

            query = "Select * From LoginTable Where Username = '******' and Password = '******' and Type = 'Owner'";

            BookDBConn.Open();

            command    = new SqlCommand(query, BookDBConn);
            dataReader = command.ExecuteReader();

            if (dataReader.Read())
            {
                OwnerPage UserAccess = new OwnerPage();
                this.Hide();
                UserAccess.ShowDialog();
                this.Show();
            }
            else
            {
                MessageBox.Show("Username or Password are not valid!", "Access Denied", MessageBoxButtons.OK, MessageBoxIcon.Stop);
            }


            BookDBConn.Close();
        }
Exemplo n.º 2
0
        public string ToXaml(int indentLevel, bool eventHandlers, Dictionary <IHmiControl, List <IHmiControl> > groups, Thickness frame)
        {
            var groupChildren = groups[this];

            if (groupChildren.Count == 0)
            {
                return(ToXaml(indentLevel, eventHandlers, true));
            }

            var sb = new StringBuilder();

            for (int i = 0; i < indentLevel; i++)
            {
                sb.Append("    ");
            }
            sb.Append("<Border Style=\"{DynamicResource BorderStyle}\"");
            sb.AppendFormat(" Name=\"{0}\"", Name);
            OwnerPage.AppendLocationXaml(this, sb);
            sb.AppendLine(">");
            for (int i = 0; i < indentLevel + 1; i++)
            {
                sb.Append("    ");
            }
            sb.AppendLine("<Grid>");
            frame.Left   += Margin.Left;
            frame.Top    += Margin.Top;
            frame.Right  += Margin.Right;
            frame.Bottom += Margin.Bottom;
            foreach (IHmiControl control in groupChildren)
            {
                var margin0 = control.fe.Margin;
                MainWindow.Shift(control.fe, frame);
                if (groups.ContainsKey(control))
                {
                    sb.AppendLine((control as IGroupHmiControl).ToXaml(indentLevel + 2, eventHandlers, groups, frame));
                }
                else
                {
                    sb.AppendLine(control.ToXaml(indentLevel + 2, eventHandlers, true));
                }
                control.fe.Margin = margin0;
            }
            for (int i = 0; i < indentLevel + 1; i++)
            {
                sb.Append("    ");
            }
            sb.AppendLine("</Grid>");
            for (int i = 0; i < indentLevel; i++)
            {
                sb.Append("    ");
            }
            sb.Append("</Border>");
            return(sb.ToString());
        }
Exemplo n.º 3
0
        public string ToXaml(int indentLevel, bool eventHandlers, bool vs)
        {
            var sb = new StringBuilder();

            for (int i = 0; i < indentLevel; i++)
            {
                sb.Append("    ");
            }

            if (vs)
            {
                sb.AppendFormat("<TextBlock Style=\"{{DynamicResource HyperlinkStyle}}\" Name=\"{0}\"", Name);
                OwnerPage.AppendLocationXaml(this, sb);
                sb.AppendLine(">");
                for (int i = 0; i < indentLevel + 1; i++)
                {
                    sb.Append("    ");
                }
                if (eventHandlers)
                {
                    sb.AppendFormat("<Hyperlink Click=\"{0}{1}_Click\">\r\n", char.ToUpper(Name[0]), Name.Substring(1));
                }
                else
                {
                    sb.AppendLine("<Hyperlink>");
                }
                for (int i = 0; i < indentLevel + 2; i++)
                {
                    sb.Append("    ");
                }
                sb.AppendLine(WebUtility.HtmlEncode(Text).Replace("\n", "&#10;"));
                for (int i = 0; i < indentLevel + 1; i++)
                {
                    sb.Append("    ");
                }
                sb.AppendLine("</Hyperlink>");
                for (int i = 0; i < indentLevel; i++)
                {
                    sb.Append("    ");
                }
                sb.Append("</TextBlock>");
            }
            else
            {
                sb.AppendFormat("<HmiHyperlink Name=\"{0}\" Text=\"{1}\"", Name, WebUtility.HtmlEncode(Text).Replace("\n", "&#10;"));
                OwnerPage.AppendLocationXaml(this, sb);
                sb.Append(" />");
            }

            return(sb.ToString());
        }
Exemplo n.º 4
0
        public string ToXaml(int indentLevel, bool eventHandlers, bool vs)
        {
            var sb = new StringBuilder();

            for (int i = 0; i < indentLevel; i++)
            {
                sb.Append("    ");
            }
            sb.Append(vs ? "<TextBlock Style=\"{DynamicResource TextBlockStyle}\"" : "<HmiTextBlock");
            sb.AppendFormat(" Name=\"{0}\" Text=\"{1}\"", Name, WebUtility.HtmlEncode(Text).Replace("\n", "&#10;"));
            OwnerPage.AppendLocationXaml(this, sb);
            sb.Append(" />");
            return(sb.ToString());
        }
Exemplo n.º 5
0
        public string ToXaml(int indentLevel, bool vs = false)
        {
            var sb = new StringBuilder();

            for (int i = 0; i < indentLevel; i++)
            {
                sb.Append("    ");
            }
            sb.Append(vs ? "<Border Style=\"{DynamicResource BorderStyle}\"" : "<HmiBorder");
            sb.AppendFormat(" Name=\"{0}\"", Name);
            OwnerPage.AppendLocationXaml(this, sb);
            sb.Append(" />");
            return(sb.ToString());
        }
Exemplo n.º 6
0
        async void Handle_Tapped(object sender, System.EventArgs e)
        {
            if (OwnerPage == null)
            {
                System.Diagnostics.Debug.WriteLine("MyPicker: OwnerPage is null");
                return;
            }
            if (busy)
            {
                return;
            }
            busy = true;
            List <string> buttons = new List <string>();

            if (ItemsSource != null)
            {
                foreach (var item in ItemsSource)
                {
                    if (item != null)
                    {
                        buttons.Add(item.ToString());
                    }
                    else
                    {
                        buttons.Add("无");
                    }
                }
            }
            var result = await OwnerPage.DisplayActionSheet(Title, null, null, buttons.ToArray());

            busy = false;
            if (result == null)
            {
                return;
            }
            int selectedIndex = buttons.IndexOf(result);
            int index         = 0;

            foreach (var item in ItemsSource)
            {
                if (index == selectedIndex)
                {
                    SelectedItem = item;
                    break;
                }
                index++;
            }
            HandleSelectedItemChanged();
        }
Exemplo n.º 7
0
        public string ToXaml(int indentLevel, bool eventHandlers, bool vs)
        {
            var sb = new StringBuilder();

            for (int i = 0; i < indentLevel; i++)
            {
                sb.Append("    ");
            }

            if (vs)
            {
                sb.AppendFormat("<ListBox Style=\"{{DynamicResource ListBoxStyle}}\" Name=\"{0}\"", Name);
                if (eventHandlers)
                {
                    sb.AppendFormat(" SelectionChanged=\"{0}{1}_SelectionChanged\"", char.ToUpper(Name[0]), Name.Substring(1));
                }
                OwnerPage.AppendLocationXaml(this, sb);
                sb.AppendLine(">");
                string[] labels = Elements.Split(new char[] { '|' }, StringSplitOptions.RemoveEmptyEntries);
                foreach (string label in labels)
                {
                    for (int i = 0; i < indentLevel + 1; i++)
                    {
                        sb.Append("    ");
                    }
                    sb.AppendFormat("<ListBoxItem Style=\"{{DynamicResource ListBoxItemStyle}}\" Content=\"{0}\" />\r\n", label);
                }
                for (int i = 0; i < indentLevel; i++)
                {
                    sb.Append("    ");
                }
                sb.Append("</ListBox>");
            }
            else
            {
                sb.AppendFormat("<HmiListBox Name=\"{0}\"", Name);
                if (Elements.Length > 0)
                {
                    sb.AppendFormat(" Elements=\"{0}\"", Elements);
                }
                OwnerPage.AppendLocationXaml(this, sb);
                sb.Append(" />");
            }

            return(sb.ToString());
        }
Exemplo n.º 8
0
        public string ToXaml(int indentLevel, bool vs = false)
        {
            var sb = new StringBuilder();

            for (int i = 0; i < indentLevel; i++)
            {
                sb.Append("    ");
            }
            sb.Append(vs ? "<Slider Style=\"{DynamicResource SliderStyle}\"" : "<HmiSlider");
            sb.AppendFormat(" Name=\"{0}\" Minimum=\"{1}\" Maximum=\"{2}\"", Name, Minimum, Maximum);
            if (vs && Height > Width)
            {
                sb.Append(" Orientation=\"Vertical\"");
            }
            OwnerPage.AppendLocationXaml(this, sb);
            sb.Append(" />");
            return(sb.ToString());
        }
Exemplo n.º 9
0
        public string ToXaml(int indentLevel, bool eventHandlers, bool vs)
        {
            var sb = new StringBuilder();

            for (int i = 0; i < indentLevel; i++)
            {
                sb.Append("    ");
            }
            sb.Append(vs ? "<ProgressBar Style=\"{DynamicResource ProgressBarStyle}\"" : "<HmiProgressBar");
            sb.AppendFormat(" Name=\"{0}\" Minimum=\"{1}\" Maximum=\"{2}\"", Name, Minimum, Maximum);
            if (vs && IsVertical)
            {
                sb.Append(" Orientation=\"Vertical\"");
            }
            OwnerPage.AppendLocationXaml(this, sb);
            sb.Append(" />");
            return(sb.ToString());
        }
Exemplo n.º 10
0
        public string ToXaml(int indentLevel, bool vs = false)
        {
            var sb = new StringBuilder();

            for (int i = 0; i < indentLevel; i++)
            {
                sb.Append("    ");
            }
            sb.Append(vs ? "<GroupBox Style=\"{DynamicResource GroupBoxStyle}\"" : "<HmiGroupBox");
            sb.AppendFormat(" Name=\"{0}\"", Name);
            if (Header is string header)
            {
                sb.AppendFormat(" Header=\"{0}\"", WebUtility.HtmlEncode(header).Replace("\n", "&#10;"));
            }
            OwnerPage.AppendLocationXaml(this, sb);
            sb.Append(" />");
            return(sb.ToString());
        }
Exemplo n.º 11
0
        public string ToXaml(int indentLevel, bool eventHandlers, bool vs)
        {
            var sb = new StringBuilder();

            for (int i = 0; i < indentLevel; i++)
            {
                sb.Append("    ");
            }
            sb.Append(vs ? "<TextBox Style=\"{DynamicResource TextBoxStyle}\"" : "<HmiTextBox");
            sb.AppendFormat(" Name=\"{0}\"", Name);
            if (eventHandlers)
            {
                sb.AppendFormat(" TextChanged=\"{0}{1}_TextChanged\"", char.ToUpper(Name[0]), Name.Substring(1));
            }
            OwnerPage.AppendLocationXaml(this, sb);
            sb.Append(" />");
            return(sb.ToString());
        }
Exemplo n.º 12
0
        public string ToXaml(int indentLevel, bool vs = false)
        {
            var sb = new StringBuilder();

            for (int i = 0; i < indentLevel; i++)
            {
                sb.Append("    ");
            }
            sb.Append(vs ? "<Image" : "<HmiImage");
            sb.AppendFormat(" Name=\"{0}\" Stretch=\"{1}\"", Name, Stretch);
            if (ImageFile.Length > 0)
            {
                sb.AppendFormat(vs ? " Source=\"Images/{0}\"" : " ImageFile=\"{0}\"", ImageFile);
            }
            OwnerPage.AppendLocationXaml(this, sb);
            sb.Append(" />");
            return(sb.ToString());
        }
Exemplo n.º 13
0
        public string ToXaml(int indentLevel, bool eventHandlers, bool vs)
        {
            var sb = new StringBuilder();

            for (int i = 0; i < indentLevel; i++)
            {
                sb.Append("    ");
            }

            if (vs)
            {
                sb.Append("<StackPanel");
                OwnerPage.AppendLocationXaml(this, sb);
                sb.AppendLine(">");
                int      index  = 0;
                string[] labels = Elements.Split(new char[] { '|' }, StringSplitOptions.RemoveEmptyEntries);
                foreach (string label in labels)
                {
                    for (int i = 0; i < indentLevel + 1; i++)
                    {
                        sb.Append("    ");
                    }
                    sb.AppendFormat("<RadioButton Style=\"{{DynamicResource RadioButtonStyle}}\" Name=\"{0}_button{1}\" Content=\"{2}\"", Name, ++index, label);
                    if (eventHandlers)
                    {
                        sb.AppendFormat(" Checked=\"{0}{1}_Checked\"", char.ToUpper(Name[0]), Name.Substring(1));
                    }
                    sb.AppendLine(" />");
                }
                for (int i = 0; i < indentLevel; i++)
                {
                    sb.Append("    ");
                }
                sb.Append("</StackPanel>");
            }
            else
            {
                sb.AppendFormat("<HmiRadioButtons Name=\"{0}\" Elements=\"{1}\"", Name, Elements);
                OwnerPage.AppendLocationXaml(this, sb);
                sb.Append(" />");
            }

            return(sb.ToString());
        }
Exemplo n.º 14
0
        public string ToXaml(int indentLevel, bool vs = false)
        {
            var sb = new StringBuilder();

            for (int i = 0; i < indentLevel; i++)
            {
                sb.Append("    ");
            }

            if (vs)
            {
                sb.AppendFormat("<StackPanel Name=\"{0}\"", Name);
                OwnerPage.AppendLocationXaml(this, sb);
                sb.AppendLine(">");
                string[] labels = Elements.Split(new char[] { '|' }, StringSplitOptions.RemoveEmptyEntries);
                foreach (string label in labels)
                {
                    for (int i = 0; i < indentLevel + 1; i++)
                    {
                        sb.Append("    ");
                    }
                    sb.AppendFormat("<RadioButton Style=\"{{DynamicResource RadioButtonStyle}}\" Content=\"{0}\" />\r\n", label);
                }
                for (int i = 0; i < indentLevel; i++)
                {
                    sb.Append("    ");
                }
                sb.Append("</StackPanel>");
            }
            else
            {
                sb.AppendFormat("<HmiRadioButtons Name=\"{0}\"", Name);
                if (Elements.Length > 0)
                {
                    sb.AppendFormat(" Elements=\"{0}\"", Elements);
                }
                OwnerPage.AppendLocationXaml(this, sb);
                sb.Append(" />");
            }

            return(sb.ToString());
        }
Exemplo n.º 15
0
        public string ToXaml(int indentLevel, bool eventHandlers, bool vs)
        {
            var sb = new StringBuilder();

            for (int i = 0; i < indentLevel; i++)
            {
                sb.Append("    ");
            }
            sb.Append(vs ? "<Slider Style=\"{DynamicResource SliderStyle}\"" : "<HmiSlider");
            sb.AppendFormat(" Name=\"{0}\" Minimum=\"{1}\" Maximum=\"{2}\"", Name, Minimum, Maximum);
            if (vs && IsVertical)
            {
                sb.Append(" Orientation=\"Vertical\"");
            }
            if (eventHandlers)
            {
                sb.AppendFormat(" ValueChanged=\"{0}{1}_ValueChanged\"", char.ToUpper(Name[0]), Name.Substring(1));
            }
            OwnerPage.AppendLocationXaml(this, sb);
            sb.Append(" />");
            return(sb.ToString());
        }
Exemplo n.º 16
0
        async void Handle_Tapped(object sender, System.EventArgs e)
        {
            if (OwnerPage == null)
            {
                System.Diagnostics.Debug.WriteLine("MyPicker: OwnerPage is null");
                return;
            }
            if (busy)
            {
                return;
            }
            busy = true;
            List <string> buttons = new List <string>();

            if (ItemsSource != null)
            {
                foreach (var item in ItemsSource)
                {
                    if (item != null)
                    {
                        buttons.Add(item.ToString());
                    }
                    else
                    {
                        buttons.Add("item is null");
                    }
                }
            }
            var result = await OwnerPage.DisplayActionSheet(Title, null, null, buttons.ToArray());

            busy = false;
            if (result == null)
            {
                return;
            }
            SelectedItem = result;
            UpdateLabel();
        }
Exemplo n.º 17
0
        public string ToXaml(int indentLevel, bool eventHandlers, bool vs)
        {
            var sb = new StringBuilder();

            for (int i = 0; i < indentLevel; i++)
            {
                sb.Append("    ");
            }

            if (vs)
            {
                sb.AppendFormat("<TreeView Style=\"{{DynamicResource TreeViewStyle}}\" Name=\"{0}\"", Name);
                if (eventHandlers)
                {
                    sb.AppendFormat(" SelectedItemChanged=\"{0}{1}_SelectedItemChanged\"", char.ToUpper(Name[0]), Name.Substring(1));
                }
                OwnerPage.AppendLocationXaml(this, sb);
                sb.AppendLine(">");

                bool     close = false;
                int      nodeLevel = 1, node2Level = 1;
                string[] labels = Elements.Split('|');
                foreach (string label in labels)
                {
                    if (label.Length > 0)
                    {
                        node2Level = Math.Min(node2Level, nodeLevel + 1);
                        while (close && nodeLevel >= node2Level)
                        {
                            for (int i = 0; i < indentLevel + nodeLevel; i++)
                            {
                                sb.Append("    ");
                            }
                            sb.AppendLine("</TreeViewItem>");
                            --nodeLevel;
                        }
                        nodeLevel = node2Level;
                        for (int i = 0; i < indentLevel + nodeLevel; i++)
                        {
                            sb.Append("    ");
                        }
                        sb.AppendFormat("<TreeViewItem Style=\"{{DynamicResource TreeViewItemStyle}}\" Header=\"{0}\">\r\n", label);
                        close      = true;
                        node2Level = 1;
                    }
                    else  // double-pipe
                    {
                        ++node2Level;
                    }
                }

                while (close && nodeLevel >= 1)
                {
                    for (int i = 0; i < indentLevel + nodeLevel; i++)
                    {
                        sb.Append("    ");
                    }
                    sb.AppendLine("</TreeViewItem>");
                    --nodeLevel;
                }

                for (int i = 0; i < indentLevel; i++)
                {
                    sb.Append("    ");
                }
                sb.Append("</TreeView>");
            }
            else
            {
                sb.AppendFormat("<HmiTreeView Name=\"{0}\"", Name);
                if (Elements.Length > 0)
                {
                    sb.AppendFormat(" Elements=\"{0}\"", Elements);
                }
                OwnerPage.AppendLocationXaml(this, sb);
                sb.Append(" />");
            }

            return(sb.ToString());
        }
Exemplo n.º 18
0
        public string ToXaml(int indentLevel, bool eventHandlers, bool vs)
        {
            var sb = new StringBuilder();

            for (int i = 0; i < indentLevel; i++)
            {
                sb.Append("    ");
            }
            string text = WebUtility.HtmlEncode(Text).Replace("\n", "&#10;");

            if (vs)
            {
                sb.AppendFormat("<Button Style=\"{{DynamicResource ButtonStyle}}\" Name=\"{0}\"", Name);
                if (eventHandlers)
                {
                    sb.AppendFormat(" Click=\"{0}{1}_Click\"", char.ToUpper(Name[0]), Name.Substring(1));
                }
                if (text.Length > 0 && ImageFile.Length > 0)
                {
                    OwnerPage.AppendLocationXaml(this, sb);
                    sb.AppendLine(">");
                    for (int i = 0; i < indentLevel + 1; i++)
                    {
                        sb.Append("    ");
                    }
                    sb.AppendLine("<StackPanel>");
                    for (int i = 0; i < indentLevel + 2; i++)
                    {
                        sb.Append("    ");
                    }
                    sb.AppendFormat("<Image Source=\"Images/{0}\" Stretch=\"None\" />\r\n", ImageFile);
                    for (int i = 0; i < indentLevel + 2; i++)
                    {
                        sb.Append("    ");
                    }
                    sb.AppendFormat("<TextBlock Text=\"{0}\" />\r\n", text);
                    for (int i = 0; i < indentLevel + 1; i++)
                    {
                        sb.Append("    ");
                    }
                    sb.AppendLine("</StackPanel>");
                    for (int i = 0; i < indentLevel; i++)
                    {
                        sb.Append("    ");
                    }
                    sb.Append("</Button>");
                }
                else if (ImageFile.Length > 0)
                {
                    OwnerPage.AppendLocationXaml(this, sb);
                    sb.AppendLine(">");
                    for (int i = 0; i < indentLevel + 1; i++)
                    {
                        sb.Append("    ");
                    }
                    sb.AppendFormat("<Image Source=\"Images/{0}\" Stretch=\"None\" />\r\n", ImageFile);
                    for (int i = 0; i < indentLevel; i++)
                    {
                        sb.Append("    ");
                    }
                    sb.Append("</Button>");
                }
                else
                {
                    if (text.Length > 0)
                    {
                        sb.AppendFormat(" Content=\"{0}\"", text);
                    }
                    OwnerPage.AppendLocationXaml(this, sb);
                    sb.Append(" />");
                }
            }
            else
            {
                sb.AppendFormat("<HmiButton Name=\"{0}\"", Name);
                if (text.Length > 0)
                {
                    sb.AppendFormat(" Text=\"{0}\"", text);
                }
                if (ImageFile.Length > 0)
                {
                    sb.AppendFormat(" ImageFile=\"{0}\"", ImageFile);
                }
                OwnerPage.AppendLocationXaml(this, sb);
                sb.Append(" />");
            }

            return(sb.ToString());
        }
Exemplo n.º 19
0
        public string ToXaml(int indentLevel, bool vs = false)
        {
            var sb = new StringBuilder();

            for (int i = 0; i < indentLevel; i++)
            {
                sb.Append("    ");
            }

            if (vs)
            {
                sb.AppendFormat("<TreeView Style=\"{{DynamicResource TreeViewStyle}}\" Name=\"{0}\"", Name);
                OwnerPage.AppendLocationXaml(this, sb);
                sb.AppendLine(">");
                bool     subitem = false;
                string[] labels  = Elements.Split('|');
                foreach (string label in labels)
                {
                    if (label.Length > 0)
                    {
                        if (subitem)
                        {
                            for (int i = 0; i < indentLevel + 2; i++)
                            {
                                sb.Append("    ");
                            }
                            sb.AppendFormat("<TreeViewItem Style=\"{{DynamicResource TreeViewItemStyle}}\" Header=\"{0}\" />\r\n", label);
                        }
                        else
                        {
                            for (int i = 0; i < indentLevel + 1; i++)
                            {
                                sb.Append("    ");
                            }
                            sb.AppendFormat("<TreeViewItem Style=\"{{DynamicResource TreeViewItemStyle}}\" Header=\"{0}\">\r\n", label);
                            subitem = true;
                        }
                    }
                    else if (subitem)
                    {
                        for (int i = 0; i < indentLevel + 1; i++)
                        {
                            sb.Append("    ");
                        }
                        sb.AppendLine("</TreeViewItem>");
                        subitem = false;
                    }
                }

                if (subitem)
                {
                    for (int i = 0; i < indentLevel + 1; i++)
                    {
                        sb.Append("    ");
                    }
                    sb.AppendLine("</TreeViewItem>");
                }
                for (int i = 0; i < indentLevel; i++)
                {
                    sb.Append("    ");
                }
                sb.Append("</TreeView>");
            }
            else
            {
                sb.AppendFormat("<HmiTreeView Name=\"{0}\"", Name);
                if (Elements.Length > 0)
                {
                    sb.AppendFormat(" Elements=\"{0}\"", Elements);
                }
                OwnerPage.AppendLocationXaml(this, sb);
                sb.Append(" />");
            }

            return(sb.ToString());
        }
Exemplo n.º 20
0
        public string ToXaml(int indentLevel, bool eventHandlers, Dictionary <IHmiControl, List <IHmiControl> > groups, Thickness frame)
        {
            var groupChildren = groups[this];

            if (groupChildren.Count == 0)
            {
                return(ToXaml(indentLevel, eventHandlers, true));
            }

            var sb = new StringBuilder();

            for (int i = 0; i < indentLevel; i++)
            {
                sb.Append("    ");
            }
            sb.Append("<GroupBox Style=\"{DynamicResource GroupBoxStyle}\"");
            sb.AppendFormat(" Name=\"{0}\"", Name);
            if (Header is string header)
            {
                sb.AppendFormat(" Header=\"{0}\"", WebUtility.HtmlEncode(header).Replace("\n", "&#10;"));
            }
            OwnerPage.AppendLocationXaml(this, sb);
            sb.AppendLine(">");
            for (int i = 0; i < indentLevel + 1; i++)
            {
                sb.Append("    ");
            }
            sb.AppendLine("<Grid>");

            frame.Left   += Margin.Left;
            frame.Top    += Margin.Top;
            frame.Right  += Margin.Right;
            frame.Bottom += Margin.Bottom;
            switch (HorizontalAlignment)
            {
            case HorizontalAlignment.Left:
            case HorizontalAlignment.Center:
                frame.Left += 6;
                break;

            case HorizontalAlignment.Right:
                frame.Right += 6;
                break;

            case HorizontalAlignment.Stretch:
                frame.Left  += 6;
                frame.Right += 6;
                break;
            }
            switch (VerticalAlignment)
            {
            case VerticalAlignment.Top:
            case VerticalAlignment.Center:
                frame.Top += 20;
                break;

            case VerticalAlignment.Bottom:
                frame.Bottom += 6;
                break;

            case VerticalAlignment.Stretch:
                frame.Top    += 20;
                frame.Bottom += 6;
                break;
            }

            foreach (IHmiControl control in groupChildren)
            {
                var margin0 = control.fe.Margin;
                MainWindow.Shift(control.fe, frame);
                if (groups.ContainsKey(control))
                {
                    sb.AppendLine((control as IGroupHmiControl).ToXaml(indentLevel + 2, eventHandlers, groups, frame));
                }
                else
                {
                    sb.AppendLine(control.ToXaml(indentLevel + 2, eventHandlers, true));
                }
                control.fe.Margin = margin0;
            }
            for (int i = 0; i < indentLevel + 1; i++)
            {
                sb.Append("    ");
            }
            sb.AppendLine("</Grid>");
            for (int i = 0; i < indentLevel; i++)
            {
                sb.Append("    ");
            }
            sb.Append("</GroupBox>");
            return(sb.ToString());
        }