public void HandleMessage(MessageBase message, SendHostMessageDelegate sendHostMessage) { var msg = message as ClientDeletePlaylist; if (msg == null) { throw new ArgumentException("Message is not the right type"); } var op = new DeletePlaylistOp(msg.PlaylistID); var qae = _getQae(); op.OpFinished += (s, e) => { ActionResponse resp; if (e.Status == OpStatus.Complete) { _getConfig().Config = qae.GetCurrentConfig(); resp = new ActionResponse() { ResponseToMessageID = msg.MessageID, Success = true }; } else { resp = new ActionResponse() { ResponseToMessageID = msg.MessageID, Success = false, ErrorMessage = e.Exception?.Message ?? "An error occurred" }; } sendHostMessage(resp); }; qae.OpManager.QueueOp(op); }
public void HandleMessage(MessageBase message) { var msg = message as ClientDeletePlaylist; if (msg == null) { throw new ArgumentException("Message is not the right type"); } var op = new DeletePlaylistOp(msg.PlaylistID); var qae = _getQae(); op.OpFinished += (s, e) => { if (e.Status == OpStatus.Complete) { _getConfig().Config = qae.GetCurrentConfig(); } }; qae.OpManager.QueueOp(op); }