Пример #1
0
        /// <summary>
        /// Browse the tree nodes
        /// </summary>
        /// <param name="id"></param>
        /// <param name="parentId"></param>
        /// <param name="direction"></param>
        private async Task BrowseTreeAsync(BrowseDirection direction, int index, bool isLoadingMore, string id = null, List <string> parentId = null)
        {
            IsLoading = true;

            if (!isLoadingMore)
            {
                ParentId = parentId;
                Items    = await BrowseManager.GetTreeAsync(EndpointId,
                                                            id,
                                                            parentId,
                                                            DiscovererId,
                                                            direction,
                                                            index,
                                                            Credential);
            }
            else
            {
                Items = await BrowseManager.GetTreeNextAsync(EndpointId,
                                                             ParentId,
                                                             DiscovererId,
                                                             Credential,
                                                             Items);
            }

            PublishedNodes = await Publisher.PublishedAsync(EndpointId, false);

            foreach (var node in Items.Results)
            {
                if (node.NodeClass == NodeClass.Variable)
                {
                    node.Value = await BrowseManager.ReadValueAsync(EndpointId, node.Id, Credential);

                    // check if publishing enabled
                    foreach (var publishedNode in PublishedNodes.Results)
                    {
                        if (node.Id == publishedNode.PublishedItem.NodeId)
                        {
                            node.PublishedItem = publishedNode.PublishedItem;
                            node.Publishing    = true;
                            break;
                        }
                    }
                }
            }

            if (string.IsNullOrEmpty(DiscovererId))
            {
                NavigationManager.NavigateTo(NavigationManager.BaseUri + "browser/" + "/" + ApplicationId + "/" + EndpointId);
            }
            else
            {
                NavigationManager.NavigateTo(NavigationManager.BaseUri + "browser/" + "/" + DiscovererId + "/" + ApplicationId + "/" + SupervisorId + "/" + EndpointId);
            }
            IsLoading = false;
        }
Пример #2
0
        /// <summary>
        /// Browse the tree nodes
        /// </summary>
        /// <param name="id"></param>
        /// <param name="parentId"></param>
        /// <param name="direction"></param>
        private async Task BrowseTreeAsync(BrowseDirection direction, int index, bool firstPage, int page, string id = null, List <string> parentId = null)
        {
            CommonHelper.Spinner = "loader-big";

            if (firstPage)
            {
                ParentId = parentId;
                NodeList = await BrowseManager.GetTreeAsync(EndpointId,
                                                            id,
                                                            parentId,
                                                            DiscovererId,
                                                            direction,
                                                            index,
                                                            Credential);
            }
            else
            {
                NodeList = await BrowseManager.GetTreeNextAsync(EndpointId,
                                                                ParentId,
                                                                DiscovererId,
                                                                Credential,
                                                                NodeList);
            }

            PublishedNodes = await Publisher.PublishedAsync(EndpointId, false);

            foreach (var node in NodeList.Results)
            {
                if (node.NodeClass == NodeClass.Variable)
                {
                    // check if publishing enabled
                    foreach (var publishedNode in PublishedNodes.Results)
                    {
                        if (node.Id == publishedNode.PublishedItem.NodeId)
                        {
                            node.PublishedItem = publishedNode.PublishedItem;
                            node.Publishing    = true;
                            break;
                        }
                    }
                }
            }

            PagedNodeList = NodeList.GetPaged(page, CommonHelper.PageLength, NodeList.Error);
            if (string.IsNullOrEmpty(DiscovererId))
            {
                NavigationManager.NavigateTo(NavigationManager.BaseUri + "browser/" + page + "/" + ApplicationId + "/" + EndpointId);
            }
            else
            {
                NavigationManager.NavigateTo(NavigationManager.BaseUri + "browser/" + page + "/" + DiscovererId + "/" + ApplicationId + "/" + SupervisorId + "/" + EndpointId);
            }
            CommonHelper.Spinner = "";
        }