protected NotificationTrigger Trigger(string name = "Email to Admin", int id = 1) { var action = new NotificationAction { Name = name, Id = 300 }; var obj = new NotificationTrigger { SubId = id, ObjectId = 1001 }; var info = obj.GetInternalFieldInfo("onNotificationAction"); info.SetValue(obj, action); info = obj.GetInternalFieldInfo("objectLink"); info.SetValue(obj, $"<a thisid=\"1001\"/>"); info = obj.GetInternalFieldInfo("type"); info.SetValue(obj, "state"); return(obj); }
public FormNotification(string messsage, NotificationType type) { InitializeComponent(); btnGoruntule.Visible = false; btnEnglish.Visible = false; btnMobil.Visible = false; btnYazdir.Visible = false; TopMost = true; Opacity = 0.0; StartPosition = FormStartPosition.Manual; string fname; for (int i = 1; i < 10; i++) { fname = "alert" + i.ToString(); FormNotification frm = (FormNotification)Application.OpenForms[fname]; if (frm == null) { Name = fname; x = Screen.PrimaryScreen.WorkingArea.Width - Width + 15; y = Screen.PrimaryScreen.WorkingArea.Height - Height * i - 5 * i; Location = new Point(x, y); break; } } x = Screen.PrimaryScreen.WorkingArea.Width - base.Width - 5; switch (type) { case NotificationType.Success: pictureBox1.Image = Resources.success; BackColor = Color.SeaGreen; break; case NotificationType.Error: pictureBox1.Image = Resources.error; BackColor = Color.DarkRed; break; case NotificationType.Info: pictureBox1.Image = Resources.info; BackColor = Color.RoyalBlue; break; case NotificationType.Warning: pictureBox1.Image = Resources.warning; BackColor = Color.DarkOrange; break; } lblMsg.Text = messsage; action = NotificationAction.start; timer1.Interval = 1; timer1.Start(); }
private void SendNotification(Int64 messageId, Int64 tkUserId, ModuleTicket.NotificationActionType actionType) { ////SE non ho un ID messaggio di riferimento, NON INVIO NOTIFICHE!!! if (messageId <= 0) { //throw new ArgumentNullException("messageId"); return; } //test ID community //int currentCommunityId = UserContext.CurrentCommunityID; NotificationAction action = new NotificationAction(); action.IdCommunity = CurrentCommunityId; action.IdObject = messageId; action.IdObjectType = (long)ModuleTicket.ObjectType.Message; action.ModuleCode = ModuleTicket.UniqueCode; action.IdModuleUsers = new List <long>(); action.IdModuleUsers.Add(tkUserId); action.IdModuleAction = (long)actionType; //IList<NotificationAction> actions = new List<NotificationAction>(); //actions.Add(action); //action.IdModuleAction = (long) ModuleTicket.MailSenderActionType.TicketSendMessageMan; View.SendNotification(action, UserContext.CurrentUserID); }
static void ExportScreenshot() { ScreenshotExporterViewModel vm = new ScreenshotExporterViewModel(); if (vm.ExportSelectionCommand.CanExecute(null)) { vm.ChooseFileNameMessage.Sent += (sender, args) => { try { Logger.Info("Choose file name message was received"); ChooseFileSaveAction a = new ChooseFileSaveAction(); a.Invoke(args); } catch (Excel.CopyException) { NotificationAction a = new NotificationAction(); a.Caption = Strings.ScreenshotExport; a.Message = Strings.GraphicHasNoCopyMethod; a.Invoke(); } }; vm.ExportSelectionCommand.Execute(null); } else { NotificationAction a = new NotificationAction(); a.Caption = Strings.ScreenshotExport; a.Message = Strings.ScreenshotExportRequiresGraphic; a.Invoke(); } }
private void SendNotification(Int64 messageId, Int64 tkUserId, ModuleTicket.NotificationActionType actionType) { SettingsPortal settingsPortal = service.PortalSettingsGet(); if (!(settingsPortal.IsNotificationUserActive && settingsPortal.IsNotificationManActive)) { return; } //test ID community int currentCommunityId = UserContext.CurrentCommunityID; NotificationAction action = new NotificationAction(); action.IdCommunity = currentCommunityId; action.IdObject = messageId; action.IdObjectType = (long)ModuleTicket.ObjectType.Message; action.ModuleCode = ModuleTicket.UniqueCode; action.IdModuleUsers = new List <long>(); action.IdModuleUsers.Add(tkUserId); action.IdModuleAction = (long)actionType; //IList<NotificationAction> actions = new List<NotificationAction>(); //actions.Add(action); //action.IdModuleAction = (long) ModuleTicket.MailSenderActionType.TicketSendMessageMan; View.SendNotification(action, UserContext.CurrentUserID); }
public async Task NotifyAsync(int userId, string message, int?bookId = null, NotificationAction action = NotificationAction.None) { if (message == null) { throw new ArgumentNullException(nameof(message), "Message of notification cannot be null"); } if (string.IsNullOrWhiteSpace(message)) { throw new ArgumentException("Message of notification cannot contain only white spaces or be empty", nameof(message)); } var newNotification = new Notification { UserId = userId, Message = message, BookId = bookId, Action = action }; _notificationsRepository.Add(newNotification); await _notificationsRepository.SaveChangesAsync(); await _notificationHubContext.Clients.User(userId.ToString()) .SendAsync( MethodNameOfHubProxy, _mapper.Map <NotificationDto>(newNotification)); }
private void SendNotification(long userId) { if (UserContext.isAnonymous) { View.DisplaySessionTimeout(this.CurrentCommunityId); return; } Domain.SettingsPortal settingsPortal = service.PortalSettingsGet(); if (!(settingsPortal.IsNotificationUserActive && settingsPortal.IsNotificationManActive)) { View.ShowSendResponse(false); return; } NotificationAction action = new NotificationAction(); action.IdModuleUsers = new List <long>(); action.IdModuleUsers.Add(userId); action.ModuleCode = ModuleTicket.UniqueCode; action.IdCommunity = CurrentCommunityId; action.IdObjectType = (long)ModuleTicket.ObjectType.Category; action.IdObject = View.CurrentCategoryId; action.IdModuleAction = (long)ModuleTicket.NotificationActionType.CategoriesNotification; View.SendNotification(action, UserContext.CurrentUserID); //this.InitView(); View.ShowSendResponse(true); }
public void ShowAlert(string message, NotificationType eType) { Opacity = 0.0; StartPosition = FormStartPosition.Manual; string formName; for (int i = 1; i < 10; i++) { formName = "alert" + i.ToString(); Form_Alert frm = (Form_Alert)Application.OpenForms[formName]; if (frm == null) { Name = formName; posX = Screen.PrimaryScreen.WorkingArea.Width - Width + 15; posY = Screen.PrimaryScreen.WorkingArea.Height - Height * i - 5 * i; Location = new Point(posX, posY); break; } } posX = Screen.PrimaryScreen.WorkingArea.Width - Width - 5; switch (eType) { case NotificationType.Success: iconPictureBox1.IconChar = FontAwesome.Sharp.IconChar.Check; iconPictureBox1.IconColor = Color.White; iconPictureBox1.BackColor = Color.SeaGreen; BackColor = Color.SeaGreen; break; case NotificationType.Error: iconPictureBox1.IconChar = FontAwesome.Sharp.IconChar.Bug; iconPictureBox1.IconColor = Color.White; iconPictureBox1.BackColor = Color.DarkRed; BackColor = Color.DarkRed; break; case NotificationType.Info: iconPictureBox1.IconChar = FontAwesome.Sharp.IconChar.Info; iconPictureBox1.IconColor = Color.White; iconPictureBox1.BackColor = Color.RoyalBlue; BackColor = Color.RoyalBlue; break; case NotificationType.Warning: iconPictureBox1.IconChar = FontAwesome.Sharp.IconChar.SkullCrossbones; iconPictureBox1.IconColor = Color.White; iconPictureBox1.BackColor = Color.DarkOrange; BackColor = Color.DarkOrange; break; } labelMessage.Text = message; Show(); notificationAction = NotificationAction.start; timer1.Interval = 1; timer1.Start(); }
private static string ToTraceString(string prefix, string jobId, int ud, NotificationAction action, string detail) { string text = string.Format( CultureInfo.InvariantCulture, "{0} JobId/UD/Action/Detail: {1}/{2}/{3}/{4}", prefix, jobId, ud, action, detail); return(text); }
public void Saved() { var deleteAction = new NotificationAction { Icon = _icons.Delete, Name = _loc.Delete, Color = "LightPink" }; deleteAction.Click += () => { if (File.Exists(_recentItem.FileName)) { var platformServices = ServiceProvider.Get <IPlatformServices>(); if (!platformServices.DeleteFile(_recentItem.FileName)) { return; } } Remove(); OnDelete?.Invoke(); }; _notificationActions.Add(deleteAction); PrimaryText = _recentItem.FileType == RecentFileType.Video ? _loc.VideoSaved : _loc.AudioSaved; Finished = true; }
private void SendNotification(ModuleTicket.NotificationActionCategoryUserReceiver receiver) { Domain.SettingsPortal settingsPortal = service.PortalSettingsGet(); if (!(settingsPortal.IsNotificationUserActive && settingsPortal.IsNotificationManActive)) { View.ShowSendInfo(false); return; } NotificationAction action = new NotificationAction(); action.IdModuleUsers = new List <long>(); action.IdModuleUsers.Add((long)receiver); action.ModuleCode = ModuleTicket.UniqueCode; action.IdCommunity = CurrentCommunityId; action.IdObjectType = (long)ModuleTicket.ObjectType.Category; action.IdObject = -1; action.IdModuleAction = (long)ModuleTicket.NotificationActionType.CategoriesNotification; View.SendNotification(action, UserContext.CurrentUserID); View.ShowSendInfo(true); }
public void ShouldSerializeSimpleAction() { var action = new NotificationAction("notify"); var json = JsonConvert.SerializeObject(action); Assert.AreEqual("\"notify\"", json); }
/* * private void Update() * { * if (Input.GetKey(KeyCode.Space)) * { * // Example notification system call. * NotificationSystem.DisplayNotification("This is a test"); * } * } */ private void Awake() { DisplayNotification = NewNotification; fadeable = GetComponentInChildren <Fadeable>(); text = GetComponentInChildren <TextMeshProUGUI>(); button = GetComponentInChildren <Button>(); button.onClick.AddListener(StopDisplay); }
public void ShouldSerializeObjectActionWithNoValue(string name) { var expectedJson = $"{{\"set_tweak\":\"{name}\"}}"; var action = new NotificationAction("set_tweak", name); var json = JsonConvert.SerializeObject(action); Assert.AreEqual(expectedJson, json); }
protected override void OnNavigatedTo(NavigationEventArgs e) { base.OnNavigatedTo(e); AudioBox.ItemsSource = AudioList; if ((int)localSettings.Values[Settings.ACTIONACTION] == Settings.Actions.CREATE) { return; } using (var context = new TaskSchedulerDbContext()) { Models.Action action = context.Actions.Where(x => x.Id == (int)localSettings.Values[Settings.ACTIONID]).First(); switch (action.Type) { case ActionType.URI: { UriAction uriAction = context.UriActions.Where(x => x.Id == action.ActionId).First(); Uri = uriAction.Uri; Index = 0; }; break; case ActionType.NOTIFICATION: { NotificationAction notificationAction = context.NotificationActions.Where(x => x.Id == action.ActionId).First(); Text = notificationAction.Text; Image = notificationAction.Image; Audio = notificationAction.Audio.GetValueOrDefault(0); if (notificationAction.Timeout.HasValue) { Timeout = notificationAction.Timeout.Value.ToString(); } Index = 1; }; break; case ActionType.APPLICATION: { ApplicationAction applicationAction = context.ApplicationActions.Where(x => x.Id == action.ActionId).First(); appListProvider.IsDoneTask.ContinueWith(async(result) => { await CoreApplication.MainView.CoreWindow.Dispatcher.RunAsync(CoreDispatcherPriority.Normal, () => { bool ok = appListProvider.AppList.Where(x => x.Package.Id.FullName == applicationAction.ApplicationName).Any(); if (ok) { AppEntry entry = appListProvider.AppList.Where(x => x.Package.Id.FullName == applicationAction.ApplicationName).First(); LoadedContent.SelectedItem = entry; LoadedContent.ScrollIntoView(entry); } }); }); Index = 2; }; break; } } }
private static ErrorMessage CreateErrorMessage(NotificationAction action, NotificationException error) { ErrorMessage obj = CreateErrorMessage(action, error.Type); obj.Error.StackTrace = error.StackTrace; obj.Error.Source = error.Source; obj.Error.Message = error.Message; obj.Error.InnerException = (error.InnerException == null) ? "" : error.InnerException.Message; return(obj); }
/// <summary> /// Updates a <see cref="NotificationAction"/> in this object's <see cref="Parameters"/>. If the notification action is null, an empty notification action is inserted. /// </summary> /// <param name="actionType">The type of notification action to insert.</param> /// <param name="value">The notification action to insert. If this value is null, an empty notification action is inserted.</param> protected void SetNotificationAction(TriggerProperty actionType, NotificationAction value) { ValidateActionType(actionType); if (value == null) { value = EmptyNotificationAction(); } UpdateCustomParameter(actionType, value); }
public List <GroupMessages> NotifyActionToModule(NotificationAction action, Int32 idSenderUser, String ipAddress, String proxyIpAddress, Notification.Domain.WebSiteSettings webSiteSettings) { List <GroupMessages> results = null; lm.Comol.Core.Notification.Domain.iNotifiableService service = null; lm.Comol.Core.Data.DataContext dc = new lm.Comol.Core.Data.DataContext(Session); switch (action.ModuleCode) { case lm.Comol.Core.BaseModules.Tickets.ModuleTicket.UniqueCode: service = new lm.Comol.Core.BaseModules.Tickets.TicketService(dc); break; case lm.Comol.Modules.Standard.WebConferencing.Domain.ModuleWebConferencing.UniqueCode: if (IstanceConfig.WebConference != null) { switch (IstanceConfig.WebConference.CurrentType) { case WebConferenceType.eWorks: service = new lm.Comol.Modules.Standard.WebConferencing.Domain.eWorks.eWService(IstanceConfig.WebConference.GetEWorksParameters(), dc); break; case WebConferenceType.OpenMeeting: service = new lm.Comol.Modules.Standard.WebConferencing.Domain.OpenMeetings.oMService(IstanceConfig.WebConference.GetOpenMeetingParameters(), dc); break; } } break; case lm.Comol.Modules.CallForPapers.Domain.ModuleCallForPaper.UniqueCode: //service = new lm.Comol.Modules.CallForPapers.Business.ServiceCallOfPapers(dc); break; case lm.Comol.Modules.CallForPapers.Domain.ModuleRequestForMembership.UniqueCode: //service = new lm.Comol.Modules.CallForPapers.Business.ServiceRequestForMembership(dc); break; case lm.Comol.Modules.Standard.ProjectManagement.Domain.ModuleProjectManagement.UniqueCode: service = new lm.Comol.Modules.Standard.ProjectManagement.Business.ServiceProjectManagement(dc); break; case lm.Comol.Core.BaseModules.CommunityDiary.Domain.ModuleCommunityDiary.UniqueID: //service = new lm.Comol.Core.BaseModules.CommunityDiary.Business.ServiceCommunityDiary(dc); break; case lm.Comol.Modules.EduPath.Domain.ModuleEduPath.UniqueCode: ///service = new lm.Comol.Modules.EduPath.BusinessLogic.Service(dc); break; } if (service != null) { results = service.GetDefaultNotificationMessages(action, idSenderUser, webSiteSettings); } return(results); }
public FormNotification(ResponseBarcode responseBarcode, bool isRetail = false) { InitializeComponent(); btnGoruntule.Visible = true; btnYazdir.Visible = true; if (isRetail) { btnEnglish.Visible = responseBarcode.Data.Supported_multi_lang || false; btnMobil.Visible = responseBarcode.Data.Has_mobile_app || false; } selectedResponseBarcode = responseBarcode; TopMost = true; Opacity = 1; StartPosition = FormStartPosition.Manual; string fname; for (int i = 1; i < 10; i++) { fname = "alert" + i.ToString(); FormNotification frm = (FormNotification)Application.OpenForms[fname]; if (frm == null) { Name = fname; x = Screen.PrimaryScreen.WorkingArea.Width - Width + 15; y = Screen.PrimaryScreen.WorkingArea.Height - Height * i - 5 * i; Location = new Point(x, y); break; } } x = Screen.PrimaryScreen.WorkingArea.Width - base.Width - 5; string messsage = string.Format("{0} reçetesi hazır", responseBarcode.Data.Patient_name); if (isRetail) { messsage = responseBarcode.Title; } pictureBox1.Image = Resources.success; BackColor = Color.SeaGreen; lblMsg.Text = messsage; action = NotificationAction.start; timer1.Interval = 1; timer1.Start(); }
/// <summary> /// Handles specific notification action. /// </summary> /// <param name="notification"></param> /// <param name="notificationAction"></param> private void NotifyAction(INotification notification, NotificationAction notificationAction) { switch (notificationAction) { case NotificationAction.Snooze15: notification.OnSnooze?.Invoke(new TimeSpan(0, 0, 2)); break; default: throw new NotSupportedException($"{notificationAction} is not supported."); } }
private INotificationAction CreateNotificationAction(NotificationAction arg) { switch (arg.ActionType) { case ActionType.FlashTaskbar: return((_mockFlashTaskBarAction = new Mock <INotificationAction>()).Object); case ActionType.ShowToast: return(new ShowToastAction((ShowToastNotificationAction)arg, _bus)); } throw new InvalidOperationException(); }
public NotificationViewModel(Notification n) { foruser = n.foruser; level = n.level.ToString(); text = n.text; seen = n.seen; action = n.action; id = n.id; created = n.created; createdby = n.createdby; modified = n.modified; modifiedby = n.modifiedby; }
public HttpResponseMessage SaveAction(NotificationAction entity) { try { NotificationBusiness.Action(filterActionUser.UserId, entity); return(Request.CreateResponse(HttpStatusCode.OK)); } catch (Exception exc) { var logId = LogBusiness.Error(exc); return(Request.CreateResponse(HttpStatusCode.InternalServerError, new ErrorModel(logId))); } }
public void ShowTaskReminderNotification(TaskReminderNotification notification) { //we create the pending intent when the user clicks the notification... var action = new NotificationAction { Action = NotificationActionType.OPEN_TASK, TaskId = notification.TaskId, TaskListId = notification.TaskListId }; var clickIntent = MainActivity.CreateIntent( notification.Id, MainActivity.InitParamsKey, JsonConvert.SerializeObject(action)); var pendingIntent = TaskStackBuilder.Create(Application.Context) .AddNextIntent(clickIntent) .GetPendingIntent(1, (int)PendingIntentFlags.UpdateCurrent); var localNotification = new TaskNotification { LargeContent = $"{notification.TaskTitle}{System.Environment.NewLine}" + $"{notification.TaskBody}", Title = notification.TaskListTitle, Id = notification.Id }; var builder = BuildSimpleNotification(localNotification); builder.SetContentIntent(pendingIntent); //we create the pending intent when the user clicks the mark as completed button... var mcIntent = MarkTaskAsCompletedReceiver.CreateIntent( notification.Id, MarkTaskAsCompletedReceiver.MarkTaskAsCompletedKey, JsonConvert.SerializeObject(notification)); var mcPendingIntent = PendingIntent.GetBroadcast( Application.Context, 0, mcIntent, 0); string title = _textProvider.Get("MarkTaskAs", _textProvider.Get("Completed")); builder.AddAction(Resource.Drawable.ic_check_white_48dp, title, mcPendingIntent); var notif = builder.Build(); NotifManager.Notify(notification.Id, notif); }
/// <summary> /// Updates a <see cref="NotificationAction"/> in this object's <see cref="Parameters"/>. If the notification action is null, an empty notification action is inserted. /// </summary> /// <param name="actionType">The type of notification action to insert.</param> /// <param name="value">The notification action to insert. If this value is null, an empty notification action is inserted.</param> protected void SetNotificationAction(TriggerProperty actionType, NotificationAction value) { if (actionType != TriggerProperty.OnNotificationAction && actionType != TriggerProperty.OffNotificationAction && actionType != TriggerProperty.EscalationNotificationAction) { throw new ArgumentException($"{actionType} is not a valid notification action type"); } if (value == null) { value = EmptyNotificationAction(); } UpdateCustomParameter(actionType, value); }
NotificationAction AddAction() { var action = new NotificationAction(); if (_syncContext != null) { _syncContext.Post(state => _actions.Add(action), null); } else { _actions.Add(action); } return(action); }
public static void Action(Guid userId, NotificationAction entity) { var repository = new NotificationRepository(); if (entity.DelayId.HasValue) { var date = DateTime.Now.AddMinutes(DelayTimeBusiness.GetTimeById(entity.DelayId.Value)); repository.UpdateDelayDate(entity.NotificationId, userId, date); Signal.SignalRClientBusiness.SendNotificationHangFire(date, userId, entity.NotificationId); } else if (entity.Read.HasValue) { repository.UpdateRead(entity.NotificationId, userId, entity.Read.Value); } }
static bool CheckSelectionIsRange() { Xl.Range range = Instance.Default.Application.Selection as Xl.Range; if (range == null) { NotificationAction a = new NotificationAction( Strings.RangeSelectionRequired, Strings.ActionRequiresSelectionOfCells, Strings.OK); a.Invoke(); return(false); } else { return(true); } }
static void JumpToTarget() { Xl.Range r = Instance.Default.Application.Selection as Xl.Range; string value = (r == null) ? String.Empty : Convert.ToString(r.Formula); Jumper j = new Jumper(value); if (!j.Jump()) { NotificationAction a = new NotificationAction( Strings.JumpToTarget, Strings.UnableToJump, Strings.Close); a.Invoke(); } }
/// <summary> /// /// </summary> /// <param name="serializedRequest"></param> /// <param name="action"></param> /// <returns></returns> protected virtual PendingIntent CreateActionIntent(string serializedRequest, NotificationAction action) { var intent = new Intent(Application.Context, typeof(NotificationActionReceiver)); intent.SetAction(NotificationActionReceiver.EntryIntentAction) .PutExtra(NotificationActionReceiver.NotificationActionActionId, action.ActionId) .PutExtra(NotificationCenter.ReturnRequest, serializedRequest); var pendingIntent = PendingIntent.GetBroadcast( Application.Context, action.ActionId, intent, PendingIntentFlags.CancelCurrent ); return(pendingIntent); }
private void Notification_Tap(object sender, System.Windows.Input.GestureEventArgs e) { if(NetworkInterface.GetIsNetworkAvailable()) { switch(action) { case NotificationAction.TryLoadingOlder: try { GetOlderComics(); } catch(WebException) { action = NotificationAction.TryLoadingOlder; ShowNotification(CannotLoadOlderMessage, 4000); } break; case NotificationAction.TryLoadingNewer: try { GetNewerComics(); } catch(WebException) { action = NotificationAction.TryLoadingNewer; ShowNotification(CannotLoadNewerMessage, 4000); } break; default: break; } } else { ShowNotification(NoNetworkMessage, 4000); } }