private void LoadFloatingStripsLayout(XmlNode floatingStripsNode) { foreach (XmlNode stripNode in floatingStripsNode.ChildNodes) { if (stripNode.Name != "CommandBarStripElement") { continue; } CommandBarStripElement strip = this.GetStripByName(stripNode.Attributes["Name"].Value); if (strip == null) { continue; } strip.SuspendLayout(true); bool oldRtl = this.RightToLeft; this.RightToLeft = false; if (stripNode.Attributes["FormLocationX"] != null && stripNode.Attributes["FormLocationY"] != null) { Point formLocation = new Point(int.Parse(stripNode.Attributes["FormLocationX"].Value), int.Parse(stripNode.Attributes["FormLocationY"].Value)); if (strip.FloatingForm != null && !strip.FloatingForm.IsDisposed) { strip.FloatingForm.Location = formLocation; } else { this.CreateFloatingStrip(strip, strip.Parent as CommandBarRowElement, formLocation); } } this.RightToLeft = oldRtl; strip.FloatingForm.EndMove(); for (int attr = 0; attr < stripNode.Attributes.Count; attr++) { switch (stripNode.Attributes[attr].Name) { case "Orientation": strip.Orientation = (stripNode.Attributes["Orientation"].Value == "Vertical") ? Orientation.Vertical : Orientation.Horizontal; break; case "VisibleInCommandBar": strip.VisibleInCommandBar = (stripNode.Attributes["VisibleInCommandBar"].Value == "True"); break; case "StretchHorizontally": strip.StretchHorizontally = (stripNode.Attributes["StretchHorizontally"].Value == "True"); break; case "StretchVertically": strip.StretchVertically = (stripNode.Attributes["StretchVertically"].Value == "True"); break; case "EnableFloating": strip.EnableFloating = (stripNode.Attributes["EnableFloating"].Value == "True"); break; case "EnableDragging": strip.EnableDragging = (stripNode.Attributes["EnableDragging"].Value == "True"); break; } } if (stripNode.Attributes["DesiredLocationX"] != null && stripNode.Attributes["DesiredLocationY"] != null) { strip.DesiredLocation = new PointF(float.Parse(stripNode.Attributes["DesiredLocationX"].Value), float.Parse(stripNode.Attributes["DesiredLocationY"].Value)); } foreach (XmlNode itemNode in stripNode.ChildNodes) { if (itemNode.Name != "RadCommandBarBaseItem") { continue; } RadCommandBarBaseItem item = this.GetItemByName(itemNode.Attributes["Name"].Value); if (item == null) { continue; } for (int attr = 0; attr < itemNode.Attributes.Count; attr++) { switch (itemNode.Attributes[attr].Name) { case "Orientation": item.Orientation = (itemNode.Attributes["Orientation"].Value == "Vertical") ? Orientation.Vertical : Orientation.Horizontal; break; case "VisibleInStrip": item.VisibleInStrip = (itemNode.Attributes["VisibleInStrip"].Value == "True"); break; case "StretchHorizontally": item.StretchHorizontally = (itemNode.Attributes["StretchHorizontally"].Value == "True"); break; case "StretchVertically": item.StretchVertically = (itemNode.Attributes["StretchVertically"].Value == "True"); break; case "Index": int index = int.Parse(itemNode.Attributes["Index"].Value); item.Parent.Children.Remove(item); strip.Items.Remove(item); if (strip.FloatingForm != null && !strip.FloatingForm.IsDisposed) { strip.FloatingForm.ItemsHostControl.Element.Layout.Children.Insert(index, item); } else { strip.Items.Insert(index, item); } break; } } } strip.ResumeLayout(true, true); } }
private void LoadFloatingStripsLayout(XmlNode floatingStripsNode) { foreach (XmlNode childNode1 in floatingStripsNode.ChildNodes) { if (!(childNode1.Name != "CommandBarStripElement")) { CommandBarStripElement stripByName = this.GetStripByName(childNode1.Attributes["Name"].Value); if (stripByName != null) { stripByName.SuspendLayout(true); bool rightToLeft = this.RightToLeft; this.RightToLeft = false; for (int index = 0; index < childNode1.Attributes.Count; ++index) { switch (childNode1.Attributes[index].Name) { case "Orientation": stripByName.Orientation = childNode1.Attributes["Orientation"].Value == "Vertical" ? Orientation.Vertical : Orientation.Horizontal; break; case "VisibleInCommandBar": stripByName.VisibleInCommandBar = childNode1.Attributes["VisibleInCommandBar"].Value == "True"; break; case "StretchHorizontally": stripByName.StretchHorizontally = childNode1.Attributes["StretchHorizontally"].Value == "True"; break; case "StretchVertically": stripByName.StretchVertically = childNode1.Attributes["StretchVertically"].Value == "True"; break; case "EnableFloating": stripByName.EnableFloating = childNode1.Attributes["EnableFloating"].Value == "True"; break; case "EnableDragging": stripByName.EnableDragging = childNode1.Attributes["EnableDragging"].Value == "True"; break; } } if (childNode1.Attributes["FormLocationX"] != null && childNode1.Attributes["FormLocationY"] != null) { Point initialLocation = new Point(int.Parse(childNode1.Attributes["FormLocationX"].Value), int.Parse(childNode1.Attributes["FormLocationY"].Value)); if (stripByName.FloatingForm != null && !stripByName.FloatingForm.IsDisposed) { stripByName.FloatingForm.Location = initialLocation; } else { this.CreateFloatingStrip(stripByName, stripByName.Parent as CommandBarRowElement, initialLocation); } } this.RightToLeft = rightToLeft; if (stripByName.FloatingForm != null) { stripByName.FloatingForm.EndMove(); } if (childNode1.Attributes["DesiredLocationX"] != null && childNode1.Attributes["DesiredLocationY"] != null) { stripByName.DesiredLocation = new PointF(float.Parse(childNode1.Attributes["DesiredLocationX"].Value), float.Parse(childNode1.Attributes["DesiredLocationY"].Value)); } foreach (XmlNode childNode2 in childNode1.ChildNodes) { if (!(childNode2.Name != "RadCommandBarBaseItem")) { RadCommandBarBaseItem itemByName = this.GetItemByName(childNode2.Attributes["Name"].Value); if (itemByName != null) { for (int index1 = 0; index1 < childNode2.Attributes.Count; ++index1) { switch (childNode2.Attributes[index1].Name) { case "Orientation": itemByName.Orientation = childNode2.Attributes["Orientation"].Value == "Vertical" ? Orientation.Vertical : Orientation.Horizontal; break; case "VisibleInStrip": itemByName.VisibleInStrip = childNode2.Attributes["VisibleInStrip"].Value == "True"; break; case "StretchHorizontally": itemByName.StretchHorizontally = childNode2.Attributes["StretchHorizontally"].Value == "True"; break; case "StretchVertically": itemByName.StretchVertically = childNode2.Attributes["StretchVertically"].Value == "True"; break; case "Index": int index2 = int.Parse(childNode2.Attributes["Index"].Value); itemByName.Parent.Children.Remove((RadElement)itemByName); stripByName.Items.Remove((RadItem)itemByName); if (stripByName.FloatingForm != null && !stripByName.FloatingForm.IsDisposed) { stripByName.FloatingForm.ItemsHostControl.Element.Layout.Children.Insert(index2, (RadElement)itemByName); break; } if (index2 >= stripByName.Items.Count) { stripByName.Items.Add(itemByName); break; } stripByName.Items.Insert(index2, itemByName); break; } } } } } stripByName.ResumeLayout(true, true); } } } }
private void LoadStripsLayout(XmlNode lineNode, int maxLineIndex) { int currentLineIndex = 0; int.TryParse(lineNode.Attributes["LineIndex"].Value, out currentLineIndex); if (currentLineIndex < 0 || currentLineIndex > maxLineIndex) { currentLineIndex = 0; } foreach (XmlNode stripNode in lineNode.ChildNodes) { if (stripNode.Name != "CommandBarStripElement") { continue; } CommandBarStripElement strip = this.GetStripByName(stripNode.Attributes["Name"].Value); if (strip == null) { continue; } if (strip.FloatingForm != null && !strip.FloatingForm.IsDisposed) { strip.FloatingForm.TryDocking(this.ElementTree.Control as RadCommandBar); } if (strip.FloatingForm != null && !strip.FloatingForm.IsDisposed) { continue; } strip.SuspendLayout(true); strip.EnableFloating = false; for (int attr = 0; attr < stripNode.Attributes.Count; attr++) { switch (stripNode.Attributes[attr].Name) { case "Orientation": strip.Orientation = (stripNode.Attributes["Orientation"].Value == "Vertical") ? Orientation.Vertical : Orientation.Horizontal; break; case "VisibleInCommandBar": strip.VisibleInCommandBar = (stripNode.Attributes["VisibleInCommandBar"].Value == "True"); break; case "StretchHorizontally": strip.StretchHorizontally = (stripNode.Attributes["StretchHorizontally"].Value == "True"); break; case "StretchVertically": strip.StretchVertically = (stripNode.Attributes["StretchVertically"].Value == "True"); break; case "EnableFloating": strip.EnableFloating = (stripNode.Attributes["EnableFloating"].Value == "True"); break; case "EnableDragging": strip.EnableDragging = (stripNode.Attributes["EnableDragging"].Value == "True"); break; } } if (stripNode.Attributes["DesiredLocationX"] != null && stripNode.Attributes["DesiredLocationY"] != null) { strip.DesiredLocation = new PointF(float.Parse(stripNode.Attributes["DesiredLocationX"].Value), float.Parse(stripNode.Attributes["DesiredLocationY"].Value)); } CommandBarRowElement parentRow = (strip.Parent as CommandBarRowElement); if (parentRow != null) { parentRow.Strips.Remove(strip); } this.lines[currentLineIndex].Strips.Add(strip); foreach (XmlNode itemNode in stripNode.ChildNodes) { if (itemNode.Name != "RadCommandBarBaseItem") { continue; } RadCommandBarBaseItem item = this.GetItemByName(itemNode.Attributes["Name"].Value); if (item == null) { continue; } for (int attr = 0; attr < itemNode.Attributes.Count; attr++) { switch (itemNode.Attributes[attr].Name) { case "Orientation": item.Orientation = (itemNode.Attributes["Orientation"].Value == "Vertical") ? Orientation.Vertical : Orientation.Horizontal; break; case "VisibleInStrip": item.VisibleInStrip = (itemNode.Attributes["VisibleInStrip"].Value == "True"); break; case "StretchHorizontally": item.StretchHorizontally = (itemNode.Attributes["StretchHorizontally"].Value == "True"); break; case "StretchVertically": item.StretchVertically = (itemNode.Attributes["StretchVertically"].Value == "True"); break; case "Index": int index = int.Parse(itemNode.Attributes["Index"].Value); item.Parent.Children.Remove(item); strip.Items.Remove(item); strip.Items.Insert(index, item); break; } } } strip.ResumeLayout(true, true); strip.EnableFloating = true; } }
private void LoadStripsLayout(XmlNode lineNode, int maxLineIndex) { int result = 0; int.TryParse(lineNode.Attributes["LineIndex"].Value, out result); if (result < 0 || result > maxLineIndex) { result = 0; } foreach (XmlNode childNode1 in lineNode.ChildNodes) { if (!(childNode1.Name != "CommandBarStripElement")) { CommandBarStripElement stripByName = this.GetStripByName(childNode1.Attributes["Name"].Value); if (stripByName != null) { if (stripByName.FloatingForm != null && !stripByName.FloatingForm.IsDisposed) { stripByName.FloatingForm.TryDocking(this.ElementTree.Control as RadCommandBar); } if (stripByName.FloatingForm == null || stripByName.FloatingForm.IsDisposed) { stripByName.SuspendLayout(true); stripByName.EnableFloating = false; for (int index = 0; index < childNode1.Attributes.Count; ++index) { switch (childNode1.Attributes[index].Name) { case "Orientation": stripByName.Orientation = childNode1.Attributes["Orientation"].Value == "Vertical" ? Orientation.Vertical : Orientation.Horizontal; break; case "VisibleInCommandBar": stripByName.VisibleInCommandBar = childNode1.Attributes["VisibleInCommandBar"].Value == "True"; break; case "StretchHorizontally": stripByName.StretchHorizontally = childNode1.Attributes["StretchHorizontally"].Value == "True"; break; case "StretchVertically": stripByName.StretchVertically = childNode1.Attributes["StretchVertically"].Value == "True"; break; case "EnableFloating": stripByName.EnableFloating = childNode1.Attributes["EnableFloating"].Value == "True"; break; case "EnableDragging": stripByName.EnableDragging = childNode1.Attributes["EnableDragging"].Value == "True"; break; } } if (childNode1.Attributes["DesiredLocationX"] != null && childNode1.Attributes["DesiredLocationY"] != null) { stripByName.DesiredLocation = new PointF(float.Parse(childNode1.Attributes["DesiredLocationX"].Value), float.Parse(childNode1.Attributes["DesiredLocationY"].Value)); } (stripByName.Parent as CommandBarRowElement)?.Strips.Remove((RadItem)stripByName); this.lines[result].Strips.Add(stripByName); foreach (XmlNode childNode2 in childNode1.ChildNodes) { if (!(childNode2.Name != "RadCommandBarBaseItem")) { RadCommandBarBaseItem itemByName = this.GetItemByName(childNode2.Attributes["Name"].Value); if (itemByName != null) { for (int index1 = 0; index1 < childNode2.Attributes.Count; ++index1) { switch (childNode2.Attributes[index1].Name) { case "Orientation": itemByName.Orientation = childNode2.Attributes["Orientation"].Value == "Vertical" ? Orientation.Vertical : Orientation.Horizontal; break; case "VisibleInStrip": itemByName.VisibleInStrip = childNode2.Attributes["VisibleInStrip"].Value == "True"; break; case "StretchHorizontally": itemByName.StretchHorizontally = childNode2.Attributes["StretchHorizontally"].Value == "True"; break; case "StretchVertically": itemByName.StretchVertically = childNode2.Attributes["StretchVertically"].Value == "True"; break; case "Index": int index2 = int.Parse(childNode2.Attributes["Index"].Value); if (index2 < stripByName.Items.Count) { itemByName.Parent.Children.Remove((RadElement)itemByName); stripByName.Items.Remove((RadItem)itemByName); stripByName.Items.Insert(index2, itemByName); break; } break; } } } } } stripByName.ResumeLayout(true, true); stripByName.EnableFloating = true; } } } } }