public void PopUpNotification(NotificationElement ne)
    {
        SetLanguage();

        if (ne != null)
        {
            NotificationElement      = ne;
            notificationText.enabled = true;
            portrait.enabled         = true;

            portrait.sprite = NotificationElement.speakerPic;

            if (language == "german")
            {
                notificationText.text = NotificationElement.dialogueTextGerman;
            }
            else
            {
                notificationText.text = NotificationElement.dialogueTextEnglish;
            }

            StartCoroutine("MoveNotifiactionUp");
        }
        else
        {
            Debug.LogError("The notification element is null or empty");
            PopUpNotification(defaultNotificationElement);
        }
    }
Ejemplo n.º 2
0
    // Update is called once per frame
    void Update()
    {
        if (!isOpen && nQueue.Count > 0)
        {
            NotificationElement e = nQueue.Dequeue();
            isOpen = true;
            //textBox.SetActive(true);
            textMesh.text = e.message();
            ms            = e.message;
            Sequence seq = DOTween.Sequence()
                           .OnStart(() => textBox.SetActive(true))
                           .Append(textBox.transform.DOLocalMoveX(-600, 0.3f).SetRelative().SetEase(Ease.OutCubic))
                           .AppendInterval(e.duration)
                           .Append(textBox.transform.DOLocalMoveX(600, 0.3f).SetRelative().SetEase(Ease.InCubic))
                           .OnComplete(() =>
            {
                isOpen = false;
                textBox.SetActive(false);
            });
            //textBox.transform.DOMoveX(-400,)
        }

        if (isOpen)
        {
            textMesh.text = ms?.Invoke();
        }
    }
    // Start is called before the first frame update
    void Start()
    {
        NotificationElement = defaultNotificationElement;

        variableEventSystem = GameObject.FindGameObjectWithTag("VariableEventSystem").GetComponent <VariableEventSystem>();

        notificationText = notificationUIGroup.GetComponentInChildren <Text>();
        portrait         = notificationUIGroup.GetComponentInChildren <Image>();
        rectTransform    = notificationUIGroup.GetComponent <RectTransform>();

        defaultHiddenPositionY = rectTransform.anchoredPosition.y;

        //Only for Debugging:
        //PopUpNotification(NotificationElement);
    }
Ejemplo n.º 4
0
        public void ActiveNotificationsShouldFadeOut()
        {
            // two notifications
            var notification = new NotificationElement(NotificationType.Info, @"Test");

            new TestScheduler().With(s =>
            {
                var viewModel = Substitute.For <NotificationViewModel>(EventAggregator);

                EventAggregator.Publish(new NotificationEvent
                {
                    Notification = notification
                });

                s.AdvanceByMs(viewModel.notificationDelay.TotalMilliseconds);

                notification.IsActive.Should().BeTrue();

                s.AdvanceByMs(viewModel.timeoutDelay.TotalMilliseconds);

                notification.IsFading.Should().BeTrue();
            });
        }
Ejemplo n.º 5
0
        private async void ExecuteLogInOutCommand()
        {
            if (AzureAdService.IsLoggedIn())
            {
                AzureAdService.Logout();
                IsLoggedIn             = false;
                UserProfileName        = "It's pretty alone down here.";
                UserProfilePhotoString = _defaultUserPhoto;
                LogInOutString         = "Login";

                _navigationService.NavigateTo(ViewModelLocator.StartUpPageKey);
                _dialogService.Show(Helpers.DialogType.Success, "Succesfully logged out.");
            }
            else
            {
                NotificationElement wait = null;
                try
                {
                    wait = _dialogService.Show(Helpers.DialogType.BusyWaiting,
                                               "Connecting to Azure Active Directory. Please wait.");
                    await AzureAdService.Login();
                }
                catch (Exception e)
                {
                    AzureAdService.HandleException(e);
                }
                finally
                {
                    wait.Hide();
                }

                if (AzureAdService.IsLoggedIn())
                {
                    IsLoggedIn     = true;
                    LogInOutString = "Logout";

                    User signedInUser = new User();
                    try
                    {
                        signedInUser = (User)await AzureAdService._client.Me.ExecuteAsync();

                        UserProfileName = signedInUser.DisplayName;
                    }
                    catch (Exception e)
                    {
                        _dialogService.Show(Helpers.DialogType.Error,
                                            $"Error getting signed in user {AzureAdService.ExtractErrorMessage(e)}");
                    }

                    if (signedInUser.ObjectId != null)
                    {
                        CouriersTodayActiveOrderList.Clear();
                        CouriersTodayActiveOrderList.Add("Display name: " + signedInUser.DisplayName);
                        CouriersTodayActiveOrderList.Add("Given name: " + signedInUser.GivenName);
                        CouriersTodayActiveOrderList.Add("Country: " + signedInUser.Country);
                        CouriersTodayActiveOrderList.Add("Phone: " + signedInUser.TelephoneNumber);
                        CouriersTodayActiveOrderList.Add("Department: " + signedInUser.Department);
                        CouriersTodayActiveOrderList.Add("Job title: " + signedInUser.JobTitle);
                        CouriersTodayActiveOrderList.Add("Usage location: " + signedInUser.UsageLocation);

                        IUser sUser = (IUser)signedInUser;
                        try
                        {
                            using (var dssr = await sUser.ThumbnailPhoto.DownloadAsync())
                            {
                                BitmapImage bitmapimage = new BitmapImage();
                                bitmapimage.BeginInit();
                                bitmapimage.StreamSource = dssr.Stream;
                                bitmapimage.CacheOption  = BitmapCacheOption.OnLoad;
                                bitmapimage.EndInit();
                                UserProfilePhotoString = bitmapimage;
                            }
                        }
                        catch (Exception e)
                        {
                            if (e.Message.Contains("Request_ResourceNotFound") || (e.InnerException != null && e.InnerException.Message.Contains("Request_ResourceNotFound")))
                            {
                                //User doesn't have profile picture
                                return;
                            }
                            else
                            {
                                _dialogService.Show(Helpers.DialogType.Error,
                                                    $"Error getting signed in user {AzureAdService.ExtractErrorMessage(e)}");
                            }
                        }
                    }
                }
            }
        }