예제 #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
        private async Task WriteAsync(string nodeId, string value)
        {
            Response = await BrowseManager.WriteValueAsync(EndpointId, nodeId, value, Credential);

            var newValue = await BrowseManager.ReadValueAsync(EndpointId, nodeId, Credential);

            var index = PagedNodeList.Results.IndexOf(PagedNodeList.Results.SingleOrDefault(x => x.Id == nodeId));

            PagedNodeList.Results[index].Value = newValue;
            ResponseClass = "list-group-item margin body-action-content visible";
        }
예제 #3
0
 /// <summary>
 /// Notify page change
 /// </summary>
 /// <param name="page"></param>
 public async Task PagerPageChangedAsync(int page)
 {
     CommonHelper.Spinner = "loader-big";
     StateHasChanged();
     if (!string.IsNullOrEmpty(NodeList.ContinuationToken) && page > PagedNodeList.PageCount)
     {
         await BrowseTreeAsync(BrowseDirection.Forward, 0, false, page);
     }
     PagedNodeList = NodeList.GetPaged(page, CommonHelper.PageLength, null);
     foreach (var node in PagedNodeList.Results)
     {
         //fetch the actual value
         if (node.NodeClass == NodeClass.Variable)
         {
             node.Value = await BrowseManager.ReadValueAsync(EndpointId, node.Id, Credential);
         }
     }
     CommonHelper.Spinner = string.Empty;
     StateHasChanged();
 }
예제 #4
0
        private async Task ReadAsync(string nodeId)
        {
            Response = await BrowseManager.ReadValueAsync(EndpointId, nodeId, Credential);

            ResponseClass = "list-group-item text-left margin body-action-content visible";
        }