protected override void ValidateSelf(EPages type) { if (type != EPages.ACC && (string.IsNullOrEmpty(this.email) || !Regex.IsMatch(this.email, "^.{1,50}$"))) { this.ValidationErrors["Email"] = "Email can be between 1 and 50 characters."; } if (string.IsNullOrEmpty(this.password) || !Regex.IsMatch(this.password, "^.{1,50}$")) { this.ValidationErrors["Password"] = "******"; } if (type.Equals(EPages.REG) || type.Equals(EPages.ACC)) { if (string.IsNullOrEmpty(this.firstName) || !Regex.IsMatch(this.firstName, "^.{1,50}$")) { this.ValidationErrors["FirstName"] = "First name can be between 1 and 50 characters."; } if (string.IsNullOrEmpty(this.lastName) || !Regex.IsMatch(this.lastName, "^.{1,50}$")) { this.ValidationErrors["LastName"] = "Last name can be between 1 and 50 characters."; } if (type != EPages.ACC && (string.IsNullOrEmpty(this.email) || !Regex.IsMatch(this.email, @"\A(?:[a-z0-9!#$%&'*+/=?^_`{|}~-]+(?:\.[a-z0-9!#$%&'*+/=?^_`{|}~-]+)*@(?:[a-z0-9](?:[a-z0-9-]*[a-z0-9])?\.)+[a-z0-9](?:[a-z0-9-]*[a-z0-9])?)\Z"))) { this.ValidationErrors["Email"] = "Email format isn't valid."; } if ((string.IsNullOrEmpty(this.password) && string.IsNullOrEmpty(this.confirmPassword)) || !this.password.Equals(this.confirmPassword)) { this.ValidationErrors["ConfirmPassword"] = "******"; } } }
protected override void ValidateSelf(EPages type) { if (string.IsNullOrEmpty(this.name) || !Regex.IsMatch(this.name, "^.{1,50}$")) { this.ValidationErrors["Name"] = "Name can be between 1 and 50 characters."; } }
public void Validate(EPages type) { this.ValidationErrors.Clear(); this.ValidateSelf(type); this.IsValid = this.ValidationErrors.IsValid; this.OnPropertyChanged("IsValid"); this.OnPropertyChanged("ValidationErrors"); }
public void NextPage(EPages nextPage) { previousPageManager.AddPage(nextPage); MasterPage currentMasterPage = PagesManager[previousPageManager.CurrentPage()]; MasterPage previousMasterPage = PagesManager[previousPageManager.BeforeCurrentPage()]; previousMasterPage.gameObject.SetActive(true); currentMasterPage.gameObject.SetActive(true); previousMasterPage.PageViewAnimation(EPageViewAnimation.Close); currentMasterPage.PageViewAnimation(EPageViewAnimation.Open); }
protected abstract void ValidateSelf(EPages type);
protected void ButtonToPageRef(Button button, EPages page) { button.onClick.AddListener(delegate { canvasManager.NextPage(page); }); button.onClick.AddListener(delegate { SoundManager.Instance.PlayUiButtonSound(); }); }
public void AddToPageDictionary(EPages page, MasterPage pageClass) { PagesManager.Add(page, pageClass); }
public EPages AddPage(EPages newPage) { previousPageManager.Add(newPage); return(newPage); }
public PreviousPageManager(EPages startingPage) { previousPageManager = new List <EPages>(); AddPage(startingPage); }
public void Activate(EPages page, int serviceID) { if (CurrentPage != null) { PageUnLoading(CurrentPage); container.Children.Clear(); CurrentPage.Dispose(); } mainPage.serviceID = serviceID; CurrentPage = Activator.CreateInstance(pages[page]) as BasePage; CurrentPage.uiDriver = this; CurrentPage.container = mainPage; if (pages[page] == typeof(pageLogon)) { LogOff(this, new EventArgs()); (CurrentPage as pageLogon).AuthenticationSucceded += new AuthenticatedHandler(UIDriver_AuthenticationSucceded); } PageLoading(CurrentPage); if (CurrentPage is AuthenticatedPage) { AuthenticatedPage cp = CurrentPage as AuthenticatedPage; if (cp.Authenticate() && cp.Authorize()) { container.Children.Add(CurrentPage); PageLoaded(CurrentPage); } else { CurrentPage.Dispose(); Activate(EPages.Logon); } } else { container.Children.Add(CurrentPage); PageLoaded(CurrentPage); } mainPage.serviceID = serviceID; }
public void ChangePage(EPages pageName) { CurrentPage = pageName; PageChanged?.Invoke(this, new EventArgs()); }