Event args passed to the LearnCompleted event.
Inheritance: System.EventArgs
Beispiel #1
0
        private void OnLearnComplete(object sender, LearnCompletedEventArgs e)
        {
            _waitHandle.Reset();
            var temp = LearningComplete;

            if (temp != null)
            {
                temp(this, new LearnHelperCompletedEventArgs(_lastReceivedCode, e));
            }
        }
Beispiel #2
0
        private void ManagedWrapper_LearnCompleted(object sender, LearnCompletedEventArgs e)
        {
            var syncLearnResults = e.UserState as SyncLearnResults;

            if (null == syncLearnResults)
            {
                throw new ApplicationException("invalid userState received");
            }
            syncLearnResults.LearnCompletedEventArgs = e;
            syncLearnResults.WaitEvent.Set();
        }
Beispiel #3
0
        private void btnOgren_Click(object sender, EventArgs e)
        {
            pbIlerleme.Value = pbSinyalKalitesi.Value = 0;
            lblTasiyiciFrekans.Text = lblIRKodu.Text = "-";
            lblIlerleme.Text = lblSinyalKalitesi.Text = "%0";

            btnIptal.Enabled = true;
            btnOgren.Enabled = gbOgrenmeSonucu.Enabled = false;

            lblIRKodu.Text = "-";
            tbEylemAdi.Text = string.Empty;

            learnCompletedEventArgs = null;

            usbuirtController.LearnAsync(CodeFormat.Uuirt, LearnCodeModifier.None, learnCompletedEventArgs);
        }
Beispiel #4
0
        private static void TestLearn(Controller mc, CodeFormat learnFormat, LearnCodeModifier learnCodeModifier)
        {
            learnCompletedEventArgs = null;
            Console.WriteLine("<Press x to abort Learn>");
            mc.Learning += new UsbUirt.Controller.LearningEventHandler(mc_Learning);
            mc.LearnCompleted += new UsbUirt.Controller.LearnCompletedEventHandler(mc_LearnCompleted);

            try
            {
                try
                {
                    mc.LearnAsync(learnFormat, learnCodeModifier, learnCompletedEventArgs);
                }
                catch(Exception ex)
                {
                    Console.WriteLine("*** ERROR calling LearnAsync! ***");
                    throw;
                }

                while (learnCompletedEventArgs == null)
                {
                    string s = Console.ReadLine();
                    if (s.Length != 0 && s[0] == 'x')
                    {
                        if (learnCompletedEventArgs == null)
                        {
                            Console.WriteLine("Calling LearnAsyncCancel...");
                            mc.LearnAsyncCancel(learnCompletedEventArgs);
                            Thread.Sleep(1000);
                            break;
                        }
                    }
                    else
                    {
                        Console.WriteLine("<Press x to abort Learn>");
                    }
                }

                if (learnCompletedEventArgs != null &&
                    learnCompletedEventArgs.Cancelled == false &&
                    learnCompletedEventArgs.Error == null)
                {
                    irCode = learnCompletedEventArgs.Code;
                    Console.WriteLine("...Done...IRCode = {0}", irCode);
                    transmitFormat = learnFormat;
                }

            }
            finally
            {
                mc.Learning -= new UsbUirt.Controller.LearningEventHandler(mc_Learning);
                mc.LearnCompleted -= new UsbUirt.Controller.LearnCompletedEventHandler(mc_LearnCompleted);
            }
        }
Beispiel #5
0
 private static void mc_LearnCompleted(object sender, LearnCompletedEventArgs e)
 {
     learnCompletedEventArgs = e;
     Console.WriteLine("Learn complete. Press return to continue.");
 }
Beispiel #6
0
 private void ManagedWrapper_LearnCompleted(object sender, LearnCompletedEventArgs e)
 {
     SyncLearnResults syncLearnResults = e.UserState as SyncLearnResults;
     if (null == syncLearnResults)
     {
         throw new ApplicationException("invalid userState received");
     }
     syncLearnResults.LearnCompletedEventArgs = e;
     syncLearnResults.WaitEvent.Set();
 }
Beispiel #7
0
        private void usbuirtController_LearnCompleted(object sender, LearnCompletedEventArgs e)
        {
            learnCompletedEventArgs = e;

            Invoke(new MethodInvoker(delegate {
                pbIlerleme.Value = pbSinyalKalitesi.Value = 0;
                lblTasiyiciFrekans.Text = "-";
                lblIlerleme.Text = lblSinyalKalitesi.Text = "%0";

                if (e.Cancelled) { return; }

                lblIRKodu.Text = e.Code;

                MessageBox.Show("Öğrenme işlemi tamamlandı");

                btnOgren.Enabled = true;
                btnIptal.Enabled = false;

                gbOgrenmeSonucu.Enabled = true;
            }));
        }
 void controller_LearnCompleted(object sender, LearnCompletedEventArgs e)
 {
     this.learnedCode = e.Code;
     this.DialogResult = System.Windows.Forms.DialogResult.OK;
     this.Close();
 }
 void LearningCompleted(object sender, LearnCompletedEventArgs e)
 {
     Dispatcher.BeginInvoke((Action)delegate
     {
         learningCompleted = true;
         IRCode = e.Code;
         CommandManager.InvalidateRequerySuggested();
     });
 }
 private static void mc_LearnCompleted(object sender, LearnCompletedEventArgs e)
 {
     learnCompletedEventArgs = e;
 }
        public static string Learn(System.Windows.Forms.TextBox status)
        {
            CancelLearn = false;

            string irCode = "";
            Controller mc = new Controller();
            learnCompletedEventArgs = null;
            mc.Learning += new UsbUirt.Controller.LearningEventHandler(mc_Learning);
            mc.LearnCompleted += new UsbUirt.Controller.LearnCompletedEventHandler(mc_LearnCompleted);

            try
            {
                try
                {
                    mc.LearnAsync(CodeFormat.Pronto, LearnCodeModifier.None, learnCompletedEventArgs);
                }
                catch (Exception ex)
                {
                    throw;
                }

                while (learnCompletedEventArgs == null)
                {
                    string s = Console.ReadLine();
                    if (CancelLearn == true)
                    {
                        if (learnCompletedEventArgs == null)
                        {
                            mc.LearnAsyncCancel(learnCompletedEventArgs);
                            Thread.Sleep(1000);
                            break;
                        }
                    }
                    else
                    {
                        status.Text = LearnState;
                        status.Update();
                        Thread.Sleep(100);
                    }
                }

                if (learnCompletedEventArgs != null &&
                    learnCompletedEventArgs.Cancelled == false &&
                    learnCompletedEventArgs.Error == null)
                {
                    irCode = learnCompletedEventArgs.Code;
                }

            }
            finally
            {
                mc.Learning -= new UsbUirt.Controller.LearningEventHandler(mc_Learning);
                mc.LearnCompleted -= new UsbUirt.Controller.LearnCompletedEventHandler(mc_LearnCompleted);
            }

            return irCode;
        }