/// <summary> /// Gather files from args if application is loaded fully (that means Current.MainWindow isn't null). /// </summary> /// <param name="args"></param> /// <returns></returns> private async Task WaitForApplicationLaunchFully(string[] args) { await AsyncExtension.WaitUntil(() => Current.MainWindow == null); string[] foundSoundFiles = ((MainWindow)Current.MainWindow).CheckSoundFiles(args); string[] playlistFiles = ((MainWindow)Current.MainWindow).CheckPlaylist(args); await((MainWindow)Current.MainWindow).AddFiles(foundSoundFiles); foreach (string path in playlistFiles) { _ = ((MainWindow)Current.MainWindow).LoadPlaylist(path); } }
private async Task <bool> _handle(Type handler_type, AbstractClientReceiveCallback callback, NetworkElement element, NetworkContentElement content) { if (!GetHandler(element.protocolID)) { return(true); } if (handler_type is null) { return(true); } AbstractMessageHandler handler = Activator.CreateInstance(handler_type, new object[] { callback, element, content }) as AbstractMessageHandler; await AsyncExtension.ExecuteAsync(handler.Handle, handler.EndHandle, handler.Error); return(handler.IsForwardingData); }