private void SaveNotification(object sender, EventArgs e) { DateTime tempTime = PickDate.Date.Date.Add(PickTime.Time); CurrentNotification = CurrentNotification ?? new Notification(); CurrentNotification.UserId = User.Instance.Id; CurrentNotification.Text = Text.Text; CurrentNotification.TriggerTime = tempTime; if (UpdateCheck) { if (!handler.UpdateNotification(CurrentNotification)) { ErrorHandler.ShowError(handler.ErrorMessage); } else { ErrorHandler.DialogGoBack(ViewModel.Content["DIALOG_ALARM_UPDATED"].ToString()); } } else if (!handler.AddNotification(CurrentNotification)) { ErrorHandler.ShowError(handler.ErrorMessage); } else { ErrorHandler.DialogGoBack(ViewModel.Content["DIALOG_ALARM_CREATED"].ToString()); } }
public void AddNotification(IToastNotification notification) { if (!NotificationHandler.ToastNotifications.Contains(notification)) { NotificationHandler.AddNotification(notification); OnToastReceived?.Invoke(this, new ToastChangedEventArgs(notification)); OnToastChanged?.Invoke(this, new ToastChangedEventArgs()); } }
void Start() { mRaycastHits = new RaycastHit[NumberOfRaycastHits]; mMap = GetComponentInChildren <Environment>(); mCharacter = Instantiate(Character, transform); mUiItemBar = new ItemSlotController[UiItemMenuBarItemCount]; // Add all item slot images for (int i = 0; i < UiItemMenuBarItemCount; i++) { mUiItemBar[i] = GameObject.Instantiate(UiItemMenuBarItem); mUiItemBar[i].transform.SetParent(UiItemMenuBar.transform); RectTransform recTransform = mUiItemBar[i].GetComponent <RectTransform>(); recTransform.localScale = new Vector3(1, 1, 1); recTransform.localEulerAngles = new Vector3(0, 0, 0); recTransform.localPosition = new Vector3(recTransform.position.x, recTransform.position.y, 0); } // Init the character mCharacter.SetUIItemBar(mUiItemBar, UIItemMenuBarLable); mCharacter.SetActionBar(UIActionSlotPrefab, UIActionBar, UIMaxActionStream, UIActionLable); CameraController.Character = mCharacter; mMouseHoldTime = 0.0f; mInterfaceState = 0; mDayTime = DayStartTime; // Init the action selector ActionSelector.SetEnabled(false); ActionSelector.mCharacter = mCharacter; CameraController.SetFollowing(true); // Init the mini map mMinimapVisulization = new Texture2D(200, 200); MinimapImage.texture = mMinimapVisulization; Generate(); if (!MapGenerationPayload.loadFromFile) { NotificationHandler.AddNotification(ref LandmarkNotification.NewGame, new[] { "Welcome to Celestia, throughout your time here, you will receive tips and tricks that will appear here!", "To select a tool, you can use numbers 1-9 on your keyboard. Try pressing 1 and cut down a tree by selecting one with the mouse left click", "You can queue up actions for your character by holding shift and clicking a action. Give it a try by selecting multiple trees.", "You can also preform a area select by pressing Left-CTRL and clicking on a object you want to interact with, then drag over the area and choose the action" } ); } }
public async Task <Address> Update(AddressDto addressDto) { Address address = await _addressRepository.GetById(addressDto.AddressId); if (address != null) { _mapper.Map(addressDto, address); address.Validate(address, new AddressValidator()); _notifications.AddNotifications(address.ValidationResult); if (!_notifications.HasNotifications) { await Put(address); } } else { _notifications.AddNotification("404", "AddressId", "Address with id = " + addressDto.AddressId + " not found"); } /* * if (address != null) { * * address.Cep = obj.Cep; * address.Street = obj.Street; * address.Number = obj.Number; * address.Complement = obj.Complement; * address.Neighborhood = obj.Neighborhood; * address.City = obj.City; * address.Uf = obj.Uf; * address.TypeGeneric = await _typeGenericRepository.GetById(obj.TypeGenericId); * * address.Validate(address, new AddressValidator()); * * if (address.Valid) { * await Put(address); * } else { * _notifications.AddNotifications(address.ValidationResult); * } * } else { * _notifications.AddNotification("404", "AddressId", "Graduate with id = " + obj.AddressId + " not found"); * } */ return(address); }
private void SavePrimaryAlarm(object sender, EventArgs e) { DateTime tempTime = PickDate.Date.Date.Add(PickTime.Time); if (TimeType1.IsChecked != true && TimeType2.IsChecked != true) { ErrorHandler.ShowError(ErrorHandler.ReturnErrorMessage("ERROR_FILL_ALL_FIELDS")); return; } Notification tempNotification = new Notification(); if (PrimaryNotification != null) { tempNotification.Id = PrimaryNotification.Id; } tempNotification.UserId = User.Instance.Id; tempNotification.Primary = true; tempNotification.Text = ViewModel.Content["TEXT_REMEMBER_PRIMARY"].ToString(); tempNotification.TriggerTime = tempTime; bool tempBool = (TimeType1.IsChecked == true); if (UpdateCheck) { if (!handler.UpdateNotification(tempNotification, tempBool)) { ErrorHandler.ShowError(handler.ErrorMessage); } else { ErrorHandler.ShowError(ErrorHandler.ReturnErrorMessage("DIALOG_ALARM_UPDATED")); } } else if (!handler.AddNotification(tempNotification, tempBool)) { ErrorHandler.ShowError(handler.ErrorMessage); } else { ErrorHandler.ShowError(ErrorHandler.ReturnErrorMessage("DIALOG_ALARM_UPDATED")); } }
public async Task<Phone> Update(PhoneDto phoneDto) { Phone phone = await _phoneRepository.GetById(phoneDto.PhoneId); if (phone != null) { _mapper.Map(phoneDto, phone); phone.Validate(phone, new PhoneValidator()); _notifications.AddNotifications(phone.ValidationResult); if (!_notifications.HasNotifications) { await Put(phone); } } else { _notifications.AddNotification("404", "PhoneId", "Phone with id = " + phoneDto.PhoneId + " not found"); } return phone; }
public async Task <Course> Update(CourseDto courseDto) { Course course = await _courseRepository.GetById(courseDto.CourseId); if (course != null) { _mapper.Map(courseDto, course); course.Validate(course, new CourseValidator()); _notifications.AddNotifications(course.ValidationResult); if (!_notifications.HasNotifications) { await Put(course); } } else { _notifications.AddNotification("404", "CourseId", "Course with id = " + courseDto.CourseId + " not found"); } return(course); }
public async Task <ActionResult> Login(Login loginUser) { //if (!ModelState.IsValid) return BadRequest(ModelState.Values.SelectMany(e => e.Errors)); var result = await _signInManager.PasswordSignInAsync(loginUser.UserName, loginUser.Password, false, true); var token = await GetJWT(loginUser.UserName); if (result.Succeeded) { var data = new { userData = new { displayName = "Julio Rodrigues", photoURL = @"/assets/images/portrait/small/avatar-s-11.jpg" }, accessToken = token }; return(Response(data)); } _notifications.AddNotification("UserName/PassWord", "User", "Usuário ou senha inválidos"); return(Response()); }