public static ICoreObject GetLocalInterfaceCardByBoardConfiguration(this ILifelistService lifelist,
                                                                            IOamConfiguration physicalConfiguration)
        {
            ICoreObjectCollection localInterfaceCards = lifelist.GetLocalInterfaceCards(true);
            ICoreObject           coreBoard           = LifelistNavigator.FindCoreBoard(localInterfaceCards, physicalConfiguration.Board);

            return(coreBoard);
        }
 public static ICoreObject GetCoreObjectByName(this ICoreObjectCollection oc, string name)
 {
     foreach (ICoreObject o in oc)
     {
         if (o.GetObjectName() == name)
         {
             return(o);
         }
     }
     return(null);
 }
        public static List <string> GetNames(this ICoreObjectCollection oc)
        {
            List <string> names = new List <string>();

            foreach (ICoreObject o in oc)
            {
                string name = o.GetObjectName();
                names.Add(name);
            }

            return(names);
        }
        public static ICoreObject GetBoardConfigurationByName(this ILifelistService lifelist,
                                                              ICoreObject localBoard,
                                                              string ConfigurationName)
        {
            ICoreObjectCollection configurations = lifelist.GetAllBoardConfigurations(localBoard);

            foreach (ICoreObject config in configurations)
            {
                IOamIdentification attributes = CoreObjectExtension.GetAttributes <IOamIdentification>(config);
                if (attributes != null && attributes.OamName == ConfigurationName)
                {
                    return(config);
                }
            }
            return(null);
        }
        public static ICoreObject GetInterfaceCardByName(this ILifelistService lifelist,
                                                         string InterfaceCardName,
                                                         bool forceScan = true)
        {
            ICoreObjectCollection interfaces = lifelist.GetLocalInterfaceCards(forceScan);

            foreach (ICoreObject card in interfaces)
            {
                string name = card.GetObjectName();
                if (name == InterfaceCardName)
                {
                    return(card);
                }
            }
            return(null);
        }
        public static ICoreObject GetBoardConfigurationByName(this ILifelistService lifelist,
                                                              string ConfigurationName,
                                                              bool forceScan = true)
        {
            ICoreObjectCollection boards = lifelist.GetLocalInterfaceCards(forceScan);

            foreach (ICoreObject localBoard in boards)
            {
                var configurations = lifelist.GetAllBoardConfigurations(localBoard);
                foreach (ICoreObject config in configurations)
                {
                    var attributes = ObjectFrame.ICoreObjectExtensions.GetAttributes <IOamIdentification>(config);
                    if (attributes != null && attributes.OamName == ConfigurationName)
                    {
                        return(config);
                    }
                }
            }
            return(null);
        }
        public static int GetClientSession(
            this ILifelistService LifelistService,
            string address,
            string configName,
            string accessibleName,
            out ICoreObject AccessibleNode,
            ConnectionOpenedEventHandler connectionOpenedEventHandler = null
            )
        {
            ICoreObjectCollection boardConfigurations = ((IOnlineConfiguration)LifelistService.GetIConnectionService()).GetUsableConfigurations("OMS");
            ICoreObject           boardConfiguration  = LifelistService.GetBoardConfigurationByName(configName);


            ICoreObjectCollection accessibleNodes = LifelistService.GetAccessibleNodes(boardConfiguration, true);
            var names = accessibleNodes.GetNames();

            if (names.Contains(accessibleName))
            {
                AccessibleNode = accessibleNodes.GetCoreObjectByName(accessibleName);
                Type t            = AccessibleNode.GetType();
                var  onlineObject = LifelistService.GetOnlineNode(AccessibleNode);

                var connection = onlineObject.GetConnectionServiceProvider();
                var ConnectionServiceProviderProxy = new ConnectionServiceProviderProxy(connection);
                ConnectionServiceProviderProxy.ConnectionOpened += connectionOpenedEventHandler;

                IOamAddress oamAddress;
                int         createResult = OamObjectCreatorProxy.CreateAddress(address, out oamAddress);

                TargetConnectionInfo TargetConnectionInfo =
                    new TargetConnectionInfo(boardConfiguration, null, null, oamAddress);

                connection.SetTargetConnectionPath(onlineObject, TargetConnectionInfo);
                IConnection omsc = connection.ConnectToOnline(onlineObject, "OMS",
                                                              OnlineConnectionModes.UseTargetConnectionInfo,
                                                              TargetConnectionInfo);
                return(0);
            }
            AccessibleNode = null;
            return(-1);
        }
示例#8
0
 public InternalCoreObjectCollectionProxy(ICoreObjectCollection icoc, ISynchronizeInvoke synchronizer = null)
 {
     ICOC = icoc as InternalCoreObjectCollection;
     UsingSynchronizer = synchronizer;
 }