public override void Update(ViewModelReturnData VMReturnData) { //Only update this view if visible if (VMReturnData.ProgramPromtView_Active) { this.View.Visibility = Visibility.Visible; if (VMReturnData.NewIssuerCard) { ProgramPrompt = "Do you wish to save this card file?"; } else { ProgramPrompt = "Do you wish to Program this card?"; } if (OkButtonPressed) { OkButtonPressed = false; VMReturnData.ProgramPromtView_Active = false; if (!VMReturnData.NewIssuerCard) { if (VMReturnData.CardInfoWrite.WriteInfoToCard(VMReturnData.VMCardDetails, VMReturnData.CardType) == 100) { VMReturnData.CardProramed_done = true; VMReturnData.App_datareset(); } else { VMReturnData.CardProgramFail = true; VMReturnData.NewCardWindow--; } } else { CardDetailsFile cardDetailsFile = new CardDetailsFile(); cardDetailsFile.createdBy = "N. Pretorius"; cardDetailsFile.dateCreated = DateTime.Now; cardDetailsFile.version = 1; VMReturnData.VMCardDetails.cardUID = VMReturnData.NewIssuerUID; cardDetailsFile.FCardDetails = VMReturnData.VMCardDetails; CardDetailManager.CreateCardDetailFile(cardDetailsFile); VMReturnData.CardProramed_done = true; VMReturnData.App_datareset(); } } if (NoButtonPressed) { NoButtonPressed = false; VMReturnData.ProgramPromtView_Active = false; VMReturnData.NewCardWindow--; } } else { this.View.Visibility = Visibility.Collapsed; } }
public override void Update(ViewModelReturnData VMReturnData) { if (VMReturnData.NewCardIssuer_Active) { this.View.Visibility = Visibility.Visible; #region Navigationbar details VMReturnData.ViewTitle = "New Issuer Card"; VMReturnData.SubTitle = "New Issuer details"; //VMReturnData.CurrentPageNumber = 1; //VMReturnData.TotalPageNumber = 4; VMReturnData.MenuButtonEnabled = Visibility.Collapsed; VMReturnData.HelpButtonEnabled = Visibility.Visible; #endregion if (IssuerFileCardBtnPressed) { IssuerFileCardBtnPressed = false; MernokPasswordFile mernokPasswordFile = MernokPasswordManager.ReadMernokPasswordFile(V); OpenFileDialog openFileDialog1 = new OpenFileDialog(); openFileDialog1.Filter = "License Files|*.merlic"; openFileDialog1.Title = "Select a Mernok Licnese File"; if (openFileDialog1.ShowDialog() == true) { // Assign the cursor in the Stream to the Form's Cursor property. Console.WriteLine(Path.GetFullPath(openFileDialog1.FileName)); LicenseFilePath = Path.GetFullPath(openFileDialog1.FileName); CardDetailsFile = CardDetailManager.ReadCardDetailFile(LicenseFilePath); VMReturnData.VMCardDetails = CardDetailsFile.FCardDetails; VMReturnData.NewCardUID = CardDetailsFile.FCardDetails.cardUID; } // } if (CardDetailsFile.FCardDetails == null) { WarningMessageF = "Please select a license file."; CardUidPresVis = Visibility.Collapsed; } else { CardUidPresVis = Visibility.Visible; } if (!VMReturnData.CardInField) { if (CardDetailsFile.FCardDetails != null) { WarningMessageI = "Present RFID card with UID: " + VMReturnData.cardInfoRead.UIDtoString(CardDetailsFile.FCardDetails.cardUID); } MessageColour = Brushes.OrangeRed; } else if (CardDetailsFile.FCardDetails != null && CardDetailsFile.FCardDetails.cardUID == VMReturnData.UID) { VMReturnData.VMCardDetails.IssuerUID = CardinFieldUID = VMReturnData.UID; MernokPasswordFile mernokPasswordFile = MernokPasswordManager.ReadMernokPasswordFile(V); bool password = true;// PasswordFinder.FindPasswordinFile(AdminPassword, mernokPasswordFile); if (password) { PassColour = Brushes.GreenYellow; string[] IssuerDetails = { "1", "piet", "1", "2" }; //PasswordDecriptor.PasswordToDetails(AdminPassword); VMReturnData.VMCardDetails.EngineerName = IssuerDetails[3]; VMReturnData.VMCardDetails.EngineerUID = UInt32.Parse(IssuerDetails[0]); VMReturnData.NextButtonEnabled = true; WarningMessageI = "Password good, click next to continue"; MessageColour = Brushes.White; } else { MessageColour = Brushes.OrangeRed; PassColour = Brushes.OrangeRed; VMReturnData.NextButtonEnabled = false; if (AdminPassword == "") { WarningMessageI = "Enter your password"; } else { WarningMessageI = "Enter correct password"; } } } } else { //View is not visible, do not update //Stop any animations on this vieModel this.View.Visibility = Visibility.Collapsed; AdminPassword = ""; } }