Exemplo n.º 1
0
 internal void _elementsMgr_Removing(IElements sender, ElementCollectionEventArgs ea)
 {
     throw new NotImplementedException("The method or operation is not implemented:  WorkSpace._elementsMgr_Removing.");
 }
Exemplo n.º 2
0
 internal void _elementsMgr_Removed(IElements sender, ElementCollectionEventArgs ea)
 {
     if (sender != null)
     {
         for (int i = 0; i < ea.Elements.Length; i++)
         {
             ClearSubscriptions(ea.Elements[i]);
         }
         if (ea.Elements.Length > 0)
         {
             var arg = new ElementInstancesDeletedEventArgs(ea.Elements);
             OnElementInstancesDeleted(arg);
         }
     }
 }
Exemplo n.º 3
0
        /// <summary>
        /// Handles the <see cref="IElements"/>.<see cref="Added"/> event which is fired when an element is added
        /// to the elements mgr of this workspace.
        /// </summary>
        internal void _elementsMgr_Added(IElements sender, ElementCollectionEventArgs ea)
        {
            if (sender != null)
            {
                // subscribe to the StatusChange events when an element is added to the elements mgr.
                for (int i = 0; i < ea.Elements.Length; i++)
                {
                    ea.Elements[i].StatusChanged += new StatusChangeEventHandler<IElement, ElementStatusChangeEventArgs>(element_StatusChanged);
                    ea.Elements[i].RequestVariableValues+=new RequestVariableValuesEventHandler<IElement>(element_RequestVariableValues);
                    ea.Elements[i].SelectionChanged += new SelectionEventHandler<IElement, SelectionEventArgs>(element_SelectionChanged);
                }

                // fire the event which confirms to subscribers that the element(s) has been successfully added.  This
                // is the final confirmation of a successful addition of an element.
                if (ea.Elements.Length > 0)
                {
                    ElementInstancesAddedEventArgs arg = new ElementInstancesAddedEventArgs(ea.Elements);
                    OnElementInstancesAdded(arg);
                }

                //ExecMgr mgr = new ExecMgr();
               // mgr.BuildExecOrder(ElementsMgr);
            }
        }
Exemplo n.º 4
0
 internal void _elementsMgr_Modifying(IElements sender, ElementCollectionEventArgs ea)
 {
     throw new NotImplementedException("The method or operation is not implemented.");
 }
Exemplo n.º 5
0
        public void _elementsMgr_AddedEventHandlerFiresElementInstancesAddedEventWhenElementsAreSuccessfullyAdded()
        {
            var wkSpce = new WorkSpace();
            // verify the event handler fires the event by catching it with a helper event handler.
            var mockElMgr = new Mock<IElements>();
            var mockEl = new Mock<IElement>();

            var helper = new HelperForWorkSpaces();
            wkSpce.ElementInstancesAdded += new InstanceAddedEventHandler<IWorkSpace, ElementInstancesAddedEventArgs>(helper.ElementInstancesAdded_DummyHandler);

            var ea = new ElementCollectionEventArgs(CollectionEventArgs.CollectionAction.Add, mockEl.Object);

            wkSpce.ElementsMgr = mockElMgr.Object;
            wkSpce._elementsMgr_Added(mockElMgr.Object, ea);
            Assert.Equal(1, helper.ElementInstancesAdded_TimesHandled);
        }