Inheritance: MonoBehaviour
    public void PushNotification(NotificationData data, string notificationIdentifier = "")
    {
        if (data.TemplateId == "")
        {
            Debug.LogError("[ERROR] TemplateId Not Set");
            return;
        }
        if (!PrefabManager.IsContainPrefab(data.App, data.TemplateId))
        {
            Debug.LogError("[ERROR] TemplateId Not Found");
            return;
        }

        NotificationId   id = new NotificationId(data.App, notificationIdentifier);
        NotificationView notificationView;

        if (!tryGetNotificationView(id, out notificationView))
        {
            notificationView = NotificationView.CreateNotificationView(data.TemplateId, id);
        }
        loadNewTemplate(ref notificationView, data.TemplateId);
        notificationView.ResolveNotificationData(data);
        notificationView.transform.SetAsFirstSibling();
        StartCoroutine(notificationView.ShowTransition(m_lerpSpeed, m_lerpThreshold));
    }
    private void loadNewTemplate(ref NotificationView view, string templateId)
    {
        NotificationId tempId = view.Id;

        Destroy(view.gameObject);
        view = NotificationView.CreateNotificationView(templateId, tempId);
    }
Esempio n. 3
0
    public void DoJoinLobby(GameObject go)
    {
        if (CommonTLMN.ValidateChipToBetting(lobby.betting, lobby.config.GAME_TYPE_TLMN) == false)
        {
            int rule = lobby.config.GAME_TYPE_TLMN == LobbyTLMN.GameConfig.GameTypeLTMN.XEP_HANG ? CommonTLMN.RULE_XEP_HANG_CHIP_COMPARE_BETTING : CommonTLMN.RULE_DEM_LA_CHIP_COMPARE_BETTING;
            Common.MessageRecharge("Số tiền của bạn phải lớn hơn hoặc bằng " + rule + " lần tiền cược.");
            return;
        }

        GetComponent <CUIHandle>().StopImpact(2f);

        if (lobby.numberUserInRoom == lobby.maxNumberPlayer)
        {
            NotificationView.ShowMessage("Bàn chơi đã đầy. Xin vui lòng tìm bàn chơi khác.", 2f);
            return;
        }

        Debug.Log("DoJoinLobby zone,room,lobby: " + lobby.zoneId + "," + lobby.roomId + "," + lobby.gameId);
        GameManager.Instance.selectedLobby = lobby;

        if (lobby.isPassword)
        {
            NotificationView.ShowDialog("Nhập mật khẩu để truy cập bàn chơi.", ProcessInputPassword);
        }
        else
        {
            ProcessInputPassword("");
        }
    }
    void Start()
    {
        if (GameManager.PlayGoldOrChip != GOLD && GameManager.PlayGoldOrChip != CHIP)
        {
            GameManager.PlayGoldOrChip = GOLD;
        }
        GameManager.Server.DoRequestCommand(Fields.REQUEST.REQUEST_FULL);
        if (GameManager.Setting.IsFirstLogin)
        {
            GameManager.Setting.IsFirstLogin = false;
            NotificationView.ShowConfirm(
                Fields.MESSAGE.FIRST_LOGIN_NOTE, Fields.MESSAGE.FIRST_LOGIN_MESSAGE,
                delegate()
            {
                StoreGame.SaveInt(StoreGame.EType.CHANGE_INFORMATION, 1);
                ProfileView.Instance.CheckWhenStart();
            }
                , null, "CẬP NHẬT", "ĐỂ SAU"
                );
        }
        GetDataUserInfo();
        SetIcon();

        HeaderMenu.Instance.OnClickButtonBackCallBack = delegate()
        {
            GameManager.Server.DoJoinRoom(GameManager.Instance.hallRoom.zoneId, GameManager.Instance.hallRoom.roomId);
        };
    }
