Exemplo n.º 1
0
        public async Task SendMessageAsync(Guid tileId, string title, string body, DateTimeOffset timestamp, MessageFlags flags, CancellationToken token)
        {
            if (tileId == Guid.Empty)
            {
                throw new ArgumentException(BandResource.NotificationInvalidTileId, "tileId");
            }
            if (string.IsNullOrWhiteSpace(title) && string.IsNullOrWhiteSpace(body))
            {
                throw new ArgumentException(BandResource.NotificationFieldsEmpty);
            }

            await Task.Delay(500);

            var appId = _appIdProvider.GetAppId();
            TileData installedTile = _tiles.GetTile(appId, tileId);

            if (installedTile == null || installedTile.OwnerId != appId)
                throw new Exception("Ownership or Tile invalid");

            return;
        }
        private string GetLogDir()
        {
            string logDirBasePath = GetLogDirBasePath();

            string applicationName = appIdProvider.GetAppId();

            string logFolderName = $"{applicationName}_Logs";

            string logDir = Path.Combine(logDirBasePath, logFolderName);

            if (!Directory.Exists(logDir))
            {
                try
                {
                    Directory.CreateDirectory(logDir);
                }
                catch
                {
                    throw new DirectoryNotFoundException($"The Directory '{logDir}' does not exists, and could not be created!");
                }
            }
            return(logDir);
        }