private async Task AddFigureAsync(Figure figure)
		{			
			figure.StrokeColor = GetRandomColor();
			figure.FillColor = GetRandomColor();
			figure.FontSize = Settings.Default.FontSize;
			figure.Size = new Size(Settings.Default.FigureSize,  Settings.Default.FigureSize);

			var availableWidth = this.deviceService.GetScreenWidth();
			var availableHeight = this.deviceService.GetScreenHeight();
		
			var x = RandomBetweenTwoNumbers(0, Convert.ToInt32(availableWidth - figure.Size.Width));
			var y = RandomBetweenTwoNumbers(0, Convert.ToInt32(availableHeight - figure.Size.Height));
			figure.Position = new Point(x, y);

			Figures.Add(figure);
			await Speak(figure);
		}
		private async Task Speak(Figure figure)
		{
			if(!Settings.Default.Speak)
				return;

			var shape = figure as ShapeFigure;
			if(shape != null) {
				var textToRead = this.languageService.GetLanguageTextForShape(shape.Type);
				if(textToRead == null)
					textToRead = shape.ToString();
				await this.speakService.SpeakTextAsync(textToRead);
			} else {
				await this.speakService.SpeakSSMLAsync(this.languageService.GetLanguageTextForLetter(figure.ToString()));
			}
		}
Exemple #3
0
		private async Task AddFigureAsync(Figure figure)
		{

			figure.StrokeColor = GetRandomColor();
			figure.FillColor = GetRandomColor();

			//TODO: what should this be
			var shapeWidth = Settings.Default.FontSize;
			var shapeHeight = Settings.Default.FontSize;

			//TODO: get this from DI
			var availableWidth = 1000;
			var availableHeight = 700;

			figure.Size = new Size(shapeWidth, shapeHeight);
			var x = RandomBetweenTwoNumbers(0, Convert.ToInt32(availableWidth - figure.Size.Width));
			var y = RandomBetweenTwoNumbers(0, Convert.ToInt32(availableHeight - figure.Size.Height));
			figure.Position = new Point(x, y);


			// var nameFunc = hashTableOfFigureGenerators[Utils.RandomBetweenTwoNumbers(0, hashTableOfFigureGenerators.Count - 1)];
			Figures.Add(figure);
			await Speak(figure);
		}