public void ReloadRestrictions() { LoadSubItems(); RestrictionNode restrictionTree = BusinessDomain.RestrictionTree; foreach (ToolItemWrapper item in items) { if (item.IsSeparator) { continue; } RestrictionNode node = restrictionTree.FindNode(item.RestrictionName); if (node == null) { throw new ApplicationException(string.Format("No restriction node found item name \"{0}\"", item.Name)); } item.ClearRestrictions(); foreach (KeyValuePair <long, UserRestriction> restriction in node.Restrictions) { item.SetRestriction(restriction.Value); } } }
public void ReloadRestrictions() { LoadSubItems(); RestrictionNode restrictionTree = BusinessDomain.RestrictionTree; foreach (MenuItemWrapper item in items) { if (item.IsSeparator) { continue; } RestrictionNode node = restrictionTree.FindNode(item.Name); if (node == null) { continue; } item.ClearRestrictions(); foreach (KeyValuePair <long, UserRestriction> restriction in node.Restrictions) { item.SetRestriction(restriction.Value); } item.SubItems.ReloadRestrictions(); } }
public void Translate() { LoadSubItems(); RestrictionNode restrictionTree = BusinessDomain.RestrictionTree; foreach (MenuItemWrapper item in items) { if (item.IsSeparator) { continue; } RestrictionNode node = restrictionTree.FindNode(item.Name); if (node == null) { throw new ApplicationException(string.Format("No restriction node found item name \"{0}\"", item.Name)); } item.Text = node.Value; item.SubItems.Translate(); if (item.SubItems.Sorted && item.Item.Submenu != null) { item.SubItems.Sort((m1, m2) => string.Compare(m1.Text, m2.Text)); RestrictionNode restrictionNode = BusinessDomain.RestrictionTree.FindNode(item.Name); restrictionNode.Children.Sort((r1, r2) => string.Compare(r1.Value, r2.Value)); Container container = (Container)item.Item.Submenu; List <Widget> children = new List <Widget> (container.Children); foreach (Widget widget in container.Children) { container.Remove(widget); } children.Sort((w1, w2) => string.Compare(((Label)((Bin)w1).Child).Text, (((Label)((Bin)w2).Child).Text))); foreach (Widget widget in children) { container.Add(widget); } } } }
public void Translate() { LoadSubItems(); RestrictionNode restrictionTree = BusinessDomain.RestrictionTree; foreach (ToolItemWrapper item in items) { if (item.IsSeparator) { continue; } RestrictionNode node = restrictionTree.FindNode(item.RestrictionName); if (node == null) { throw new ApplicationException(string.Format("No restriction node found item name \"{0}\"", item.Name)); } string text = node.Value.EndsWith("...") ? node.Value.Substring(0, node.Value.Length - 3) : node.Value; item.Text = text.Trim(); } }