當前位置: 首頁>>代碼示例>>C#>>正文


C# Settings.PersonSetting類代碼示例

本文整理匯總了C#中SirenOfShame.Lib.Settings.PersonSetting的典型用法代碼示例。如果您正苦於以下問題:C# PersonSetting類的具體用法?C# PersonSetting怎麽用?C# PersonSetting使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。


PersonSetting類屬於SirenOfShame.Lib.Settings命名空間,在下文中一共展示了PersonSetting類的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的C#代碼示例。

示例1: HowManyTimesHasPerformedBackToBackBuildsAcrossBuilds

 public static int HowManyTimesHasPerformedBackToBackBuildsAcrossBuilds(PersonSetting activePerson, IEnumerable<BuildStatus> allActiveBuildDefinitionsOrderedChronoligically)
 {
     return allActiveBuildDefinitionsOrderedChronoligically
         .GroupBy(i => i.BuildDefinitionId)
         .Select(i => HowManyTimesHasPerformedBackToBackBuildsForABuild(activePerson, i))
         .Aggregate(0, (i, j) => i + j);
 }
開發者ID:dirkrombauts,項目名稱:SirenOfShame,代碼行數:7,代碼來源:BackToBackBuilds.cs

示例2: AvatarPicker

 public AvatarPicker(ImageList avatarImageList, PersonSetting personSetting)
 {
     _imageService = new ImageService();
     _okToClose = true;
     _avatarImageList = avatarImageList;
     _personSetting = personSetting;
     InitializeComponent();
     emailTextbox.Text = personSetting.Email;
     if (personSetting.Email != null)
     {
         _gravatar.SetImage(personSetting, avatarImageList);
         tabControl1.SelectedIndex = 1;
     }
     if (personSetting.AvatarImageName != null)
     {
         _croppedCustom.ImageLocation = Path.Combine(SirenOfShameSettings.GetAvatarsFolder(),
             personSetting.AvatarImageName);
         tabControl1.SelectedIndex = 2;
     }
     int avatarCount = SirenOfShameSettings.AVATAR_COUNT;
     for (int i = 0; i < avatarCount; i++)
     {
         Avatar avatar = new Avatar();
         avatar.SetImage(i, avatarImageList);
         avatar.Click += AvatarOnClick;
         flowLayoutPanel1.Controls.Add(avatar);
     }
 }
開發者ID:dirkrombauts,項目名稱:SirenOfShame,代碼行數:28,代碼來源:AvatarPicker.cs

示例3: HowManyTimesHasPerformedBackToBackBuildsForABuild

        public static int HowManyTimesHasPerformedBackToBackBuildsForABuild(PersonSetting activePerson, IEnumerable<BuildStatus> currentBuildDefinitionOrderedChronoligically) {
            BuildStatus lastBuild = null;

            int backToBack = 0;

            foreach (var buildStatus in currentBuildDefinitionOrderedChronoligically)
            {
                bool lastBuildWasByActivePerson = lastBuild != null && lastBuild.RequestedBy == activePerson.RawName;
                bool currentBuildIsByActivePerson = buildStatus.RequestedBy == activePerson.RawName;
                if (lastBuildWasByActivePerson && currentBuildIsByActivePerson)
                {
                    bool lastBuildPassed = lastBuild.BuildStatusEnum == BuildStatusEnum.Working;
                    bool currentBuildPassed = buildStatus.BuildStatusEnum == BuildStatusEnum.Working;
                    bool wereBackToBack = lastBuild.IsBackToBackWithNextBuild(buildStatus);
                    if (lastBuildPassed && currentBuildPassed && wereBackToBack)
                    {
                        backToBack++;
                    }
                }

                lastBuild = buildStatus;
            }

            _log.Debug(activePerson.RawName + " has achieved back to back successful builds " + backToBack + " times");
            return backToBack;
        }
開發者ID:dirkrombauts,項目名稱:SirenOfShame,代碼行數:26,代碼來源:BackToBackBuilds.cs

