예제 #1
0
        public static Task<List<ControlSystemAlarmResponse>> GetControlSystemAlarmResponses()
        {
            var task = new TaskCompletionSource<List<ControlSystemAlarmResponse>>();
            var cee = new CmsWebServiceClient(Utils.WcfBinding, Utils.WcfEndPoint);

            cee.GetControlSystemAlarmResponsesCompleted += (s, e) => task.SetResult(e.Result);
            cee.GetControlSystemAlarmResponsesAsync();
            return task.Task;
        }
        private void LoadAlarmResponses(NodeView expandedNode)
        {
            var cmsWebServiceClient = new CmsWebServiceClient(Utils.WcfBinding, Utils.WcfEndPoint);

            EventHandler<GetControlSystemAlarmResponsesCompletedEventArgs> fetchCompleted = null;
            fetchCompleted = (s, eventArgs) =>
            {
                var alarmResponses = eventArgs.Result;
                if (alarmResponses != null)
                {
                    foreach (var response in alarmResponses)
                    {
                        var child = new NodeView(expandedNode)
                        {
                            Id = response.Id,
                            Name = response.Name,
                            Description = response.Description,
                            Icon = "/CmsEquipmentDatabase;component/Images/Configuration.png",
                            Type = NodeType.AlarmResponseNode,
                            HasChildren = false,
                            SortField = response.Ordinal.ToString()
                        };
                        expandedNode.Children.Add(child);
                    }
                    Utils.HideSpinner(expandedNode);
                    expandedNode.Sort();
                }
            };
            cmsWebServiceClient.GetControlSystemAlarmResponsesCompleted += fetchCompleted;
            cmsWebServiceClient.GetControlSystemAlarmResponsesAsync();
        }