protected async override void OnAppearing() { base.OnAppearing(); if (Events.Count == 0) { Task alert = null; try { IsLoading = true; CommandIssued = true; string xml_scan; if (RemoteDevice.Components.Count == 0) { xml_scan = await RemoteDevice.Send(Protocol.ScanHardware); await RemoteDevice.LoadComponents(xml_scan); } xml_scan = await RemoteDevice.Send(Protocol.ScanEvents); await RemoteDevice.LoadEvents(xml_scan); CommandIssued = false; } catch (Exception ex) { alert = DisplayAlert("Error", "Could not load the events. Reason:\r\n" + ex.Message, "OK"); return; } finally { IsLoading = false; if (alert != null) { await alert; } } } if (PageStack.Children.Contains(LoadingIndicator)) { PageStack.Children.Remove(LoadingIndicator); } }
protected async override void OnAppearing() { base.OnAppearing(); if (Components.Count == 0) { IsLoading = true; Task alert = null; try { string xml_scan = await RemoteDevice.Send(Protocol.ScanHardware); await RemoteDevice.LoadComponents(xml_scan); } catch (Exception ex) { alert = DisplayAlert("Error", "Could not load the components. Reason:\r\n" + ex.Message, "OK"); return; } finally { IsLoading = false; if (alert != null) { await alert; } } } if (PageStack.Children.Contains(LoadingIndicator)) { PageStack.Children.Remove(LoadingIndicator); } RemoteDevice.CollectorFailed += CollectorFailed; RemoteDevice.RunCollector(); HasComponents = true; }