예제 #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);
        }
예제 #2
0
 /// <summary>
 /// Add new leader.
 /// </summary>
 /// <param name="email">Email address.</param>
 /// <param name="score">Highscore.</param>
 /// <param name="callback">After finishing to called function.</param>
 public static void WriteLeader(string email, int score, Action <string> callback = null)
 {
     // Send new leader to database.
     var leader = new Leaders(email, score);
     var json   = JsonUtility.ToJson(leader);
     //ConnectionReference.Child(TABLE_NAME).Child(userId).SetRawJsonValueAsync(json);
 }
예제 #3
0
        public Report Build()
        {
            var leaders           = Leaders.Select(l => CreateAchievement(l.Key, l.Value)).ToList();
            var averageHeightInCm = $"{Math.Round(AverageHeight, 1)} cm";

            return(new Report(Players, AveragePpg, leaders, PlayersPerPosition, averageHeightInCm));
        }
        public IHttpActionResult PutLeaders(decimal id, Leaders leaders)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            if (id != leaders.lead_ID)
            {
                return(BadRequest());
            }

            db.Entry(leaders).State = EntityState.Modified;

            try
            {
                db.SaveChanges();
            }
            catch (DbUpdateConcurrencyException)
            {
                if (!LeadersExists(id))
                {
                    return(NotFound());
                }
                else
                {
                    throw;
                }
            }

            return(StatusCode(HttpStatusCode.NoContent));
        }
예제 #5
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);
        }
예제 #6
0
        public List<Leader> Get(Leaders request)
        {
            var sql = @"Select Fulfiller as Name, Count(Id) as Score From Fulfillment 
                        Where Status = 'Completed' Group By Fulfiller
                        Order by Count(Id) desc";
            var leaders = DbConnExec<List<Leader>>((con) => con.Select<Leader>(sql));

            return leaders;
        }
예제 #7
0
        public List <Leader> Get(Leaders request)
        {
            var sql     = @"Select Fulfiller as Name, Count(Id) as Score From Fulfillment 
                        Where Status = 'Completed' Group By Fulfiller
                        Order by Count(Id) desc";
            var leaders = DbConnExec <List <Leader> >((con) => con.Select <Leader>(sql));

            return(leaders);
        }
예제 #8
0
 /// <summary>
 ///     データを遅延読み込み中かどうかを判定する
 /// </summary>
 /// <returns>データを遅延読み込み中ならばtrueを返す</returns>
 private static bool IsLoadingData()
 {
     return(Leaders.IsLoading() ||
            Ministers.IsLoading() ||
            Teams.IsLoading() ||
            Provinces.IsLoading() ||
            Techs.IsLoading() ||
            Units.IsLoading() ||
            Maps.IsLoading());
 }
        public IHttpActionResult GetLeaders(decimal id)
        {
            Leaders leaders = db.Leaders.Find(id);

            if (leaders == null)
            {
                return(NotFound());
            }

            return(Ok(leaders));
        }
        public IHttpActionResult PostLeaders(Leaders leaders)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            db.Leaders.Add(leaders);
            db.SaveChanges();

            return(CreatedAtRoute("DefaultApi", new { id = leaders.lead_ID }, leaders));
        }
예제 #11
0
 void InitializeDatabaseInterfaces()
 {
     DamageTypes.SetupDatabaseInterface(out m_dbiDamageTypes);
     WeaponTypes.SetupDatabaseInterface(out m_dbiWeaponTypes);
     UserClasses.SetupDatabaseInterface(out m_dbiUserClasses);
     Abilities.SetupDatabaseInterface(out m_dbiAbilities);
     Objects.SetupDatabaseInterface(out m_dbiObjects);
     Squads.SetupDatabaseInterface(out m_dbiSquads);
     Techs.SetupDatabaseInterface(out m_dbiTechs);
     Powers.SetupDatabaseInterface(out m_dbiPowers);
     Civs.SetupDatabaseInterface(out m_dbiCivs);
     Leaders.SetupDatabaseInterface(out m_dbiLeaders);
 }
        public IHttpActionResult DeleteLeaders(decimal id)
        {
            Leaders leaders = db.Leaders.Find(id);

            if (leaders == null)
            {
                return(NotFound());
            }

            db.Leaders.Remove(leaders);
            db.SaveChanges();

            return(Ok(leaders));
        }
        private async Task SetUserContent()
        {
            MainPage.CurrentUser = await WakaTimeRepo.GetCurrentUser();

            if (MainPage.CurrentUser != null)
            {
                masterPage.gridUser.IsVisible      = true;
                masterPage.gridUser.BindingContext = MainPage.CurrentUser;
            }

            Leaders leaders = await WakaTimeRepo.GetLeaders();

            MainPage.CurrentLeader = leaders.CurrentUser;
        }
