Ejemplo n.º 1
0
        private List <string> GetAvailableChannels(bool onlyWriteEnabled)
        {
            IWorkspace2 Workspace = this.WorkSpace;

            string[]      aliasOut    = { };
            string[]      channelOut  = { };
            NodeInfo[]    myNodeInfo  = { };
            List <string> channelList = new List <string>();

            ThrowExceptionIfVeriStandIsNotLaunched();

            //Jiri: It is enough to add aliases names to list directly. It can be used as variable name. I tested that

            Workspace.GetAliasList(out aliasOut, out channelOut);
            channelList = new List <string>();

            if (!onlyWriteEnabled)
            {
                foreach (string alias in aliasOut)
                {
                    channelList.Add("Aliases/" + alias);
                }
                //This is tricky, because I dind't find a way how to chech if the alias is read only. So the aliases will be published as read only
                //TODO: Alias chceck?
            }

            Workspace.GetSystemNodeChannelList("", out myNodeInfo);

            foreach (NodeInfo node in myNodeInfo)
            {
                if (node.IsChannel)
                {
                    if (onlyWriteEnabled)
                    {
                        if (node.IsWritable)
                        {
                            channelList.Add(node.FullPath);
                        }
                    }
                    else
                    {
                        channelList.Add(node.FullPath);
                    }
                }
                ;
            }

            //channelCount = channelList.Count;
            return(channelList);
        }