public AdaptiveBackgroundImage(string url, AdaptiveBackgroundImageMode mode, AdaptiveHorizontalAlignment hAlignment, AdaptiveVerticalAlignment vAlignment) { Url = new Uri(url, UriKind.RelativeOrAbsolute); Mode = mode; HorizontalAlignment = hAlignment; VerticalAlignment = vAlignment; }
public AdaptiveBackgroundImage(Uri url, AdaptiveBackgroundImageMode mode, AdaptiveHorizontalAlignment hAlignment, AdaptiveVerticalAlignment vAlignment) { Url = url; Mode = mode; HorizontalAlignment = hAlignment; VerticalAlignment = vAlignment; }
public static void SetHorizontalAlignment(this Image image, AdaptiveHorizontalAlignment alignment) { if (Enum.TryParse(alignment.ToString(), out HorizontalAlignment a)) { image.HorizontalAlignment = a; } }
public static void SetHorizontalAlignment(this Image image, AdaptiveHorizontalAlignment alignment) { switch (alignment) { case AdaptiveHorizontalAlignment.Left: { image.HorizontalOptions = LayoutOptions.Start; return; } case AdaptiveHorizontalAlignment.Center: { image.HorizontalOptions = LayoutOptions.Center; return; } case AdaptiveHorizontalAlignment.Right: { image.HorizontalOptions = LayoutOptions.End; return; } } image.HorizontalOptions = LayoutOptions.FillAndExpand; }
public AdaptiveTextBlock GetadaptiveTextBlock(string InputTxt, AdaptiveTextSize Size, AdaptiveTextColor Color, AdaptiveTextWeight Weight, AdaptiveHorizontalAlignment adaptiveHorizontalAlignment) { var TextBlock = GetadaptiveTextBlock(InputTxt, Size, Weight, adaptiveHorizontalAlignment); TextBlock.Color = Color; return(TextBlock); }
public AdaptiveTextBlock GetadaptiveTextBlock(string InputTxt, AdaptiveTextSize Size, AdaptiveTextWeight Weight, AdaptiveHorizontalAlignment adaptiveHorizontalAlignment) { var TextBlock = GetadaptiveTextBlock(InputTxt); TextBlock.Size = Size; TextBlock.Weight = Weight; TextBlock.HorizontalAlignment = adaptiveHorizontalAlignment; return(TextBlock); }
public static string GetBoardAdaptiveCard(Board board) { string text = ""; var adaptiveCard = new AdaptiveCard("1.0") { Body = new List <AdaptiveElement>() }; if (board.getStatus() == Board.GameState.INPROGRESS) { if (board.getCurrentPlayerName().Equals("Your")) { text = board.getCurrentPlayerName() + " Turn [" + board.getCurrentPlayerToken() + "]"; } else { text = board.getCurrentPlayerName() + "'s Turn [" + board.getCurrentPlayerToken() + "]"; } } else if (board.getStatus() == Board.GameState.WIN) { if (board.getWinnerName().Equals("Your")) { text = "You Win"; } else { text = board.getWinnerName() + " Wins!"; } } else { text = "No winner"; } var textBlock = new AdaptiveTextBlock() { Text = text, HorizontalAlignment = AdaptiveHorizontalAlignment.Center, Size = AdaptiveTextSize.Large, Spacing = AdaptiveSpacing.Small }; var horizontalAlignment = new AdaptiveHorizontalAlignment[] { AdaptiveHorizontalAlignment.Right, AdaptiveHorizontalAlignment.Center, AdaptiveHorizontalAlignment.Left }; var index = 0; adaptiveCard.Body.Add(textBlock); for (var i = 0; i < 3; i++) { var columnSet = new AdaptiveColumnSet() { Separator = false, Spacing = AdaptiveSpacing.Medium }; for (var j = 0; j < 3; j++) { columnSet.Columns.Add(new AdaptiveColumn() { Width = AdaptiveColumnWidth.Stretch, Items = new List <AdaptiveElement>() { new AdaptiveImage() { AltText = "", Url = new Uri(board.getCDN(board.getCellState(index), index++)), Size = AdaptiveImageSize.Medium, HorizontalAlignment = horizontalAlignment[j] } }, Spacing = AdaptiveSpacing.Small, }); } adaptiveCard.Body.Add(columnSet); } return(adaptiveCard.ToJson()); }