public static Task<List<ControlSystemAlarmColour>> GetControlSystemAlarmColours() { var task = new TaskCompletionSource<List<ControlSystemAlarmColour>>(); var cee = new CmsWebServiceClient(Utils.WcfBinding, Utils.WcfEndPoint); cee.GetControlSystemAlarmColoursCompleted += (s, e) => task.SetResult(e.Result); cee.GetControlSystemAlarmColoursAsync(); return task.Task; }
private void LoadAlarmColours(NodeView expandedNode) { var cmsWebServiceClient = new CmsWebServiceClient(Utils.WcfBinding, Utils.WcfEndPoint); EventHandler<GetControlSystemAlarmColoursCompletedEventArgs> fetchCompleted = null; fetchCompleted = (s, eventArgs) => { var alarmColours = eventArgs.Result; if (alarmColours != null) { foreach (var alarmColour in alarmColours) { var child = new NodeView(expandedNode) { Id = alarmColour.Id, Name = alarmColour.Name, Description = alarmColour.Description, Icon = "/CmsEquipmentDatabase;component/Images/Configuration.png", Type = NodeType.AlarmColourNode, HasChildren = false, SortField = alarmColour.Name }; expandedNode.Children.Add(child); } Utils.HideSpinner(expandedNode); expandedNode.Sort(); } }; cmsWebServiceClient.GetControlSystemAlarmColoursCompleted += fetchCompleted; cmsWebServiceClient.GetControlSystemAlarmColoursAsync(); }