Esempio n. 5
0
        /// <summary>The on startup.</summary>
        /// <param name="e">The e.</param>
        protected override void OnStartup(StartupEventArgs e)
        {
            base.OnStartup(e);
            this.InitializeErrorHandler();
            NotificationView.Initialize();
            var result = new QueueHandler(e.Args).Process();

            string message = null;

            if (result == Status.Success)
            {
                message = Literals.ShellExtension_Subtitles_downloaded_successfully;
            }
            else if (result == Status.Fatal)
            {
                message = Literals.ShellExtension_Failed_process_request;
            }

            if (string.IsNullOrEmpty(message))
            {
                NotificationView.AttachEndHandler((sender, args) => this.Dispatcher.InvokeShutdown());
            }
            else
            {
                NotificationView.Show(message, (sender, args) => this.Dispatcher.InvokeShutdown());
            }
        }
    void ProcessAfterRecharge(bool isDone, WWW response, IDictionary json)
    {
        if (isDone && json.Contains("code"))
        {
            if (json.Contains("code") && json["code"].ToString() == "1")
            {
                serial.value   = "";
                cardCode.value = "";
            }
            else
            {
                if (string.IsNullOrEmpty(json["message"].ToString()))
                {
                    NotificationView.ShowMessage("Có lỗi trong quá trình nạp thẻ. Bạn vui lòng thử lại!");
                }
                else
                {
                    NotificationView.ShowMessage(json["message"].ToString());
                }
                WaitingView.Hide();
            }
        }
        else
        {
            NotificationView.ShowMessage("Thông tin thẻ nạp không hợp lệ!");
            WaitingView.Hide();
        }


        flag = false;
        //WaitingView.Hide();
    }
Esempio n. 7
0
 private void gcmReceiverMessage(Dictionary <string, object> obj)
 {
     if (obj.ContainsKey("message"))
     {
         string title   = "Thông báo từ hệ thống";
         string message = obj ["message"].ToString();
         if (obj.ContainsKey("title"))
         {
             title = obj ["title"].ToString();
         }
         if (obj.ContainsKey("action"))
         {
             string action = obj ["action"].ToString();
             string url    = obj ["url"].ToString();
             NotificationView.ShowConfirm(title, message, delegate() {
                 Application.OpenURL(url);
                 Debug.Log("open url");
             }, null);
         }
         else
         {
             ServerMessagesView.MessageServer(title, message, 5f);
         }
     }
 }
    void OnClickSaveSecurity(GameObject go)
    {
        User user = GameManager.Instance.mInfo;

        if (user.email == null)
        {
            if (!Utility.Input.IsEmail(txtEmail.value))
            {
                NotificationView.ShowMessage("Email không đúng định dạng. Đề nghị nhập lại.\nVí dụ: [email protected]");
                return;
            }
        }
        if (user.cmtnd == null)
        {
            if (!Utility.Input.IsCMTND(txtCMTND.value))
            {
                NotificationView.ShowMessage("Số chứng minh thư không có thật.\nSố chứng minh thư là số có 9 chữ số.");
                return;
            }
        }
        if (user.phone == null)
        {
            if (!Utility.Input.IsPhone(txtPhone.value))
            {
                NotificationView.ShowMessage("Số điện thoại không có thật.\nSố điện thoại đúng định dạng là số có 10-11 chữ số.");
                return;
            }
        }
        if (!isChangeSecurityInfor)
        {
            _ChangeSecurityInfor();
            isChangeSecurityInfor = true;
        }
    }
Esempio n. 9
0
    protected virtual void OnGenericError(GenericErrorResponse e)
    {
        Debug.LogError("GenericErrorResponse: " + e.ErrorType);
        switch (e.ErrorType)
        {
        case ErrorType.ActionRequiresLogin:
            DoLogOut();
            NotificationView.ShowMessage("Phiên đăng nhập hết hạn, mời bạn đăng nhập lại.", 5f);
            break;

        case ErrorType.UserBanned:
            NotificationView.ShowMessage("Tài khoản của bạn đã bị ban, không thể vào phòng.", 5f);
            break;

        case ErrorType.FailedToJoinGameRoom:
            NotificationView.ShowMessage("Không thể vào phòng game.", 5f);
            break;

        case ErrorType.UserNameExists:
            NotificationView.ShowMessage("Gặp lỗi bất thường khi thực hiện đăng nhập, mã lỗi: -1", 5f);
            break;

        case ErrorType.UserNotJoinedToRoom:
            // NotificationView.ShowMessage("", 5f);
            break;

        default:
            break;
        }
    }
    void ProcessAfterChangeInformation(bool isDone, WWW textResponse, IDictionary json)
    {
        isChangedInformation = false;
        if (isDone)
        {
            NotificationView.ShowMessage(json["message"].ToString(), 3f);
            if (json["code"].ToString() == "1")
            {
                Hashtable user = (Hashtable)json["user"];
                panelShowGeneral.SetActive(true);
                panelEditGeneral.SetActive(false);
                string gender = user["gender"].ToString().Equals("male") ? "Nam" : "Nữ";
                lbSex.text = gender;

                string[] arr      = user["birthday"].ToString().Split(":".ToCharArray(), StringSplitOptions.RemoveEmptyEntries);
                DateTime birthday = new DateTime(int.Parse(arr[0]), int.Parse(arr[1]), int.Parse(arr[2]));

                lbBrithday.text = Utility.Convert.TimeToString(birthday);
                lbAddress.text  = user["address"].ToString();
                GameManager.Instance.mInfo.firstName  = user["first_name"].ToString();
                GameManager.Instance.mInfo.lastName   = user["last_name"].ToString();
                GameManager.Instance.mInfo.middleName = user["middle_name"].ToString();
                GameManager.Instance.mInfo.gender     = lbSex.text;
                GameManager.Instance.mInfo.brithday   = birthday;
                GameManager.Instance.mInfo.address    = lbAddress.text;

                lbFullname.text = GameManager.Instance.mInfo.FullName;
            }
        }
        WaitingView.Instance.Close();
    }
