Example #1
0
    Widget _buildTopAssetsRow(BuildContext context)
    {
        var test = new AssetCard("Myarworldmap", "2019-2-21");

        return(new Container(
                   margin: EdgeInsets.only(left: Screen.width * 0.03f),
                   child: new Column(
                       children: new List <Widget>
        {
            test,
            test,
            test,
            test,
            test,
            test,
            test,
            test,
            test,
            test,
            test,
            test,
            test,
            test,
            test
        }
                       )
                   ));
    }
Example #2
0
            Widget _buildTopAssetsRow(BuildContext context, string title)
            {
                var testCard = new AssetCard(
                    "AI Template",
                    "INVECTOR",
                    45.0f,
                    36.0f,
                    true,
                    "https://d2ujflorbtfzji.cloudfront.net/key-image/46dc65c1-f605-4ccb-97e0-3d60b28cfdfe.jpg"
                    );

                return(new Container(
                           margin: EdgeInsets.only(left: 98),
                           child: new Column(
                               children: new List <Widget> {
                    new Container(
                        child: new Container(
                            margin: EdgeInsets.only(top: 50, bottom: 20),
                            child: new Row(
                                crossAxisAlignment: CrossAxisAlignment.baseline,
                                children: new List <Widget> {
                        new Container(
                            child: new Text(
                                title,
                                style: new TextStyle(
                                    fontSize: 24,
                                    color: CLColors.black
                                    )
                                )
                            ),
                        new Container(
                            margin: EdgeInsets.only(left: 15),
                            child:
                            new Text(
                                "See More",
                                style: new TextStyle(
                                    fontSize: 16,
                                    color: CLColors.text4
                                    )
                                )
                            )
                    })
                            )
                        ),
                    new Row(
                        children: new List <Widget> {
                        testCard,
                        testCard,
                        testCard,
                        testCard,
                        testCard,
                        testCard
                    }
                        )
                }
                               )));
            }
Example #3
0
            Widget _buildTopAssetsRow(BuildContext context, string title)
            {
                var testCard = new AssetCard(
                    "AI Template",
                    "INVECTOR",
                    45.0f,
                    36.0f,
                    true,
                    "https://assetstorev1-prd-cdn.unity3d.com/key-image/76a549ae-de17-4536-bd96-4231ed20dece.jpg"
                    );

                return(new Container(
                           margin: EdgeInsets.only(left: 98),
                           child: new Column(
                               children: new List <Widget> {
                    new Container(
                        child: new Container(
                            margin: EdgeInsets.only(top: 50, bottom: 20),
                            child: new Row(
                                crossAxisAlignment: CrossAxisAlignment.baseline,
                                children: new List <Widget> {
                        new Container(
                            child: new Text(
                                title,
                                style: new TextStyle(
                                    fontSize: 24,
                                    color: CLColors.black
                                    )
                                )
                            ),
                        new Container(
                            margin: EdgeInsets.only(left: 15),
                            child:
                            new Text(
                                "See More",
                                style: new TextStyle(
                                    fontSize: 16,
                                    color: CLColors.text4
                                    )
                                )
                            )
                    })
                            )
                        ),
                    new Row(
                        children: new List <Widget> {
                        testCard,
                        testCard,
                        testCard,
                        testCard,
                        testCard,
                        testCard
                    }
                        )
                }
                               )));
            }
        /// <summary>
        /// Parses a HTML table in file to get all the card data listed within.
        /// </summary>
        /// <param name="filepath"></param>
        /// <param name="type"></param>
        /// <returns></returns>
        private static IEnumerable <InvestigatorCard> Parse(string filepath, InvestigatorCardType type)
        {
            List <InvestigatorCard> cards = new List <InvestigatorCard>();
            HtmlDocument            doc   = new HtmlDocument();

            doc.Load(filepath);

            foreach (HtmlNode rowNode in doc.DocumentNode.Descendants("tr"))
            {
                IEnumerable <HtmlNode> cardNodes = rowNode.Descendants("td");
                string   name         = cardNodes.ElementAt(0).InnerText.Trim();
                string   traitsString = cardNodes.ElementAt(1).InnerText.Replace('-', ',').Replace('—', ',');
                HtmlNode expNode      = cardNodes.ElementAt(2);
                HtmlNode expLinkNode  = expNode.SelectSingleNode(".//a");
                string   expString    = "Core";

                if (expLinkNode != null)
                {
                    expString = expLinkNode.GetAttributeValue("title", "Core");
                }

                List <string> traits = new List <string>();
                foreach (string traitRaw in traitsString.Split(','))
                {
                    traits.Add(traitRaw.ToUpper().Trim());
                }

                Expansion        exp = ExpansionExtensions.FromString(expString);
                InvestigatorCard card;

                if (type == InvestigatorCardType.Asset)
                {
                    int cost = int.Parse(cardNodes.ElementAt(3).InnerText);
                    card = new AssetCard(name, type, exp, traits, cost);
                }
                else
                {
                    card = new InvestigatorCard(name, type, exp, traits);
                }

                cards.Add(card);
            }

            return(cards);
        }
        private async void CreateBalances()
        {
            //Change this, this should be used with the server the wallet is using and with the account you selected,
            //not a hard coded one.
            Server  server         = new Server("https://horizon-testnet.stellar.org/");
            KeyPair accountKeyPair = KeyPair.FromAccountId("GDLIITOORUA7DN3DDFEGNCGNFVRFKJKFOXJOE2FO4FYMFQF5LRT5YL7U");

            stellar_dotnet_sdk.responses.AccountResponse accountResponse = await server.Accounts.Account(accountKeyPair);

            for (int i = 0; i < accountResponse.Balances.Length; i++)
            {
                stellar_dotnet_sdk.responses.Balance balance = accountResponse.Balances[i];

                AssetCard assetCard = new AssetCard();

                //Set AssetCard Balance
                Balance assetCardBalance = new Balance();
                assetCard.Balance       = assetCardBalance;
                assetCardBalance.Amount = balance.BalanceString;

                //Check if it's native or not
                if (balance.AssetType == "native")
                {
                    assetCardBalance.AssetCode     = "XLM";
                    assetCardBalance.IssuerAddress = "Native Lumens";
                }
                else
                {
                    assetCardBalance.AssetCode     = balance.AssetCode;
                    assetCardBalance.IssuerAddress = balance.AssetIssuer.AccountId;
                }

                //Set AssetCard Other

                assetCard.BgColor = "#275AF0";

                //Add it to the list
                _assetsCards.Add(assetCard);
            }
        }
