private async Task PopulateGrid()
        {
            string gameScore = _gameScore.Replace("&", "\n");

            _txtScore.Text            = String.Format("{0} Points of {1}", _score.Score, _total);
            _txtScoreType.Text        = _scoreType.ToString();
            _txtPlayer.Text           = _player.ToString();
            _txtScoreDescription.Text = _score.Description;
            _txtGameScore.Text        = gameScore;
            if (_player == PlayerType.Player)
            {
                _rectBackground.Fill = (ImageBrush)Application.Current.Resources["bmBurledMaple"];
                SetTextColor(Colors.Black);
            }
            else
            {
                _rectBackground.Fill = (ImageBrush)Application.Current.Resources["bmWalnut"];
                SetTextColor(Colors.White);
            }


            await AddCardImages(_cards, _scoreType);

            ShowScore(_cards, _score.Cards);
        }
Example #2
0
 public static string HumanName(this ScoreType s)
 {
     switch (s)
     {
     default: return(s.ToString());
     }
 }
Example #3
0
 public GetUserScores(uint userId, ScoreType type, bool includeFails = false, int limit = 10)
 {
     this.userId       = userId;
     this.type         = type.ToString().ToLower();
     this.includeFails = includeFails;
     this.limit        = limit;
 }
Example #4
0
        public static string GetScoreForType(ScoreType type)
        {
            switch (type)
            {
            default:
            case ScoreType.Aces:
            case ScoreType.Twos:
            case ScoreType.Threes:
            case ScoreType.Fours:
            case ScoreType.Fives:
            case ScoreType.Sixes: return(type.ToString());

            case ScoreType.ThreeOfAKind: return("Three of a Kind");

            case ScoreType.FourOfAKind: return("Four of a Kind");

            case ScoreType.FullHouse: return("Full House");

            case ScoreType.SmallStraight: return("Small Straight");

            case ScoreType.LargeStraight: return("Large Straight");

            case ScoreType.Yahtzee: return("Yahtzee");

            case ScoreType.Chance: return("Chance");
            }
        }
Example #5
0
 private static void TryPrintScoresForTypeSortedDescending(ScoreType type)
 {
     try
     {
         var scores = _service.GetRankings(type);
         Console.WriteLine($"Scores for {type.ToString()} sorted descending");
         scores.ForEach(Console.WriteLine);
         Console.WriteLine();
     } catch (RepositoryError) {
     }
 }
Example #6
0
        public List <RS_ScoreManageModel> GetManageCode(string deptCode, DateTime dt, ScoreType sorceType)
        {
            RS_ScoreManageQueryModel queryModel = new RS_ScoreManageQueryModel();

            queryModel.DeptCodeEqual = deptCode;
            queryModel.MarkDateEqual = dt;
            queryModel.TypeEqual     = int.Parse(sorceType.ToString("d"));
            List <RS_ScoreManageModel> list = new List <RS_ScoreManageModel>();

            return(this.GetRS_ScoreManageList(queryModel));
        }
Example #7
0
 /// <summary>
 /// 將 Token 依 ScoreType 標準化。
 /// </summary>
 public static string Regulation(this ScoreType type, string token)
 {
     return(string.Format("{0}:{1}", type.ToString(), token));
 }
Example #8
0
        public List <EmployScoreMode> GetScores(string userCode, ScoreType st, DateTime dt)
        {
            DateTime monthFirstDate;
            int      num;

            if (dt > DateTime.Now)
            {
                monthFirstDate = this.GetMonthFirstDate(DateTime.Now);
            }
            else
            {
                monthFirstDate = this.GetMonthFirstDate(dt);
            }
            RS_ScoreManageQueryModel   queryModel = new RS_ScoreManageQueryModel();
            List <RS_ScoreManageModel> list       = new List <RS_ScoreManageModel>();

            queryModel.MarkerEqual   = userCode;
            queryModel.MarkDateEqual = monthFirstDate;
            queryModel.TypeEqual     = int.Parse(st.ToString("d"));
            list = this.GetRS_ScoreManageList(queryModel);
            if ((list == null) || (list.Count == 0))
            {
                for (num = 12; (list.Count == 0) && (num > 0); num--)
                {
                    queryModel               = new RS_ScoreManageQueryModel();
                    monthFirstDate           = monthFirstDate.AddMonths(-1);
                    queryModel.MarkerEqual   = userCode;
                    queryModel.MarkDateEqual = monthFirstDate;
                    queryModel.TypeEqual     = int.Parse(st.ToString("d"));
                    list = this.GetRS_ScoreManageList(queryModel);
                }
                if ((list == null) || (list.Count == 0))
                {
                    return(null);
                }
            }
            else
            {
                int code = list[0].Code;
                if (int.Parse(list[0].Status) < int.Parse(WorkFlowStatus.Audited.ToString("d")))
                {
                    for (num = 12; (list.Count == 0) && (num > 0); num--)
                    {
                        queryModel               = new RS_ScoreManageQueryModel();
                        monthFirstDate           = monthFirstDate.AddMonths(-1);
                        queryModel.MarkerEqual   = userCode;
                        queryModel.MarkDateEqual = monthFirstDate;
                        queryModel.TypeEqual     = int.Parse(st.ToString("d"));
                        list = this.GetRS_ScoreManageList(queryModel);
                    }
                    if ((list.Count == 0) || (list == null))
                    {
                        return(null);
                    }
                }
            }
            List <RS_EmployScoreModel> userScoreListByManageCode = new List <RS_EmployScoreModel>();

            userScoreListByManageCode = this.GetUserScoreListByManageCode(list[0].Code);
            string                 userNameByUserID = this.GetUserNameByUserID(list[0].Marker);
            EmployScoreMode        item             = new EmployScoreMode();
            List <EmployScoreMode> list3            = new List <EmployScoreMode>();

            foreach (RS_EmployScoreModel model2 in userScoreListByManageCode)
            {
                item           = new EmployScoreMode();
                item.UserCode  = model2.UserCode;
                item.Score     = model2.Score.ToString();
                item.Marker    = userNameByUserID;
                item.ScoreCode = model2.Code;
                item.MarkTime  = list[0].MarkDate.ToString();
                item.Status    = list[0].Status;
                list3.Add(item);
            }
            return(list3);
        }
    private static int iterator = 0 ; // 用來產生新物件讓物件名稱不重複的的序號

    #endregion Fields

    #region Methods

    public static string CreateBattleScore_TextRowName( ScoreType _Type )
    {
        string ret = "" ;
        ret = GUI_BattleScore_TextRow_ + _Type.ToString() ;
        return ret ;
    }
