/// <summary> /// Constructor /// </summary> public NotifyingScopeNode() { // define views that can be used normalMessageViewDescription = new MessageViewDescription(); normalMessageViewDescription.DisplayName = "Normal Message View"; normalMessageViewDescription.ViewType = typeof(NormalMessageView); errorMessageViewDescription = new MessageViewDescription(); errorMessageViewDescription.DisplayName = "Simulated Error Message View"; errorMessageViewDescription.ViewType = typeof(ErrorMessageView); // define actions that can be used changeToNormalAction = new Action("Show Normal", "Switches the view to the normal view", -1, "ShowNormal"); changeToErrorAction = new Action("Simulate an Error", "Switches the view to an error handling view", -1, "ShowError"); // set the node name this.DisplayName = "On Scope Node Change Sample"; // set starting view description this.ViewDescriptions.Add(normalMessageViewDescription); this.ViewDescriptions.DefaultIndex = 0; // add starting action to show an 'error' this.ActionsPaneItems.Clear(); this.ActionsPaneItems.Add(changeToErrorAction); }
/// <summary> /// Adds a view description and set it as the default /// </summary> /// <param name="displayName"></param> /// <param name="viewType"></param> public void AddViewDescription(string displayName, Type viewType) { // add the view description (display name is required) MessageViewDescription mvd = new MessageViewDescription(); mvd.DisplayName = displayName; mvd.ViewType = viewType; this.ViewDescriptions.Add(mvd); }
/// <summary> /// Constructor /// </summary> public MessageViewSnapIn() { // update scope pane with a node in the tree this.RootNode = new ScopeNode(); this.RootNode.DisplayName = "MessageView Sample"; // set up the update result pane when scope node selected MessageViewDescription mvd = new MessageViewDescription(); mvd.DisplayName = "Hello World"; mvd.BodyText = "This is a MessageView. You can attach it to any scope node."; mvd.IconId = MessageViewIcon.Information; // attach the view and set it as the default to show this.RootNode.ViewDescriptions.Add(mvd); this.RootNode.ViewDescriptions.DefaultIndex = 0; }