コード例 #1
0
 public AdaptiveBackgroundImage(string url, AdaptiveBackgroundImageMode mode, AdaptiveHorizontalAlignment hAlignment, AdaptiveVerticalAlignment vAlignment)
 {
     Url  = new Uri(url, UriKind.RelativeOrAbsolute);
     Mode = mode;
     HorizontalAlignment = hAlignment;
     VerticalAlignment   = vAlignment;
 }
コード例 #2
0
 public AdaptiveBackgroundImage(Uri url, AdaptiveBackgroundImageMode mode, AdaptiveHorizontalAlignment hAlignment, AdaptiveVerticalAlignment vAlignment)
 {
     Url  = url;
     Mode = mode;
     HorizontalAlignment = hAlignment;
     VerticalAlignment   = vAlignment;
 }
コード例 #3
0
 public static void SetHorizontalAlignment(this Image image, AdaptiveHorizontalAlignment alignment)
 {
     if (Enum.TryParse(alignment.ToString(), out HorizontalAlignment a))
     {
         image.HorizontalAlignment = a;
     }
 }
コード例 #4
0
ファイル: ImageExtensions.cs プロジェクト: TingtingAn/AskMe
        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;
        }
コード例 #5
0
        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);
        }
コード例 #6
0
        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);
        }
コード例 #7
0
        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());
        }