public ModuleChannel(ModuleChannel other)
 {
     ModuleName    = other.ModuleName;
     ChannelNumber = other.ChannelNumber;
     Description   = other.Description;
     Axis          = other.Axis;
 }
Exemple #2
0
        public static void StoreSetting(SettingProgram settingProgram, SettingWindow settingWindow, SettingFBGA settingFBGA,
                                        SettingMIC settingMIC, SettingECG settingECG, SettingACC settingACC, SettingPPG settingPPG)
        {
            string path = Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments);

            if (!path.EndsWith("\\"))
            {
                path += "\\";
            }
            path += "PolicardiographApp\\";
            StreamWriter sw = File.CreateText(path + "Settings.dat");

            try
            {
                string line    = String.Format("//ProgramSetting");
                string newline = sw.NewLine;
                sw.WriteLine(line);
                line = "ProgramSetting_SavePath=" + settingProgram.SavePath;
                sw.WriteLine(line);
                line = "ProgramSetting_BattMax=" + settingProgram.MaxBatteryVoltage.ToString(CultureInfo.InvariantCulture);
                sw.WriteLine(line);
                line = "ProgramSetting_BattMin=" + settingProgram.MinBatteryVoltage.ToString(CultureInfo.InvariantCulture);
                sw.WriteLine(line);
                line = "ProgramSetting_BattAlert=" + settingProgram.BatteryAlertVoltage.ToString(CultureInfo.InvariantCulture);
                sw.WriteLine(line);
                line = "ProgramSetting_BattLastTime=" + settingProgram.BatteryLastMeasuredTime.ToString() + newline;
                sw.WriteLine(line);

                line    = String.Format("//MainWindowSetting");
                newline = sw.NewLine;
                sw.WriteLine(line);
                if (settingWindow.TimeAxis > 0)
                {
                    line = String.Format("MainWindowSetting_TimeAxis={0}", settingWindow.TimeAxis);
                    sw.WriteLine(line + newline);
                }



                for (int i = 0; i < settingWindow.UserTabSelectedDisplays.Count; i++)
                {
                    ModuleChannel tempModuleChannel = settingWindow.UserTabSelectedDisplays.ElementAt(i);
                    if (tempModuleChannel.Axis.Length > 0)
                    {
                        line = String.Format("MainWindowSetting_DisplayAxis{0}={1}", i + 1, tempModuleChannel.Axis);
                        sw.WriteLine(line);
                    }
                    if (tempModuleChannel.Description.Length > 0)
                    {
                        line = String.Format("MainWindowSetting_DisplayDescription{0}={1}", i + 1, tempModuleChannel.Description);
                        sw.WriteLine(line);
                    }
                    if (tempModuleChannel.ModuleName.Length > 0)
                    {
                        line = String.Format("MainWindowSetting_DisplayModuleSelection{0}={1}", i + 1, tempModuleChannel.ModuleName);
                        sw.WriteLine(line);
                    }
                    if (tempModuleChannel.ChannelNumber > 0)
                    {
                        line = String.Format("MainWindowSetting_DisplayChannelSelection{0}={1}", i + 1, tempModuleChannel.ChannelNumber);
                        sw.WriteLine(line + newline);
                    }
                }

                line = String.Format("//FBGASetting");
                sw.WriteLine(line);
                for (int i = 0; i < settingFBGA.SelectedDisplays.Count; i++)
                {
                    ModuleChannel tempModuleChannel = settingFBGA.SelectedDisplays.ElementAt(i);
                    if (tempModuleChannel.Axis.Length > 0)
                    {
                        line = String.Format("FBGASetting_DisplayAxis{0}={1}", i + 1, tempModuleChannel.Axis);
                        sw.WriteLine(line);
                    }
                    if (tempModuleChannel.Description.Length > 0)
                    {
                        line = String.Format("FBGASetting_DisplayDescription{0}={1}", i + 1, tempModuleChannel.Description);
                        sw.WriteLine(line);
                    }
                    if (tempModuleChannel.ModuleName.Length > 0)
                    {
                        line = String.Format("FBGASetting_DisplayModuleSelection{0}={1}", i + 1, tempModuleChannel.ModuleName);
                        sw.WriteLine(line);
                    }
                    if (tempModuleChannel.ChannelNumber > 0)
                    {
                        line = String.Format("FBGASetting_DisplayChannelSelection{0}={1}", i + 1, tempModuleChannel.ChannelNumber);
                        sw.WriteLine(line + newline);
                    }
                }
                if (settingFBGA.NumberOfChannels > 0)
                {
                    line = String.Format("FBGASetting_NoChannel={0}", settingFBGA.NumberOfChannels);
                    sw.WriteLine(line);
                }
                if (settingFBGA.IntegrationTime > 0)
                {
                    line = String.Format("FBGASetting_IntegrationTime={0}", settingFBGA.IntegrationTime);
                    sw.WriteLine(line);
                }
                if (settingFBGA.SLEDPower >= 0)
                {
                    line = String.Format(new System.Globalization.CultureInfo("en-GB"), "FBGASetting_SLEDPower={0:#0.0#}", settingFBGA.SLEDPower);
                    sw.WriteLine(line);
                }
                line = String.Format("FBGASetting_HighDynamicRange={0}", settingFBGA.HighDynamicRange);
                sw.WriteLine(line + newline);

                line = String.Format("//MICSetting");
                sw.WriteLine(line);
                for (int i = 0; i < settingMIC.SelectedDisplays.Count; i++)
                {
                    ModuleChannel tempModuleChannel = settingMIC.SelectedDisplays.ElementAt(i);
                    if (tempModuleChannel.Axis.Length > 0)
                    {
                        line = String.Format("MICSetting_DisplayAxis{0}={1}", i + 1, tempModuleChannel.Axis);
                        sw.WriteLine(line);
                    }
                    if (tempModuleChannel.Description.Length > 0)
                    {
                        line = String.Format("MICSetting_DisplayDescription{0}={1}", i + 1, tempModuleChannel.Description);
                        sw.WriteLine(line);
                    }
                    if (tempModuleChannel.ModuleName.Length > 0)
                    {
                        line = String.Format("MICSetting_DisplayModuleSelection{0}={1}", i + 1, tempModuleChannel.ModuleName);
                        sw.WriteLine(line);
                    }
                    if (tempModuleChannel.ChannelNumber > 0)
                    {
                        line = String.Format("MICSetting_DisplayChannelSelection{0}={1}", i + 1, tempModuleChannel.ChannelNumber);
                        sw.WriteLine(line + newline);
                    }
                }
                if (settingMIC.NumberOfChannels > 0)
                {
                    line = String.Format("MICSetting_NoChannel={0}", settingMIC.NumberOfChannels);
                    sw.WriteLine(line);
                }
                line = String.Format("MICSetting_MIC1Mute={0}", settingMIC.MuteMIC1);
                sw.WriteLine(line);
                line = String.Format("MICSetting_MIC2Mute={0}", settingMIC.MuteMIC2);
                sw.WriteLine(line);
                line = String.Format("MICSetting_MIC3Mute={0}", settingMIC.MuteMIC3);
                sw.WriteLine(line);
                line = String.Format("MICSetting_MIC4Mute={0}", settingMIC.MuteMIC4);
                sw.WriteLine(line);
                line = String.Format("MICSetting_HighPassFilter={0}", settingMIC.HighPassFilter);
                sw.WriteLine(line);
                line = String.Format("MICSetting_SyncTest={0}", settingMIC.SyncTest);
                sw.WriteLine(line + newline);

                line = String.Format("//ECGSetting");
                sw.WriteLine(line);
                for (int i = 0; i < settingECG.SelectedDisplays.Count; i++)
                {
                    ModuleChannel tempModuleChannel = settingECG.SelectedDisplays.ElementAt(i);
                    if (tempModuleChannel.Axis.Length > 0)
                    {
                        line = String.Format("ECGSetting_DisplayAxis{0}={1}", i + 1, tempModuleChannel.Axis);
                        sw.WriteLine(line);
                    }
                    if (tempModuleChannel.Description.Length > 0)
                    {
                        line = String.Format("ECGSetting_DisplayDescription{0}={1}", i + 1, tempModuleChannel.Description);
                        sw.WriteLine(line);
                    }
                    if (tempModuleChannel.ModuleName.Length > 0)
                    {
                        line = String.Format("ECGSetting_DisplayModuleSelection{0}={1}", i + 1, tempModuleChannel.ModuleName);
                        sw.WriteLine(line);
                    }
                    if (tempModuleChannel.ChannelNumber > 0)
                    {
                        line = String.Format("ECGSetting_DisplayChannelSelection{0}={1}", i + 1, tempModuleChannel.ChannelNumber);
                        sw.WriteLine(line + newline);
                    }
                }
                if (settingECG.NumberOfChannels > 0)
                {
                    line = String.Format("ECGSetting_NoChannel={0}", settingECG.NumberOfChannels);
                    sw.WriteLine(line);
                }
                line = String.Format("ECGSetting_Gain={0}", settingECG.Gain);
                sw.WriteLine(line);
                line = "ECGSetting_CH4Mode=" + settingECG.CH4Mode;
                sw.WriteLine(line);
                line = String.Format("ECGSetting_SensP={0}", settingECG.SensP);
                sw.WriteLine(line);
                line = String.Format("ECGSetting_SensN={0}", settingECG.SensN);
                sw.WriteLine(line);
                line = String.Format("ECGSetting_DisplayAVLeads={0}", settingECG.AVLeads);
                sw.WriteLine(line + newline);


                line = String.Format("//ACCSetting");
                sw.WriteLine(line);
                for (int i = 0; i < settingACC.SelectedDisplays.Count; i++)
                {
                    ModuleChannel tempModuleChannel = settingACC.SelectedDisplays.ElementAt(i);
                    if (tempModuleChannel.Axis.Length > 0)
                    {
                        line = String.Format("ACCSetting_DisplayAxis{0}={1}", i + 1, tempModuleChannel.Axis);
                        sw.WriteLine(line);
                    }
                    if (tempModuleChannel.Description.Length > 0)
                    {
                        line = String.Format("ACCSetting_DisplayDescription{0}={1}", i + 1, tempModuleChannel.Description);
                        sw.WriteLine(line);
                    }
                    if (tempModuleChannel.ModuleName.Length > 0)
                    {
                        line = String.Format("ACCSetting_DisplayModuleSelection{0}={1}", i + 1, tempModuleChannel.ModuleName);
                        sw.WriteLine(line);
                    }
                    if (tempModuleChannel.ChannelNumber > 0)
                    {
                        line = String.Format("ACCSetting_DisplayChannelSelection{0}={1}", i + 1, tempModuleChannel.ChannelNumber);
                        sw.WriteLine(line + newline);
                    }
                }
                if (settingACC.NumberOfChannels > 0)
                {
                    line = String.Format("ACCSetting_NoChannel={0}", settingACC.NumberOfChannels / 3);
                    sw.WriteLine(line + newline);
                }

                line = String.Format("//PPGSetting");
                sw.WriteLine(line);
                for (int i = 0; i < settingPPG.SelectedDisplays.Count; i++)
                {
                    ModuleChannel tempModuleChannel = settingPPG.SelectedDisplays.ElementAt(i);
                    if (tempModuleChannel.Axis.Length > 0)
                    {
                        line = String.Format("PPGSetting_DisplayAxis{0}={1}", i + 1, tempModuleChannel.Axis);
                        sw.WriteLine(line);
                    }
                    if (tempModuleChannel.Description.Length > 0)
                    {
                        line = String.Format("PPGSetting_DisplayDescription{0}={1}", i + 1, tempModuleChannel.Description);
                        sw.WriteLine(line);
                    }
                    if (tempModuleChannel.ModuleName.Length > 0)
                    {
                        line = String.Format("PPGSetting_DisplayModuleSelection{0}={1}", i + 1, tempModuleChannel.ModuleName);
                        sw.WriteLine(line);
                    }
                    if (tempModuleChannel.ChannelNumber > 0)
                    {
                        line = String.Format("PPGSetting_DisplayChannelSelection{0}={1}", i + 1, tempModuleChannel.ChannelNumber);
                        sw.WriteLine(line + newline);
                    }
                }
                if (settingPPG.NumberOfChannels > 0)
                {
                    line = String.Format("PPGSetting_NoChannel={0}", settingPPG.NumberOfChannels);
                    sw.WriteLine(line + newline);
                }
                sw.Close();
            }
            finally{
                sw.Close();
            }
        }