Example #6
0
        public Attachment GetAssetCard(AssetCard data, string parent = null)
        {
            var assetListCard = new AdaptiveCard("1.0")
            {
                Body = new List <AdaptiveElement>()
                {
                    new AdaptiveImage()
                    {
                        Id   = "bannerimage",
                        Url  = data?.ImageUrl != null ? new Uri(data?.ImageUrl?.ToString()) : null,
                        Size = AdaptiveImageSize.Stretch,
                    },
                    new AdaptiveContainer
                    {
                        Items = new List <AdaptiveElement>()
                        {
                            new AdaptiveColumnSet()
                            {
                                Columns = new List <AdaptiveColumn>()
                                {
                                    new AdaptiveColumn()
                                    {
                                        Width = "100",
                                        Items = new List <AdaptiveElement>()
                                        {
                                            new AdaptiveTextBlock()
                                            {
                                                Id     = "Title",
                                                Text   = data?.Title,
                                                Weight = AdaptiveTextWeight.Bolder,
                                            },
                                        },
                                    },
                                },
                            },
                        },
                    },

                    new AdaptiveContainer
                    {
                        Items = new List <AdaptiveElement>()
                        {
                            new AdaptiveColumnSet()
                            {
                                Columns = new List <AdaptiveColumn>()
                                {
                                    new AdaptiveColumn()
                                    {
                                        Width = "100",
                                        Items = new List <AdaptiveElement>()
                                        {
                                            new AdaptiveTextBlock()
                                            {
                                                Id   = "ShortDescription",
                                                Text = data?.Description,
                                                Size = AdaptiveTextSize.Small,
                                                Wrap = true,
                                            },
                                        },
                                    },
                                },
                            },
                        },
                    },
                },

                Actions = new List <AdaptiveAction>()
                {
                },
            };

            var openUrlAction1 = this.AddOpenUrlCardAction(data.ServerRelativeUrl);
            {
                assetListCard.Actions.Add(openUrlAction1);
            }

            var fileType = data.Title.Split('.');

            if (fileType.Count() > 1)
            {
                var action1 = this.AddCardAction(fileType[1].ToString(), data.ServerRelativeUrl);
                if (action1 != null)
                {
                    assetListCard.Actions.Add(action1);
                }
            }
            return(new Attachment()
            {
                ContentType = AdaptiveCard.ContentType,
                Content = assetListCard,
            });
        }