Exemplo n.º 1
0
        /// <summary> Look up guild summary information for the specified ally codes. </summary>
        private async void DoLookup()
        {
            if (!AllyCodes.Any())
            {
                MessageBox.Show("Must supply one or more ally codes.", "Error", MessageBoxButton.OK, MessageBoxImage.Error);
                return;
            }

            // Pull guild summary data for each ally code
            ButtonsEnabled = false;
            GuildInfo[] retval;
            retval = await Api.GetGuildInfo(AllyCodes);

            if (retval == null)
            {
                ButtonsEnabled = true;
                return;
            }

            // Consolidate information
            var tmpdata = new ObservableCollection <GuildSummary>(retval.Select(x => new GuildSummary()
            {
                Name = x.name, Members = x.members, Power = x.gp
            }));

            // Update UI
            Results        = tmpdata;
            ButtonsEnabled = true;
        }