public void CreateSlidesFromSelectedWidgets()
        {
            viewModel.NewSlides=new List<Slide>();
            numberOfSlidesToSave = viewModel.SelectedWidgets.Count();

            if(numberOfSlidesToSave == 0)
            {
                viewModel.DoneAddingSlides();
                return;
            }

            numberOfSlidesSaved = 0;
            viewModel.Progressbar.IsVisible = true;
            viewModel.Progressbar.Message = "Creating slides...";
            foreach (var widgetMetadata in viewModel.SelectedWidgets)
            {
                Widget newWidget = Activator.CreateInstance(widgetMetadata.Type) as Widget;

                var newSlideConfiguration = new SlideConfiguration()
                {
                    Title = widgetMetadata.UserSelectedTitle,
                    Duration = widgetMetadata.SecondsOnScreen,
                    WidgetConfigurationId = newWidget.Configuration.Id,
                    WidgetType = widgetMetadata.Type.FullName,
                    WidgetXapName = widgetMetadata.XAPName
                };

                var slideTitle = widgetMetadata.UserSelectedTitle ?? widgetMetadata.Name;
                var newSlide = new Slide { Title = slideTitle, Widget = newWidget, SecondsOnScreen = widgetMetadata.SecondsOnScreen };

                slideConfigPersister.Save(newSlideConfiguration);
                viewModel.NewSlides.Add(newSlide);
            }
        }
 private void AssertAreEqual(SlideConfiguration resultConfig, SlideConfiguration expectedConfig)
 {
     resultConfig.Title.ShouldBe(expectedConfig.Title);
     resultConfig.Duration.ShouldBe(expectedConfig.Duration);
     resultConfig.SlideNumberInSlideshow.ShouldBe(expectedConfig.SlideNumberInSlideshow);
     resultConfig.WidgetType.ShouldBe(expectedConfig.WidgetType);
     resultConfig.WidgetConfigurationId.ShouldBe(expectedConfig.WidgetConfigurationId);
     resultConfig.WidgetXapName.ShouldBe(expectedConfig.WidgetXapName);
 }
 public void Save(SlideConfiguration configuration)
 {
     try
     {
         repo.Save(configuration);
     }
     catch (Exception exception)
     {
         logger.WriteEntry(new ErrorLogEntry(this.GetType().ToString(), exception.ToString()));
     }
 }
        public void Setup()
        {
            slideConfiguration = new SlideConfiguration()
            {
                Duration = 200,
                Title = "hello!",
                SlideNumberInSlideshow = 30,
                WidgetConfigurationId = Guid.NewGuid(),
                WidgetType = "Smeedee.Widget",
                WidgetXapName = "Smeedee.Widgets.xap"
            };


            client = new SlideConfigurationRepositoryServiceClient();

            client.Save(slideConfiguration);
        }
Exemple #5
0
        private Slide CreateSlideFromConfig(SlideConfiguration slideConfiguration)
        {
            var widgetType = GetType(slideConfiguration.WidgetType);
            var widget = Activator.CreateInstance(widgetType) as Widget;
            widget.SetConfigurationId(slideConfiguration.WidgetConfigurationId);
            
            var newSlide = new Slide()
            {
                Title = slideConfiguration.Title,
                SecondsOnScreen = slideConfiguration.Duration,
                Widget = widget
            };

            return newSlide;
        }
 private void Setup()
 {
     _slideConfig = new SlideConfiguration();
 }
Exemple #7
0
        public void OnEdit()
		{
            if (CurrentSlideInSettingsMode())
            {
                return;
            }
		    var dialogViewModel = new EditSlideshowDialog()
		    {
                Slideshow = this
		    };

			modalDialogService.Show(dialogViewModel, dialogResult =>
			{
                if (dialogResult)
	            {
		            var slideConfigPersister = this.GetDependency<IPersistDomainModelsAsync<SlideConfiguration>>();
                    var newSlideConfigurations = new List<SlideConfiguration>();
                    foreach (var slide in Slides)
                    {
                        var slideConfig = new SlideConfiguration()
                        {
                            Title = slide.Title,
                            Duration = slide.SecondsOnScreen,
                            WidgetConfigurationId = slide.Widget.Configuration.Id,
                            WidgetType = slide.Widget.GetType().FullName,

                        };

                        newSlideConfigurations.Add(slideConfig);
                    }
                    slideConfigPersister.Save(newSlideConfigurations);
			    }
            }); 
		}
Exemple #8
0
			public void Setup()
			{
				ViewModelBootstrapperForTests.Initialize();

				slideConfigRepoMock = new Mock<IAsyncRepository<SlideConfiguration>>();
				loggerMock = new Mock<ILog>();

				widgetMetadataRepoMock = new Mock<IAsyncRepository<WidgetMetadata>>();
				WidgetsExists();

				slideConfig = new SlideConfiguration
				{
					Duration = 100,
					Title = "Holidays provider widget",
					WidgetType = typeof(HolidayProviderTestWidget).FullName,
					WidgetConfigurationId = Guid.NewGuid()
				};
				slideConfigs = new List<SlideConfiguration> { slideConfig };
				slideConfigRepoMock.Setup(t => t.BeginGet(It.IsAny<Specification<SlideConfiguration>>())).Raises(
					t => t.GetCompleted += null, new GetCompletedEventArgs<SlideConfiguration>(slideConfigs, new AllSpecification<SlideConfiguration>()));

				moduleLoader = new ModuleLoader(slideConfigRepoMock.Object, widgetMetadataRepoMock.Object, loggerMock.Object);

				slideshowViewModel = new Slideshow();
				dockBarViewModel = new DockBar();

				Before();
			}