CCT.NUI.WPFSamples.PinCode.HandInterfaceWindow.element_Tick C# (CSharp) Method

element_Tick() private method

private element_Tick ( object sender, System e ) : void
sender object
e System
return void
        void element_Tick(object sender, System.Timers.ElapsedEventArgs e)
        {
            code = code + (sender as HandInterfaceElement).Number.ToString();
            this.labelCode.Dispatcher.Invoke(new Action(() =>
            {
                this.labelCode.Content = this.code;
            }));
            if (this.code.Length == 5)
            {
                if (this.code == "52315")
                {
                    this.element.Stop();
                    this.labelAccess.Dispatcher.Invoke(new Action(() =>
                    {
                        this.labelAccess.Foreground = new SolidColorBrush(Color.FromArgb(160, 0, 255, 0));
                        this.labelAccess.Content = "Access granted!";
                        this.textTimer = new DispatcherTimer();
                        this.textTimer.Interval = TimeSpan.FromMilliseconds(10);
                        this.textTimer.Tick += new EventHandler(textTimer_Tick);
                        this.textTimer.Start();
                    }));
                }
                else
                {
                    this.element.FadeOut();
                    this.labelAccess.Dispatcher.Invoke(new Action(() =>
                    {
                        this.labelAccess.Foreground = new SolidColorBrush(Color.FromArgb(160, 255, 0, 0));
                        this.labelAccess.Content = "Access denied!";
                    }));
                }
            }
        }