Esempio n. 11
0
        private void HandleCollectionChanged(object sender, NotifyCollectionChangedEventArgs e)
        {
            if (e.Action == NotifyCollectionChangedAction.Add)
            {
                var replaceExisting = false;
                var minWidth = 0.0;

                if (currentNotification != null)
                {
                    minWidth = currentNotification.ActualWidth;
                    replaceExisting = true;
                    RemoveOldNotification();
                }

                var item = e.NewItems[0] as Notification;

                currentNotification = new NotificationView() { DataContext = item, MinWidth = minWidth};
                currentNotification.MouseLeftButtonUp +=
                    delegate { if (currentNotification != null) RemoveOldNotification(); };

                LayoutRoot.Children.Add(currentNotification);
                currentNotification.Display(replaceExisting);

                if (item != null && item.Level == NotificationLevel.Error)
                {
                    timer.Interval = TimeSpan.FromSeconds(6);
                }
                else
                {
                    timer.Interval = TimeSpan.FromSeconds(3);
                }

                timer.Start();
            }
        }
 private async Task loadSender(NotificationView notification)
 {
     notification.Sender =
         AccountViewFactory.Create(await accounts.GetObject(notification.SenderAccountId));
     notification.Sender.AspNetUser =
         await userManager.FindByIdAsync(notification.Sender.AspNetUserId);
 }
Esempio n. 13
0
    public void DoJoinLobby(GameObject go)
    {
        if (Common.ValidateChipToBetting(lobby.betting, GameManager.PlayGoldOrChip) == false)
        {
            int rule = Common.RULE_CHIP_COMPARE_BETTING;
            Common.MessageRecharge("Số tiền của bạn phải lớn hơn hoặc bằng " + rule + " lần tiền cược.");
            return;
        }

        GetComponent <CUIHandle>().StopImpact(2f);

        if (lobby.numberUserInRoom == lobby.maxNumberPlayer)
        {
            NotificationView.ShowMessage("Bàn chơi đã đầy. Xin vui lòng tìm bàn chơi khác.", 2f);
            return;
        }
        GameManager.Instance.selectedLobby = lobby;

        if (lobby.isPassword)
        {
            NotificationView.ShowDialog("Nhập mật khẩu để truy cập bàn chơi", ProcessInputPassword);
        }
        else
        {
            ProcessInputPassword("");
        }
    }
Esempio n. 14
0
        private void OnOpenFile()
        {
            var dlg = new OpenFileDialog();

            dlg.Filter = "Hex files (*.hex) | *.hex";
            if (dlg.ShowDialog().GetValueOrDefault())
            {
                try
                {
                    long size = (settings.MemoryType == MemoryType.FLASH)
                        ? settings.SettingsInfo.Processor.FlashSize
                        : settings.SettingsInfo.Processor.EepromSize;
                    IMemory memory = new Memory(size);
                    hexFileManager.OpenFile(dlg.FileName, memory);
                    var hfvm = new HexFileViewModel(memory, dlg.FileName, this);
                    _files.Add(hfvm);
                    ActiveDocument = hfvm;
                }
                catch (Exception ex)
                {
                    NotificationOpenViewModel vm = new NotificationOpenViewModel(ex.Message);
                    NotificationView          v  = new NotificationView(vm);
                    v.Owner = Application.Current.MainWindow;
                    v.ShowDialog();
                }
                RaiseCanExecuteChanged();
            }
        }
