private async Task LoadSniff() { LoadingInProgress = true; FilteringInProgress = true; AssertNoOnGoingTask(); currentActionToken = new CancellationTokenSource(); try { var packets = await sniffLoader.LoadSniff(solutionItem.File, currentActionToken.Token, this); if (currentActionToken.IsCancellationRequested) { LoadingInProgress = false; currentActionToken = null; return; } using (AllPackets.SuspendNotifications()) { foreach (var packet in packets.Packets_) { AllPackets.Add(packetViewModelCreator.Process(packet) !); } } } catch (ParserException e) { await messageBoxService.ShowDialog(new MessageBoxFactory <bool>() .SetIcon(MessageBoxIcon.Error) .SetTitle("Error with parser") .SetMainInstruction("Parser error") .SetContent(e.Message) .WithOkButton(false) .Build()); if (CloseCommand != null) { await CloseCommand.ExecuteAsync(); } } catch (Exception e) { Console.WriteLine(e.ToString()); } FilteringProgress = -1; await SplitPacketsIfNeededAsync().ConfigureAwait(true); LoadingInProgress = false; FilteringInProgress = false; currentActionToken = null; await ApplyFilterCommand.ExecuteAsync(); }
public override async void ViewAppearing() { base.ViewAppearing(); MediaUrl = string.Empty; // Download the Playfield Display await Task.Run(async() => { var response = await _server.GetDisplay(_display); if (response.Success) { MediaUrl = response.MediaUrl; } else { _dialogService.Show(Translation.alert_display_failed_title, response.Error, Translation.general_close, async() => await CloseCommand?.ExecuteAsync()); } }); }