public Image CreateImage(IMonikerAttributes monikerAttributes, IVsUIObject vsUiObject)
        {
            try
            {
                if (vsUiObject == null)
                {
                    return(null);
                }

                var colorType   = monikerAttributes.GetColorType();
                var themedColor = _imageDataProvider.GetThemedColor(colorType);

                if (!themedColor.HasValue)
                {
                    return(null);
                }

                var imageMoniker = _imageDataProvider.GetImageMoniker(vsUiObject);
                var image        = _imageDataProvider.GetImage(imageMoniker, themedColor.Value);

                return(image);
            }
            catch
            {
                return(null);
            }
        }
示例#2
0
 public Task <IImage> GetImageAsync(string name)
 {
     using (var imageStream = _imageDataProvider.GetImage(name))
     {
         var image = _imageFactory.CreateImage(name, imageStream);
         return(Task.FromResult(image));
     }
 }
示例#3
0
        public GameAnswerMV(IImageDataProvider imageDataProvider, ICountryQuestion question, ICountryAnswer answer)
        {
            _question = question;
            _answer   = answer;

            _flag = imageDataProvider.GetImage(_answer.Country.SmallFlag);

            GuessCommand = new RelayCommand(() => MessengerInstance.Send(new CountryGuessNotification(_question, _answer)));
        }
示例#4
0
        private void NextQuestion()
        {
            if (_currentQuestion != null && _currentQuestion.MoveNext())
            {
                var question = _currentQuestion.Current;
                Game.AskQuestion(question);

                Flag     = _imageDataProvider.GetImage(question.Country.SmallFlag);
                ShowFlag = question.ShowFlag;

                Name     = question.Country.AdministrativeName;
                ShowName = question.ShowName;

                Answers = Game.Answers
                          .Select((o, i) => new QuizGameAnswerMV(_imageDataProvider, question, (ICountryAnswer)o, i % 2, i / 2))
                          .ToList();
            }
        }