Esempio n. 15
0
    public static NotificationView CreateNotificationView(string templateId, NotificationController.NotificationId id)
    {
        NotificationController notificationController;

#if UNITY_EDITOR
        if (NotificationEditingBehavior.Instance)
        {
            notificationController = NotificationEditingBehavior.Instance.NotificationController;
            GameObject prefab;
            if (notificationController.PrefabManager.TryGetPrefab(id.app, templateId, out prefab))
            {
                GameObject viewObject = UnityEditor.PrefabUtility.InstantiatePrefab(prefab) as GameObject;
                viewObject.transform.SetParent(notificationController.NotificationContainer);
                viewObject.transform.localScale = Vector3.one;
                NotificationView view = viewObject.GetComponent <NotificationView>();
                view.SetIdentifier(id.id);
                return(view);
            }
        }
#endif
        if (NotificationController.Instance)
        {
            notificationController = NotificationController.Instance;
            GameObject prefab;
            if (notificationController.PrefabManager.TryGetPrefab(id.app, templateId, out prefab))
            {
                GameObject       viewObject = Instantiate(prefab, notificationController.NotificationContainer);
                NotificationView view       = viewObject.GetComponent <NotificationView>();
                view.SetIdentifier(id.id);
                return(view);
            }
        }

        return(null);
    }
Esempio n. 16
0
    void OnLogin(LoginResponse response)
    {
        if (response.Successful)
        {
            ServerWeb.StartThread(ServerWeb.URL_REQUEST_USER, new object[] { "username", GameManager.Instance.mInfo.username }, delegate(bool isDone, WWW res, IDictionary json) {
            });
            GameManager.Instance.mInfo.password = lablePassword.value;
            GameManager.Server.DoJoinRoom(GameManager.Instance.hallRoom.zoneId, GameManager.Instance.hallRoom.roomId);

#if UNITY_WEBPLAYER
            if (!hasAccessToken)
            {
                Application.ExternalEval("ajaxLoginUnity(\"" + lableUsername.text + "\", \"" + lablePassword.text + "\");");
            }
#endif
        }
        else
        {
            IsClickButtonLogin = false;
            string message = "Thông tin đăng nhập không hợp lệ. Yêu cầu nhập lại thông tin truy cập.";
            if (response.EsObject.variableExists("reason"))
            {
                message = response.EsObject.getString("reason");
            }
            NotificationView.ShowMessage(message);
        }
    }
 public void ShowOnNotifiaction()
 {
     try
     {
         if (!NotificationView.IsVisible)
         {
             if (BuyNotifications.Count > 0)
             {
                 double x = SystemParameters.PrimaryScreenWidth - NotificationView.Width;
                 double y = SystemParameters.PrimaryScreenHeight - NotificationView.Height - 40;
                 NotificationView.Left = x;
                 NotificationView.Top  = y;
                 NotificationView.Activate();
                 NotificationView.Topmost = HotItemController.Config.IsTopMostNotification;  // important
                 if (HotItemController.Config.IsTopMostNotification)
                 {
                     NotificationView.Show();
                 }
             }
         }
         else
         {
             //NotificationView.Hide();
         }
     }
     catch { }
 }
Esempio n. 18
0
    /// <summary>
    /// Gửi request kick người chơi
    /// </summary>
    void DoRequestKickPlayer(GameObject go)
    {
        if (GameModelChan.CurrentState >= GameModelChan.EGameState.dealClient)
        {
            NotificationView.ShowMessage("Bạn không thể đuổi người chơi khác trong khi ván bài đang diễn ra.");
            return;
        }

        UIContainerAnonymous anony = go.GetComponent <UIContainerAnonymous>();

        if (anony != null)
        {
            NotificationView.ShowConfirm("Xác nhận.", "Bạn có chắc rằng muốn đuổi người chơi " + ((EPlayerController)anony.intermediary).username + "\n\nRa khỏi bàn chơi không ?",
                                         delegate()
            {
                GameManager.Server.DoRequestPluginGame(Utility.SetEsObject(Fields.GAMEPLAY.PLAY, new object[] {
                    Fields.ACTION, "kickPlayer",
                    Fields.PLAYER.USERNAME, ((EPlayerController)anony.intermediary).username
                }));
            }, null);
        }
        else
        {
            Debug.LogError("Không tìm được người chơi");
        }
    }
