public void CheckPort() { PortCheckStatus = PortCheckStatus.Checking; CheckPortAsync().ContinueWith(prev => { if (prev.IsCanceled || prev.IsFaulted) { PortCheckStatus = PortCheckStatus.Failed; } else { PortCheckStatus = prev.Result; } }); }