示例4: CalculateLowestBuildRatioAfter50Builds

 public static double? CalculateLowestBuildRatioAfter50Builds(PersonSetting personSetting, IEnumerable<BuildStatus> allActiveBuildDefinitionsOrderedChronoligically)
 {
     int totalBuilds = 0;
     int unsuccessfulBuilds = 0;
     double lowestRatio = 0.0;
     List<BuildStatus> buildStatuses = allActiveBuildDefinitionsOrderedChronoligically
         .Where(i => i.RequestedBy == personSetting.RawName)
         .ToList();
     if (buildStatuses.Count < 50) return null;
     double currentRatio = 0;
     DateTime? lowestRatioAchieved = null;
     foreach (var buildStatus in buildStatuses)
     {
         totalBuilds++;
         if (buildStatus.BuildStatusEnum == BuildStatusEnum.Broken)
             unsuccessfulBuilds++;
         currentRatio = (double)unsuccessfulBuilds / totalBuilds;
         if (totalBuilds == 50)
         {
             lowestRatio = currentRatio;
             lowestRatioAchieved = buildStatus.StartedTime;
         }
         if (totalBuilds > 50)
         {
             var oldLowestRatio = lowestRatio;
             lowestRatio = Math.Min(currentRatio, lowestRatio);
             if (Math.Abs(oldLowestRatio - lowestRatio) > .001)
             {
                 lowestRatioAchieved = buildStatus.StartedTime;
             }
         }
     }
     _log.Debug(string.Format("{0}'s lowest build ratio is {1:p}. They achieved it on {3:d}. Their current ratio is {2:p}", personSetting.RawName, lowestRatio, currentRatio, lowestRatioAchieved));
     return lowestRatio;
 }
開發者ID:dirkrombauts,項目名稱:SirenOfShame,代碼行數:35,代碼來源:BuildRatio.cs

示例5: CalculateCurrentBuildRatio

 public static double CalculateCurrentBuildRatio(PersonSetting personSetting, IEnumerable<BuildStatus> allActiveBuildDefinitionsOrderedChronoligically)
 {
     var currentUserBuilds = allActiveBuildDefinitionsOrderedChronoligically.Where(i => i.RequestedBy == personSetting.RawName).ToList();
     var totalBuilds = currentUserBuilds.Count;
     var unsuccessfulBuilds = currentUserBuilds.Count(i => i.BuildStatusEnum == BuildStatusEnum.Broken);
     return totalBuilds == 0 ? 0 : (double)unsuccessfulBuilds/totalBuilds;
 }
開發者ID:dirkrombauts,項目名稱:SirenOfShame,代碼行數:7,代碼來源:BuildRatio.cs

示例6: CalculateSuccessInARow

 public static int CalculateSuccessInARow(PersonSetting personSetting, IEnumerable<BuildStatus> allActiveBuildDefinitionsOrderedChronoligically)
 {
     return allActiveBuildDefinitionsOrderedChronoligically
         .Reverse()
         .Where(i => i.RequestedBy == personSetting.RawName)
         .TakeWhile(i => i.BuildStatusEnum != BuildStatusEnum.Broken)
         .Count();
 }
開發者ID:dirkrombauts,項目名稱:SirenOfShame,代碼行數:8,代碼來源:SuccessInARow.cs

示例7: WasJustLikeLightning_ZeroBuilds

 public void WasJustLikeLightning_ZeroBuilds()
 {
     var fakePersonSetting = new PersonSetting { RawName = "currentUser" };
     var builds = new List<BuildStatus>
     {
     };
     Assert.AreEqual(false, new LikeLightning(fakePersonSetting, builds).HasJustAchieved());
 }
開發者ID:dirkrombauts,項目名稱:SirenOfShame,代碼行數:8,代碼來源:LikeLightningTest.cs

示例8: OnlyOnePersonOnProject

 public void OnlyOnePersonOnProject()
 {
     PersonSetting personSetting = new PersonSetting { RawName = "currentUser", TotalBuilds = 110, FailedBuilds = 0 };
     var people = new List<PersonSetting> {
         personSetting,
     };
     Assert.IsFalse(new Napoleon(personSetting, people).HasJustAchieved());
 }
開發者ID:dirkrombauts,項目名稱:SirenOfShame,代碼行數:8,代碼來源:NapoleonTest.cs

示例9: RefreshStats

 public void RefreshStats(PersonSetting person)
 {
     _reputation.Text = person.GetReputation().ToString(CultureInfo.InvariantCulture);
     _achievements.Text = person.Achievements.Count.ToString(CultureInfo.InvariantCulture);
     _failPercent.Text = string.Format("{0:p1}", person.CurrentBuildRatio).Replace(" ", "");
     _successfulBuildsInARow.Text = string.Format("{0}", person.CurrentSuccessInARow);
     _fixedSomeoneElsesBuild.Text = string.Format("{0}", person.NumberOfTimesFixedSomeoneElsesBuild);
     _totalBuilds.Text = string.Format("{0}", person.TotalBuilds);
 }
