コード例 #1
0
ファイル: ReadPosition.cs プロジェクト: nicarb/Rubinator3000
        // Currently not in use
        public ReadPosition Clone()
        {
            // Creates a clean clone without any references to the old ReadPosition

            return(new ReadPosition(
                       Convert.ToDouble(RelativeX),
                       Convert.ToDouble(RelativeY),
                       Convert.ToInt32(FaceIndex),
                       Convert.ToInt32(RowIndex),
                       Convert.ToInt32(ColIndex),
                       Convert.ToInt32(CameraIndex),
                       Color.FromArgb(Convert.ToInt32(Color.R), Convert.ToInt32(Color.G), Convert.ToInt32(Color.B)),
                       new Ellipse()
            {
                Width = Convert.ToDouble(Circle.Width),
                Height = Convert.ToDouble(Circle.Height),
                Stroke = new System.Windows.Media.SolidColorBrush(
                    System.Windows.Media.Color.FromArgb(
                        Convert.ToByte(((System.Windows.Media.SolidColorBrush)Circle.Stroke).Color.A),
                        Convert.ToByte(((System.Windows.Media.SolidColorBrush)Circle.Stroke).Color.R),
                        Convert.ToByte(((System.Windows.Media.SolidColorBrush)Circle.Stroke).Color.G),
                        Convert.ToByte(((System.Windows.Media.SolidColorBrush)Circle.Stroke).Color.B))),
                StrokeThickness = Convert.ToDouble(Circle.StrokeThickness)
            },
                       (double[])Percentages.Clone(),
                       AssumedCubeColor
                       ));
        }
コード例 #2
0
ファイル: UxSize.cs プロジェクト: yongaru/fuse-studio
 public static UxSize Percentages(Percentages value)
 {
     return(new UxSize
     {
         PercentagesValue = value,
     });
 }
コード例 #3
0
        public static void AskPercentageQuestion(Generator generator)
        {
            Percentages subject         = new Percentages();
            var         questionCount   = generator.QuestionCount;
            var         currentQuestion = 1;

            while (currentQuestion <= questionCount)
            {
                PercentageProblem p = (PercentageProblem)subject.GenerateQuestion(generator.Difficulty);
                var isCorrect       = false;
                while (!isCorrect)
                {
                    // Ask question
                    p.PrintQuestion(currentQuestion);

                    // Get answer
                    Console.Write("Answer: ");
                    int  answer      = 0;
                    bool validAnswer = true;
                    try
                    {
                        answer = Convert.ToInt32(Console.ReadLine());
                    }
                    catch (Exception)
                    {
                        validAnswer = false;
                    }

                    // Work out if answer is correct
                    if (validAnswer)
                    {
                        isCorrect = subject.IsCorrect(p, answer);
                        Console.WriteLine(isCorrect ? "Correct!" : "Not quite right. Try again.");
                    }
                }

                currentQuestion++;
            }
        }
コード例 #4
0
 public static string Serialize(Percentages d)
 {
     return((d.Value).ToString("0") + "%");
 }
コード例 #5
0
 public void Progress(int percentage)
 {
     Percentages.Add(percentage);
 }