예제 #1
0
        public override void Update(ViewModelReturnData VMReturnData)
        {
            //Only update this view if visible

            if (VMReturnData.NewIssuerPresent_Active)
            {
                this.View.Visibility = Visibility.Visible;
                #region navigation bar details
                VMReturnData.NavigationBar_Active = true;
                VMReturnData.ViewTitle            = "Issuer Card";
                VMReturnData.SubTitle             = "Issuer select";
                VMReturnData.MenuButtonEnabled    = Visibility.Hidden;
                VMReturnData.HelpButtonEnabled    = Visibility.Visible;
                VMReturnData.BackButtonEnabled    = true;
                #endregion

                if (VMReturnData.NewCardWindow < 1)
                {
                    if (VMReturnData.CardInField)
                    {
                        cardInfoRead.UID = VMReturnData.UID;
                        formated         = cardInfoRead.Block1Info();
                        UID = cardInfoRead.UIDtoString(VMReturnData.UID);
                        if (formated)
                        {
                            CardImage      = new BitmapImage(new Uri(@"/Resources/Images/CardFormatError.png", UriKind.Relative));
                            WarningMessage = "Card formated, present unformated card.";
                            MessageColour  = Brushes.OrangeRed;
                        }
                        else
                        {
                            CardImage = new BitmapImage(new Uri(@"/Resources/Images/CardValid.png", UriKind.Relative));
                            VMReturnData.NextButtonEnabled = true;
                            MessageColour  = Brushes.White;
                            WarningMessage = "Card VALID: Click next to continue";
                        }
                    }
                    else
                    {
                        ClearDetails();
                        VMReturnData.NextButtonEnabled = false;
                    }
                }
            }
            else
            {
                //View is not visible, do not update
                //Stop any animations on this vieModel
                View.Visibility            = Visibility.Collapsed;
                VMReturnData.NewIssuerCard = false;
                VMReturnData.NewIssuerUID  = 0;
            }
        }
예제 #2
0
        public override void Update(ViewModelReturnData VMReturnData)
        {
            //Only update this view if visible
            if (VMReturnData.StartUpView_Active)
            {
                this.View.Visibility = Visibility.Visible;
                #region Startup operation
                CardPresent = formated & VMReturnData.CardInField;
                if (VMReturnData.CardInField && !VMReturnData.OptionsPressed && !VMReturnData.NewIssuerCard)
                {
                    if (VMReturnData.prevUID == 0)
                    {
                        VMReturnData.prevUID = VMReturnData.UID;
                        readVis = Visibility.Collapsed;
                    }
                    else if (VMReturnData.prevUID != VMReturnData.UID)
                    {
                        VMReturnData.cardChanged     = true;
                        VMReturnData.CardFormatError = false;
                        oneRead = false;
                        VMReturnData.prevUID = VMReturnData.UID;
                    }

                    if (VMReturnData.cardChanged && VMReturnData.LicenceView_Active && VMReturnData.EditCard != true)
                    {
                        VMReturnData.BackApp();
                        VMReturnData.cardChanged = false;
                    }
                    else if (VMReturnData.NewCardWindow < 1 && formated && !VMReturnData.NewCardAccess_Active)
                    {
                        VMReturnData.cardChanged = false;
                        if (!oneRead)
                        {
                            ReadCardInfoHandler();
                            readVis = Visibility.Visible;
                            oneRead = true;
                        }
                    }
                    else if (VMReturnData.NewCardWindow < 1 && !formated && !VMReturnData.NewCardAccess_Active)
                    {
                        VMReturnData.cardChanged = false;
                        if (!oneRead)
                        {
                            NewCardInfoHandler();
                            readVis = Visibility.Visible;
                            oneRead = true;
                        }
                    }

                    UID = RFIDCardInfoRead.UIDtoString(VMReturnData.UID);
                    RFIDCardInfoRead.UID = VMReturnData.UID;
                    formated             = RFIDCardInfoRead.Block1Info();

                    if (formated)
                    {
                        CardImage = new BitmapImage(new Uri(@"/Resources/Images/CardValid.png", UriKind.Relative));
                    }
                    else
                    {
                        CardImage = new BitmapImage(new Uri(@"/Resources/Images/CardFormatError.png", UriKind.Relative));

                        //readVis = Visibility.Collapsed;
                    }
                    VMReturnData.cardInfoRead.formatted = formated;


                    if (ReadCardPressed == true)
                    {
                        ReadCardPressed = false;
                        doneProgress    = false;
                        ProgressBarTimer.Start();
                        VMReturnData.cardInfoRead.ReadInfo(VMReturnData.UID);
                    }

                    if (NewCardPressed == true)
                    {
                        //VMReturnData.NewCardAccess_Active = true;
                        ReadCardInfoHandler();
                        VMReturnData.EditCard      = false;
                        VMReturnData.EditCardUID   = 0;
                        VMReturnData.NewCardWindow = 0;
                        VMReturnData.NewCardUID    = VMReturnData.UID;
                        NewCardPressed             = false;
                    }
                }
                else
                {
                    UID = "Present RFID card";
                    ProgressBarValue = 0;
                    ReadProgress     = default_max;
                    doneProgress     = false;
                    oneRead          = false;
                    this.CardImage   = new BitmapImage(new Uri(@"/Resources/Images/PresentCard.png", UriKind.Relative));
                    ProgressBarTimer.Stop();
                    readVis = Visibility.Collapsed;
                }

                if (OptionsPressed)
                {
                    OptionsPressed = false;
                    VMReturnData.MenuView_Active = true;
                }

                if (doneProgress)
                {
                    if (!VMReturnData.cardInfoRead.formatted)
                    {
                        VMReturnData.CardFormatError = true;
                    }
                    else
                    {
                        VMReturnData.LicenceView_Active = true;
                    }

                    doneProgress     = false;
                    ProgressBarValue = 2;
                    ReadProgress     = default_max;
                }
                #endregion

                #region Exit button
                else if (_buttonExitPressed)
                {
                    _buttonExitPressed = false;
                    VMReturnData.ExitPromtView_Active = true;
                }
                #endregion
            }
            else
            {
                this.View.Visibility = Visibility.Collapsed;
            }
        }