public void Loaded(ViewLoadedParams p)
        {
            viewLoadedParams = p;
            dynamoWindow     = p.DynamoWindow;
            var viewModel = dynamoWindow.DataContext as DynamoViewModel;

            logger = viewModel.Model.Logger;

            Notifications = new ObservableCollection <Logging.NotificationMessage>();

            notificationHandler = (notificationMessage) =>
            {
                Notifications.Add(notificationMessage);
                AddNotifications();
            };

            p.NotificationRecieved += notificationHandler;

            //add a new menuItem to the Dynamo mainMenu.
            notificationsMenuItem = new NotificationsMenuItem(this);
            //null out the content of the notificationsMenu to get rid of
            //the parent of the menuItem we created
            (notificationsMenuItem.MenuItem.Parent as ContentControl).Content = null;
            //place the menu into the DynamoMenu
            p.dynamoMenu.Items.Add(notificationsMenuItem.MenuItem);
        }
 public void Dispose()
 {
     UnregisterEventHandlers();
     //for some reason the menuItem was not being gc'd in tests without manually removing it
     viewLoadedParams.dynamoMenu.Items.Remove(notificationsMenuItem.MenuItem);
     BindingOperations.ClearAllBindings(notificationsMenuItem.CountLabel);
     notificationsMenuItem = null;
 }
 public void Dispose()
 {
     UnregisterEventHandlers();
     //for some reason the menuItem was not being gc'd in tests without manually removing it
     viewLoadedParams.dynamoMenu.Items.Remove(notificationsMenuItem.MenuItem);
     BindingOperations.ClearAllBindings(notificationsMenuItem.CountLabel);
     notificationsMenuItem = null;
 }
        public void Loaded(ViewLoadedParams p)
        {
            dynamoWindow = p.DynamoWindow;

            p.NotificationRecieved += (notificationMessage) =>
            {
                Notifications.Add(notificationMessage);
            };
             
           
            Notifications = new ObservableCollection<Logging.NotificationMessage>();

            //add a new menuItem to the Dynamo mainMenu.
            var notificationsMenuItem = new NotificationsMenuItem(this);
            //null out the content of the notificationsMenu to get rid of 
            //the parent of the menuItem we created
            (notificationsMenuItem.MenuItem.Parent as ContentControl).Content = null;
            //place the menu into the DynamoMenu
            p.dynamoMenu.Items.Add(notificationsMenuItem.MenuItem);
        }