private void OnEncryptionSuccsessMsg(EncryptionSuccsessMsg msg) { if (_uploadToDropboxChecked) { _logger.Info("upload to Dropbox checked"); _logger.Info("get dropbox access from database"); var dropboxAccess = _database.GetSingleByName<DropboxAccess>(DropboxAccess.ObjectName); if (dropboxAccess != null) { string filename = Path.GetFileName(msg.TargetPath); _logger.Info("read file content in byte array"); byte[] content; using (FileStream fileStream = File.OpenRead(msg.TargetPath)) { content = new byte[fileStream.Length]; fileStream.Read(content, 0, (int) fileStream.Length); fileStream.Close(); } _messenger.Send(new StartUploadToDropboxMsg()); _logger.Info(string.Format("start uploading file:{0}", filename)); _dropboxService.Upload(dropboxAccess.AccessToken, filename, content, OnUploadSuccess); } } }
private void OnEncryptionSuccsessMsg(EncryptionSuccsessMsg msg) { MessageBox.Show( "File encrypted!", "Success", MessageBoxButton.OK, MessageBoxImage.Asterisk); }