public void NotifyUser(string strMessage, NotifyType type) { switch (type) { case NotifyType.StatusMessage: StatusBorder.Background = new SolidColorBrush(Windows.UI.Colors.Green); break; case NotifyType.ErrorMessage: StatusBorder.Background = new SolidColorBrush(Windows.UI.Colors.Red); break; } StatusBlock.Text = strMessage; StatusBorder.Visibility = (StatusBlock.Text != String.Empty) ? Visibility.Visible : Visibility.Collapsed; if (StatusBlock.Text != String.Empty) { StatusBorder.Visibility = Visibility.Visible; StatusPanel.Visibility = Visibility.Visible; } else { StatusBorder.Visibility = Visibility.Collapsed; StatusPanel.Visibility = Visibility.Collapsed; } }
public void SetNotification(string title, string message, NotifyType type, NotifyButton button) { switch (button) { case NotifyButton.Ok: this.btnOK.Visibility = Visibility.Visible; this.btnCancel.Visibility = Visibility.Collapsed; break; case NotifyButton.Cancel: this.btnCancel.Visibility = Visibility.Visible; this.btnOK.Visibility = Visibility.Collapsed; break; case NotifyButton.OkAndCancel: this.btnOK.Visibility = Visibility.Visible; this.btnCancel.Visibility = Visibility.Visible; break; } switch (type) { case NotifyType.StatusMessage: mainGrid.Background = new SolidColorBrush(Windows.UI.Colors.Green); break; case NotifyType.ErrorMessage: mainGrid.Background = new SolidColorBrush(Windows.UI.Colors.Red); break; } txtStatusBlock.Text = title + Environment.NewLine + Environment.NewLine + message; }
public void Show(NotifyType type, string header, string body, Action activated, Action<Exception> failed = null) { foreach (var x in this.notifiers) { x.Show(type, header, body, activated, failed); } }
public async void NotifyUserFromBackground(string strMessage, NotifyType type) { await Dispatcher.RunAsync(CoreDispatcherPriority.Normal, () => { NotifyUser(strMessage, type); }); }
/// <summary> /// Used to display messages to the user /// </summary> /// <param name="strMessage"></param> /// <param name="type"></param> public void NotifyUser(string strMessage, NotifyType type) { if (StatusBlock != null) { switch (type) { case NotifyType.StatusMessage: StatusBorder.Background = new SolidColorBrush(Windows.UI.Colors.Green); break; case NotifyType.ErrorMessage: StatusBorder.Background = new SolidColorBrush(Windows.UI.Colors.Red); break; } StatusBlock.Text = strMessage; // Collapse the StatusBlock if it has no text to conserve real estate. if (StatusBlock.Text != String.Empty) { StatusBorder.Visibility = Windows.UI.Xaml.Visibility.Visible; } else { StatusBorder.Visibility = Windows.UI.Xaml.Visibility.Collapsed; } } }
/// <summary> /// 處理傳遞訊息的控制邏輯 /// </summary> /// <param name="notifytype">enum: System, User</param> /// <param name="sendertype">enum: Email, Line</param> /// <param name="message">訊息物件</param> /// <returns></returns> public string Notify(NotifyType notifytype, SenderType sendertype, Message message) { string procResult = ""; // 判斷需產出哪一個 RefinedAbstraction 的子類別物件 switch (notifytype) { case NotifyType.System : notifier = new SystemNotifier(); break; case NotifyType.User : notifier = new UserNotifier(); break; } // 判斷需哪個實作 MessageSender 介面的實作物件來服務 // 實務上會設計如 List or Hastable 集合儲存這些實作物件,並透過 Key 來取得相對應的實作物件 switch (sendertype) { case SenderType.Email : notifier.sender = mailSender; break; case SenderType.Line : notifier.sender = lineSender; break; } // 回傳執行結果,藉此觀察使用哪一個 Notifier 子類別物件與 MessengSender 物件 procResult = notifier.Notify(message); return procResult; }
public void OnNotify(string message, NotifyType type) { if (Notify != null) { Notify(this, new NotifyEventArgs(message, type)); } }
public void DisplayStatus(string message, NotifyType type) { Dispatcher.RunAsync(Windows.UI.Core.CoreDispatcherPriority.Normal, () => { switch (type) { case NotifyType.StatusMessage: StatusBorder.Background = new SolidColorBrush(Windows.UI.Colors.Green); break; case NotifyType.ErrorMessage: StatusBorder.Background = new SolidColorBrush(Windows.UI.Colors.Red); break; } StatusBlock.Text = message; // Collapse the StatusBlock if it has no text to conserve real estate. StatusBorder.Visibility = !string.IsNullOrEmpty(StatusBlock.Text) ? Visibility.Visible : Visibility.Collapsed; if (!string.IsNullOrEmpty(StatusBlock.Text)) { StatusBorder.Visibility = Visibility.Visible; StatusPanel.Visibility = Visibility.Visible; } else { StatusBorder.Visibility = Visibility.Collapsed; StatusPanel.Visibility = Visibility.Collapsed; } }).AsTask(); }
public async void NotifyUser(string message, NotifyType type) { // Always dispatch to UI thread await rootPage.Dispatcher.RunAsync(CoreDispatcherPriority.Normal, () => { rootPage.NotifyUser(message, type); }); }
public NotifyCallbackEventArgs(NotifyType notifyType, string statusId) { if (statusId.Length > 1) { this.StatusId = long.Parse(statusId); this.NotifyType = notifyType; } }
public void SaveNotification(string sessionId, string notificationMessage, NotifyType notificationType) { var notification = new StickyNotificationRecord(); _notificationRepository.Create(notification); notification.SessionId = sessionId; notification.NotificationMessage = notificationMessage; notification.NotificationType = notificationType; }
public void ShowMessage(String message, NotifyType type) { DISPATCHER.ExecuteAsync(delegate() { var frame = (Frame)Window.Current.Content; var container = frame.Content as MainPage; container.NotifyUser(message, type); }); }
public void Show(NotifyType type, string header, string body, Action activated, Action<Exception> failed = null) { var toast = new Toast(header, body); toast.Activated += (sender, args) => activated(); if (failed != null) toast.ToastFailed += (sender, args) => failed(args.ErrorCode); sound.SoundOutput(header, true); toast.Show(); }
/// <summary> /// Crea un Alert attività valido /// </summary> public AlertAttivita(NotifyType tipoAvviso, Referente destinatario, Attivita attivita) { TipoAvviso = tipoAvviso; Destinatario = destinatario; Attivita = attivita; if (Attivita != null) Attivita.Alert.Add(this); }
public ListOfEventSummariesType(ObjectId objectIdentifier, EventState eventState, EventTransitionBits acknowledgedTransitions, ReadOnlyArray<TimeStamp> eventTimeStamps, NotifyType notifyType, EventTransitionBits eventEnable, ReadOnlyArray<uint> eventPriorities) { this.ObjectIdentifier = objectIdentifier; this.EventState = eventState; this.AcknowledgedTransitions = acknowledgedTransitions; this.EventTimeStamps = eventTimeStamps; this.NotifyType = notifyType; this.EventEnable = eventEnable; this.EventPriorities = eventPriorities; }
public void Show(NotifyType type, string header, string body, Action activated, Action<Exception> failed = null) { try { this.notifier.Show(type, header, body, activated, failed); } catch(Exception ex) { System.Diagnostics.Debug.WriteLine(ex); KanColleClient.Current.CatchedErrorLogWriter.ReportException(ex.Source, ex); } }
public static void AddNotification(this Controller context, NotifyType type, string message, bool persistForTheNextRequest) { string dataKey = string.Format("afa.notifications.{0}", type); if (persistForTheNextRequest) { context.TempData[dataKey] = message; } else { context.ViewData[dataKey] = message; } }
public void NotifyUser(string strMessage, NotifyType type) { switch (type) { case NotifyType.StatusMessage: StatusBlock.Foreground = new SolidColorBrush(Colors.Green); break; case NotifyType.ErrorMessage: StatusBlock.Foreground = new SolidColorBrush(Colors.Red); break; } StatusBlock.Text = strMessage; }
public void Show(NotifyType type, string header, string body, Action activated, Action<Exception> failed = null) { //Grabacr07.KanColleViewer.ViewModels.Contents.ShipyardViewModel sy = new Grabacr07.KanColleViewer.ViewModels.Contents.ShipyardViewModel(); //logger.WriteLine(sy.BuildingDocks[0].Ship); logger.WriteLine("Notified:"); logger.WriteLine(header); logger.WriteLine(body); LCD.raiseAlarm(header+" at: " + DateTime.Now.ToString(), body); logger.WriteLine(DateTime.Now.ToString()); //legalább műxik //MessageBox.Show(Grabacr07.KanColleWrapper.KanColleClient.Current.Homeport.Admiral.Comment); }
public static Dictionary<string, long> GetNotifyQueueMessageData(NotifyType emailType, Customer Source, Customer Target, Challenge Challenge) { Dictionary<string, long> data = new Dictionary<string, long>(); data.Add("nType", (long)emailType); if(Source!=null) data.Add("SrcID", Source.ID); if(Target!=null) data.Add("TgtID", Target.ID); if(Challenge!=null) data.Add("ChaID", Challenge.ID); return data; }
public static Dictionary<string, long> GetNotifyQueueMessageData(NotifyType emailType, Nullable<long> SourceCustomerID, Nullable<long> TargetCustomerID, Nullable<long> ChallengeID) { Dictionary<string, long> data = new Dictionary<string, long>(); data.Add("nType", (long)emailType); if (SourceCustomerID != null) data.Add("SrcID", SourceCustomerID.GetValueOrDefault()); if(TargetCustomerID!=null) data.Add("TgtID", TargetCustomerID.GetValueOrDefault()); if(ChallengeID!=null) data.Add("ChaID", ChallengeID.GetValueOrDefault()); return data; }
public void Show(NotifyType type, string header, string body, Action activated, Action<Exception> failed = null) { if (this.notifyIcon == null) return; if (activated != null) { this.notifyIcon.BalloonTipClicked -= this.activatedAction; this.activatedAction = (sender, args) => activated(); this.notifyIcon.BalloonTipClicked += this.activatedAction; } sound.SoundOutput(header, false); notifyIcon.ShowBalloonTip(1000, header, body, ToolTipIcon.None); }
/// <summary> /// Display notification /// </summary> /// <param name="type">Notification type</param> /// <param name="message">Message</param> /// <param name="persistForTheNextRequest">A value indicating whether a message should be persisted for the next request</param> protected virtual void AddNotification(NotifyType type, string message, bool persistForTheNextRequest) { string dataKey = string.Format("nop.notifications.{0}", type); if (persistForTheNextRequest) { if (TempData[dataKey] == null) TempData[dataKey] = new List<string>(); ((List<string>)TempData[dataKey]).Add(message); } else { if (ViewData[dataKey] == null) ViewData[dataKey] = new List<string>(); ((List<string>)ViewData[dataKey]).Add(message); } }
public static void AddNotification(this Controller context, NotifyType type, string message, bool persistForTheNextRequest) { string dataKey = string.Format("testapp.notifications.{0}", type); if (persistForTheNextRequest) { if (context.TempData[dataKey] == null) context.TempData[dataKey] = new List<string>(); ((List<string>)context.TempData[dataKey]).Add(message); } else { if (context.ViewData[dataKey] == null) context.ViewData[dataKey] = new List<string>(); ((List<string>)context.ViewData[dataKey]).Add(message); } }
public UnconfirmedEventNotificationRequest(uint processIdentifier, ObjectId initiatingDeviceIdentifier, ObjectId eventObjectIdentifier, TimeStamp timeStamp, uint notificationClass, byte priority, EventType eventType, Option<string> messageText, NotifyType notifyType, Option<bool> ackRequired, Option<EventState> fromState, EventState toState, Option<NotificationParameters> eventValues) { this.ProcessIdentifier = processIdentifier; this.InitiatingDeviceIdentifier = initiatingDeviceIdentifier; this.EventObjectIdentifier = eventObjectIdentifier; this.TimeStamp = timeStamp; this.NotificationClass = notificationClass; this.Priority = priority; this.EventType = eventType; this.MessageText = messageText; this.NotifyType = notifyType; this.AckRequired = ackRequired; this.FromState = fromState; this.ToState = toState; this.EventValues = eventValues; }
public NotifyUnit( NotifyType type,String tipTitle,String tipText ) { this.Type = type; switch (this.Type) { case NotifyType.Eject: case NotifyType.Plug: this.TypeNum = -1; break; case NotifyType.ReceiveFile: this.TypeNum = NotifyUnit.RECEIVEFILE; break; case NotifyType.ShareBegin: case NotifyType.ShareEnd:this.TypeNum = NotifyUnit.SHAREFILE; break; case NotifyType.SyncBegin: case NotifyType.SyncEnd:this.TypeNum = NotifyUnit.SYNC; break; } this.TipTitle = tipTitle; this.TipText = tipText; }
public void NotifyUser(string strMessage, NotifyType type) { if (frameMessage.Visibility == Visibility.Collapsed) { frameMessage.Visibility = Visibility.Visible; } switch (type) { case NotifyType.StatusMessage: frameMessage.Background = new SolidColorBrush(Windows.UI.Colors.Green); break; case NotifyType.ErrorMessage: frameMessage.Background = new SolidColorBrush(Windows.UI.Colors.Red); break; } textBlockMessage.Text = strMessage; }
private void NotifyUser(string message, NotifyType type) { this.StatusBlock.Visibility = Windows.UI.Xaml.Visibility.Visible; switch (type) { case NotifyType.ErrorMessage: StatusBlock.Style = AzureMobileSendEmail.App.Current.Resources["ErrorStyle"] as Style; break; case NotifyType.StatusMessage: StatusBlock.Style = AzureMobileSendEmail.App.Current.Resources["StatusStyle"] as Style; break; case NotifyType.SuccessMessage: StatusBlock.Style = AzureMobileSendEmail.App.Current.Resources["SuccessStyle"] as Style; break; } StatusBlock.Text = message; }
public void ShowStatusInfo(string strMessage, NotifyType type) { switch (type) { case NotifyType.Normal: statusBorder.Background = new SolidColorBrush(Color.FromArgb(255, 0, 122, 204)); break; case NotifyType.Success: statusBorder.Background = new SolidColorBrush(Colors.Green); break; case NotifyType.Warning: statusBorder.Background = new SolidColorBrush(Color.FromArgb(255, 255, 140, 64)); break; case NotifyType.Error: statusBorder.Background = new SolidColorBrush(Colors.Red); break; } statusBlock.Text = strMessage; }
public static void AddSharePointStatus(NotifyType severity, Page page, string text) { string statusBar = @" var statusID; ExecuteOrDelayUntilScriptLoaded(function(){{ ExecuteOrDelayUntilScriptLoaded( function(){{ statusID = SP.UI.Status.addStatus(""{0}"", ""<span>{1}</span>""); SP.UI.Status.setStatusPriColor(statusID, ""{2}""); }}, 'core.js' )}}, 'sp.js' );"; string color = ""; string title = ""; if (severity.Equals(NotifyType.Error)) { color = "red"; title = "Ошибка!"; } else if (severity.Equals(NotifyType.Warn)) { color = "yellow"; title = "Внимание!"; } else if (severity.Equals(NotifyType.Info)) { color = "blue"; title = "Информация!"; } else { color = "green"; title = "Ок!"; } string script = string.Format(statusBar, title, text, color); page.ClientScript.RegisterClientScriptBlock(page.GetType(), "AddSharePointStatus", script, true); }
public static void LogMessage(string message, NotifyType type = NotifyType.StatusMessage) { Debug.WriteLine(message); //SDKTemplate.MainPage.Current.NotifyUser(message, type); }
public void NotifyOccured(NotifyType notifyType, Socket socket, BaseInfo baseInfo) { Database database = Database.GetInstance(); Server server = Server.GetInstance(); Users users = Users.GetInstance(); UserInfo userInfo = users.FindUser(socket); switch (notifyType) { case NotifyType.Request_GameList: { List <GameInfo> games = database.GetAllGames(); if (games == null) { Main.ReplyError(socket); return; } for (int i = 0; i < games.Count; i++) { games[i].UserCount = users.GetGameUsers(games[i].GameId).Count; } GameListInfo gameListInfo = new GameListInfo(); gameListInfo.Games = games; server.Send(socket, NotifyType.Reply_GameList, gameListInfo); } break; //case NotifyType.Request_Download_GameFile: // 2014-01-21: GreenRose // { // GameInfo gameInfo = (GameInfo)baseInfo; // List<string> listDWGameFiles = database.GetDWGameFiles(gameInfo.GameId); // DWGameFileInfo dwGameFileInfo = new DWGameFileInfo(); // dwGameFileInfo.gameInfo = gameInfo; // dwGameFileInfo.listGameFile = listDWGameFiles; // server.Send(socket, NotifyType.Reply_Download_GameFile, dwGameFileInfo); // } // break; case NotifyType.Request_EnterGame: { GameInfo enterInfo = (GameInfo)baseInfo; if (userInfo == null) { SetError(ErrorType.Unknown_User, "알수 없는 사용자가 게임에 들어가려고 하였습니다."); Main.ReplyError(socket); return; } if (enterInfo.nCashOrPointGame == 0) { userInfo.nCashOrPointGame = 0; } else { userInfo.nCashOrPointGame = 1; } if (userInfo.GameId.Trim() != "") { if (OutGame(userInfo) == false) { Main.ReplyError(socket); return; } } GameInfo gameInfo = new GameInfo(); if (enterInfo.nCashOrPointGame == 0) { gameInfo = database.FindGame(enterInfo.GameId); if (gameInfo == null) { SetError(ErrorType.Invalid_GameId, "게임방아이디가 틀립니다."); Main.ReplyError(socket); return; } gameInfo.nCashOrPointGame = enterInfo.nCashOrPointGame; } else { int nGameID = Convert.ToInt32(enterInfo.GameId) - 1; gameInfo = database.FindGame(nGameID.ToString()); if (gameInfo == null) { SetError(ErrorType.Invalid_GameId, "게임방아이디가 틀립니다."); Main.ReplyError(socket); return; } gameInfo.nCashOrPointGame = enterInfo.nCashOrPointGame; gameInfo.GameId = enterInfo.GameId; } if (string.IsNullOrEmpty(userInfo.RoomId) == false) { gameInfo = enterInfo; } GameTable gameTable = FindTable(gameInfo.GameId); if (gameTable == null) { gameTable = MakeTable(gameInfo); if (gameTable == null) { Main.ReplyError(socket); return; } } gameTable.Run(notifyType, baseInfo, userInfo); } break; case NotifyType.Request_PlayerEnter: { //GameInfo enterInfo = (GameInfo)baseInfo; if (userInfo == null) { SetError(ErrorType.Unknown_User, "알수 없는 사용자가 게임에 들어가려고 하였습니다."); Main.ReplyError(socket); return; } if (string.IsNullOrEmpty(userInfo.GameId) == true) { SetError(ErrorType.Unknown_User, "게임방아이다가 없습니다."); Main.ReplyError(socket); return; } GameTable gameTable = FindTable(userInfo.GameId); if (gameTable == null) { SetError(ErrorType.Invalid_GameId, "게임방아이디가 틀립니다."); Main.ReplyError(socket); return; } gameTable.Run(notifyType, baseInfo, userInfo); // added by usc at 2014/03/25 TableInfo tableInfo = gameTable.GetTableInfo(); StringInfo messageInfo = new StringInfo(); messageInfo.UserId = "AMDIN_MSG"; messageInfo.String = string.Format("{0} 进入房间", userInfo.Nickname); messageInfo.FontSize = 12; messageInfo.FontName = "Segoe UI"; messageInfo.FontStyle = "b"; messageInfo.FontWeight = "d"; messageInfo.FontColor = "#9adf8c"; messageInfo.strRoomID = userInfo.GameId; BroadCastGame(tableInfo, NotifyType.Reply_GameChat, messageInfo, userInfo.Id); } break; //case NotifyType.Request_PlayerOut: // { // if (userInfo == null) // { // SetError(ErrorType.Unknown_User, "알수 없는 사용자가 게임에 들어가려고 하였습니다."); // Main.ReplyError(socket); // return; // } // if (string.IsNullOrEmpty(userInfo.GameId) == true) // { // SetError(ErrorType.Unknown_User, "게임방아이다가 없습니다."); // Main.ReplyError(socket); // return; // } // GameTable gameTable = FindTable(userInfo.GameId); // if (gameTable == null) // { // SetError(ErrorType.Invalid_GameId, "게임방아이디가 틀립니다."); // Main.ReplyError(socket); // return; // } // gameTable.Run(notifyType, baseInfo, userInfo); // } // break; case NotifyType.Request_OutGame: { if (userInfo == null) { SetError(ErrorType.Unknown_User, "알수 없는 사용자가 게임을 탈퇴하려고 하였습니다."); Main.ReplyError(socket); return; } if (OutGame(userInfo) == false) { Main.ReplyError(socket); return; } } break; // added by usc at 2014/01/08 case NotifyType.Request_GameChat: { StringInfo stringInfo = (StringInfo)baseInfo; if (userInfo == null) { BaseInfo.SetError(ErrorType.Unknown_User, "알수 없는 사용자가 채팅하려고 합니다."); } stringInfo.UserId = userInfo.Id; GameTable gameTable = FindTable(userInfo.GameId); if (gameTable == null) { SetError(ErrorType.Invalid_GameId, "게임방아이디가 틀립니다."); Main.ReplyError(socket); return; } TableInfo tableInfo = gameTable.GetTableInfo(); BroadCastGame(tableInfo, NotifyType.Reply_GameChat, stringInfo, null); } break; // added by usc at 2014/02/15 case NotifyType.Request_GameResult: { StringInfo stringInfo = (StringInfo)baseInfo; if (userInfo == null) { return; } GameTable gameTable = FindTable(userInfo.GameId); if (gameTable == null) { SetError(ErrorType.Invalid_GameId, "게임방아이디가 틀립니다."); Main.ReplyError(socket); return; } TableInfo tableInfo = gameTable.GetTableInfo(); BroadCastGame(tableInfo, NotifyType.Reply_GameResult, stringInfo, userInfo.Id); // added by usc at 2014/03/04 if (userInfo.Auto == 0) { Server.GetInstance().Send(userInfo.Socket, NotifyType.Reply_UserInfo, userInfo); } } break; default: { if (userInfo == null) { return; } GameTable gameTable = FindTable(userInfo.GameId); if (gameTable == null) { return; } gameTable.Run(notifyType, baseInfo, userInfo); } break; } }
/// <summary> /// 初始化一个 定义返回消息、日志消息与附加数据的业务操作结果信息类 的新实例 /// </summary> /// <param name="notifyType">业务操作结果类型</param> /// <param name="message">业务返回消息</param> /// <param name="logMessage">业务日志记录消息</param> /// <param name="appendData">业务返回数据</param> public Notification(NotifyType notifyType, string message, string logMessage, object appendData) : this(notifyType, message, logMessage) { AppendData = appendData; }
/// <summary> /// Initialize new instance of class <see cref="Notify"/>. /// </summary> /// <param name="type"><see cref="NotifyType"/></param> /// <param name="messages">Messages</param> public Notify(NotifyType type, IList <string> messages) : this() { Type = type; Messages = messages; }
public bool AddNotify(AuthUser oprateUser, Notify notify) { #region 基础参数检查 if (notify == null) { return(false); } if (notify.UserID <= 0) { return(false); } if (notify.UserID == oprateUser.UserID) { return(true); } #endregion UnreadNotifies UnreadNotifies = null; #if !Passport PassportClientConfig setting = Globals.PassportClient; if (setting.EnablePassport) { NotifyType type = AllNotifyTypes[notify.TypeID]; NotifyActionProxy[] proxys = new NotifyActionProxy[notify.Actions.Count]; int i = 0; foreach (NotifyAction action in notify.Actions) { NotifyActionProxy nap = new NotifyActionProxy(); nap.Url = "{clienturl}" + action.Url; nap.Title = action.Title; nap.IsDialog = action.IsDialog; proxys[i] = nap; i++; } ThreadPool.QueueUserWorkItem(delegate(object a) { try { setting.PassportService.Notify_Send(notify.UserID, type.TypeName, notify.Content, notify.DataTable.ToString(), proxys, notify.Keyword); } catch { } }); } else #endif { NotifyState SysState = AllSettings.Current.NotifySettings.GetNotifySystemState(notify.TypeID); SystemNotifyProvider.Update(); //判断系统设置 switch (SysState) { case NotifyState.AlwaysClose: return(false); case NotifyState.DefaultClose: case NotifyState.DefaultOpen: //判断用户设置 UserNotifySetting userSetting = UserBO.Instance.GetNotifySetting(notify.UserID); if (userSetting != null && userSetting.GetNotifyState(notify.TypeID) == NotifyState.DefaultClose) { return(false); } break; } StringTable actions = new StringTable(); if (notify.Actions != null) { foreach (NotifyAction na in notify.Actions) { actions.Add(na.Title, (na.IsDialog ? "*" : "") + na.Url); } } NotifyDao.Instance.AddNotify(notify.UserID, notify.TypeID, notify.Content, notify.Keyword, notify.DataTable.ToString(), 0, actions.ToString(), out UnreadNotifies); AuthUser user; user = UserBO.Instance.GetUserFromCache <AuthUser>(notify.UserID); if (user != null) { user.UnreadNotify = UnreadNotifies; } if (OnUserNotifyCountChanged != null) { OnUserNotifyCountChanged(UnreadNotifies); } RemoveCacheByType(notify.UserID, 0); return(true); } return(true); }
/// <summary> /// Notify result /// </summary> /// <param name="notifyType"> /// <see cref="NotifyType" /> /// </param> /// <param name="message">Message</param> /// <returns> /// <see cref="NotifyResult" /> /// </returns> public NotifyResult Notify(NotifyType notifyType, string message) { return(Notify(notifyType, new List <string> { message })); }
/// <summary> /// Notify result /// </summary> /// <param name="notifyType"> /// <see cref="NotifyType" /> /// </param> /// <param name="messages">Messages</param> /// <returns> /// <see cref="NotifyResult" /> /// </returns> public NotifyResult Notify(NotifyType notifyType, IList <string> messages) { return(new NotifyResult(notifyType, messages)); }
/// <summary> /// 通知消息 /// </summary> public void Notify(NotifyType notifyType, string msg, IServer sender) { notifier?.OnNotify(notifyType, msg, sender); }
/// <summary> /// Display notification /// </summary> /// <param name="type">Notification type</param> /// <param name="message">Message</param> /// <param name="encode">A value indicating whether the message should not be encoded</param> public virtual void Notification(NotifyType type, string message, bool encode = true) { PrepareTempData(type, message, encode); }
public void NotifyBase(NotifyType notifyType, Socket socket, BaseInfo receiveInfo) { }
private void NotifyUserFromAsyncThread(string strMessage, NotifyType type) { var ignore = Dispatcher.RunAsync( CoreDispatcherPriority.Normal, () => _rootPage.NotifyUser(strMessage, type)); }
public void Show(NotifyType type, string header, string body, Action activated, Action <Exception> failed = null) { this.notifier.Show(type, header, body, activated, failed); }
/// <summary> /// 检查某个用户是否已经有接收当前用户发送的此类通知 /// <param name="userID">当前用户</param> /// <param name="relatedUserID">通知接收者</param> /// </summary> //public abstract bool CheckIfNotified(int userID, int senderUserID, NotifyType notifyType); public abstract bool RegisterNotifyType(string notifyType, bool keep, string description, out NotifyType type);
public void NotifyOccured(NotifyType notifyType, Socket socket, BaseInfo baseInfo) { Database database = Database.GetInstance(); Server server = Server.GetInstance(); Users users = Users.GetInstance(); ResultInfo resultInfo = new ResultInfo(); switch (notifyType) { case NotifyType.Request_EnterMeeting: { UserInfo userInfo = Users.GetInstance().FindUser(socket); if (userInfo == null) { SetError(ErrorType.Unknown_User, "알수 없는 사용자입니다."); Main.ReplyError(socket); return; } AskChatInfo askChatInfo = (AskChatInfo)baseInfo; UserInfo targetInfo = Users.GetInstance().FindUser(askChatInfo.TargetId); if (targetInfo == null) { SetError(ErrorType.Unknown_User, "채팅대상이 존재하지 않습니다."); Main.ReplyError(socket); return; } askChatInfo.TargetId = userInfo.Id; server.Send(targetInfo.Socket, NotifyType.Request_EnterMeeting, askChatInfo); } break; case NotifyType.Reply_EnterMeeting: { AskChatInfo askChatInfo = (AskChatInfo)baseInfo; UserInfo targetInfo = Users.GetInstance().FindUser(askChatInfo.TargetId); if (targetInfo == null) { SetError(ErrorType.Unknown_User, "채팅대상이 존재하지 않습니다."); Main.ReplyError(socket); return; } if (askChatInfo.Agree == 0) { server.Send(targetInfo.Socket, NotifyType.Reply_EnterMeeting, askChatInfo); return; } RoomInfo meetingInfo = EnterMeeting(socket, askChatInfo); if (meetingInfo == null) { Main.ReplyError(socket); return; } } break; case NotifyType.Request_OutMeeting: { UserInfo userInfo = OutMeeting(socket); if (userInfo == null) { Main.ReplyError(socket); } } break; case NotifyType.Request_RoomList: { UserInfo userInfo = Users.GetInstance().FindUser(socket); if (userInfo == null) { SetError(ErrorType.Unknown_User, "알수 없는 사용자가 방목록을 요구하였습니다."); Main.ReplyError(socket); return; } List <RoomInfo> rooms = null; if (userInfo.Kind == (int)UserKind.ServiceWoman) { rooms = database.GetAllRooms(); } else { rooms = GetRooms(); } if (rooms == null) { Main.ReplyError(socket); return; } RoomListInfo roomListInfo = new RoomListInfo(); roomListInfo.Rooms = rooms; server.Send(socket, NotifyType.Reply_RoomList, roomListInfo); } break; case NotifyType.Request_MakeRoom: { RoomInfo roomInfo = (RoomInfo)baseInfo; UserInfo userInfo = users.FindUser(socket); if (userInfo == null) { Main.ReplyError(socket); return; } roomInfo.Owner = userInfo.Id; if (database.AddRoom(roomInfo) == false) { Main.ReplyError(socket); return; } string str = string.Format("{0} 님이 방 {1} 을 만들었습니다.", userInfo.Id, roomInfo.Id); LogView.AddLogString(str); server.Send(socket, NotifyType.Reply_MakeRoom, roomInfo); View._isUpdateRoomList = true; ReplyRoomList(); } break; case NotifyType.Request_UpdateRoom: { RoomInfo updateInfo = (RoomInfo)baseInfo; RoomInfo roomInfo = Database.GetInstance().FindRoom(updateInfo.Id); if (roomInfo == null) { Main.ReplyError(socket); return; } roomInfo.Body = updateInfo; if (Database.GetInstance().UpdateRoom(roomInfo) == false) { Main.ReplyError(socket); return; } server.Send(socket, NotifyType.Reply_UpdateRoom, roomInfo); } break; case NotifyType.Request_DelRoom: { RoomInfo delInfo = (RoomInfo)baseInfo; if (FindRoom(delInfo.Id) != null) { SetError(ErrorType.Live_Room, "유저들이 들어있는 방입니다."); Main.ReplyError(socket); return; } if (Database.GetInstance().FindRoom(delInfo.Id) == null) { SetError(ErrorType.Invalid_RoomId, "삭제하려는 방이 없습니다."); Main.ReplyError(socket); return; } if (Database.GetInstance().DelRoom(delInfo.Id) == false) { Main.ReplyError(socket); return; } server.Send(socket, NotifyType.Reply_DelRoom, delInfo); } break; case NotifyType.Request_EnterRoom: { OutRoom(socket); RoomInfo enterInfo = (RoomInfo)baseInfo; UserInfo userInfo = EnterRoom(socket, enterInfo.Id); if (userInfo == null) { Main.ReplyError(socket); return; } } break; case NotifyType.Request_OutRoom: { if (OutRoom(socket) == null) { Main.ReplyError(socket); break; } } break; case NotifyType.Request_RoomDetail: { RoomInfo roomInfo = (RoomInfo)baseInfo; ReplyRoomDetailInfo(roomInfo.Id); } break; case NotifyType.Request_StringChat: { StringInfo stringInfo = (StringInfo)baseInfo; UserInfo userInfo = users.FindUser(socket); if (userInfo == null) { BaseInfo.SetError(ErrorType.Unknown_User, "알수 없는 사용자가 채팅하려고 합니다."); Main.ReplyError(socket); return; } stringInfo.UserId = userInfo.Id; BroadCast(userInfo.RoomId, NotifyType.Reply_StringChat, stringInfo, null); } break; case NotifyType.Request_VoiceChat: { VoiceInfo voiceInfo = (VoiceInfo)baseInfo; UserInfo userInfo = users.FindUser(socket); if (userInfo == null) { BaseInfo.SetError(ErrorType.Unknown_User, "알수 없는 사용자가 채팅하려고 합니다."); Main.ReplyError(socket); return; } voiceInfo.UserId = userInfo.Id; BroadCast(userInfo.RoomId, NotifyType.Reply_VoiceChat, voiceInfo, userInfo.Id); } break; case NotifyType.Request_VideoChat: { VideoInfo videoInfo = (VideoInfo)baseInfo; UserInfo userInfo = users.FindUser(socket); if (userInfo == null) { BaseInfo.SetError(ErrorType.Unknown_User, "알수 없는 사용자가 채팅하려고 합니다."); Main.ReplyError(socket); return; } videoInfo.UserId = userInfo.Id; BroadCast(userInfo.RoomId, NotifyType.Reply_VideoChat, videoInfo, userInfo.Id); } break; case NotifyType.Request_Give: { UserInfo userInfo = users.FindUser(socket); if (userInfo == null) { BaseInfo.SetError(ErrorType.Unknown_User, "알수 없는 사용자가 선물하려고 합니다."); Main.ReplyError(socket); return; } PresentHistoryInfo presentInfo = (PresentHistoryInfo)baseInfo; presentInfo.SendId = userInfo.Id; UserInfo targetInfo = database.FindUser(presentInfo.ReceiveId); if (targetInfo == null) { BaseInfo.SetError(ErrorType.Unknown_User, "받으려는 사용자정보가 정확치 않습니다."); Main.ReplyError(socket); return; } if (Cash.GetInstance().ProcessPresent(presentInfo) == false) { Main.ReplyError(socket); return; } BroadCast(userInfo.RoomId, NotifyType.Reply_Give, baseInfo, null); ReplyRoomDetailInfo(userInfo.RoomId); users.ReplyUserList(null); View._isUpdateUserList = true; } break; case NotifyType.Request_MusiceInfo: { UserInfo userInfo = users.FindUser(socket); if (userInfo == null) { BaseInfo.SetError(ErrorType.Unknown_User, "不明会员准备删除过照片信息."); Main.ReplyError(socket); return; } MusiceInfo musiceInfo = (MusiceInfo)baseInfo; BroadCast(userInfo.RoomId, NotifyType.Reply_MusiceInfo, musiceInfo, null); //server.Send(socket, NotifyType.Reply_MusiceInfo, musiceInfo); } break; case NotifyType.Request_MusiceStateInfo: { UserInfo userInfo = users.FindUser(socket); if (userInfo == null) { BaseInfo.SetError(ErrorType.Unknown_User, "不明会员准备删除过照片信息."); Main.ReplyError(socket); return; } MusiceStateInfo musiceStateInfo = (MusiceStateInfo)baseInfo; BroadCast(userInfo.RoomId, NotifyType.Reply_MusiceStateInfo, musiceStateInfo, null); //server.Send(socket, NotifyType.Reply_MusiceStateInfo, musiceStateInfo); } break; } }
/// <summary> /// 获取发送器 /// </summary> /// <param name="type"></param> /// <returns></returns> public ISender[] GetSenders(NotifyType type) { return((from a in _senders.Keys where type.CommunicationType.HasFlag(a) select _senders[a]).ToArray()); }
public virtual bool Action(NotifyType notifyType, BaseInfo baseInfo, UserInfo userInfo) { switch (notifyType) { case NotifyType.Request_EnterGame: { if (_GameTable.ViewerEnterTable(userInfo) == false) { Main.ReplyError(userInfo.Socket); return(false); } Server.GetInstance().Send(userInfo.Socket, NotifyType.Reply_EnterGame, _GameTable._GameInfo); _GameTable.BroadCastGame(NotifyType.Reply_TableDetail, _GameTable._TableInfo); } break; case NotifyType.Request_PlayerEnter: { if (_GameTable.PlayerEnterTable(baseInfo, userInfo) == false) { Main.ReplyError(userInfo.Socket); return(false); } _GameTable.BroadCastGame(NotifyType.Reply_TableDetail, _GameTable._TableInfo); } break; //case NotifyType.Request_PlayerOut: // { // if (_GameTable.GetPlayerIndex(userInfo) < 0) // return true; // foreach (UserInfo outInfo in _GameTable._TableInfo._Outers) // { // if (outInfo == userInfo) // return true; // } // _GameTable._TableInfo._Outers.Add(userInfo); // //} // } // break; case NotifyType.Request_OutGame: { _GameTable.OutTable(userInfo); } break; case NotifyType.Notify_GameTimer: { GameTimer gameTimer = (GameTimer)baseInfo; if (gameTimer.timerId == _TimerId) { _IsLeaveTime = true; } NotifyGameTimer(gameTimer); } break; case NotifyType.Notify_Ping: break; default: return(false); } return(true); }
public async Task <OperationResult> Create(string title, string url, DateTime start, NotifyType type, User user) { var notification = new Notification { Title = title, Url = url, Date = start, Type = type, UserId = user.Id }; return(await _notifyRepository.AddAsync(notification)); }
private void LogStatus(string message, NotifyType type) { rootPage.NotifyUser(message, type); Log(message); }
/// <summary> /// Notify result /// </summary> /// <param name="notifyType"> /// <see cref="NotifyType" /> /// </param> /// <param name="modelStates"> /// <see cref="IDictionary{TKey,TValue}" /> /// </param> /// <returns> /// <see cref="NotifyResult" /> /// </returns> public NotifyResult Notify(NotifyType notifyType, IDictionary <string, ModelState> modelStates) { return(new NotifyResult(notifyType, modelStates)); }
public NotifyTypesAttribute(NotifyType types) { this.types = types; }
protected ICollection <LocalizedString> GetMessages(NotifyType type) { return(ResolveNotifications(type).AsReadOnly()); }
public void NotifyUser(string strMessage, NotifyType type) { // var task = Dispatcher.RunAsync(CoreDispatcherPriority.Normal, () => UpdateStatus(strMessage, type)); }
/// <summary> /// Initialize new instance of class <see cref="Notify"/>. /// </summary> /// <param name="type"><see cref="NotifyType"/></param> /// <param name="message">Message</param> public Notify(NotifyType type, string message) : this(type, new List <string> { message }) { }
private void NotifyUser(string message, NotifyType type) { StatusMessage.Text = message; }
public bool RegisterNotifyType(string typeName, bool keep, string description, out NotifyType type) { type = null; if (string.IsNullOrEmpty(typeName)) { ThrowError(new CustomError("typename", "通知类型名称不能空")); return(false); } bool result = NotifyDao.Instance.RegisterNotifyType(typeName, keep, description, out type); if (result == false) { ThrowError(new CustomError("typename", "类型已经存在")); return(false); } else { m_AllNotifyTypes = null; } return(result); }
/// <summary> /// Показать уведомление /// </summary> /// <param name="message">Сообщение</param> /// <param name="type">Тип</param> /// <param name="msgOpt">настройки сообщения</param> public void Show(string message, NotifyType type = NotifyType.Information, [CanBeNull] NotifyMessageOptions msgOpt = null) { Show(message, this, msgOpt, type); }
public void Add(NotifyType type, /*LocalizedString*/ string message, bool durable = true) { _entries.Add(new NotifyEntry { Type = type, Message = message, Durable = durable }); }
/// <summary> /// Показать уведомление на основном экране с дефолтными настройками /// </summary> /// <param name="message">Сообщение</param> /// <param name="type">Тип</param> /// <param name="msgOpt">настройки сообщения</param> public static void ShowOnScreen(string message, NotifyType type = NotifyType.Information, [CanBeNull] NotifyMessageOptions msgOpt = null) { Show(message, notifyScreen, msgOpt, type); }
public NotifyTypeModel(NotifyType type) { Name = type.Name; Remark = type.Remark; CommunicationType = type.CommunicationType; }
public void Show(NotifyType type, string header, string body, Action activated, Action <Exception> failed = null) { Modules.SoundsModules.Current.Notify(failed); }