/// <summary>
        /// Initializes the new I-V curve measurements
        /// </summary>
        /// <returns>true, if initialization succeed and false otherwise</returns>
        private bool InitIV_Measurements()
        {
            #region SMU, rendering and save data configurations

            //Checking the SMU settings
            if (sourceDeviceConfiguration != null)
            {
                #region Chart rendering settings

                //Initializing a new plot on I-V chart
                if (_IV_LineGraph != null)
                {
                    //Detaching receive event from "old" data source
                    _experimentalIV_DataSource.DetachPointReceiveEvent();
                    _IV_LineGraph.Remove();
                }
                //Creating new plot and attaching it to the chart
                _CurrentIV_Curve           = new List <PointD>();
                _experimentalIV_DataSource = new ExperimentalIV_DataSource(_CurrentIV_Curve);
                _experimentalIV_DataSource.AttachPointReceiveEvent();
                _IV_LineGraph = new LineGraph(_experimentalIV_DataSource);
                _IV_LineGraph.AddToPlotter(chartIV_Curves);

                #endregion

                //Getting SMU device
                Device = sourceDeviceConfiguration.Keithley2602A_DeviceSettings.Device;

                #region I-V measurement configuration

                var ExperimentSettings = IV_And_TimeTraceViewModel.Instance;

                var StartValue       = ExperimentSettings.IV_MeasurementStartValue;
                var EndValue         = ExperimentSettings.IV_MeasurementEndValue;
                var Step             = ExperimentSettings.IV_MeasurementStep;
                var NumberOfAverages = ExperimentSettings.IV_MeasurementNumberOfAverages;
                var TimeDelay        = ExperimentSettings.IV_MeasurementTimeDelay;

                SourceMode DeviceSourceMode = SourceMode.Voltage;

                if (this.radioIVSourceVoltage.IsChecked == true)
                {
                    DeviceSourceMode = SourceMode.Voltage;
                }
                else if (this.radioIVSourceCurrent.IsChecked == true)
                {
                    DeviceSourceMode = SourceMode.Current;
                }

                IV_Curve = new MeasureIV(StartValue, EndValue, Step, NumberOfAverages, TimeDelay, DeviceSourceMode, Device);

                #endregion

                #region Saving I-V data into files

                var    _IV_FileNumber = String.Format("_{0}{1}{2}", (_IV_FilesCounter / 100) % 10, (_IV_FilesCounter / 10) % 10, _IV_FilesCounter % 10);
                string newFileName    = string.Empty;

                if (!string.IsNullOrEmpty(_SaveIV_MeasuremrentFileName))
                {
                    _IV_MeasurementLog = new IV_MeasurementLog((new FileInfo(_SaveIV_MeasuremrentFileName)).DirectoryName + "\\IV_MeasurementLog.dat");

                    newFileName = _SaveIV_MeasuremrentFileName.Insert(_SaveIV_MeasuremrentFileName.LastIndexOf('.'), _IV_FileNumber);
                    ++_IV_FilesCounter;
                }

                if (!string.IsNullOrEmpty(_SaveIV_MeasuremrentFileName))
                {
                    string fileName = (new FileInfo(newFileName)).Name;

                    string sourceMode = string.Empty;

                    if (this.radioIVSourceVoltage.IsChecked == true)
                    {
                        sourceMode = "Source mode: Voltage";
                    }
                    else if (this.radioIVSourceCurrent.IsChecked == true)
                    {
                        sourceMode = "SourceMode: Current";
                    }

                    double micrometricBoltPosition = double.NaN;
                    double.TryParse(this.textBoxIV_MicrometricBoltPosition.Text, numberStyle, culture, out micrometricBoltPosition);

                    string comment = this.textBoxIV_Comment.Text;

                    _IV_MeasurementLog.AddNewIV_MeasurementLog(fileName, sourceMode, micrometricBoltPosition, comment);
                }

                if (_IV_SingleMeasurement != null)
                {
                    _IV_SingleMeasurement.Dispose();
                }


                _IV_SingleMeasurement = new IV_SingleMeasurement(newFileName);

                #endregion

                return(true);
            }
            else
            {
                MessageBox.Show("The device is not initialized.", "Error!", MessageBoxButton.OK, MessageBoxImage.Error);
                return(false);
            }

            #endregion
        }
        /// <summary>
        /// Initializes the new I-V curve measurements
        /// </summary>
        /// <returns>true, if initialization succeed and false otherwise</returns>
        private bool InitIV_Measurements()
        {
            #region SMU, rendering and save data configurations

            //Checking the SMU settings
            if (sourceDeviceConfiguration != null)
            {
                #region Chart rendering settings

                //Initializing a new plot on I-V chart
                if (_IV_LineGraph != null)
                {
                    //Detaching receive event from "old" data source
                    _experimentalIV_DataSource.DetachPointReceiveEvent();
                    _IV_LineGraph.Remove();
                }
                //Creating new plot and attaching it to the chart
                _CurrentIV_Curve = new List<PointD>();
                _experimentalIV_DataSource = new ExperimentalIV_DataSource(_CurrentIV_Curve);
                _experimentalIV_DataSource.AttachPointReceiveEvent();
                _IV_LineGraph = new LineGraph(_experimentalIV_DataSource);
                _IV_LineGraph.AddToPlotter(chartIV_Curves);

                #endregion

                //Getting SMU device
                Device = sourceDeviceConfiguration.Keithley2602A_DeviceSettings.Device;

                #region I-V measurement configuration

                var ExperimentSettings = IV_And_TimeTraceViewModel.Instance;

                var StartValue = ExperimentSettings.IV_MeasurementStartValue;
                var EndValue = ExperimentSettings.IV_MeasurementEndValue;
                var Step = ExperimentSettings.IV_MeasurementStep;
                var NumberOfAverages = ExperimentSettings.IV_MeasurementNumberOfAverages;
                var TimeDelay = ExperimentSettings.IV_MeasurementTimeDelay;

                SourceMode DeviceSourceMode = SourceMode.Voltage;

                if (this.radioIVSourceVoltage.IsChecked == true)
                {
                    DeviceSourceMode = SourceMode.Voltage;
                }
                else if (this.radioIVSourceCurrent.IsChecked == true)
                {
                    DeviceSourceMode = SourceMode.Current;
                }

                IV_Curve = new MeasureIV(StartValue, EndValue, Step, NumberOfAverages, TimeDelay, DeviceSourceMode, Device);

                #endregion

                #region Saving I-V data into files

                var _IV_FileNumber = String.Format("_{0}{1}{2}", (_IV_FilesCounter / 100) % 10, (_IV_FilesCounter / 10) % 10, _IV_FilesCounter % 10);
                string newFileName = string.Empty;

                if (!string.IsNullOrEmpty(_SaveIV_MeasuremrentFileName))
                {
                    _IV_MeasurementLog = new IV_MeasurementLog((new FileInfo(_SaveIV_MeasuremrentFileName)).DirectoryName + "\\IV_MeasurementLog.dat");

                    newFileName = _SaveIV_MeasuremrentFileName.Insert(_SaveIV_MeasuremrentFileName.LastIndexOf('.'), _IV_FileNumber);
                    ++_IV_FilesCounter;
                }

                if (!string.IsNullOrEmpty(_SaveIV_MeasuremrentFileName))
                {

                    string fileName = (new FileInfo(newFileName)).Name;

                    string sourceMode = string.Empty;

                    if (this.radioIVSourceVoltage.IsChecked == true)
                    {
                        sourceMode = "Source mode: Voltage";
                    }
                    else if (this.radioIVSourceCurrent.IsChecked == true)
                    {
                        sourceMode = "SourceMode: Current";
                    }

                    double micrometricBoltPosition = double.NaN;
                    double.TryParse(this.textBoxIV_MicrometricBoltPosition.Text, numberStyle, culture, out micrometricBoltPosition);

                    string comment = this.textBoxIV_Comment.Text;

                    _IV_MeasurementLog.AddNewIV_MeasurementLog(fileName, sourceMode, micrometricBoltPosition, comment);
                }

                if (_IV_SingleMeasurement != null)
                    _IV_SingleMeasurement.Dispose();

                _IV_SingleMeasurement = new IV_SingleMeasurement(newFileName);

                #endregion

                return true;
            }
            else
            {
                MessageBox.Show("The device is not initialized.", "Error!", MessageBoxButton.OK, MessageBoxImage.Error);
                return false;
            }

            #endregion
        }