Esempio n. 19
0
        public MainViewModel()
        {
            viewNotifications     = new NotificationView();
            notificationViewModel = viewNotifications.DataContext as NotificationViewModel;

            GetNotificationsCountRegister();
        }
Esempio n. 20
0
    public void OnClickButtonInvite(GameObject targetObject)
    {
        List <string> lstStr = new List <string>();

        listUserOnline.ForEach(u =>
        {
            if (u.value)
            {
                lstStr.Add(u.mUser.username);
            }
        });

        if (lstStr.Count > 0)
        {
            GameManager.Server.DoRequestPluginGame(Utility.SetEsObject("invitePlayGame", new object[] {
                "invitedUsers", lstStr.ToArray(),
                "zoneId", GameManager.Instance.selectedChannel.zoneId,
                "roomId", GameManager.Instance.selectedChannel.roomId
            }));
            for (int i = 0; i < tableInvite.transform.childCount; i++)
            {
                tableInvite.transform.GetChild(i).GetComponent <UIToggle>().value = false;
            }
            NotificationView.ShowMessage("Đã gửi lời mời thành công", 3f);
        }
        else
        {
            NotificationView.ShowMessage("Bạn chưa chọn một người chơi nào để mời ", 3f);
        }
    }
Esempio n. 21
0
    void OnClickCreate(GameObject go)
    {
        int numBetting = 0;

        for (int i = 0; i < betting.Length; i++)
        {
            if (betting[i] == null)
            {
                continue;
            }

            if (betting[i].value == true && ((ChannelPhom)GameManager.Instance.selectedChannel).bettingValues[i] == ChannelPhom.CHANNEL_BILLIONAIRE_BETTING_OTHER_VALUE)
            {
                numBetting = Convert.ToInt32(txtBetting.value) * 10000;
                break;
            }
            else if (betting[i].value)
            {
                numBetting = ((ChannelPhom)GameManager.Instance.selectedChannel).bettingValues[i];
            }
        }
        if (GameManager.Instance.mInfo.chip < numBetting * CommonPhom.RULE_CHIP_COMPARE_BETTING || numBetting < 0)
        {
            NotificationView.ShowMessage("Mức tiền cược phải nhỏ hơn " + CommonPhom.RULE_CHIP_COMPARE_BETTING + " lần số chip của bạn, hoặc mức cược đang nhỏ hơn 0", 3f);
        }
        else
        {
            WaitingView.Show("Đang tạo bàn");
            DoCreateGame(numBetting);
        }
    }
        public void TestPushNotification_Success()
        {
            //         var str = @"	""Id"" : ""5e772b6e01af179ba4ce65f2"",
            //""ParentID"" : ""5e772b6e01af179ba4ce65f1"",
            //""ParentTypeID"" : 1,
            //""ActionID"" : 6,
            //""SenderID"" : 13617,
            //""Created"" : ""2020-03-22T14:40:06.534+05:30"",
            //""Modified"" : ""2020-03-22T14:40:06.534+05:30"",
            //""IsRead"" : false,
            //""GeneralNotification"" : false";

            //         var mmm = JsonConvert.DeserializeObject<NotificationView>(str);

            var notificatoinObj = new NotificationView()
            {
                Id           = "5e7c42bc0bfd2e2dd070cfa5",
                ActionID     = ActionType.Comment,
                ParentTypeID = ParentType.Post,
                SenderID     = 13600,
                ParentID     = "5e7c42bc0bfd2e2dd070cfa5",
                IsRead       = false
            };

            var deviceid =
                "ee4wtft4cEMWiIZ5ifeQ2h:APA91bEJMYiI9a_Y3IHRsI-iB4PzDMvQtcZoKTXV4cWJABgvh7T1sJgdHDW_x7J3dniAZASSBpRoDuuAg1YCjg9JdJ-JsO6T3-UiHGUm1E5EjC35sfNyXI_PIs1HDEJsrSAUawKQCM2W";

            var yy = _pushNotificationService.SendPushNotificationAsync(notificatoinObj, deviceid).Result;

            Assert.IsNotNull(yy);
        }
