private void Apply_Button_Click(object sender, RoutedEventArgs e)                           //When the user clicks the apply button
        {
            DataVault.LineColors[DataVault.CallBackID - 1]   = Color_List.SelectedValue.ToString(); //save the color to the DataVault
            DataVault.LinePlotMode[DataVault.CallBackID - 1] = HexHandler.SelectedValue.ToString(); //save the data stream settings to the DataVault
            OxyPlot.LineStyle transfer_style = new OxyPlot.LineStyle();                             //make blank line style
            switch (LineStyle_select.SelectedItem.ToString())                                       //change the linestyle string selected to an actual linestyle
            {
            case ("Dash"):
                transfer_style = OxyPlot.LineStyle.Dash;
                break;

            case ("Dot"):
                transfer_style = OxyPlot.LineStyle.Dot;
                break;

            case ("Solid"):
                transfer_style = OxyPlot.LineStyle.Solid;
                break;

            case ("Long Dash"):
                transfer_style = OxyPlot.LineStyle.LongDash;
                break;

            default:
                transfer_style = OxyPlot.LineStyle.None;
                break;
            }
            DataVault.LineStyle[DataVault.CallBackID - 1] = transfer_style;                         //save the line style to the DataVault
            GLegal.Recount("Es", NeedsRecount);                                                     //Recount
            DataVault.DatapointDots[DataVault.CallBackID - 1] = datapointHighlight.IsChecked.Value; //save the datapoint highlighting option to the DataVault
            if (NewName != "")                                                                      //checks if there is nothing in the name tag
            {
                DataVault.LineNames[DataVault.CallBackID - 1] = NewName;                            //save the name entered to the DataVault
            }
            else
            {
                DataVault.LineNames[DataVault.CallBackID - 1] = DataVault.TempString; //save the sensor name to the DataVault
            }
            if (Name_c != "")                                                         //check if name is blank
            {
                Error err = new Error("Error", Name_c);                               //generate new error message
                err.Show();                                                           //show message
                DataVault.LineNames[DataVault.CallBackID - 1] = Name_c;               //Save name to the DataVault
            }
            this.Close();                                                             //close window
        }
        private void Custom_Name_TextChanged(object sender, TextChangedEventArgs e) //if there is a change to the custom name field
        {
            LegalName lgname  = new LegalName();                                    //make a new instance of the legalname
            bool      isLegal = lgname.Check(Custom_Name.Text);                     //check if the name is legal

            if (!isLegal)
            {
                Ess.Visibility = Visibility.Visible; //display warning
            }
            else
            {
                NewName = Custom_Name.Text; //save the new name for storage
                try
                {
                    Ess.Visibility = Visibility.Hidden; //hide warning
                }
                catch
                { }
            }
            Name_c       = lgname.CheckLn(Custom_Name.Text);
            NeedsRecount = lgname.Recount("Al", lgname.IsFastMode(Custom_Name.Text)); //determine if a recount is needed
        }