예제 #1
0
        private async Task LoadMavlinkFile(string file)
        {
            try
            {
                UiDispatcher.RunOnUIThread(() =>
                {
                    SystemConsole.Show();
                });
                AppendMessage("Loading " + file);
                ShowStatus("Loading " + file);

                MavlinkLog data = new MavlinkLog();
                await data.Load(file, progress);

                logs.Add(data);
                ShowSchema();

                Debug.WriteLine(data.StartTime.ToString());
                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();
        }
예제 #2
0
        private async Task LoadMavlinkFile(string file)
        {
            try
            {
                UiDispatcher.RunOnUIThread(() =>
                {
                    SystemConsole.Show();
                });
                AppendMessage("Loading " + file);
                ShowStatus("Loading " + file);

                MavlinkLog data = new MavlinkLog();
                await data.Load(file, progress);

                logs.Add(data);
                ShowSchema();

                Debug.WriteLine(data.StartTime.ToString());

                UiDispatcher.RunOnUIThread(() =>
                {
                    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();
                    }

                    foreach (var text in data.GetStatusMessages())
                    {
                        SystemConsole.Write(text + "\n");
                    }

                    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 LoadMavlinkFile(string file)
        {
            try
            {
                AppendMessage("Loading " + file);
                ShowStatus("Loading " + file);

                MavlinkLog data = new MavlinkLog();
                await data.Load(file, progress);

                logs.Add(data);
                ShowSchema();

                Debug.WriteLine(data.StartTime.ToString());

                UiDispatcher.RunOnUIThread(() =>
                {
                    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();
        }