コード例 #1
0
        /// <summary>
        /// Initializes a new instance of the AttractScreenViewModel class that loads model content from the given Uri
        /// </summary>
        public AttractScreen2ViewModel()
            : base()
        {
            BackgroundImage = new BitmapImage(PackUriHelper.CreatePackUri("/Content/AttractScreen2/background.png"));
            CoverImage      = new BitmapImage(PackUriHelper.CreatePackUri("/Content/AttractScreen2/cover.png"));
            ImgHeight       = SystemParameters.FullPrimaryScreenHeight * strenthRatio;
            ImgWidth        = (ImgHeight / CoverImage.Height) * CoverImage.Width;

            toRightLen = (ImgWidth - SystemParameters.FullPrimaryScreenWidth);
            ToLeftLen  = -ToRightLen;

            AnmitTime = TimeSpan.FromSeconds((ImgHeight / CoverImage.Height) * amnitRatio);
        }
コード例 #2
0
        /// <summary>
        /// Initializes a new instance of the HomeScreenViewModel class that loads model content from the given Uri
        /// </summary>
        /// <param name="modelContentUri">Uri to the collection of AttractScreenImage models to be loaded</param>
        public HomeScreenViewModel(Uri modelContentUri)
            : base()
        {
            this.LoadModels(PackUriHelper.CreatePackUri(DefaultAttractScreenModelContent));
            this.CurrentImage = this.Images[this.currentIndex];

            this.experienceSelected = new RelayCommand <RoutedEventArgs>(this.OnExperienceSelected);

            using (Stream experienceModelsStream = Application.GetResourceStream(modelContentUri).Stream)
            {
                var experiences = XamlServices.Load(experienceModelsStream) as IList <ExperienceOptionModel>;
                if (null == experiences)
                {
                    throw new InvalidDataException();
                }

                this.Experiences = new ObservableCollection <ExperienceOptionModel>(experiences);
            }
        }
コード例 #3
0
        /// <summary>
        /// Loads the collection of AttractScreenImage models and transforms them to a collection of images.
        /// </summary>
        /// <param name="modelContentUri">Uri to the collection of AttractScreenImage models to be loaded</param>
        protected void LoadModels(Uri modelContentUri)
        {
            //using (Stream attractModelsStream = Application.GetResourceStream(modelContentUri).Stream)
            //{
            //    this.images = new ObservableCollection<Image>(
            //        from imageModel in XamlServices.Load(attractModelsStream) as IList<AttractImageModel>
            //        select new Image() { Source = new BitmapImage(imageModel.ImageUri) });
            //}

            string[] myImages = Directory.GetFiles("Content/myImages");

            foreach (var image in myImages)
            {
                Image tmpImage = new Image();
                tmpImage.Source = new BitmapImage(PackUriHelper.CreatePackUri(image));

                this.images.Add(tmpImage);
            }
        }
コード例 #4
0
 /// <summary>
 /// Initializes a new instance of the AttractScreenViewModel class and loads model content from the default resource path
 /// </summary>
 public AttractScreenViewModel()
     : this(PackUriHelper.CreatePackUri(DefaultAttractScreenModelContent))
 {
 }
コード例 #5
0
 /// <summary>
 /// Initializes a new instance of the HomeScreenViewModel class and loads model content from the default resource path
 /// </summary>
 public HomeScreenViewModel()
     : this(PackUriHelper.CreatePackUri(DefaultHomeScreenModelContent))
 {
 }