public FriendViewModel(IDataService dataService, int friendNumber) { _toxModel = dataService.ToxModel; _avatarManager = dataService.AvatarManager; FriendNumber = friendNumber; Conversation = new ConversationViewModel(dataService, this); FileTransfers = new FileTransfersViewModel(dataService, friendNumber); Call = new CallViewModel(friendNumber); Name = _toxModel.GetFriendName(friendNumber); if (Name == string.Empty) { Name = _toxModel.GetFriendPublicKey(friendNumber).ToString(); } StatusMessage = _toxModel.GetFriendStatusMessage(friendNumber); if (StatusMessage == string.Empty) { StatusMessage = "Friend request sent."; } SetFriendStatus(_toxModel.GetFriendStatus(friendNumber)); IsConnected = _toxModel.IsFriendOnline(friendNumber); _avatarManager.FriendAvatarChanged += FriendAvatarChangedHandler; _toxModel.FriendNameChanged += FriendNameChangedHandler; _toxModel.FriendStatusMessageChanged += FriendStatusMessageChangedHandler; _toxModel.FriendStatusChanged += FriendStatusChangedHandler; _toxModel.FriendConnectionStatusChanged += FriendConnectionStatusChangedHandler; }
private ProfileViewModel(IDataService dataService, ToxData toxData, ToxDataInfo toxDataInfo) { _toxModel = dataService.ToxModel; _avatarManager = dataService.AvatarManager; _toxData = toxData; _toxDataInfo = toxDataInfo; }
public UserViewModel(IDataService dataService) { _toxModel = dataService.ToxModel; _avatarManager = dataService.AvatarManager; _toxModel.PropertyChanged += ToxModelPropertyChangedHandler; _avatarManager.UserAvatarChanged += UserAvatarChangedHandler; }
public ProfileManagementViewModel(IDataService dataService) { _dataService = dataService; _toxModel = dataService.ToxModel; _avatarManager = dataService.AvatarManager; Profiles = new ObservableCollection <ProfileViewModel>(); }
public AvatarManager(IToxModel toxModel) { _toxModel = toxModel; _avatarTransferManager = new AvatarTransferManager(toxModel, this); ResetUserAvatar(); FriendAvatars = new Dictionary <int, BitmapImage>(); _toxModel.FriendConnectionStatusChanged += FriendConnectionStatusChangedHandler; }
public OneFriendRequestViewModel(IToxModel toxModel, FriendRequestsViewModel friendRequestsViewModel, ToxKey publicKey, string message) { _toxModel = toxModel; _friendRequestsViewModel = friendRequestsViewModel; _publicKey = publicKey; Message = message; }
public ProfileSettingsViewModel(IDataService dataService) { _toxModel = dataService.ToxModel; _avatarManager = dataService.AvatarManager; _toxModel.PropertyChanged += ToxModelPropertyChangedHandler; _avatarManager.UserAvatarChanged += UserAvatarChangedHandler; _avatarManager.IsUserAvatarSetChanged += IsUserAvatarSetChangedHandler; RefreshQrCodeId(); }
public FileTransfersModel(IDataService dataService, int friendNumber) { _dataService = dataService; _toxModel = dataService.ToxModel; _fileTransferResumer = dataService.FileTransferResumer; _friendNumber = friendNumber; _toxModel.FileSendRequestReceived += FileSendRequestReceivedHandler; _toxModel.FriendConnectionStatusChanged += FriendConnectionStatusChangedHandler; }
/// <summary> /// Invoked when the application is launched normally by the end user. Other entry points /// will be used such as when the application is launched to open a specific file. /// </summary> /// <param name="e">Details about the launch request and process.</param> protected override async void OnLaunched(LaunchActivatedEventArgs e) { DispatcherHelper.Initialize(); // We cheat a little bit here... TODO: Fix it! Until then: Please, don't use ServiceLocator anywhere else in the code than ViewModelLocator! var dataService = ServiceLocator.Current.GetInstance <IDataService>(); _toxModel = dataService.ToxModel; _avatarManager = dataService.AvatarManager; var rootFrame = Window.Current.Content as Frame; // Do not repeat app initialization when the Window already has content, // just ensure that the window is active if (rootFrame == null) { // Create a Frame to act as the navigation context and navigate to the first page rootFrame = new Frame(); // Associate the frame with a SuspensionManager key SuspensionManager.RegisterFrame(rootFrame, "AppFrame"); // Set the default language rootFrame.Language = ApplicationLanguages.Languages[0]; rootFrame.NavigationFailed += OnNavigationFailed; await HandlePreviousExecutionState(e.PreviousExecutionState); await InitializeSingletons(); // Place the frame in the current Window Window.Current.Content = rootFrame; } if (rootFrame.Content == null) { // When the navigation stack isn't restored navigate to the first page, // configuring the new page by passing required information as a navigation // parameter if (Window.Current.Bounds.Width < 930) { rootFrame.Navigate(typeof(FriendListPage)); } else { rootFrame.Navigate(typeof(MainPage)); } } // Ensure the current window is active Window.Current.Activate(); ApplicationView.GetForCurrentView().SetPreferredMinSize(new Size { Width = 500, Height = 500 }); }
public AvatarTransferManager(IToxModel toxModel, AvatarManager avatarManager) { _toxModel = toxModel; _avatarManager = avatarManager; _transfers = new Dictionary <TransferId, TransferData>(); _toxModel.FileControlReceived += FileControlReceivedHandler; _toxModel.FileChunkRequested += FileChunkRequestedHandler; _toxModel.FileSendRequestReceived += FileSendRequestReceivedHandler; _toxModel.FileChunkReceived += FileChunkReceivedHandler; }
public ConversationViewModel(IDataService dataService, FriendViewModel friendViewModel) { _dataService = dataService; _toxModel = dataService.ToxModel; _friendViewModel = friendViewModel; MessageGroups = new ObservableCollection <MessageGroupViewModel>(); _toxModel.FriendMessageReceived += FriendMessageReceivedHandler; _toxModel.FriendTypingChanged += FriendTypingChangedHandler; RestoreMessageHistory(dataService.MessageHistoryManager); }
public FriendRequestsViewModel(IDataService dataService) { _toxModel = dataService.ToxModel; Requests = new ObservableCollection <OneFriendRequestViewModel>(); Requests.CollectionChanged += FriendRequestsCollectionChangedHandler; _toxModel.FriendRequestReceived += FriendRequestReceivedHandler; RestoreData(); DecideFriendRequestsListVisibility(); }
public SentMessageViewModel(IDataService dataService, string text, DateTime timestamp, ToxMessageType messageType, int id, FriendViewModel target, MessageDeliveryState state) { _toxModel = dataService.ToxModel; Text = text; Timestamp = timestamp; MessageType = messageType; Sender = new UserViewModel(dataService); Id = id; _target = target; State = state; if (state == MessageDeliveryState.Pending) { _toxModel.ReadReceiptReceived += ReadReceiptReceivedHandler; _toxModel.FriendConnectionStatusChanged += FriendConnectionStatusChangedHandler; SetupAndStartResendTimer(); } }
public FriendListViewModel(IDataService dataService) { _dataService = dataService; _toxModel = dataService.ToxModel; Friends = new ObservableCollection <FriendViewModel>(); foreach (var friendNumber in _toxModel.Friends) { // TODO: Remember which friend we talked last and set the selection to that one by default! if (Friends.Count == 0) { SelectedFriend = new FriendViewModel(_dataService, friendNumber); Friends.Add(SelectedFriend); continue; } // Friends.Add(new FriendViewModel(dataService, friendNumber)); } _toxModel.FriendListChanged += FriendListChangedHandler; }
public AvatarResizer(IToxModel toxModel, StorageFolder avatarsFolder, StorageFile avatarFile) { _toxModel = toxModel; _avatarsFolder = avatarsFolder; _avatarFile = avatarFile; }
public AddFriendViewModel(IDataService dataService) { _toxModel = dataService.ToxModel; }
public FileTransferResumer(IToxModel toxModel) { _toxModel = toxModel; _toxModel.FriendListChanged += FriendListChangedHandler; }