/// <summary>
        /// Asynchroniously get the spectal data from the file
        /// </summary>
        /// <param name="file"></param>
        /// <returns></returns>
        public async Task GetSpecDataAsync(string file)
        {
            //check the input
            if (String.IsNullOrWhiteSpace(file))
            {
                return;
            }

            try
            {
                //get the type of spectral data
                Type specType = SpectralData.GetSpectralDataType(file);
                //create an instance so we can actually use it
                specdata = Activator.CreateInstance(specType, new string[] { file }) as SpectralData;

                //initilize the spectral data object
                await specdata.LoadDataAsync(matches.Peaks);

                SetPersistentLibraryMatches();
                //apply the peaks to the lines
                matches.SpecData = specdata;
                OnPropertyChanged("InputFile");
            }
            catch (System.Runtime.InteropServices.COMException)
            {
                DialogViewModel dialogViewModel = new DialogViewModel("Could not open: " + file, "Exeption: Bad File", true, false);
                dialogService.ShowDialog(dialogViewModel);
            }
            catch (IndexOutOfRangeException)
            {
                DialogViewModel dialogViewModel = new DialogViewModel("File: " + file + " did not contain any peak inforamtion", "Exeption: Bad File", true, false);
                dialogService.ShowDialog(dialogViewModel);
            }
            catch (System.IO.IOException)
            {
                DialogViewModel dialogViewModel = new DialogViewModel("File: " + file + " is in use by another program", "Exeption: File in Use", true, false);
                dialogService.ShowDialog(dialogViewModel);
            }
            catch (System.IO.FileFormatException ex)
            {
                DialogViewModel dialogViewModel = new DialogViewModel($"File: {file} \n\n{ex.Message}", "Exeption: File Format", true, false);
                dialogService.ShowDialog(dialogViewModel);
            }
            catch (Exception ex)
            {
                DialogViewModel dialogViewModel = new DialogViewModel(ex.Message + ":\n" + ex.StackTrace, "General Exception", true, false);
                dialogService.ShowDialog(dialogViewModel);
            }
        }
        public SpectralSettingsViewModel(SpectralData data)
        {
            OkCommand     = new RelayCommand(P => CloseRequested?.Invoke(this, new DialogCloseRequestEventArgs(true)));
            CancelCommand = new RelayCommand(P => CloseRequested?.Invoke(this, new DialogCloseRequestEventArgs(false)));

            UpDownCommand = new RelayCommand(UpDownCommand_Execute, CanUpDownExecute);
            CopyCommand   = new RelayCommand(CopyCommand_Execute, CanCopyExecute);

            this.data      = data;
            RectangleItems = new ObservableCollection <Rectangle>();
            LineItems      = new ObservableCollection <Line>();
            TextItems      = new ObservableCollection <ChartText>();

            EfficiencyMeasurements.CollectionChanged += EfficiencyMeasurements_CollectionChanged;
            WriteEfficiencyEquation();
        }