Changes to BamlViewer?

Developer
Mar 19, 2007 at 10:59 PM
I have a couple of very small changes to the BamlViewer (mostly adding SelectAll and Copy to a ContextMenu to the RichTextBox). Can I contribute them here?
Coordinator
Mar 20, 2007 at 2:44 AM
Sure :)
Developer
Mar 20, 2007 at 5:26 AM
What's the best way to contribute them? Since I am not a user, I can't check them in. I'd be happy to post the code here or I could join the group. Your call.
Coordinator
Mar 20, 2007 at 8:00 AM
Added you to the project. Alternatively you can send the changes via Email.
Developer
Mar 20, 2007 at 9:32 AM
Great. I just checked in the change. This change includes

- BamlViewer's XAML Window now has a Context menu with three commands: "Select All", "Copy" and "Save As".

I am not sure how builds work, but could you let me know when this is part of a release?
Developer
Mar 20, 2007 at 2:44 PM
I've fixed the dialog and checked it in. Hopefully, I didn't screw up the tabs again.
Developer
Mar 20, 2007 at 11:49 PM
D'oh...it doesn't make sense to have the Save As context in the XAML window. I am going to move this functionality to the Tree control if that works for you.
Jun 6, 2008 at 9:52 AM
Edited Jun 9, 2008 at 4:27 PM

Can you add some changes to BamlViewerWindow.cs. It will allow sorting tree by node name.

   public BrowserTreeView()
   {
    this.ShowLines = false;
    this.HotTracking = true;
    this.HideSelection = false;
    this.TreeViewNodeSorter = new NodeSorter();
    ...
   }

      // Create a node sorter that implements the IComparer interface.
      public class NodeSorter : IComparer
      {
        public int Compare(object x, object y)
        {
          if (x == null || y == null)
          {
            return ((IComparable)x).CompareTo(y);
          }
          else
          {
            Boolean isXAssemblyNode = x is AssemblyNode;
            Boolean isYAssemblyNode = y is AssemblyNode;

            if (isXAssemblyNode == true && isYAssemblyNode == false)
            {
              return (-1);
            }
            else if (isXAssemblyNode == false && isYAssemblyNode == true)
            {
              return (1);
            }
            else if (isXAssemblyNode == true && isYAssemblyNode == true)
            {
              return String.Compare(((AssemblyNode)x).Text, ((AssemblyNode)y).Text);
            }
            else
            {
              Boolean isXResourceNode = x is ResourceNode;
              Boolean isYResourceNode = y is ResourceNode;

              if (isXResourceNode == true && isYResourceNode == false)
              {
                return (-1);
              }
              else if (isXResourceNode == false && isYResourceNode == true)
              {
                return (1);
              }
              else if (isXResourceNode == true && isYResourceNode == true)
              {
                return String.Compare(((ResourceNode)x).Text, ((ResourceNode)y).Text);
              }
              else
              {
                Boolean isXBamlNode = x is BamlNode;
                Boolean isYBamlNode = y is BamlNode;

                if (isXBamlNode == true && isYBamlNode == false)
                {
                  return (-1);
                }
                else if (isXBamlNode == false && isYBamlNode == true)
                {
                  return (1);
                }
                else if (isXBamlNode == true && isYBamlNode == true)
                {
                  return String.Compare(((BamlNode)x).Text, ((BamlNode)y).Text);
                }
                else
                {
                  return 0;
                }
              }
            }
          }
        }
      }