예제 #14
0
 /// <summary>
 ///     編集済みかどうかを取得する
 /// </summary>
 /// <returns>編集済みならばtrueを返す</returns>
 public static bool IsDirty()
 {
     return(Misc.IsDirty() ||
            Config.IsDirty() ||
            Leaders.IsDirty() ||
            Ministers.IsDirty() ||
            Teams.IsDirty() ||
            Provinces.IsDirty() ||
            Techs.IsDirty() ||
            Units.IsDirty() ||
            CorpsNames.IsDirty() ||
            UnitNames.IsDirty() ||
            RandomLeaders.IsDirty() ||
            Scenarios.IsDirty());
 }
예제 #15
0
 /// <summary>
 ///     データを保存する
 /// </summary>
 private static void SaveFiles()
 {
     if (!Misc.Save())
     {
         return;
     }
     if (!Config.Save())
     {
         return;
     }
     if (!Leaders.Save())
     {
         return;
     }
     if (!Ministers.Save())
     {
         return;
     }
     if (!Teams.Save())
     {
         return;
     }
     if (!Provinces.Save())
     {
         return;
     }
     if (!Techs.Save())
     {
         return;
     }
     if (!Units.Save())
     {
         return;
     }
     if (!CorpsNames.Save())
     {
         return;
     }
     if (!UnitNames.Save())
     {
         return;
     }
     if (!RandomLeaders.Save())
     {
         return;
     }
     Scenarios.Save();
 }
예제 #16
0
        // #NOTE place new DatabaseObjectKind code here

        void InitializeDatabaseInterfaces()
        {
            DamageTypes.SetupDatabaseInterface();
            ImpactEffects.SetupDatabaseInterface();
            WeaponTypes.SetupDatabaseInterface();
            UserClasses.SetupDatabaseInterface();
            Abilities.SetupDatabaseInterface();
            Objects.SetupDatabaseInterface();
            Squads.SetupDatabaseInterface();
            Tactics.SetupDatabaseInterface();
            Techs.SetupDatabaseInterface();
            TerrainTileTypes.SetupDatabaseInterface();
            Powers.SetupDatabaseInterface();
            Civs.SetupDatabaseInterface();
            Leaders.SetupDatabaseInterface();
        }
예제 #17
0
 public async Task <ActionResult <Leaders> > Post(Leaders leader)
 {
     try
     {
         repository.Add(leader);
         if (await repository.SaveChangesAsync())
         {
             return(Created("", leader));
         }
     }
     catch (Exception e)
     {
         return(this.StatusCode(StatusCodes.Status500InternalServerError, "Post Leader Failure" + e));
     }
     return(BadRequest());
 }
        private async void LoadLeaderboard()
        {
            this.leaders = await this.leaderboard.GetPage(this.currentPage);

            List <Leader> items = new List <Leader>();

            this.leaders.Users.ForEach(l => items.Add(l));

            if (this.leaders.CurrentUser != null)
            {
                // The display name is undefined due to the format
                this.leaders.CurrentUser.User.DisplayName = this.leaders.CurrentUser.User.Username;

                items.Insert(0, this.leaders.CurrentUser);
            }

            lvwLeaders.ItemsSource = items;
            lblPage.Text           = this.currentPage.ToString();
        }
예제 #19
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.");
            }
        }