開發者ID:AutomatedArchitecture,項目名稱:SirenOfShame,代碼行數:9,代碼來源:UserPanel.cs

示例10: GetBothDisplayAndRawNames_RawNameNoDisplayName_OnlyShowsRawName

 public void GetBothDisplayAndRawNames_RawNameNoDisplayName_OnlyShowsRawName()
 {
     var personSetting = new PersonSetting
         {
             RawName = "dev\\lrichard",
             DisplayName = "dev\\lrichard"
         };
     Assert.AreEqual("dev\\lrichard", personSetting.GetBothDisplayAndRawNames());
 }
開發者ID:jimbobTX,項目名稱:SirenOfShame,代碼行數:9,代碼來源:PersonSettingTest.cs

示例11: GetBothDisplayAndRawNames_DisplayNameAndRawName_DisplaysBoth

 public void GetBothDisplayAndRawNames_DisplayNameAndRawName_DisplaysBoth()
 {
     var personSetting = new PersonSetting
         {
             RawName = "dev\\lrichard",
             DisplayName = "Lee Richardson"
         };
     Assert.AreEqual("Lee Richardson (dev\\lrichard)", personSetting.GetBothDisplayAndRawNames());
 }
開發者ID:jimbobTX,項目名稱:SirenOfShame,代碼行數:9,代碼來源:PersonSettingTest.cs

示例12: OnlyOneBuild

 public void OnlyOneBuild()
 {
     PersonSetting personSetting = new PersonSetting {RawName = "currentUser"};
     List<BuildStatus> builds = new List<BuildStatus>
     {
         new BuildStatus { RequestedBy = "currentUser", StartedTime = new DateTime(2010, 1, 1, 1, 1, 59), BuildStatusEnum = BuildStatusEnum.Working },
     };
     Assert.IsFalse(new AndGotAwayWithIt(personSetting, builds).HasJustAchieved());
 }
開發者ID:jimbobTX,項目名稱:SirenOfShame,代碼行數:9,代碼來源:AndGotAwayWithItTest.cs

示例13: SirenNeverBeenConnected

 public void SirenNeverBeenConnected()
 {
     PersonSetting personSetting = new PersonSetting { RawName = "currentUser" };
     SirenOfShameSettings settings = new SirenOfShameSettings(false)
     {
         SirenEverConnected = false,
         MyRawName = "currentUser"
     };
     Assert.AreEqual(false, new ShamePusher(personSetting, settings).HasJustAchieved());
 }
開發者ID:dirkrombauts,項目名稱:SirenOfShame,代碼行數:10,代碼來源:ShamePusherTest.cs

示例14: BrokenThenFixed_BothByCurrentUser_ButWithin60Seconds_

 public void BrokenThenFixed_BothByCurrentUser_ButWithin60Seconds_()
 {
     PersonSetting personSetting = new PersonSetting {RawName = "currentUser"};
     List<BuildStatus> builds = new List<BuildStatus>
     {
         new BuildStatus { RequestedBy = "currentUser", FinishedTime = new DateTime(2010, 1, 1, 1, 1, 1), BuildStatusEnum = BuildStatusEnum.Broken },
         new BuildStatus { RequestedBy = "currentUser", StartedTime = new DateTime(2010, 1, 1, 1, 2, 1), BuildStatusEnum = BuildStatusEnum.Working },
     };
     Assert.IsFalse(new AndGotAwayWithIt(personSetting, builds).HasJustAchieved());
 }
開發者ID:jimbobTX,項目名稱:SirenOfShame,代碼行數:10,代碼來源:AndGotAwayWithItTest.cs

示例15: CurrentUserHas99MorePointsThanAnyoneElse

 public void CurrentUserHas99MorePointsThanAnyoneElse()
 {
     PersonSetting personSetting = new PersonSetting { RawName = "currentUser", TotalBuilds = 110, FailedBuilds = 0 };
     var people = new List<PersonSetting> {
         personSetting,
         new PersonSetting { RawName = "someoneElse", TotalBuilds = 11, FailedBuilds = 0 },
         new PersonSetting { RawName = "someoneElseElse", TotalBuilds = 5, FailedBuilds = 0 },
     };
     Assert.IsFalse(new Napoleon(personSetting, people).HasJustAchieved());
 }
開發者ID:dirkrombauts,項目名稱:SirenOfShame,代碼行數:10,代碼來源:NapoleonTest.cs


注:本文中的SirenOfShame.Lib.Settings.PersonSetting類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。