コード例 #1
0
ファイル: Optimierung.cs プロジェクト: graetzer/trash
        //*********************
        //Konstruktoren
        //*********************

        public Optimierung(Messwertverwaltung mwv)
        {
            InitializeComponent();
            this.mwv = mwv;
            this.tbdTemperatur.Text   = "14";
            this.tbdLicht.Text        = this.mwv.GetDurschnittsLicht().ToString();
            this.tbdFeuchtigkeit.Text = "12";
            this.tbdDünger.Text       = "17";
            //NAme Temp Licht Feuchte Duenger Kosten Wasseek Ertrag
            this.dgvPflanzen.Rows.Add(new String[] { "Kartoffeln", "15", "1000", "50", "30", "10", "20", "40" });
            this.dgvPflanzen.Rows.Add(new String[] { "Mais", "17", "1230", "60", "50", "20", "20", "50" });
            this.cbAktualisieren();
        }
コード例 #2
0
ファイル: Form1.cs プロジェクト: graetzer/trash
        private void MainForm_Load(object sender, EventArgs e)
        {
            try {
                StreamReader sr = new StreamReader(Application.StartupPath + "\\Intervalle.inf");
                this.TemperaturIntervall   = Convert.ToSingle(sr.ReadLine());
                this.FeuchtigkeitIntervall = Convert.ToSingle(sr.ReadLine());
                this.DüngerIntervall       = Convert.ToSingle(sr.ReadLine());
                this.LichtIntervall        = Convert.ToSingle(sr.ReadLine());
                sr.Close();
            }
            catch { }
            this.Mwv           = new Messwertverwaltung(this, this.TemperaturIntervall, this.LichtIntervall, this.FeuchtigkeitIntervall, this.DüngerIntervall);
            this.schnittStelle = new RS232COM(this.Mwv, 115200, "1", 8);

            this.server = new IACServer(8080, this.Mwv, this.schnittStelle);
            this.server.Start();
        }
コード例 #3
0
ファイル: RS232COM.cs プロジェクト: graetzer/trash
        //*********************
        //Konstruktoren
        //*********************

        public RS232COM(Messwertverwaltung Mwv, int baudRate, string stopBits, int dataBits)
        {
            this.Mwv = Mwv;
            this.comPort.BaudRate = baudRate;
            this.comPort.DataBits = dataBits;
            this.comPort.StopBits = (StopBits)Enum.Parse(typeof(StopBits), stopBits);

            for (int i = 1; i < 10; i++)
            {
                try {
                    this.comPort.PortName = "COM" + i.ToString();
                    this.comPort.Open();
                }
                catch { }
                this.comPort.DataReceived += new SerialDataReceivedEventHandler(this.DataReceived);
            }
            if (!this.comPort.IsOpen)
            {
                MessageBox.Show("COM Port anschliessen!");
            }
        }