Ejemplo n.º 1
0
        private void FormMain_Load(object sender, EventArgs e)
        {
            labelHint.Text = "Initializing";

            // init hueUtil
            hueUtil.Init(labelHint);

            // init audio
            Thread t = new Thread(() =>
            {
                aps = AudioUtil.GetAudioApplications();

                foreach (AudioApplication ap in aps)
                {
                    RadioButton rb = new RadioButton
                    {
                        Text  = ap.sessionName,
                        Width = 280
                    };
                    rb.Click += (o, i) =>
                    {
                        (new Thread(() => audioSessionControl2 = AudioUtil.GetAudioSessionControlByPid(ap.pid))).Start();
                    };
                    this.Invoke(new Action(() => { radioButtonslayout.Controls.Add(rb); }));
                }
            });

            t.SetApartmentState(ApartmentState.MTA);
            t.Start();

            // init timers
            timerPeak.Elapsed += Timer_GetPeakValue;
            timerPeak.Start();
            timerGC.Elapsed += Timer_TrigerGC;
            timerGC.Start();

            // trackbar saturation
            trackBarSaturation.Minimum       = 0;
            trackBarSaturation.Maximum       = 255;
            trackBarSaturation.Value         = saturationValue;
            labelSaturation.Text             = "Saturation: " + trackBarSaturation.Value;
            trackBarSaturation.ValueChanged += OnTrackBarSaturationChanged;
        }