Ejemplo n.º 1
0
        private async void StartBtn_Click(object sender, EventArgs e)
        {
            StartBtn.Enabled = false;

            trackBar3.Enabled = false;
            trackBar1.Enabled = false;

            running = true;
            var s1 = trackBar2.Value.ToString();
            var s2 = trackBar1.Value.ToString();
            var s3 = textBox2.Text;


            var roomT    = new Progress <int>(x => trackBar1.Value = x);
            var desiredT = new Progress <int>(x => trackBar3.Value = x);
            var airconT  = new Progress <int>(x => trackBar5.Value = x);
            var heating  = new Progress <int>(x => trackBar4.Value = x);

            var roomTbox   = new Progress <string>(x => IBox.Text = x);
            var outsidebox = new Progress <string>(x => OBox.Text = x);
            var airconbox  = new Progress <string>(x => textBox2.Text = x);



            int[]  outsideT = Zima;
            double materialQ;

            int roomTi    = trackBar1.Value;
            int desiredTi = trackBar3.Value;
            int airconTi  = trackBar5.Value;
            int heatingi  = trackBar4.Value;

            if (comboBox1.SelectedIndex.Equals(0))
            {
                outsideT = Zima;
            }
            else
            {
                outsideT = Lato;
            }

            if (comboBox2.SelectedIndex.Equals(0))
            {
                materialQ = 0.2;
            }
            else if (comboBox2.SelectedIndex.Equals(1))
            {
                materialQ = 0.8;
            }
            else
            {
                materialQ = 1.7;
            }

            var progress1 = new Progress <string>(x => Logs.Text += x);

            await Task.Factory.StartNew(() => SecondThreadConcern.LongWork(progress1, s1, s2, s3, roomT, roomTi, roomTbox, desiredT, desiredTi, heating, heatingi, outsideT, outsidebox, airconT, airconTi, airconbox, materialQ),
                                        TaskCreationOptions.LongRunning);
        }
Ejemplo n.º 2
0
        private async void StpBtn_Click(object sender, EventArgs e)
        {
            StartBtn.Enabled = true;
            running          = false;
            await Task.Factory.StartNew(() => SecondThreadConcern.Staph(),
                                        TaskCreationOptions.LongRunning);

            trackBar3.Enabled = true;
            trackBar1.Enabled = true;
        }