示例#1
0
        protected override async Task OnInitAsync()
        {
            if (ruleTreeProps == null)
            {
                string sLastRuleTreeCreated = WonkaBlazorWebApp.Client.Shared.SimpleCache.LastRuleTreeCreated;
                if (!String.IsNullOrEmpty(sLastRuleTreeCreated))
                {
                    ruleTreeId = sLastRuleTreeCreated;
                }
                else
                {
                    ruleTreeId = "";
                }

                if (!String.IsNullOrEmpty(ruleTreeId))
                {
                    ruleTreeProps =
                        await Client.GetJsonAsync <WonkaBlazorWebApp.Shared.WBWARuleTree>("api/RuleTree?rtid=" + ruleTreeId);
                }
                else
                {
                    ruleTreeProps = await Client.GetJsonAsync <WBWARuleTree>("sample-data/ruletree.json");
                }

                SetPageFields();
            }

            base.OnInitAsync();
        }
示例#2
0
        protected async Task GetTreeProps()
        {
            ruleTreeProps =
                await Client.GetJsonAsync <WonkaBlazorWebApp.Shared.WBWARuleTree>("api/RuleTree?rtid=" + ruleTreeId);

            SetPageFields();
        }
        protected override async Task OnInitAsync()
        {
            attrChosenIdx = 0;

            string sLastRuleTreeCreated = WonkaBlazorWebApp.Client.Shared.SimpleCache.LastRuleTreeCreated;

            if (attrSources == null)
            {
                if (!String.IsNullOrEmpty(sLastRuleTreeCreated))
                {
                    WonkaBlazorWebApp.Shared.WBWARuleTree RuleTreeInfo =
                        await Client.GetJsonAsync <WonkaBlazorWebApp.Shared.WBWARuleTree>("api/RuleTree?rtid=" + sLastRuleTreeCreated);

                    attrSources = RuleTreeInfo.AttributeSources.ToArray();
                }
                else
                {
                    WBWARuleTree SampleRuleTree = await Client.GetJsonAsync <WBWARuleTree>("sample-data/ruletree.json");

                    attrSources = SampleRuleTree.AttributeSources.ToArray();
                }

                if ((attrSources != null) && (attrSources.Length > 0))
                {
                    typeOfSrc     = attrSources[0].BlockchainTypeOfSource;
                    contractAddr  = attrSources[0].BlockchainContractAddress;
                    ctrtGetMethod = attrSources[0].BlockchainGetValueMethod;
                    attrName      = attrSources[0].AttributeName;
                }
            }

            base.OnInitAsync();
        }