예제 #20
0
        public string GetName(DatabaseObjectKind kind, int id)
        {
            Contract.Requires <ArgumentOutOfRangeException>(kind != DatabaseObjectKind.None);

            // #NOTE place new DatabaseObjectKind code here

            switch (kind)
            {
            case DatabaseObjectKind.Ability:        return(Abilities.TryGetNameWithUndefined(id));

            case DatabaseObjectKind.Civ:            return(Civs.TryGetNameWithUndefined(id));

            case DatabaseObjectKind.DamageType:     return(DamageTypes.TryGetNameWithUndefined(id));

            case DatabaseObjectKind.ImpactEffect: return(ImpactEffects.TryGetNameWithUndefined(id));

            case DatabaseObjectKind.Leader:         return(Leaders.TryGetNameWithUndefined(id));

            case DatabaseObjectKind.Object:         return(Objects.TryGetNameWithUndefined(id));

            case DatabaseObjectKind.ObjectType:     return(ObjectTypes.TryGetNameWithUndefined(id));

            case DatabaseObjectKind.Power:          return(Powers.TryGetNameWithUndefined(id));

            case DatabaseObjectKind.Squad:          return(Squads.TryGetNameWithUndefined(id));

            case DatabaseObjectKind.Tactic:         return(Tactics.TryGetNameWithUndefined(id));

            case DatabaseObjectKind.Tech:           return(Techs.TryGetNameWithUndefined(id));

            case DatabaseObjectKind.TerrainTileType: return(TerrainTileTypes.TryGetNameWithUndefined(id));

            // TODO: Should just use the Objects DBI AFAICT
            case DatabaseObjectKind.Unit:           return(TryGetNameUnit(id));

            case DatabaseObjectKind.UserClass:      return(UserClasses.TryGetNameWithUndefined(id));

            case DatabaseObjectKind.WeaponType:     return(WeaponTypes.TryGetNameWithUndefined(id));

            default: throw new KSoft.Debug.UnreachableException(kind.ToString());
            }
        }
예제 #21
0
        /// <summary>
        ///     コピー/移動先コンボボックスの選択項目変更時の処理
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void OnDestComboBoxSelectedIndexChanged(object sender, EventArgs e)
        {
            if (destComboBox.SelectedIndex < 0)
            {
                return;
            }

            if (!copyRadioButton.Checked && !moveRadioButton.Checked)
            {
                copyRadioButton.Checked = true;
            }

            // 開始ID数値アップダウンの数値が変更されていなければ変更する
            if (!_idChanged)
            {
                idNumericUpDown.ValueChanged -= OnIdNumericUpDownValueChanged;
                idNumericUpDown.Value         = Leaders.GetNewId(Countries.Tags[destComboBox.SelectedIndex]);
                idNumericUpDown.ValueChanged += OnIdNumericUpDownValueChanged;
            }
        }
예제 #22
0
 public static Leaders.Authorize LeaderType(int employeeid)
 {
     try
     {
         RequestDataContext ctx     = new RequestDataContext();
         Leaders            request = (from req in ctx.Leaders
                                       where req.LeaderId == employeeid
                                       select req).SingleOrDefault();
         if (request != null)
         {
             return(request.Author);
         }
         return(Leaders.Authorize.Authorize_NON);
     }
     catch (Exception ex)
     {
         Utilities.WriteToTrace("RequestDAL.LeaderType()", ex);
         return(Leaders.Authorize.Authorize_NON);
     }
 }
예제 #23
0
        /// <summary>
        ///     ファイルの再読み込みを要求する
        /// </summary>
        public static void RequestReload()
        {
            Misc.RequestReload();
            Config.RequestReload();
            Leaders.RequestReload();
            Ministers.RequestReload();
            Teams.RequestReload();
            Techs.RequestReload();
            Units.RequestReload();
            Provinces.RequestReload();
            CorpsNames.RequestReload();
            UnitNames.RequestReload();
            RandomLeaders.RequestReload();
            Scenarios.RequestReload();
            Maps.RequestReload();

            SaveCanceled = false;

            Log.Verbose("Request to reload");
        }
예제 #24
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);
        }
        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");
        }
예제 #26
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);
        }
예제 #27
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);
         }
     }
 }