Esempio n. 23
0
        private void HandleCollectionChanged(object sender, NotifyCollectionChangedEventArgs e)
        {
            if (e.Action == NotifyCollectionChangedAction.Add)
            {
                var replaceExisting = false;
                var minWidth        = 0.0;

                if (_currentNotification != null)
                {
                    minWidth        = _currentNotification.ActualWidth;
                    replaceExisting = true;
                    RemoveOldNotification();
                }

                _currentNotification = new NotificationView()
                {
                    DataContext = e.NewItems[0], MinWidth = minWidth
                };
                _currentNotification.MouseLeftButtonUp +=
                    delegate { if (_currentNotification != null)
                               {
                                   RemoveOldNotification();
                               }
                };

                LayoutRoot.Children.Add(_currentNotification);
                _currentNotification.Display(replaceExisting);
                _timer.Start();
            }
        }
        public void CreateNotification(ICollection <Inline> title, ICollection <Inline> message, Color color, TimeSpan showTime)
        {
            var notification = new NotificationView(new NotificationViewModel()
            {
                Title    = title,
                Message  = message,
                BarBrush = App.GetBrush(color),
            });

            notifications.Add(notification);

            notification.Show();
            PlaceNotification(notification);

            var timer = new Timer(showTime.TotalMilliseconds);

            timer.Elapsed += (sender, e) =>
            {
                timer.Stop();
                timer.Dispose();
                timers.Remove(timer);

                notification.Dispatcher.BeginInvoke(new Action(() =>
                {
                    notification.Close();
                    notifications.Remove(notification);
                }));
            };
            timers.Add(timer);
            timer.Start();
        }
Esempio n. 25
0
    void Start()
    {
        GameManager.Server.DoRequestCommand(Fields.REQUEST.REQUEST_FULL);

        if (GameManager.Setting.IsFirstLogin)
        {
            GameManager.Setting.IsFirstLogin = false;
            NotificationView.ShowConfirm(
                Fields.MESSAGE.FIRST_LOGIN_NOTE, Fields.MESSAGE.FIRST_LOGIN_MESSAGE,
                delegate()
            {
                StoreGame.SaveInt(StoreGame.EType.CHANGE_INFORMATION, 1);
                ProfileView.Instance.CheckWhenStart();
            }
                , null, "CẬP NHẬT", "ĐỂ SAU"
                );
        }

        listButton[0].GetComponentInChildren <NumberUserInChannel>().SetValue(2);
        SetIcon();
        HeaderMenu.Instance.OnClickButtonBackCallBack = delegate()
        {
            GameManager.Server.DoJoinRoom(GameManager.Instance.hallRoom.zoneId, GameManager.Instance.hallRoom.roomId);
        };
    }
Esempio n. 26
0
    void OnClickSendFeedBack(GameObject go)
    {
        if (isFeedBackClicked)
        {
            return;
        }

        if (!Utility.Input.IsStringValid(txtContent.value, 10, 999999))
        {
            NotificationView.ShowMessage("Nội dung bạn gửi quá ngắn.\n\nHãy nhập một lời góp ý trên 10 ký tự", 3f);
            return;
        }

        ServerWeb.StartThread(ServerWeb.URL_SEND_FEEDBACK,
                              new object[] { "game_id", (int)GameManager.GAME, "user_id", GameManager.Instance.mInfo.id, "title", txtTitle.value, "content", txtContent.value },
                              CallBackResponse);
        if (CBSendLog.value == true)
        {
            //LogViewer.SaveLogToFile();//for test
            LogViewer.SendLogToServer();
            CBSendLog.value = false;
            //Debug.LogWarning("Đã gửi debug_log");
        }
        isFeedBackClicked = true;
    }
