Ejemplo n.º 1
0
        public CalibratorCollection()
        {
            Ini      = new UlIniFile(csCalibIniFName);
            Category = new Dictionary <string, Dictionary <int, CalibratorRow> >();

            Initialize();
        }
        public static void Create()
        {
            Busy = false;

            Ini = new UlIniFile(csIniFName);

            TotalLog       = new UlLogger();
            TotalLog.Path  = Path.GetFullPath(Ini.GetString("Log", "TotalPath"));
            TotalLog.FName = Ini.GetString("Log", "TotalFileName");

            DbLog       = new UlLogger();
            DbLog.Path  = Path.GetFullPath(Ini.GetString("Log", "DatabasePath"));
            DbLog.FName = Ini.GetString("Log", "DatabaseFileName");

            string connectString = Ini.GetString("Database", "ConnectString");

            DB = new AppDatabase(connectString);

            if (string.IsNullOrWhiteSpace(connectString) == true)
            {
                DB.DataSource     = Ini.GetString("Database", "DataSource");
                DB.InitialCatalog = Ini.GetString("Database", "InitialCatalog");
                DB.UserID         = Ini.GetString("Database", "UserID");
                DB.Password       = Ini.GetString("Database", "Password");
            }
            DB.Open();

            Settings = new AppSettings();
            TotalLog[ELogTag.Note] = $"Create application resource";
        }
Ejemplo n.º 3
0
        static public void CreateLogger()
        {
            Ini = new UlIniFile(csConfigIniFName);

            TLog       = new UlLogger();
            TLog.Path  = Ini.GetString("Log", "TotalPath");
            TLog.FName = Ini.GetString("Log", "TotalFileName");
            TLog.AddHead("NOTE");
            TLog.AddHead("ERROR");
            TLog.AddHead("EXCEPTION");
        }
Ejemplo n.º 4
0
        public TestSettings(UlIniFile ini)
        {
            this.ini = ini;

            Options = new TestOptions();

            Coefficients = new List <CoefficientDataRow>();
            Coefficients.Add(new CoefficientDataRow());
            Coefficients.Add(new CoefficientDataRow());
            Coefficients.Add(new CoefficientDataRow());
            Coefficients.Add(new CoefficientDataRow());
        }
Ejemplo n.º 5
0
        public CalorimeterServer(UlIniFile ini)
        {
            Ini = ini;

            Clients = new Dictionary <string, ClientRow>();

            ClientList = new List <ClientRow>();

            Udp = new UdpClient(Ini.GetInteger("Server", "port"));

            Devices = new ServerDevice(this);

            Listener = new ServerListener(this);

            Sender = new ServerSender(this);
        }
Ejemplo n.º 6
0
        private void etcOptionMenuItem_Click(object sender, EventArgs e)
        {
            FormEtcOption form = new FormEtcOption();

            if (form.ShowDialog() == DialogResult.OK)
            {
                UlIniFile ini     = Resource.Ini;
                string    section = "Options";

                ini.SetBoolean(section, "FixedAtmPressure", form.FixedAtmPressure);
                ini.SetBoolean(section, "ForcedInteg", form.ForcedInteg);
                ini.SetString(section, "ExcelPath", form.ExcelPath);

                Resource.Settings.Load();
            }
        }
Ejemplo n.º 7
0
        public CalorimeterClient(UlIniFile ini)
        {
            Ini = ini;

            string ip   = Ini.GetString("Server", "ip");
            int    port = Ini.GetInteger("Server", "port");

            IpPoint = new IPEndPoint(
                IPAddress.Parse(ip), port);

            Udp = new UdpClient();

            Listener = new ClientListener(this);

            Sender = new ClientSender(this);

            Devices = new ClientDevice(this);
        }
