Exemplo n.º 1
0
        private async Task Initialise()
        {
            IsRunning = true;
            RaisePropertyChanged("IsRunning");
            IEnumerable <Models.LeaderSummary> summaries = await _leaderService.GetLeadersAsync(false);

            int myId = await _userService.GetMyUserIdAsync();

            foreach (Models.LeaderSummary summary in summaries)
            {
                LeaderSummaryViewModel vm = new LeaderSummaryViewModel(summary);
                vm.IsMe = (summary.id == myId);

                Leaders.Add(vm);
            }

            IsRunning = false;
            RaisePropertyChanged("IsRunning");

            SearchResults = Leaders;
            RaisePropertyChanged("SearchResults");

            var mysummary = Leaders.FirstOrDefault(l => l.IsMe == true);

            ScrollToMe?.Invoke(mysummary);
        }
Exemplo n.º 2
0
        private void ParseLeaderLine(string data)
        {
            data = data.Trim();
            var type = data.Substring(0, data.IndexOf(':'));
            var race = data.Substring(data.LastIndexOf(',') + 2);
            var name = data.Substring(data.IndexOf(':') + 2, data.LastIndexOf(',') - data.IndexOf(':') - 2);

            var thisLeader = World.GetAddLeader(name);

            thisLeader.Site = this;
            if (thisLeader.Civilization == null)
            {
                if (Parent != null)
                {
                    thisLeader.Civilization = Parent;
                }
            }


            thisLeader.Race = World.GetAddRace(race);

            if (!Leader.LeaderTypes.Contains(type))
            {
                Leader.LeaderTypes.Add(type);
            }
            thisLeader.LeaderType = Leader.LeaderTypes.IndexOf(type);

            Leaders.Add(thisLeader);
        }
Exemplo n.º 3
0
        public IgesGeneralSymbol(IgesGeneralNote note, IEnumerable <IgesLeader> leaders, IEnumerable <IgesEntity> geometries)
            : this()
        {
            Note = note;
            foreach (var leader in leaders)
            {
                Leaders.Add(leader);
            }

            foreach (var geometry in geometries)
            {
                Geometries.Add(geometry);
            }

            if (Geometries.Count < 1)
            {
                throw new InvalidOperationException($"At least one geometrical entity must be specified.");
            }
        }
Exemplo n.º 4
0
        public IReportBuilder WithAchievement(Medal medal, Player player)
        {
            if (player == null)
            {
                throw new ArgumentNullException(nameof(player));
            }
            if (Leaders.ContainsKey(medal))
            {
                throw new ArgumentException($"Player for '{Enum.GetName(typeof(Medal), medal)}' has already been assigned. " +
                                            "Only 1 player per achievement is allowed.");
            }

            if (Leaders.ContainsValue(player))
            {
                throw new ArgumentException($"Player '{player.Name}' already has a medal! " +
                                            "Only 1 medal per player is allowed.");
            }

            Leaders.Add(medal, player);
            return(this);
        }
        public async void Refresh()
        {
            // = true;
            //RaisePropertyChanged("IsRunning");
            var summaries = await _leaderService.GetLeadersAsync(false);

            int myId = await _userService.GetMyUserIdAsync();

            Leaders.Clear();

            foreach (var summary in summaries)
            {
                LeaderSummaryViewModel vm = new LeaderSummaryViewModel(summary);
                vm.IsMe = (summary.id == myId);

                Leaders.Add(vm);
            }

            IsRefreshing = false;
            RaisePropertyChanged("IsRefreshing");
        }
Exemplo n.º 6
0
        internal override int ReadParameters(List <string> parameters, IgesReaderBinder binder)
        {
            var index = 0;

            binder.BindEntity(Integer(parameters, index++), e => Note = e as IgesGeneralNote);
            var geometryCount = Integer(parameters, index++);

            for (int i = 0; i < geometryCount; i++)
            {
                binder.BindEntity(Integer(parameters, index++), e => Geometries.Add(e));
            }

            var leaderCount = Integer(parameters, index++);

            for (int i = 0; i < leaderCount; i++)
            {
                binder.BindEntity(Integer(parameters, index++), e => Leaders.Add(e as IgesLeader));
            }

            return(index);
        }
Exemplo n.º 7
0
 private void Process(IEnumerable <string> filtered)
 {
     foreach (var con in filtered)
     {
         if (con[0] != '<')
         {
             All.Add(con);
         }
         else if (con[1] == 'S')
         {
             Leaders.Add(con);
         }
         else if (con[1] == 'M')
         {
             Medians.Add(con);
         }
         else if (con[1] == 'E')
         {
             Trailers.Add(con);
         }
     }
 }