Esempio n. 27
0
        public async static void Show(string message, string title, Brush backgroundBrush, Brush foregroundTextBrush, Brush countdownBackgroundBrush, double timeToLive, bool autoHide = false, double width = 300, double height = 180, string metroIcon = "", string imageIcon = "", double scaleIcon = 1)
        {
            if (NotificationService._rootControl != null && message != null)
            {
                DispatchedHandler invokedHandler = new DispatchedHandler(() =>
                {
                    if (NotificationService._rootControl == null) //|| MsgBoxService._rootControl.Visibility == Visibility.Visible)
                    {
                        return;
                    }
                    NotificationService._rootControl.Visibility = Visibility.Visible;
                    NotificationView view = new NotificationView(message, "", autoHide, timeToLive, metroIcon, iconColor: backgroundBrush, imageIcon: imageIcon, scaleIcon: scaleIcon);
                    view.Width            = width;
                    view.Height           = height;
                    view.Margin           = new Thickness(3);
                    //view.HorizontalAlignment = horizontalAlignment;
                    //view.VerticalAlignment = VerticalAlignment.Top;
                    view.BackgroundFill             = backgroundBrush;
                    view.MessageTextForegroundColor = foregroundTextBrush;
                    view.CountdownBackgroundColor   = countdownBackgroundBrush;
                    view.Show();
                    view.OnClosing += new EventHandler(NotificationService.view_OnClosing);

                    NotificationService._MsgboxContainer.Children.Insert(0, view);
                });
                await NotificationService._rootControl.Dispatcher.RunAsync(CoreDispatcherPriority.Normal, invokedHandler);
            }
        }
 void OnClickButtonGold(GameObject go)
 {
     //GameManager.PlayGoldOrChip = Fields.StatusPlayer.GOLD;
     //OnDrawListChannel();
     //SetIcon();
     NotificationView.ShowMessage("Chức năng đang được xây dựng, vui lòng quay lại sau", 3f);
 }
Esempio n. 29
0
        private bool ShowDialog(NotificationViewModel vm)
        {
            var v = new NotificationView(vm);

            v.Owner = Application.Current.MainWindow;
            return((bool)v.ShowDialog());
        }
Esempio n. 30
0
    System.Collections.IEnumerator TimeoutToDestroy()
    {
        yield return(new WaitForSeconds(timeout));

        NotificationView.ShowMessage("Không có phản hồi từ máy chủ. Vui lòng kiểm tra chất lượng mạng");
        this.Close();
    }
        public async Task <ActionResult> Create(NotificationView notificationView)
        {
            if (ModelState.IsValid)
            {
                notificationView.PublishedOn = DateTime.Now.ToLocalTime();
                notificationView.UserId      = User.Identity.GetUserId();

                var pic    = string.Empty;
                var folder = "~/Content/Notifications";

                if (notificationView.ImageFile != null)
                {
                    pic = FilesHelper.UploadPhoto(notificationView.ImageFile, folder);
                    pic = $"{folder}/{pic}";
                }

                var notification = this.ToNotification(notificationView, pic);

                db.Notifications.Add(notification);
                await db.SaveChangesAsync();

                return(RedirectToAction("Index"));
            }

            return(View(notificationView));
        }
Esempio n. 32
0
 protected override void OnViewLoaded(object view)
 {
     base.OnViewLoaded(view);
     _view = (NotificationView)view;
     AppStateSettings.Instance.NewNotification += AppStateNewNotification;
     AppStateSettings.Instance.DeleteNotification += InstanceDeleteNotification;
     AppStateSettings.Instance.DeleteAllTextNotifications += Instance_DeleteAllTextNotifications;
 }
Esempio n. 33
0
        private void RemoveOldNotification()
        {
            var oldView = currentNotification;

            oldView.Hide(() => LayoutRoot.Children.Remove(oldView));

            currentNotification = null;
            timer.Stop();
        }
        private void HandleCollectionChanged(object sender, NotifyCollectionChangedEventArgs e)
        {
            if (e.Action == NotifyCollectionChangedAction.Add)
            {
                var replaceExisting = false;
                var minWidth = 0.0;

                if (_currentNotification != null)
                {
                    minWidth = _currentNotification.ActualWidth;
                    replaceExisting = true;
                    RemoveOldNotification();
                }

                _currentNotification = new NotificationView() { DataContext = e.NewItems[0], MinWidth = minWidth};
                _currentNotification.MouseLeftButtonUp +=
                    delegate { if (_currentNotification != null) RemoveOldNotification(); };

                LayoutRoot.Children.Add(_currentNotification);
                _currentNotification.Display(replaceExisting);
                _timer.Start();
            }
        }