예제 #28
0
        /// <summary>
        ///     データを再読み込みする
        /// </summary>
        public static void Reload()
        {
            Log.Info("Reload");

            // データを再読み込みする
            Misc.Reload();
            Config.Reload();
            Leaders.Reload();
            Ministers.Reload();
            Teams.Reload();
            Provinces.Reload();
            Techs.Reload();
            Units.Reload();
            CorpsNames.Reload();
            UnitNames.Reload();
            RandomLeaders.Reload();
            Scenarios.Reload();

            // データ読み込み後の更新処理呼び出し
            OnFileLoaded();

            SaveCanceled = false;
        }
예제 #29
0
        /// <summary>
        ///     フォーム読み込み時の処理
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void OnFormLoad(object sender, EventArgs e)
        {
            Graphics g      = Graphics.FromHwnd(Handle);
            int      margin = DeviceCaps.GetScaledWidth(2) + 1;

            // 対象国コンボボックス
            srcComboBox.BeginUpdate();
            srcComboBox.Items.Clear();
            int width = srcComboBox.Width;

            foreach (string s in Countries.Tags
                     .Select(country => Countries.Strings[(int)country])
                     .Select(name => Config.ExistsKey(name)
                    ? $"{name} {Config.GetText(name)}"
                    : name))
            {
                srcComboBox.Items.Add(s);
                width = Math.Max(width,
                                 (int)g.MeasureString(s, srcComboBox.Font).Width +
                                 SystemInformation.VerticalScrollBarWidth +
                                 margin);
            }
            srcComboBox.DropDownWidth = width;
            srcComboBox.EndUpdate();
            if (_args.TargetCountries.Count > 0)
            {
                srcComboBox.SelectedIndex = Countries.Tags.ToList().IndexOf(_args.TargetCountries[0]);
            }
            srcComboBox.SelectedIndexChanged += OnSrcComboBoxSelectedIndexChanged;

            // 兵科
            armyCheckBox.Text     = Config.GetText(TextId.BranchArmy);
            navyCheckBox.Text     = Config.GetText(TextId.BranchNavy);
            airforceCheckBox.Text = Config.GetText(TextId.BranchAirForce);

            // コピー/移動先コンボボックス
            destComboBox.BeginUpdate();
            destComboBox.Items.Clear();
            width = destComboBox.Width;
            foreach (string s in Countries.Tags
                     .Select(country => Countries.Strings[(int)country])
                     .Select(name => Config.ExistsKey(name)
                    ? $"{name} {Config.GetText(name)}"
                    : name))
            {
                destComboBox.Items.Add(s);
                width = Math.Max(width,
                                 (int)g.MeasureString(s, srcComboBox.Font).Width +
                                 SystemInformation.VerticalScrollBarWidth +
                                 margin);
            }
            destComboBox.DropDownWidth = width;
            destComboBox.EndUpdate();
            if (_args.TargetCountries.Count > 0)
            {
                destComboBox.SelectedIndex = Countries.Tags.ToList().IndexOf(_args.TargetCountries[0]);
            }
            destComboBox.SelectedIndexChanged += OnDestComboBoxSelectedIndexChanged;

            // 開始ID
            if (_args.TargetCountries.Count > 0)
            {
                idNumericUpDown.Value = Leaders.GetNewId(_args.TargetCountries[0]);
            }
            idNumericUpDown.ValueChanged += OnIdNumericUpDownValueChanged;

            // 理想階級コンボボックス
            idealRankComboBox.BeginUpdate();
            idealRankComboBox.Items.Clear();
            width = idealRankComboBox.Width;
            foreach (string s in Leaders.RankNames.Where(name => !string.IsNullOrEmpty(name)))
            {
                idealRankComboBox.Items.Add(s);
                width = Math.Max(width, (int)g.MeasureString(s, idealRankComboBox.Font).Width + margin);
            }
            idealRankComboBox.DropDownWidth = width;
            idealRankComboBox.EndUpdate();
            if (idealRankComboBox.Items.Count > 0)
            {
                idealRankComboBox.SelectedIndex = 0;
            }
            idealRankComboBox.SelectedIndexChanged += OnIdealRankComboBoxSelectedIndexChanged;

            // 引退年
            if ((Game.Type != GameType.DarkestHour) || (Game.Version < 103))
            {
                retirementYearCheckBox.Enabled      = false;
                retirementYearNumericUpDown.Enabled = false;
                retirementYearNumericUpDown.ResetText();
            }
        }