Example #10
0
        /// <summary>
        ///     Validate different alignment score functions
        ///     using input sequences and reference sequences
        /// </summary>
        /// <param name="nodeName">xml node name</param>
        /// <param name="type">Molecule Type</param>
        /// <param name="scoretype">Score Function Type.</param>
        private void ValidateAlignmentScore(string nodeName, ScoreType scoretype)
        {
            string inputFilePath = utilityObj.xmlUtil.GetTextValue(nodeName, Constants.FilePathNode);
            string refFilePath = utilityObj.xmlUtil.GetTextValue(nodeName, Constants.RefFilePathNode);

            ISequenceParser parser = null;
            ISequenceParser refParser = null;
            try
            {
                parser = new FastAParser(inputFilePath);
                IEnumerable<ISequence> sequences = parser.Parse();

                refParser = new FastAParser(refFilePath);
                IEnumerable<ISequence> refSequences = refParser.Parse();

                IList<ISequence> alignedSequences = GetPAMSAMAlignedSequences(sequences.ToList());

                // Validate the score
                switch (scoretype)
                {
                    case ScoreType.QScore:
                        string expectedQScore = utilityObj.xmlUtil.GetTextValue(nodeName, Constants.QScoreNode);
                        float qScore = MsaUtils.CalculateAlignmentScoreQ(alignedSequences, refSequences.ToList());
                        Assert.AreEqual(expectedQScore, qScore.ToString((IFormatProvider) null));
                        break;
                    case ScoreType.TCScore:
                        string expectedTCScore = utilityObj.xmlUtil.GetTextValue(nodeName, Constants.TCScoreNode);
                        float tcScore = MsaUtils.CalculateAlignmentScoreQ(alignedSequences, refSequences.ToList());
                        Assert.AreEqual(expectedTCScore, tcScore.ToString((IFormatProvider) null));
                        break;
                    case ScoreType.Offset:
                        string expectedResiduesCount = utilityObj.xmlUtil.GetTextValue(nodeName,
                                                                                       Constants.ResiduesCountNode);
                        List<int> positions = MsaUtils.CalculateOffset(alignedSequences[0], refSequences.ElementAt(0));
                        int residuesCount = 0;
                        for (int i = 0; i < positions.Count; i++)
                        {
                            if (positions[i] < 0)
                            {
                                residuesCount++;
                            }
                        }
                        Assert.AreEqual(expectedResiduesCount, residuesCount.ToString((IFormatProvider) null));
                        break;
                    case ScoreType.MultipleAlignmentScoreFunction:
                        string expectedAlignScore = utilityObj.xmlUtil.GetTextValue(nodeName,
                                                                                    Constants.ExpectedScoreNode);
                        float score = MsaUtils.MultipleAlignmentScoreFunction(
                            alignedSequences, similarityMatrix, gapOpenPenalty, gapExtendPenalty);

                        Assert.IsTrue(expectedAlignScore.Contains(score.ToString((IFormatProvider) null)));
                        break;
                    case ScoreType.PairWiseScoreFunction:
                        string expectedPairwiseScore = utilityObj.xmlUtil.GetTextValue(nodeName,
                                                                                       Constants.PairWiseScoreNode);
                        float pairwiseScore = MsaUtils.PairWiseScoreFunction(
                            alignedSequences[0], alignedSequences[1], similarityMatrix,
                            gapOpenPenalty, gapExtendPenalty);
                        Assert.AreEqual(expectedPairwiseScore, pairwiseScore.ToString((IFormatProvider) null));
                        break;
                }

                ApplicationLog.WriteLine(
                    String.Format(null, @"PamsamBvtTest:{0} validation completed successfully",
                                  scoretype.ToString()));
            }
            finally
            {
                if (parser != null)
                    (parser).Dispose();
                if (refParser != null)
                    (refParser).Dispose();
            }
        }
 public virtual void TestScore(ScoreType scoreType, int expectedValue)
 {
     Assert.That(Character[scoreType].Total, Is.EqualTo(expectedValue),
         string.Format("Incorrect {0}", scoreType.ToString()));
 }
 public string GetStringScoreType()
 {
     return(scoreType.ToString());
 }