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(); }
private void Create_SystemConsole() { systemConsole = new SystemConsole(); new SystemConsoleController(systemConsole); systemConsole.MdiParent = this; systemConsole.Show(); }
private async Task LoadJSonFile(string file) { try { UiDispatcher.RunOnUIThread(() => { SystemConsole.Show(); }); AppendMessage("Loading " + file); ShowStatus("Loading " + file); JSonDataLog data = new JSonDataLog(); await data.Load(file, progress); //logs.Add(data); ShowSchema(); LoadFlights(data); } catch (Exception ex) { AppendMessage("### Error loading json file: " + ex.Message); } ShowStatus("Done Loading " + file); UpdateButtons(); }
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 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(); }
public MainForm() { InitializeComponent(); Settings s = new Settings(); if (s.ShowConsole) { SystemConsole.Show(); Trace.Listeners.Add(new ConsoleTraceListener()); } miShowConsole.Checked = s.ShowConsole; ready = true; }
private async void OnOpenFile(object sender, RoutedEventArgs e) { OpenButton.IsEnabled = false; Microsoft.Win32.OpenFileDialog fo = new Microsoft.Win32.OpenFileDialog(); fo.Filter = "PX4 Log Files (*.px4log)|*.px4log|CSV Files (*.csv)|*.csv|bin files (*.bin)|*.bin|mavlink files (*.mavlink)|*.mavlink|JSON files (*.json)|*.json"; fo.CheckFileExists = true; fo.Multiselect = true; if (fo.ShowDialog() == true) { SystemConsole.Show(); foreach (var file in fo.FileNames) { switch (System.IO.Path.GetExtension(file).ToLowerInvariant()) { case ".csv": await Task.Run(async() => { await LoadCsvFile(file); }); break; case ".bin": case ".px4log": await Task.Run(async() => { await LoadBinaryFile(file); }); break; case ".mavlink": await Task.Run(async() => { await LoadMavlinkFile(file); }); break; case ".json": await Task.Run(async() => { await LoadJSonFile(file); }); break; default: MessageBox.Show("Do not know how to read files of type : " + System.IO.Path.GetExtension(file), "Unsupported file extension", MessageBoxButton.OK, MessageBoxImage.Exclamation); break; } } ShowTotalFlightTime(); } OpenButton.IsEnabled = true; }
void MiShowConsoleCheckedChanged(object sender, EventArgs e) { if (!ready) { return; } Settings s = new Settings(); s.ShowConsole = miShowConsole.Checked; s.Save(); if (miShowConsole.Checked) { SystemConsole.Show(); Trace.Listeners.Add(new ConsoleTraceListener()); } else { Trace.Listeners.Clear(); SystemConsole.Free(); } }
private void GraphItem(LogItemSchema schema) { if (schema.IsNumeric) { ChartStack.Visibility = Visibility.Visible; ChartStack.UpdateLayout(); SimpleLineChart chart = new SimpleLineChart(); chart.Margin = defaultChartMargin; chart.Focusable = false; chart.Closed += OnChartClosed; chart.LineColor = GetRandomColor(); chart.StrokeThickness = 1; chart.Tag = schema; if (currentFlightLog != null && schema.Root == currentFlightLog.Schema) { List <DataValue> values = new List <DataValue>(currentFlightLog.GetDataValues(schema, DateTime.MinValue, TimeSpan.MaxValue)); InitializeChartData(schema, chart, values); // now turn on live scrolling... chart.LiveScrolling = true; // the X values are in microseconds (s0 the numerator is the speed of scrolling). chart.LiveScrollingXScale = 50.0 / 1000000.0; liveScrolling.Add(chart); // now start watching the live update for new values that need to be added to this chart. Task.Run(() => { LiveUpdate(chart, currentFlightLog, schema); }); } else { List <DataValue> values = new List <DataValue>(GetSelectedDataValues(schema)); if (values.Count > 0) { InitializeChartData(schema, chart, values); } else { chart = null; } ShowStatus(string.Format("Found {0} data values", values.Count)); } if (chart != null) { if (chartGroup != null) { chartGroup.AddChart(chart); if (chartGroup.Parent == null) { ChartStack.AddChartGroup(chartGroup); } } else { ChartStack.AddChart(chart); } LayoutCharts(); } ConsoleButton.IsChecked = false; SystemConsole.Hide(); } else { StringBuilder sb = new StringBuilder(); foreach (var value in GetSelectedDataValues(schema)) { sb.AppendLine(value.Label); } SystemConsole.Write(sb.ToString()); ConsoleButton.IsChecked = true; SystemConsole.Show(); } }
private void OnShowConsole(object sender, RoutedEventArgs e) { SystemConsole.Show(); }
public MainForm() { InitializeComponent(); Settings s = new Settings(); if (s.ShowConsole) { SystemConsole.Show(); Trace.Listeners.Add(new ConsoleTraceListener()); } miShowConsole.Checked = s.ShowConsole; miEnableLock.Checked = s.EnableLock; cbLock.Visible = s.EnableLock; /* WIFI HANDOVER */ /* ------------- */ /*WifiHandoverButton = new TypeSelectButton("Wifi Handover"); * WifiHandoverButton.Dock = DockStyle.Top; * pLeft.Controls.Add(WifiHandoverButton); * WifiHandoverButton.OnSelected = new System.EventHandler(OnWifiHandoverSelected);*/ /* VCARD */ /* ----- */ VCardButton = new TypeSelectButton("vCard"); VCardButton.Dock = DockStyle.Top; pLeft.Controls.Add(VCardButton); VCardButton.OnSelected = new System.EventHandler(OnVCardSelected); /* MEDIA */ /* ----- */ MediaButton = new TypeSelectButton("MIME Media"); MediaButton.Dock = DockStyle.Top; pLeft.Controls.Add(MediaButton); MediaButton.OnSelected = new System.EventHandler(OnMediaSelected); /* TEXT */ /* ---- */ TextButton = new TypeSelectButton("Text"); TextButton.Dock = DockStyle.Top; pLeft.Controls.Add(TextButton); TextButton.OnSelected = new System.EventHandler(OnTextSelected); /* URI */ /* --- */ UriButton = new TypeSelectButton("URI"); UriButton.Dock = DockStyle.Top; pLeft.Controls.Add(UriButton); UriButton.OnSelected = new System.EventHandler(OnUriSelected); /* SMARTPOSTER */ /* ----------- */ SmartPosterButton = new TypeSelectButton("SmartPoster"); SmartPosterButton.Dock = DockStyle.Top; pLeft.Controls.Add(SmartPosterButton); SmartPosterButton.OnSelected = new System.EventHandler(OnSmartPosterSelected); /* Default is URI */ SelectUri(); Trace.WriteLine("Starting up"); ready = true; }