public MessageBoxChildWindow(string message, string caption, UserNotificationType notificationType, bool doNotBlock) : this(true) { XvueMessageBox contentMessageBox = new XvueMessageBox(notificationType, message); Caption = caption; IsModal = !doNotBlock; Content = contentMessageBox; ViewMSOTcSystem.ChildWindowContainer.Children.Add(this); Unloaded += MessageBoxChildWindow_Unloaded; }
public static int Create( User.User user, string title, string content, UserNotificationType type = UserNotificationType.Info ) => ExecuteScalarInt( $@"INSERT INTO public.user_notifications(guid, user_id, title, content, seen, type, updated_at) VALUES (@guid, @user_id, @title, @content, @seen, '{type.ToString()}', CURRENT_TIMESTAMP); SELECT currval('user_notifications_id_seq');" , new { guid = Guid.NewGuid().ToString(), user_id = user.id, title, content, seen = false, type } );
/// <summary> /// Subscribes a user to a notification type /// </summary> public void SubscribeUserToNotificationType(User user, NotificationType notificationType) { if (user == null) { throw new ArgumentNullException("user"); } var userNotificationType = user.UserNotificationTypes.FirstOrDefault(x => x.NotificationTypeId == (int)notificationType); if (userNotificationType != null) { return; } userNotificationType = new UserNotificationType { NotificationTypeId = (int)notificationType, DateCreated = DateTime.Now }; user.UserNotificationTypes.Add(userNotificationType); }
public void NotifyUserOnError(string message, string caption, UserNotificationType notificationType, bool doNotBlock) { if (notificationType == UserNotificationType.ReportIssue) { ViewSystemHelper.HandPlay(); if (!string.IsNullOrEmpty(message)) { _system.IMSOTLog.HandleError(caption, message); } _system.CommandCreateIssueReporter.Execute(message); mainIssueReportChildWindow.Caption = caption; mainIssueReportChildWindow.IsModal = !doNotBlock; mainIssueReportChildWindow.WindowState = Xceed.Wpf.Toolkit.WindowState.Open; } else { MessageBoxChildWindow messageBoxNotify = new MessageBoxChildWindow(message, caption, notificationType, doNotBlock); ViewSystemHelper.BeepPlay(); messageBoxNotify.ShowMessage(); } }
public UserNotificationEvent(string message, UserNotificationType type = UserNotificationType.Info) { this.NotificationType = type; this.Message = message; }
public static UserNotification NewNotification( User user, string title, string content, UserNotificationType type = UserNotificationType.Info ) { return(UserNotificationRepository.Create(user, title, content, type)); }
/// <summary> /// Sets user notification type. /// </summary> /// <param name="channelAccount">Channel acciunt</param> /// <param name="userNotificationType">Notification type.</param> public async Task <OperationResponse> SetUserNotificationTypeAsync(ChannelAccount channelAccount, UserNotificationType userNotificationType) { if (channelAccount == null) { throw new ArgumentNullException(nameof(channelAccount)); } if (userNotificationType == null) { throw new ArgumentNullException(nameof(userNotificationType)); } var response = new OperationResponse(); User user = _telegramContext.Users.FirstOrDefault(x => x.Id == channelAccount.Id); if (user is null) { response.ErrorMessage = $"User with id:{channelAccount.Id} not found."; return(response); } user.NotificationType = userNotificationType; try { _telegramContext.Users.Update(user); await _telegramContext.SaveChangesAsync(); response.Success = true; return(response); } catch (Exception ex) { response.ErrorMessage = ex.InnerException is null ? ex.Message : ex.InnerException.Message; return(response); } }
public XvueMessageBox(UserNotificationType notificationType, string message) : this() { SetCurrentValue(XvueMessageBox.MessageTypeProperty, notificationType); SetCurrentValue(XvueMessageBox.MessageProperty, message); }
void LoadConfigurationFromStream(Stream stream) { XmlReaderSettings settings = new XmlReaderSettings (); Assembly ass = Assembly.GetExecutingAssembly (); using (Stream schema = ass.GetManifestResourceStream ("DebuggerConfiguration")) settings.Schemas.Add (null, new XmlTextReader (schema)); XmlReader reader = XmlReader.Create (stream, settings); XPathDocument doc = new XPathDocument (reader); XPathNavigator nav = doc.CreateNavigator (); XPathNodeIterator iter = nav.Select ("/DebuggerConfiguration/Configuration/*"); while (iter.MoveNext ()) { if (iter.Current.Name == "LoadNativeSymtabs") LoadNativeSymtabs = Boolean.Parse (iter.Current.Value); else if (iter.Current.Name == "StayInThread") { ; // ignore, this is no longer in use. } else if (iter.Current.Name == "FollowFork") FollowFork = Boolean.Parse (iter.Current.Value); else if (iter.Current.Name == "OpaqueFileNames") OpaqueFileNames = Boolean.Parse (iter.Current.Value); else if (iter.Current.Name == "StopOnManagedSignals") StopOnManagedSignals = Boolean.Parse (iter.Current.Value); else if (iter.Current.Name == "NestedBreakStates") NestedBreakStates = Boolean.Parse (iter.Current.Value); else if (iter.Current.Name == "RedirectOutput") RedirectOutput = Boolean.Parse (iter.Current.Value); else if (iter.Current.Name == "Martin_Boston_07102008") { ; // ignore, this is no longer in use. } else if (iter.Current.Name == "BrokenThreading") { ; // ignore, this is no longer in use. } else if (iter.Current.Name == "StopDaemonThreads") { if (Boolean.Parse (iter.Current.Value)) threading_model |= ThreadingModel.StopDaemonThreads; else threading_model &= ~ThreadingModel.StopDaemonThreads; } else if (iter.Current.Name == "StopImmutableThreads") { if (Boolean.Parse (iter.Current.Value)) threading_model |= ThreadingModel.StopImmutableThreads; else threading_model &= ~ThreadingModel.StopImmutableThreads; } else if (iter.Current.Name == "ThreadingModel") { switch (iter.Current.Value.ToLower ()) { case "single": threading_model |= ThreadingModel.Single; break; case "process": threading_model |= ThreadingModel.Process; break; case "global": threading_model |= ThreadingModel.Global; break; case "default": break; default: Report.Error ("Invalid value `{0}' in 'ThreadingModel'", iter.Current.Value); break; } } else if (iter.Current.Name == "UserNotifications") { switch (iter.Current.Value.ToLower ()) { case "+threads": case "threads": user_notifications |= UserNotificationType.Threads; break; case "-threads": user_notifications &= ~UserNotificationType.Threads; break; default: Report.Error ("Invalid value `{0}' in 'UserNotifications'", iter.Current.Value); break; } } else { Report.Error ("Invalid configuration item `{0}'", iter.Current.Name); } } iter = nav.Select ("/DebuggerConfiguration/ModuleGroups/ModuleGroup"); while (iter.MoveNext ()) { string name = iter.Current.GetAttribute ("name", ""); ModuleGroup group = CreateModuleGroup (name); group.SetSessionData (iter); } iter = nav.Select ("/DebuggerConfiguration/DirectoryMap/Map"); while (iter.MoveNext ()) { string from = iter.Current.GetAttribute ("from", ""); string to = iter.Current.GetAttribute ("to", ""); directory_maps.Add (from, to); } }
public static UserNotification Create( Model.User.User user, string title, string content, UserNotificationType type = UserNotificationType.Info ) { return(Find(UserNotification.Create(user, title, content, type))); }