private async Task LoadBinaryFile(string file) { try { UiDispatcher.RunOnUIThread(() => { SystemConsole.Show(); }); AppendMessage("Loading " + file); ShowStatus("Loading " + file); Px4DataLog data = new Px4DataLog(); await data.Load(file, progress); logs.Add(data); ShowSchema(); LoadFlights(data); // remember successfully loaded log file. Settings settings = await((App)App.Current).LoadSettings(); settings.LastLogFile = file; await settings.SaveAsync(); } catch (Exception ex) { AppendMessage("### Error loading log: " + ex.Message); } ShowStatus("Done Loading " + file); UpdateButtons(); }
private async Task LoadBinaryFile(string file) { try { UiDispatcher.RunOnUIThread(() => { SystemConsole.Show(); }); AppendMessage("Loading " + file); ShowStatus("Loading " + file); Px4DataLog data = new Px4DataLog(); await data.Load(file, progress); logs.Add(data); ShowSchema(); UiDispatcher.RunOnUIThread(() => { // add flights Flight entireLog = new Flight() { Name = "Log " + logs.Count, StartTime = data.StartTime, Duration = data.Duration }; allFlights.Add(entireLog); foreach (var flight in data.GetFlights()) { flight.Name = "Flight " + allFlights.Count; allFlights.Add(flight); AppendMessage("Motor started at {0} and ran for {1} ", flight.StartTime, flight.Duration); } if (myMap.Visibility == Visibility.Visible) { ShowMap(); } ShowTotalFlightTime(); }); // remember successfully loaded log file. Settings settings = await((App)App.Current).LoadSettings(); settings.LastLogFile = file; await settings.SaveAsync(); } catch (Exception ex) { AppendMessage("### Error loading log: " + ex.Message); } ShowStatus("Done Loading " + file); UpdateButtons(); }
private async Task LoadBinaryFile(string file) { try { AppendMessage("Loading " + file); ShowStatus("Loading " + file); Px4DataLog data = new Px4DataLog(); await data.Load(file, progress); logs.Add(data); ShowSchema(); Debug.WriteLine(data.StartTime.ToString()); UiDispatcher.RunOnUIThread(() => { // add flight for Flight entireLog = new Flight() { Name = "Log " + logs.Count, StartTime = data.StartTime, Duration = data.Duration }; allFlights.Add(entireLog); foreach (var flight in data.GetFlights()) { flight.Name = "Flight " + allFlights.Count; allFlights.Add(flight); AppendMessage("Motor started at {0} and ran for {1} ", flight.StartTime, flight.Duration); } if (myMap.Visibility == Visibility.Visible) { ShowMap(); } }); // remember successfully loaded log file. Settings settings = await ((App)App.Current).LoadSettings(); settings.LastLogFile = file; await settings.SaveAsync(); } catch (Exception ex) { AppendMessage("### Error loading log: " + ex.Message); } ShowStatus("Done Loading " + file); UpdateButtons(); }