private void SendApproveMessageToCreator(string tenantId, string senderId, string senderFullName, string senderAvatar, string eventId, string receiverId, bool isApprove) { // TODO: Update for send with rabbitMQ later. var message = $"<b>{senderFullName}</b> {{{(isApprove ? "approved" : "declined")} your event.}}"; var notification = new NotificationEvent { TenantId = tenantId, Title = message, Content = "", SenderId = senderId, SenderFullName = senderFullName, SenderAvatar = senderAvatar, Url = $"/event/detail/{eventId}", ReceiverId = receiverId, Type = NotificationType.Info, IsSystem = false }; //_eventBus.Publish(notification); //var apiUrls = _configuration.GetApiUrl(); //if (apiUrls != null) //{ // var httpClientService = new HttpClientService(); // var resultNotification = await httpClientService // .PostAsync<int>($"{apiUrls.NotificationApiUrl}notifications/send", // notification); //} new NotificationHelper().Send(notification); }
private async Task SendNotificationToApprover(string tenantId, string creatorId, string creatorFullName, string creatorAvatar, string eventId) { // Check if is send. Send event to approve for approve. var apiUrls = _configuration.GetApiUrl(); if (apiUrls != null) { var listApprover = await new HttpClientService() .GetAsync <List <ApproverConfigViewModel> >($"{apiUrls.CoreApiUrl}/approver-configs/search/{tenantId}/{(int)ApproverConfigType.Event}"); if (listApprover != null && listApprover.Any()) { var notificationHelper = new NotificationHelper(); foreach (var approver in listApprover) { var notificationEvent = new NotificationEvent { TenantId = tenantId, Title = $"<b>{creatorFullName}</b> {{send an event and waiting you for approve.}}", Content = "", SenderId = creatorId, SenderFullName = creatorFullName, SenderAvatar = creatorAvatar, Url = $"/event/detail/{eventId}", ReceiverId = approver.UserId, Type = NotificationType.Info, IsSystem = false }; notificationHelper.Send(notificationEvent); } } } }
void Button_OnClick(object sender, NotificationEvent e) { GameUI.FireNotificationEvent(e); switch(e.Command) { case("Undo") : GameUI.Undo(); return; case ("Restart"): GameUI.Reset(); return; case ("Exit"): GameUI.Exit(); return; case ("Up"): GameUI.Player.doMove(Direction.Up); return; case ("Down"): GameUI.Player.doMove(Direction.Down); return; case ("Left"): GameUI.Player.doMove(Direction.Left); return; case ("Right"): GameUI.Player.doMove(Direction.Right); return; case ("Help"): NodeUIDialogHelp help = new NodeUIDialogHelp(GameUI, 20000); help.GameUI.Add(help); return; default: NodeEffectText msg = new NodeEffectText(GameUI, 100, "Command not implemented:"+e.Command, new VectorInt(100, 100)); msg.Path = new StaticPath(new VectorInt(100, 100), 30); GameUI.Add(msg); return; } }
public void ShouldNot_AddNewNotification_Invalid() { var notificationEvent = new NotificationEvent(); var newNotification = _manager.AddNewNotification(notificationEvent); Assert.Null(newNotification); }
private void stuffHappened(NotificationEvent eventCode, byte[] info) { switch (eventCode) { case NotificationEvent.REP_CLIENT: Console.WriteLine("CLIENT"); break; case NotificationEvent.REP_MASTER: Console.WriteLine("MASTER"); break; case NotificationEvent.REP_NEWMASTER: Console.WriteLine("NEWMASTER"); break; case NotificationEvent.REP_STARTUPDONE: /* We don't care about these */ break; case NotificationEvent.REP_PERM_FAILED: Console.WriteLine("Insufficient Acks."); break; default: Console.WriteLine("Event: {0}", eventCode); break; } }
/// <summary> /// This function starts running an application when a specified event occurs. /// </summary> /// <param name="appName">Name of the application to be started.</param> /// <param name="whichEvent">Event at which the application is to be started.</param> /// <seealso cref="T:OpenNETCF.Win32.Core.EventNotifications"/> public static void RunAppAtEvent(string appName, NotificationEvent whichEvent) { if(!CeRunAppAtEvent(appName, (int)whichEvent)) { throw new WinAPIException("Cannot Set Notification Handler"); } }
private static CallbackEvent ToAPICallbackEvent( NotificationEvent notificationEvent ) { switch (notificationEvent) { case NotificationEvent.PACKAGE_OPT_OUT: return CallbackEvent.PACKAGE_OPT_OUT; case NotificationEvent.PACKAGE_COMPLETE: return CallbackEvent.PACKAGE_COMPLETE; case NotificationEvent.PACKAGE_ACTIVATE: return CallbackEvent.PACKAGE_ACTIVATE; case NotificationEvent.PACKAGE_CREATE: return CallbackEvent.PACKAGE_CREATE; case NotificationEvent.PACKAGE_DEACTIVATE: return CallbackEvent.PACKAGE_DEACTIVATE; case NotificationEvent.PACKAGE_DECLINE: return CallbackEvent.PACKAGE_DECLINE; case NotificationEvent.PACKAGE_DELETE: return CallbackEvent.PACKAGE_DELETE; case NotificationEvent.PACKAGE_READY_FOR_COMPLETION: return CallbackEvent.PACKAGE_READY_FOR_COMPLETE; case NotificationEvent.PACKAGE_RESTORE: return CallbackEvent.PACKAGE_RESTORE; case NotificationEvent.PACKAGE_TRASH: return CallbackEvent.PACKAGE_TRASH; case NotificationEvent.ROLE_REASSIGN: return CallbackEvent.ROLE_REASSIGN; default: throw new InvalidCastException(); } }
public static void RunAppAtEvent(string appName, NotificationEvent whichEvent) { if (!NativeMethods.CeRunAppAtEvent(appName, (int)whichEvent)) { throw new Win32Exception(Marshal.GetLastWin32Error(), "Cannot Set Notification Handler"); } }
public NotificationTemplate(NotificationType type, NotificationEvent notificationEvent, bool isSystemNotification) { Id = $"{notificationEvent.Name}-{type.Name}"; TypeName = type.Name; NotificationEventName = notificationEvent.Name; IsSystemNotification = isSystemNotification; }
protected override void OnClickButton(object sender, NotificationEvent e) { if (this.GameUI.OnGameWin != null) { this.GameUI.OnGameWin(this, e); } }
void AddNotification(NotificationEvent n) { var notification = new Notification(n.Text, n.Details); notifications.Add(notification); Messenger.Default.Send(new NotificationAdded(notification)); }
/// <summary> /// Reset alert collection for Guest /// </summary> /// <param name="message">The message.</param> /// <param name="eventType">Instance of NotificationEventType</param> public static void RetrievePerson(NotificationEvent message, NotificationEventType eventType) { List<PersonType> personTypeList = new List<PersonType>(); if (message != null && message.PersonTypeId == CommonConstants.GuestTypeId) { personTypeList.Add(PersonType.Guest); } else if (message != null && message.PersonTypeId == CommonConstants.CrewmemberTypeId) { personTypeList.Add(PersonType.Crewmember); } else if (message != null && message.PersonTypeId == CommonConstants.VisitorTypeId) { personTypeList.Add(PersonType.Visitor); } if (eventType == NotificationEventType.Reservation) { RetrieveGuestForReservation(message, eventType, personTypeList); } else { RetrieveGuest(message, eventType, personTypeList); } }
/// <summary> /// This function starts running an application when a specified event occurs. /// </summary> /// <param name="appName">Name of the application to be started.</param> /// <param name="whichEvent">Event at which the application is to be started.</param> /// <seealso cref="T:OpenNETCF.Win32.Core.EventNotifications"/> public static void RunAppAtEvent(string appName, NotificationEvent whichEvent) { if (!CeRunAppAtEvent(appName, (int)whichEvent)) { throw new WinAPIException("Cannot Set Notification Handler"); } }
private void showNotification(string msg, bool isError) { if (NotificationEvent != null) { NotificationEvent.Invoke(this, msg, isError); } }
private void stuffHappened(NotificationEvent eventCode, byte[] info) { switch (eventCode) { case NotificationEvent.REP_AUTOTAKEOVER_FAILED: Console.WriteLine("Event: REP_AUTOTAKEOVER_FAILED"); break; case NotificationEvent.REP_CLIENT: Console.WriteLine("Event: CLIENT"); break; case NotificationEvent.REP_CONNECT_BROKEN: Console.WriteLine("Event: REP_CONNECT_BROKEN"); break; case NotificationEvent.REP_CONNECT_ESTD: Console.WriteLine("Event: REP_CONNECT_ESTD"); break; case NotificationEvent.REP_CONNECT_TRY_FAILED: Console.WriteLine("Event: REP_CONNECT_TRY_FAILED"); break; case NotificationEvent.REP_MASTER: Console.WriteLine("Event: MASTER"); break; case NotificationEvent.REP_NEWMASTER: electionDone = true; Console.WriteLine("Event: NEWMASTER"); break; case NotificationEvent.REP_LOCAL_SITE_REMOVED: Console.WriteLine("Event: REP_LOCAL_SITE_REMOVED"); break; case NotificationEvent.REP_SITE_ADDED: Console.WriteLine("Event: REP_SITE_ADDED"); break; case NotificationEvent.REP_SITE_REMOVED: Console.WriteLine("Event: REP_SITE_REMOVED"); break; case NotificationEvent.REP_STARTUPDONE: startUpDone++; Console.WriteLine("Event: REP_STARTUPDONE"); break; case NotificationEvent.REP_PERM_FAILED: Console.WriteLine("Event: Insufficient Acks."); break; default: Console.WriteLine("Event: {0}", eventCode); break; } }
public void Publish() { if (Notify != null) { NotificationEvent notificationObj = new NotificationEvent(DateTime.Now, "New Notification Arrived from"); Notify(this, notificationObj); } }
public RegisterInfo(NotificationEvent _event, Action <NotificationEvent, System.Object[]> callback, WeakReference caller) { Event = _event; Callback = callback; Caller = caller; }
public void ConvertSDKUnrecognizedNotificationEventToAPIUnknownValue() { apiNotificationEvent1 = "NEWLY_ADDED_REQUIREMENT_STATUS"; NotificationEvent unrecognizedNotificationEvent = NotificationEvent.valueOf(apiNotificationEvent1); string acutalApiValue = new EventNotificationConverter(unrecognizedNotificationEvent).ToAPICallbackEvent(); Assert.AreEqual(apiNotificationEvent1, acutalApiValue); }
public Restro() { _emailEvent = new NotificationEvent(); AddListOfItem(); AddListOfTable(); SetRestroName(); SetRestroBranchName(); }
public IList <NotificationTemplate> GetNotificationTemplatesByNotificationEvent( NotificationEvent notificationEvent, IEnumerable <string> excludedTemplates) { return(_context.NotificationTemplates .Where(x => x.NotificationEventName == notificationEvent.Name && excludedTemplates.All(t => t != x.Id)) .ToList()); }
public ActionResult Add() { var evnt = new NotificationEvent { Active = true }; return(View(evnt)); }
public void Add(NotificationEvent notification) { using (var context = _provider.Provide()) { context.Notifications.Add(notification); context.SaveChanges(); } }
public bool GetById(Guid id, out NotificationEvent notification) { using (var context = _provider.Provide()) { notification = context.Notifications.FirstOrDefault(n => n.Id.Equals(id)); } return(notification != null); }
public MainForm() { _notificationEvent = EventAggregator .Instance .Get <NotificationEvent>(); InitializeComponent(); SetupEvents(); }
public void Consume(NotificationEvent message) { if (!_filter(message)) { return; } Publish(message); }
private void SetMessageGeoLocation(NotificationEvent message) { // if the geo data has not already been set by the health check if (!IsGeoSet(message.Latitude, message.Longitude)) { message.Latitude = _location.Latitude; message.Longitude = _location.Longitude; } }
public void Consume(NotificationEvent message) { NotificationEvent other; if (!_repository.GetById(message.Id, out other)) { _repository.Add(message); } }
protected override bool ShouldSend(NotificationEvent @event, UserSettings settings, NotificationSendingResult result) { if (string.IsNullOrWhiteSpace(settings.Email)) { result.Errors.Add("User email address is not configured"); return(false); } return(base.ShouldSend(@event, settings, result)); }
public NotificationEventResponse Deliver(NotificationEvent notification) { var restRequest = new RestRequest("api/notification/notify", Method.POST) { RequestFormat = DataFormat.Json }; restRequest.AddBody(notification); return(ExecuteRequest <NotificationEventResponse>(restRequest)); }
public NotificationPushedApp(OSInstance instance) : base(instance) { data = new NotificationEvent { app_name = "Discord", title = "RomanPort", subtext = "This is an example of what notifications can show. They can also be multiline, and show a black and white representation of the user's profile picture. Cool!", icon_url = "https://cdn.discordapp.com/avatars/235392678920060928/f7f0075ee119e53fa6d03bb1e322cfbc.png" }; }
protected override bool ShouldSend(NotificationEvent @event, UserSettings settings, NotificationSendingResult result) { if (string.IsNullOrWhiteSpace(settings.PhoneNumber)) { result.Errors.Add(PhoneNumberIsNotConfiguredErrorMessage); return(false); } return(base.ShouldSend(@event, settings, result)); }
public Notification(NotificationEvent notificationEvent, string recipientId, string subject, string body) { Id = NotificationNewId; NotificationEvent = notificationEvent; RecipientId = recipientId; Subject = subject; Body = body; CreationDate = DateTime.Now; IsRead = false; }
public void Add(NotificationEvent notification) { var filename = MakeItemFilename(notification.Id); lock (LockObject) { Serialiser.ToJsonInFile(filename, notification); } Logger.Debug("Stored Notification ({0}): {1}", notification.EventType, filename); }
void LoadQueues(Machine machine) { Task.Factory .StartNew(() => { var queues = MessageQueue .GetPrivateQueuesByMachine(machine.MachineName) .Concat(new[] { // don't add non-transactional dead letter queue - wouldn't be safe! //new MessageQueue(string.Format(@"FormatName:DIRECT=OS:{0}\SYSTEM$;DeadLetter", machine.MachineName)), new MessageQueue(string.Format(@"FormatName:DIRECT=OS:{0}\SYSTEM$;DeadXact", machine.MachineName)), }) .ToArray(); return(queues); }) .ContinueWith(t => { if (!t.IsFaulted) { try { var queues = t.Result .Select(queue => { try { return(new Queue(queue)); } catch (Exception e) { throw new ApplicationException(string.Format("An error occurred while loading message queue {0}", queue.Path), e); } }); machine.SetQueues(queues); return(NotificationEvent.Success("{0} queues loaded from {1}", t.Result.Length, machine.MachineName)); } catch (Exception e) { return(NotificationEvent.Fail(e.ToString(), "Could not load queues from {0}: {1}", machine.MachineName, e.Message)); } } return(NotificationEvent.Fail(t.Exception.ToString(), "Could not load queues from {0}: {1}", machine.MachineName, t.Exception.Message)); }, Context.UiThread) .ContinueWith(t => Messenger.Default.Send(t.Result), Context.UiThread); }
public void NetMessage(string evnt, string channel) { Debug.Log(evnt); System.IO.StringReader strStream = new System.IO.StringReader(evnt); CustomEventMessage CEM = (CustomEventMessage)xmlSerializer.Deserialize(strStream); CustomEvent ce = new NotificationEvent("NetworkMessage"); ce ["NetworkMessage"] = CEM; CES.Broadcast(ce, channel); }
/// <summary> /// Function to update person status /// </summary> /// <param name="notificationEvent">notification event</param> private static void UpdatePersonStatus(NotificationEvent notificationEvent) { var personStatus = JsonConvert.DeserializeObject<PersonChangeNotification>(notificationEvent.EventDescription); if (notificationEvent.PersonTypeId == CommonConstants.GuestTypeId) { UpdateGuestStatus(notificationEvent.PersonId, personStatus.LastStatus); } else if (notificationEvent.PersonTypeId == CommonConstants.CrewmemberTypeId) { UpdateCrewStatus(notificationEvent.PersonId, personStatus.LastStatus); } else if (notificationEvent.PersonTypeId == CommonConstants.VisitorTypeId) { UpdateVisitorStatus(notificationEvent.PersonId, personStatus.LastStatus); } }
/// <summary> /// Updates the person data. /// </summary> /// <param name="message">The message.</param> /// <param name="personList">The person list.</param> public static void UpdatePersonData(NotificationEvent message, IList<PersonBase> personList) { if (message == null) { throw new ArgumentNullException("message"); } Person personData = null; Workstation workStation = DIContainer.Instance.Resolve<Workstation>(); NotificationEventType eventType; bool isValidEventType = Enum.TryParse(message.EventTypeId, out eventType); if (isValidEventType) { List<PersonType> personTypeList = new List<PersonType>(); if (message != null && message.PersonTypeId == CommonConstants.GuestTypeId) { personTypeList.Add(PersonType.Guest); } else if (message != null && message.PersonTypeId == CommonConstants.VisitorTypeId) { personTypeList.Add(PersonType.Visitor); } else if (message != null && message.PersonTypeId == CommonConstants.CrewmemberTypeId) { personTypeList.Add(PersonType.Crewmember); } if (eventType == NotificationEventType.Reservation) { RetrieveGuestForReservation(message, personData, workStation, eventType, personTypeList, personList); } else { personData = RetrievePerson(message, personData, workStation, eventType, personTypeList, personList); } } }
public void AddEvent(NotificationEvent notificationEvent) { this.notificationEvents.Add(notificationEvent); }
/// <summary> /// Function to find out whether is there need for search. /// </summary> /// <param name="message">Instance of NotificationEvent</param> /// <param name="personList">List of person</param> /// <returns>True or false</returns> public static bool IsNeedForSearch(NotificationEvent message, IList<PersonBase> personList) { NotificationEventType eventType = (NotificationEventType)Enum.Parse(typeof(NotificationEventType), message.EventTypeId); bool isNeedForSearch = false; if (eventType == NotificationEventType.Reservation) { isNeedForSearch = personList.Any(p => p.CruiseDetail != null && !string.IsNullOrEmpty(p.CruiseDetail.ReservationNumber) && p.CruiseDetail.ReservationNumber.Equals(message.ReservationNumber, StringComparison.OrdinalIgnoreCase)); } else { isNeedForSearch = personList.Any(p => !string.IsNullOrEmpty(p.PersonId) && p.PersonId.Equals(message.PersonId, StringComparison.OrdinalIgnoreCase)); } return isNeedForSearch; }
/// <summary> /// Function to updates the selected person. /// </summary> /// <param name="message">The message.</param> /// <param name="personData">The person data.</param> /// <param name="personTypeList">The person type list.</param> /// <param name="personsPartyManager">The persons party manager.</param> /// <param name="eventType">Type of the event.</param> private static void UpdateSelectedPerson(NotificationEvent message, Person personData, List<PersonType> personTypeList, PersonsPartyManager personsPartyManager, NotificationEventType eventType) { if (personTypeList.FirstOrDefault() == PersonType.Guest && personsPartyManager.CurrentParty.IsPartyCreated) { var guest = personsPartyManager.CurrentParty.Guests.FirstOrDefault(g => g.GuestId.Equals(message.PersonId, StringComparison.OrdinalIgnoreCase)); MapGuestData(guest, personData.Guests.FirstOrDefault(), eventType); RetrieveGuestPhoto(guest); } else if (personTypeList.FirstOrDefault() == PersonType.Crewmember && personsPartyManager.CurrentParty.IsPartyCreated) { var crewMember = personsPartyManager.CurrentParty.Crew.FirstOrDefault(c => c.CrewmemberId.Equals(message.PersonId, StringComparison.OrdinalIgnoreCase)); MapCrewMemberData(crewMember, personData, eventType); RetrieveCrewmemberPhoto(crewMember); } else if (personTypeList.FirstOrDefault() == PersonType.Visitor && personsPartyManager.CurrentParty.IsPartyCreated) { var visitor = personsPartyManager.CurrentParty.Visitors.FirstOrDefault(v => v.VisitorId.Equals(message.PersonId, StringComparison.OrdinalIgnoreCase)); MapVisitorData(visitor, personData, eventType); RetrieveVisitorPhoto(visitor); } }
/// <summary> /// Retrieves the guest. /// </summary> /// <param name="message">The message.</param> /// <param name="personData">The person data.</param> /// <param name="workStation">The work station.</param> /// <param name="eventType">Type of the event.</param> /// <param name="personTypeList">The person type list.</param> /// <param name="personList">The person list.</param> /// <returns> /// The person /// </returns> private static Person RetrievePerson(NotificationEvent message, Person personData, Workstation workStation, NotificationEventType eventType, List<PersonType> personTypeList, IList<PersonBase> personList) { var person = personList.Where(p => p.PersonId == message.PersonId).FirstOrDefault(); var task = Task.Run(async () => await PersonsService.RetrievePersonsBySearchText(workStation.Ship.ShipId, null, personTypeList, SearchType.PersonId, personId: message.PersonId, folioNumber: null)); task.Wait(); if (!task.IsCanceled && !task.IsFaulted) { personData = task.Result; PersonBase retrievedPerson = null; if (personTypeList.FirstOrDefault() == PersonType.Guest) { retrievedPerson = personData.Guests.FirstOrDefault().MapToPersonBase(); } else if (personTypeList.FirstOrDefault() == PersonType.Crewmember) { retrievedPerson = personData.Crewmembers.FirstOrDefault().MapToPersonBase(); } else if (personTypeList.FirstOrDefault() == PersonType.Visitor) { retrievedPerson = personData.Visitors.FirstOrDefault().MapToPersonBase(); } if (personData != null) { MapPersonData(person, retrievedPerson, eventType); if (person != null) { RetrievePhoto(person); } } } return personData; }
/// <summary> /// Updates the searched person from notification. /// </summary> /// <param name="message">The message.</param> private void UpdateRecentPersonFromNotification(NotificationEvent message) { if (CommonMethods.IsNeedForSearch(message, this.personList)) { CommonMethods.UpdatePersonData(message, this.personList); } }
/// <summary> /// Retrieves the guest. /// </summary> /// <param name="message">The message.</param> /// <param name="eventType">Type of the event.</param> /// <param name="personTypeList">The person type list.</param> private static void RetrieveGuestForReservation(NotificationEvent message, NotificationEventType eventType, List<PersonType> personTypeList) { Workstation workStation = DIContainer.Instance.Resolve<Workstation>(); var task = Task.Run(async () => await PersonsService.RetrievePersonsBySearchText(workStation.Ship.ShipId, message.ReservationNumber, personTypeList, SearchType.Reservation, null, null, 1, CommonConstants.MaxPageCount, null, folioNumber: null)); task.Wait(); if (!task.IsCanceled && !task.IsFaulted) { var personData = task.Result; var personsPartyManager = DIContainer.Instance.Resolve<PersonsPartyManager>(); personData.Guests.Iterate(g => { if (personsPartyManager.CurrentParty.IsPartyCreated && personsPartyManager.CurrentParty.Guests.Any(a => a.GuestId.Equals(g.GuestId, StringComparison.OrdinalIgnoreCase))) { var guest = personsPartyManager.CurrentParty.Guests.FirstOrDefault(p => p.GuestId.Equals(g.GuestId, StringComparison.OrdinalIgnoreCase)); MapGuestData(guest, g, eventType); RetrieveGuestPhoto(guest); } }); } }
protected virtual void OnClickButton(object sender, NotificationEvent e) { throw new Exception("The method or operation is not implemented."); }
public EventNotificationConfigBuilder ForEvent( NotificationEvent notificationEvent ) { events.Add( notificationEvent ); return this; }
/// <summary> /// Retrieves the guest. /// </summary> /// <param name="message">The message.</param> /// <param name="personData">The person data.</param> /// <param name="workStation">The work station.</param> /// <param name="eventType">Type of the event.</param> /// <param name="personTypeList">The person type list.</param> /// <param name="personList">The person list.</param> private static void RetrieveGuestForReservation(NotificationEvent message, Person personData, Workstation workStation, NotificationEventType eventType, List<PersonType> personTypeList, IList<PersonBase> personList) { var task = Task.Run(async () => await PersonsService.RetrievePersonsBySearchText(workStation.Ship.ShipId, message.ReservationNumber, personTypeList, SearchType.Reservation, null, null, null, 0, null, folioNumber: null)); task.Wait(); if (!task.IsCanceled && !task.IsFaulted) { personData = task.Result; if (personData != null) { personData.Guests.Iterate(g => { var person = personList.FirstOrDefault(p => p.PersonId.Equals(message.PersonId, StringComparison.OrdinalIgnoreCase)); if (person != null) { MapPersonData(person, g.MapToPersonBase(), eventType); RetrievePhoto(person); } }); } } }
private void OnButtonMouseOver(object sender, NotificationEvent e) { if (sender == b1 && GameUI.Bookmarks[0] != null) { ShowMouseOverImage(0, b1); return; } if (sender == b2 && GameUI.Bookmarks[1] != null) { ShowMouseOverImage(1, b2); return; } if (sender == b3 && GameUI.Bookmarks[2] != null) { ShowMouseOverImage(2, b3); return; } if (sender == b4 && GameUI.Bookmarks[3] != null) { ShowMouseOverImage(3, b4); return; } if (sender == b5 && GameUI.Bookmarks[4] != null) { ShowMouseOverImage(4, b5); return; } }
private void OnButtonClick(object sender, NotificationEvent e) { if (e.Command == "WP1") { StartBookmark(e, 0); return; } if (e.Command == "WP2") { StartBookmark(e, 1); return; } if (e.Command == "WP3") { StartBookmark(e,2); return; } if (e.Command == "WP4") { StartBookmark(e, 3); return; } if (e.Command == "WP5") { StartBookmark(e, 4); return; } }
private void StartBookmark(NotificationEvent e, int idx) { NodeCursorEventArgs cursor = e.Tag as NodeCursorEventArgs; // Set if either empty or right-click if (GameUI.Bookmarks[idx] == null || (cursor != null && cursor.Button == UI.GameUI.MouseButtons.Right)) { // Set it from current GameUI.Bookmarks[idx] = GameUI.MakeBookmark(); } else { // Already set, reset the game to this GameUI.Reset(GameUI.Bookmarks[idx]); } }
/* * Implemention of EventHandler interface to handle the Berkeley DB events * we are interested in receiving. */ private void RepQuoteEventHandler(NotificationEvent eventCode, byte[] event_info) { switch (eventCode) { case NotificationEvent.REP_CLIENT: dbenv.IsMaster = false; dbenv.InClientSync = true; break; case NotificationEvent.REP_MASTER: dbenv.IsMaster = true; dbenv.InClientSync = false; break; case NotificationEvent.REP_NEWMASTER: dbenv.InClientSync = true; break; case NotificationEvent.REP_STARTUPDONE: dbenv.InClientSync = false; break; /* * Did not get enough acks to guarantee transaction * durability based on the configured ack policy. This * transaction will be flushed to the master site's * local disk storage for durability. */ case NotificationEvent.REP_PERM_FAILED: Console.WriteLine("Insufficient acknowledgements " + "to guarantee transaction durability."); break; default: Console.WriteLine("Ignoring event: {0}", eventCode); break; } }
/// <summary> /// Function to find out whether is there need for search. /// </summary> /// <param name="message">Instance of NotificationEvent</param> /// <param name="eventType">NotificationEventType enumeration</param> /// <returns>True or false</returns> public static bool IsNeedForSearch(NotificationEvent message, NotificationEventType eventType) { var personsPartyManager = DIContainer.Instance.Resolve<PersonsPartyManager>(); bool isNeedForSearch = false; PersonType personType = PersonType.Guest; if (message != null && message.PersonTypeId == CommonConstants.GuestTypeId) { personType = PersonType.Guest; } else if (message != null && message.PersonTypeId == CommonConstants.CrewmemberTypeId) { personType = PersonType.Crewmember; } else if (message != null && message.PersonTypeId == CommonConstants.VisitorTypeId) { personType = PersonType.Visitor; } if (eventType == NotificationEventType.Reservation) { isNeedForSearch = personsPartyManager.CurrentParty.Guests.Any(g => g.CruiseDetail.ReservationNumber.Equals(message.ReservationNumber, StringComparison.OrdinalIgnoreCase)); } else { if (personType == PersonType.Guest) { isNeedForSearch = personsPartyManager.CurrentParty.Guests.Any(g => g.GuestId.Equals(message.PersonId, StringComparison.OrdinalIgnoreCase)); } else if (personType == PersonType.Crewmember) { isNeedForSearch = personsPartyManager.CurrentParty.Crew.Any(c => c.CrewmemberId.Equals(message.PersonId, StringComparison.OrdinalIgnoreCase)); } else if (personType == PersonType.Visitor) { isNeedForSearch = personsPartyManager.CurrentParty.Visitors.Any(v => v.VisitorId.Equals(message.PersonId, StringComparison.OrdinalIgnoreCase)); } } return isNeedForSearch; }
/// <summary> /// Retrieves the guest. /// </summary> /// <param name="message">The message.</param> /// <param name="eventType">Type of the event.</param> /// <param name="personTypeList">The person type list.</param> private static void RetrieveGuest(NotificationEvent message, NotificationEventType eventType, List<PersonType> personTypeList) { Workstation workStation = DIContainer.Instance.Resolve<Workstation>(); var task = Task.Run(async () => await PersonsService.RetrievePersonsBySearchText(workStation.Ship.ShipId, null, personTypeList, SearchType.PersonId, personId: message.PersonId, folioNumber: null)); task.Wait(); if (!task.IsCanceled && !task.IsFaulted) { var personData = task.Result; var personsPartyManager = DIContainer.Instance.Resolve<PersonsPartyManager>(); if (personsPartyManager.CurrentParty != null) { ApplicationDispatcher.BeginInvoke(DispatcherPriority.Normal, (Action)(() => UpdateSelectedPerson(message, personData, personTypeList, personsPartyManager, eventType))); } } }