private void HexColorTextBox_TextChanged(object sender, System.Windows.Controls.TextChangedEventArgs e) { string hexColor = HexColorTextBox.Text; if (hexColor.Length == 4 || hexColor.Length == 7 || hexColor.Length == 9) { Regex regex = new Regex(@"#([a-fA-F0-9]{6}|[a-fA-F0-9]{3}|[a-fA-F0-9]{8})"); if (regex.IsMatch(hexColor)) { HexColorTextBox.Foreground = new SolidColorBrush((Color)ColorConverter.ConvertFromString(ColorManager.Secondary900)); try { ColorPicker.Color = (Color)ColorConverter.ConvertFromString(hexColor); } catch (Exception exception) { ShowError.ShowErrorMessage(exception.Message); } } else { HexColorTextBox.Foreground = new SolidColorBrush((Color)ColorConverter.ConvertFromString(ColorManager.Primary900)); } } else { HexColorTextBox.Foreground = new SolidColorBrush((Color)ColorConverter.ConvertFromString(ColorManager.Primary900)); } }
private void WorkerCompleted(object sender, RunWorkerCompletedEventArgs e) { if (progressBar != null && progressBarGrid != null) { progressBarGrid.Visibility = Visibility.Hidden; progressBar.IsIndeterminate = true; } if (!processingError) { var inputFile = new DriverlessInputFile(InputFileManager.LastID + 1, FileNameWithoutPath, channels); //TODO: ha lesz standard input file is, akkor azt még előbb kell eldönteni vagy utána rögtön válassza ki és utána nézzem meg hogy ezek benne vannak e. var yChannel = inputFile.GetChannel("y"); if (yChannel == null) { ShowError.ShowErrorMessage("Can't find 'y' channel, so the track will not shown"); } var c0refChannel = inputFile.GetChannel("c0ref"); if (c0refChannel == null) { ShowError.ShowErrorMessage("Can't find 'c0ref' channel, so the track will not shown"); } InputFileManager.AddInputFile(inputFile); InputFileManager.ActiveInputFileName = FileNameWithoutPath; ((InputFilesSettings)((SettingsMenu)MenuManager.GetTab(TextManager.SettingsMenuName).Content).GetTab(TextManager.FilesSettingsName).Content).AddInputFileSettingsItem(inputFile); ((DriverlessMenu)MenuManager.GetTab(TextManager.DriverlessMenuName).Content).UpdateAfterReadFile(); ((GroupSettings)((SettingsMenu)MenuManager.GetTab(TextManager.SettingsMenuName).Content).GetTab(TextManager.GroupsSettingsName).Content).UpdateAfterReadFile(FileNameWithoutPath); } }
private void WorkerDoWork(object sender, DoWorkEventArgs e) { try { ProcessFile(fileName); } catch (Exception exception) { Application.Current.Dispatcher.Invoke(() => { ShowError.ShowErrorMessage(exception.Message); processingError = true; }); } Application.Current.Dispatcher.Invoke(() => { progressBar.Value = 0; progressBar.IsIndeterminate = true; }); }
/// <summary> /// Builds one <see cref="Chart"/> with the <paramref name="group"/>s values. /// </summary> /// <param name="group"><see cref="Group"/> that will shown on the <see cref="Chart"/></param> /// <returns>A <see cref="Chart"/> with the <paramref name="group"/>s values.</returns> private Chart BuildGroupChart(Group group) { var chart = new Chart(group.Name); int dataIndex = (int)DataSlider.Value; var addedChannelNames = new List <string>(); foreach (var channelName in ChannelNames) { var attribute = group.GetAttribute(channelName.Item1); if (attribute != null) { foreach (var inputFile in channelName.Item2) { int lineWidth = group.GetAttribute(channelName.Item1).LineWidth; var channel = GetChannel(inputFile.Item1, channelName.Item1); if (inputFile.Item2) // aktiv e a channel { var actHorizontalAxisData = GetChannel(inputFile.Item1, group.HorizontalAxis).Data; if (actHorizontalAxisData == null) { ShowError.ShowErrorMessage($"Can't find '{group.HorizontalAxis}', so can't show diagram properly"); } if (actHorizontalAxisData.Count > horizontalAxisData.Count) { horizontalAxisData = new List <double>(actHorizontalAxisData); } var channelDataPlotData = ConvertChannelDataToPlotData(channel.Data.ToArray(), actHorizontalAxisData); var color = group.GetAttribute(channel.Name).Color; chart.AddPlot(xAxisValues: channelDataPlotData.Item1, yAxisValues: channelDataPlotData.Item2, lineWidth: lineWidth, lineColor: ColorTranslator.FromHtml(color), xAxisLabel: group.HorizontalAxis); chart.AddSideValue(channelName: channelName.Item1, xAxisValues: channelDataPlotData.Item2, isActive: true, inputFileID: inputFile.Item1, color: color, lineWidth: lineWidth); } else { chart.AddSideValue(channelName: channelName.Item1, xAxisValues: new double[0], inputFileID: inputFile.Item1); } chart.AddChannelName(channelName.Item1); addedChannelNames.Add(channelName.Item1); } } } foreach (var attribute in group.Attributes) { if (!addedChannelNames.Contains(attribute.Name)) { chart.AddChannelName(attribute.Name); chart.AddSideValue(channelName: attribute.Name, xAxisValues: new double[0]); } } if (horizontalAxisData.Count > 0) { double xValue = dataIndex < horizontalAxisData.Count ? horizontalAxisData[dataIndex] : horizontalAxisData.Last(); chart.UpdateHighlight(xValue); } chart.SetAxisLimitsToAuto(); return(chart); }
public MainWindow() { InitializeComponent(); try { ConfigurationManager.LoadConfigurations(Path.Combine(MakeDirectoryPath("configuration_files"), TextManager.ConfigurationFileName)); Title = $"Telemetry {ConfigurationManager.Version}"; } catch (Exception exception) { ShowError.ShowErrorMessage(exception.Message); } try { UnitOfMeasureManager.InitializeUnitOfMeasures(Path.Combine(MakeDirectoryPath("default_files"), TextManager.UnitOfMeasuresFileName)); } catch (Exception exception) { ShowError.ShowErrorMessage(exception.Message); } try { DriverlessTrackManager.LoadTracks(Path.Combine(MakeDirectoryPath("default_files"), TextManager.DriverlessTracksFolderName)); } catch (Exception exception) { ShowError.ShowErrorMessage(exception.Message); } try { GroupManager.InitGroups(Path.Combine(MakeDirectoryPath("default_files"), TextManager.GroupsFileName)); } catch (Exception exception) { ShowError.ShowErrorMessage(exception.Message); } try { DefaultsManager.LoadDefaults(Path.Combine(MakeDirectoryPath("default_files"), TextManager.DefaultFileName)); } catch (Exception exception) { ShowError.ShowErrorMessage(exception.Message); } try { MenuManager.InitMainMenuTabs(MainMenuTabControl); } catch (Exception exception) { ShowError.ShowErrorMessage(exception.Message); } }