public ConversationController() { EfDbContext dbContext = new EfDbContext(); _userRepository = new UserRepository(dbContext); _conversationManager = new ConversationManager(_userRepository); }
public ChatServiceManager(IClientManager clientManager, IConversationManager conversationManager) { if (clientManager == null) { throw new ArgumentNullException("clientManager"); } if (conversationManager == null) { throw new ArgumentNullException("conversationManager"); } this.clientManager = clientManager; this.conversationManager = conversationManager; this.clientManager.ClientLeave += c => conversationManager.EndConversation(c); conversationManager.ConversationStart += (x, y) => { clientManager.SetNotFreeClient(x); clientManager.SetNotFreeClient(y); }; conversationManager.ConversationEnd += (x, y) => { clientManager.SetFreeClient(x); clientManager.SetFreeClient(y); }; }
void context_PreRequestHandlerExecute(object sender, EventArgs e) { if (HttpContext.Current.Handler is Page) { Page page = (Page)HttpContext.Current.Handler; page.Unload += new EventHandler(page_Unload); if (HttpContext.Current.Session != null) { if (LOG.IsDebugEnabled) { LOG.Debug("context_PreRequestHandlerExecute: Processing HttpContext.Current.Session"); } foreach (String convMngName in this.ConversationManagerNameList) { if (LOG.IsDebugEnabled) { LOG.Debug(string.Format("context_PreRequestHandlerExecute: Processing ConversationManager: {0}", convMngName)); } IConversationManager convMng = (IConversationManager)this.applicationContext.GetObject(convMngName); convMng.EndOnTimeOut(); convMng.FreeEnded(); } } else { if (LOG.IsDebugEnabled) { LOG.Debug("context_PreRequestHandlerExecute: no HttpContext.Current.Session found."); } } } }
private async Task PublishNotificationAndEmails(IConversationManager securityRule, ConversationKey key, string comment) { var participants = await securityRule.GetParticipants(key.EntityId); var users = participants.Participants.SelectMany(t => t.Users); var userParticipants = users.DistinctBy(a => a.Id).ToList(); var link = securityRule.Link(key.EntityId).GetUrl(); foreach (var user in userParticipants) { if (user.Id.ToString() != this.userContext.User.UserId) { var model = new CommentAddedEmail.Model(this.appConfig.Value, comment, user.Username, user.Email, link); await this.emailSender.SendEmail(user.Email, model); this.notificationsDbContext.Add( new Notification( new EntityReference(NotificationRecipientType.UserId.Value, user.Id.ToString()), new EntityReference(key.EntityType, key.EntityId.ToString()), $"New comment posted for {key.EntityType.Split('.').Last()} #{key.EntityId}", null)); } } await this.notificationsDbContext.SaveChangesAsync(); }
public App(IContacts contactManager, IConversationManager conversationManager) { ConversationManager = conversationManager; ContactManager = contactManager; InitApp(); }
public BotActivityHandler( IConversationManager conversationManager, ConversationState conversationState) { _conversationManager = conversationManager; _conversationState = conversationState; }
public ExportMultipleDialogModel(IConversationManager conversationManager, IDisplayOptionsReadOnly displayOptions, IFileSystem exportFileSystem, ExportErrorFormatter exportErrorFormatter) { _conversationManager = conversationManager; _displayOptions = displayOptions; _exportFileSystem = exportFileSystem; _exportErrorFormatter = exportErrorFormatter; }
public ConversationDTOManager(IConversationManager conversationManager, IMapper mapper, IUserFinder userFinder) { this.conversationManager = conversationManager; this.mapper = mapper; this.userFinder = userFinder; }
private ConversationWindowModel GetPopulatedConversationWindowModel() { IDisplayOptions displayOptions = new MockDisplayOptions(); IPhoneSelectOptions phoneSelectOptions = new MockPhoneSelectOptions(); ConversationWindowModel model = new ConversationWindowModel(displayOptions, phoneSelectOptions); IConversationManager conversationManager = GetConversationManager(displayOptions); model.ConversationManager = conversationManager; return(model); }
public FriendshipManager( IFriendshipRepository friendshipRepo, IUserRepository userRepo, IConversationManager conversationMgr, IHubContext <FriendsHub, IFriendsClient> friendsHub) { _friendshipRepo = friendshipRepo; _userRepo = userRepo; _conversationMgr = conversationMgr; _friendsHub = friendsHub; }
public ExportMultipleDialogView(IConversationManager conversationManager, IDisplayOptionsReadOnly displayOptions) { InitializeComponent(); IFileSystem exportFileSystem = new OsFileSystem(); ExportErrorFormatter exportErrorFormatter = new ExportErrorFormatter(); _model = new ExportMultipleDialogModel(conversationManager, displayOptions, exportFileSystem, exportErrorFormatter); _progressCallback = null; Loaded += delegate { folderPathTextBox.Text = Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments); }; }
public FriendshipController( IUserRepository userRepo, IFriendshipRepository friendshipRepo, IFriendshipManager friendshipMgr, IConversationRepository conversationRepo, IConversationManager conversationMgr, IHubContext <FriendsHub, IFriendsClient> friendsHub, StupidLoader stupidLoader) { _userRepo = userRepo; _friendshipRepo = friendshipRepo; _friendshipMgr = friendshipMgr; _conversationMgr = conversationMgr; _friendsHub = friendsHub; _stupidloader = stupidLoader; }
/// <summary> /// Handles the Unload event of the page control. /// </summary> /// <param name="sender">The source of the event.</param> /// <param name="e">The <see cref="System.EventArgs"/> instance containing the event data.</param> /// <remarks> /// Necessary for Redirect or Abort for any reason. /// </remarks> void page_Unload(object sender, EventArgs e) { if (LOG.IsDebugEnabled) { LOG.Debug("page_Unload HttpContext.Current.Session is null: " + (HttpContext.Current.Session == null)); } foreach (String convMngName in this.ConversationManagerNameList) { if (LOG.IsDebugEnabled) { LOG.Debug(string.Format("page_Unload: Processing ConversationManager: {0}", convMngName)); } IConversationManager convMng = (IConversationManager)this.applicationContext.GetObject(convMngName); convMng.EndOnTimeOut(); convMng.FreeEnded(); convMng.PauseConversations(); } }
private static void OnDoWork(object sender, DoWorkEventArgs e) { AsyncLoadingProgressParams workParams = (AsyncLoadingProgressParams)e.Argument; ILoadingProgressCallback progressCallback = workParams.LoadingProgressCallback; bool mergeConversations = workParams.MergeConversations; IPhoneDeviceInfo deviceInfo = workParams.DeviceInfo; try { IConversationManager conversationManager = MainWindowModelBase.LoadConversationManager(progressCallback, deviceInfo, mergeConversations); progressCallback.End(); e.Result = conversationManager; } catch (OperationCanceledException) { e.Cancel = true; } }
public MainWindow() { InitializeComponent(); _currentView = DefaultApplicationView; _conversationManager = null; DisplayOptions options = new DisplayOptions(); _displayOptions = options as IDisplayOptions; _displayOptions.TimeDisplayFormatPropertyChanged += OnTimeDisplayFormatPropertyChanged; _displayOptions.HideEmptyConversationsPropertyChanged += OnHideEmptyConversationsPropertyChanged; _displayOptions.MergeContactsPropertyChanged += OnMergeContactsPropertyChanged; _displayOptions.LoadMmsAttachmentsPropertyChanged += OnLoadMmsAttachmentsPropertyChanged; _displayOptions.ConversationSortingPropertyChanged += OnConversationSortingPropertyChanged; _phoneSelectOptions = options as IPhoneSelectOptions; _deviceInfo = null; conversationRenderControl.DisplayOptions = _displayOptions; conversationRenderControl.findBar.FindModel = new FindDialogModel(this); Loaded += OnLoaded; }
private void alreadyHasAnotherManagerRaise() { Regex msgErrorRx = new Regex(".*already.*has.*another.*manager.*"); IConversationManager otherConversationManager = null; //Raise error try { otherConversationManager = new WebConversationManager(); otherConversationManager.AddConversation(this.ConversationA); this.Session["testResult"] = "NOT OK"; } catch (InvalidOperationException ioe) { if (msgErrorRx.IsMatch(ioe.Message)) { this.Session["testResult"] = "OK"; } else { this.Session["testResult"] = "NOT OK " + ioe.Message; } } }
public static IConversationManager LoadConversationManager(ILoadingProgressCallback progressCallback, IPhoneDeviceInfo deviceInfo, bool mergeConversations) { IConversationManager conversationManager = null; using (DatabaseReader contactDatabaseReader = new DatabaseReader(DatabaseFinder.FindContactDatabasePath(deviceInfo.BackupPath))) { ContactReader contactReader = new ContactReader(); contactReader.ParseDatabase(contactDatabaseReader); using (DatabaseReader textDatabaseReader = new DatabaseReader(DatabaseFinder.FindTextMessageDatabasePath(deviceInfo.BackupPath))) { TextMessageReaderBase textMessageReader; IEnumerable <ChatRoomInformation> chatReader; IEnumerable <MessageAttachment> attachments; int chatWorkEstimate; if ((deviceInfo.OsVersion == null) || (deviceInfo.OsVersion.MajorVersion >= 6)) { try { textMessageReader = new TextMessageReaderiOS6(deviceInfo.BackupPath); textMessageReader.ParseDatabase(textDatabaseReader); ChatRoomInformationReaderiOS6 chatRoomInfoReader = new ChatRoomInformationReaderiOS6(); chatRoomInfoReader.ParseDatabase(textDatabaseReader); chatReader = chatRoomInfoReader; attachments = new List <MessageAttachment>(); chatWorkEstimate = chatRoomInfoReader.ItemCountEstimate; } catch (DatabaseQueryException) { textMessageReader = new TextMessageReader(deviceInfo.BackupPath); textMessageReader.ParseDatabase(textDatabaseReader); chatReader = new List <ChatRoomInformation>(); attachments = new List <MessageAttachment>(); chatWorkEstimate = 0; } } else if (deviceInfo.OsVersion.MajorVersion == 5) { textMessageReader = new TextMessageReader2(deviceInfo.BackupPath); textMessageReader.ParseDatabase(textDatabaseReader); ChatRoomInformationReader chatRoomInfoReader = new ChatRoomInformationReader(); chatRoomInfoReader.ParseDatabase(textDatabaseReader); chatReader = chatRoomInfoReader; attachments = new List <MessageAttachment>(); chatWorkEstimate = chatRoomInfoReader.ItemCountEstimate; } else { textMessageReader = new TextMessageReader(deviceInfo.BackupPath); textMessageReader.ParseDatabase(textDatabaseReader); chatReader = new List <ChatRoomInformation>(); attachments = new List <MessageAttachment>(); chatWorkEstimate = 0; } int workEstimate = AllYourTextsLib.Conversation.ConversationManager.GetWorkEstimate(contactReader.ItemCountEstimate, textMessageReader.ItemCountEstimate, chatWorkEstimate, 0); if (mergeConversations) { workEstimate += MergingConversationManager.GetWorkEstimateByContacts(contactReader.ItemCountEstimate); } progressCallback.Begin(workEstimate); conversationManager = new ConversationManager(contactReader, textMessageReader, chatReader, attachments, progressCallback); if (mergeConversations) { conversationManager = new MergingConversationManager(conversationManager, progressCallback); } } } return(conversationManager); }
private void OnWorkerCompleted(object sender, RunWorkerCompletedEventArgs e) { if (e.Cancelled) { if (_conversationManager == null) { Application.Current.Shutdown(); } else if (_progressDialog != null) { _progressDialog.Close(); } } else if (e.Error != null) { _progressDialog.Close(); // // If the database file is unreadable, don't auto-open it. // if (_displayOptions != null) { _phoneSelectOptions.PhoneDataPath = ""; _phoneSelectOptions.Save(); } if (e.Error is DirectoryNotFoundException) { ShowDatabaseErrorDialog(new MissingBackupPathException()); } else if (e.Error is FileNotFoundException) { FileNotFoundException ex = (FileNotFoundException)e.Error; ShowDatabaseErrorDialog(new MissingBackupFileException(ex.FileName, ex)); } else if (e.Error is UnreadableDatabaseFileException) { UnreadableDatabaseFileException ex = (UnreadableDatabaseFileException)e.Error; ShowDatabaseErrorDialog(ex); } else { FailHandler.HandleUnrecoverableFailure(e.Error); } Application.Current.Shutdown(); } else { _conversationManager = (IConversationManager)e.Result; UpdateModels(); PopulateConversationList(); Update(); _progressDialog.Close(); _progressCallback = null; _progressDialog = null; ShowTextsOutOfDateWarningIfNeeded(); } }
/// <summary> /// Initializes a new instance of the <see cref="WebConversationScope"/> class. /// </summary> /// <param name="conversationManager">The conversation manager.</param> /// <param name="sessionScope">The session context.</param> public WebConversationScope(IConversationManager conversationManager, ISessionScope sessionScope) { _conversationManager = conversationManager; _sessionScope = sessionScope; }
/// <summary> /// Initializes a new instance of the <see cref="NHibernateConversation"/> class. /// </summary> /// <param name="manager">The manager.</param> /// <param name="sessionProvider">The session provider.</param> /// Implementors should take notice: internal NHibernateConversation(IConversationManager manager, ISessionFactory sessionProvider) { this.manager = manager; sessionFactory = sessionProvider; BeginSession(); }