Ejemplo n.º 8
0
        public NameTag(UlIniFile ini)
        {
            Thermos = new List <MeasureRow>();
            Presses = new List <MeasureRow>();

            string value = ini.GetString("Recorder", "Pressure");

            string[] values = value.Split(new[] { ',' }, StringSplitOptions.None);

            PressIndex  = int.Parse(values[0]);
            PressLength = int.Parse(values[1]);

            value  = ini.GetString("Recorder", "Thermocouple");
            values = value.Split(new[] { ',' }, StringSplitOptions.None);

            ThermoIndex  = int.Parse(values[0]);
            ThermoLength = int.Parse(values[1]);

            int    i    = 1;
            string key  = $"Tag{i}";
            string name = ini.GetString("TC.Tag", key);

            while (string.IsNullOrWhiteSpace(name) == false)
            {
                Thermos.Add(new MeasureRow(null, "", name, i));

                i++;
                key  = $"Tag{i}";
                name = ini.GetString("TC.Tag", key);
            }

            i    = 1;
            key  = $"Tag{i}";
            name = ini.GetString("Press.Tag", key);

            while (string.IsNullOrWhiteSpace(name) == false)
            {
                Presses.Add(new MeasureRow(null, "", name, i));

                i++;
                key  = $"Tag{i}";
                name = ini.GetString("Press.Tag", key);
            }
        }
Ejemplo n.º 9
0
        private void LoadCoefficient()
        {
            string    key;
            UlIniFile ini = Resource.Ini;

            coefficients.Clear();
            foreach (ECoefficient coeff in Enum.GetValues(typeof(ECoefficient)))
            {
                key = coeff.ToString();

                coefficients.Add(new CoefficientViewRow(
                                     coeff.ToDescription(),
                                     (float)ini.GetDouble("Coefficient.ID11", key),
                                     (float)ini.GetDouble("Coefficient.ID12", key),
                                     (float)ini.GetDouble("Coefficient.ID21", key),
                                     (float)ini.GetDouble("Coefficient.ID22", key)));
            }

            coeffGridView.RefreshData();
        }
Ejemplo n.º 10
0
        private void prtOptionMenuItem_Click(object sender, EventArgs e)
        {
            FormPrintingOption form = new FormPrintingOption();

            if (form.ShowDialog() == DialogResult.OK)
            {
                UlIniFile ini     = Resource.Ini;
                string    section = "Options";

                ini.SetBoolean(section, "AutoExcel", form.AutoExcel);
                ini.SetBoolean(section, "StoppedTestExcel", form.StoppedTestExcel);
                ini.SetBoolean(section, "Indoor11", form.Indoor11);
                ini.SetBoolean(section, "Indoor12", form.Indoor12);
                ini.SetBoolean(section, "Indoor21", form.Indoor21);
                ini.SetBoolean(section, "Indoor22", form.Indoor22);
                ini.SetBoolean(section, "Indoor1TC", form.IndoorTC1);
                ini.SetBoolean(section, "Indoor2TC", form.IndoorTC2);
                ini.SetBoolean(section, "OutdoorTC", form.OutdoorTC);

                Resource.Settings.Load();
            }
        }
Ejemplo n.º 11
0
        static public void Create()
        {
            UserNo    = 0;
            Authority = EUserAuthority.Viewer;

            Ini = new UlIniFile(csConfigIniFName);

            TLog       = new UlLogger();
            TLog.Path  = Ini.GetString("Log", "TotalPath");
            TLog.FName = Ini.GetString("Log", "TotalFileName");
            TLog.AddHead("NOTE");
            TLog.AddHead("ERROR");
            TLog.AddHead("EXCEPTION");

            Server = new CalorimeterServer(Ini);

            Db          = new CalorimeterDatabase();
            Db.Database = Ini.GetString("Database", "FileName");
            Db.Open();

            Db.Load(Ini.GetInteger("Calibrator", "CalibrationNo"));
        }
Ejemplo n.º 12
0
        private void saveButton_Click(object sender, EventArgs e)
        {
            if (MessageBox.Show("Would you like to save current coefficient values?",
                                Resource.Caption, MessageBoxButtons.YesNo, MessageBoxIcon.Question)
                == DialogResult.No)
            {
                return;
            }

            UlIniFile ini = Resource.Ini;

            saveButton.Focus();

            foreach (ECoefficient coeff in Enum.GetValues(typeof(ECoefficient)))
            {
                ini.SetDouble("Coefficient.ID11", coeff.ToString(), coefficients[(int)coeff].ID11);
                ini.SetDouble("Coefficient.ID12", coeff.ToString(), coefficients[(int)coeff].ID12);
                ini.SetDouble("Coefficient.ID21", coeff.ToString(), coefficients[(int)coeff].ID21);
                ini.SetDouble("Coefficient.ID22", coeff.ToString(), coefficients[(int)coeff].ID22);
            }

            Resource.Settings.Load();
            coeffGridView.Focus();
        }