Пример #1
0
        /// <summary>
        /// Unload our layer content
        /// </summary>
        public override void UnloadContent()
        {
            if (WhiteBrush != null)
            {
                WhiteBrush.Dispose();
            }
            WhiteBrush = null;

            if (LightGreenBrush != null)
            {
                LightGreenBrush.Dispose();
            }
            LightGreenBrush = null;

            if (RedBrush != null)
            {
                RedBrush.Dispose();
            }
            RedBrush = null;

            if (QuestionBrush != null)
            {
                QuestionBrush.Dispose();
            }
            QuestionBrush = null;

            if (CorrectBrush != null)
            {
                CorrectBrush.Dispose();
            }
            CorrectBrush = null;

            if (IncorrectBrush != null)
            {
                IncorrectBrush.Dispose();
            }
            IncorrectBrush = null;

            if (BlackBrush != null)
            {
                BlackBrush.Dispose();
            }
            BlackBrush = null;

            if (QuestionFormat != null && !QuestionFormat.IsDisposed)
            {
                QuestionFormat.Dispose();
            }
            if (AnswerFormat != null && !AnswerFormat.IsDisposed)
            {
                AnswerFormat.Dispose();
            }
            if (KeyIndicatorFormat != null && !KeyIndicatorFormat.IsDisposed)
            {
                KeyIndicatorFormat.Dispose();
            }
        }
Пример #2
0
        /// <summary>
        /// Load our layer content
        /// </summary>
        public override void LoadContent()
        {
            if (WhiteBrush != null)
            {
                WhiteBrush.Dispose();
            }
            WhiteBrush = new SolidColorBrush(Surface.RenderTarget2D, SharpDX.Color.White);

            if (LightGreenBrush != null)
            {
                LightGreenBrush.Dispose();
            }
            LightGreenBrush = new SolidColorBrush(Surface.RenderTarget2D, SharpDX.Color.LightGreen);

            if (RedBrush != null)
            {
                RedBrush.Dispose();
            }
            RedBrush = new SolidColorBrush(Surface.RenderTarget2D, SharpDX.Color.Red);

            if (QuestionBrush != null)
            {
                QuestionBrush.Dispose();
            }
            QuestionBrush = new SolidColorBrush(Surface.RenderTarget2D, new Color(MM_Repository.Training.QuestionTextColor.R, MM_Repository.Training.QuestionTextColor.G, MM_Repository.Training.QuestionTextColor.B, MM_Repository.Training.QuestionTextColor.A));

            if (CorrectBrush != null)
            {
                CorrectBrush.Dispose();
            }
            CorrectBrush = new SolidColorBrush(Surface.RenderTarget2D, new Color(MM_Repository.Training.CorrectAnswerColor.R, MM_Repository.Training.CorrectAnswerColor.G, MM_Repository.Training.CorrectAnswerColor.B, MM_Repository.Training.CorrectAnswerColor.A));

            if (IncorrectBrush != null)
            {
                IncorrectBrush.Dispose();
            }
            IncorrectBrush = new SolidColorBrush(Surface.RenderTarget2D, new Color(MM_Repository.Training.IncorrectAnswerColor.R, MM_Repository.Training.IncorrectAnswerColor.G, MM_Repository.Training.IncorrectAnswerColor.B, MM_Repository.Training.IncorrectAnswerColor.A));

            if (BlackBrush != null)
            {
                BlackBrush.Dispose();
            }
            BlackBrush = new SolidColorBrush(Surface.RenderTarget2D, SharpDX.Color.Black);


            if (QuestionFormat != null && !QuestionFormat.IsDisposed)
            {
                QuestionFormat.Dispose();
            }
            QuestionFormat = new TextFormat(Surface.FactoryDirectWrite, MM_Repository.Training.QuestionFont.Name, MM_Repository.Training.QuestionFont.Size)
            {
                TextAlignment = TextAlignment.Leading, ParagraphAlignment = ParagraphAlignment.Near
            };

            if (AnswerFormat != null && !AnswerFormat.IsDisposed)
            {
                AnswerFormat.Dispose();
            }
            AnswerFormat = new TextFormat(Surface.FactoryDirectWrite, MM_Repository.Training.AnswerFont.Name, MM_Repository.Training.AnswerFont.Size)
            {
                TextAlignment = TextAlignment.Leading, ParagraphAlignment = ParagraphAlignment.Near
            };


            if (KeyIndicatorFormat != null && !KeyIndicatorFormat.IsDisposed)
            {
                KeyIndicatorFormat.Dispose();
            }
            KeyIndicatorFormat = new TextFormat(Surface.FactoryDirectWrite, MM_Repository.OverallDisplay.KeyIndicatorLabelFont.Name, MM_Repository.OverallDisplay.KeyIndicatorLabelFont.Size)
            {
                TextAlignment = TextAlignment.Leading, ParagraphAlignment = ParagraphAlignment.Near
            };
        }