public void Slides_Slides_Tests()
        {
            try
            {
                storageService.File.CopyFile(Utils.CloudStorage_Input_Folder + "/slide-sample.pptx", Utils.CloudStorage_Output_Folder + "/slide-sample.pptx");
                SlidesResponse slidesResponse = slidesService.Slides.ReadPresentationSlidesInfo("slide-sample.pptx", Utils.CloudStorage_Output_Folder);
                System.Threading.Thread.Sleep(3000); // Just for testing
                slidesService.Slides.AddEmptySlideToTheEndOfPresentation("slide-sample.pptx", Utils.CloudStorage_Output_Folder);
                slidesService.Slides.AddCopyOfSlideToTheEndOfPresentation("slide-sample.pptx", 1, Utils.CloudStorage_Output_Folder);
                System.Threading.Thread.Sleep(3000); // Just for testing
                slidesService.Slides.AddEmptySlideToSpecifiedPosition("slide-sample.pptx", 1, Utils.CloudStorage_Output_Folder);
                slidesService.Slides.AddCopyOfSlideToSpecifiedPosition("slide-sample.pptx", 1, 2, Utils.CloudStorage_Output_Folder);
                System.Threading.Thread.Sleep(3000); // Just for testing
                slidesService.Slides.ChangeSlidePosition("slide-sample.pptx", 1, 2, Utils.CloudStorage_Output_Folder);
                slidesService.Slides.AddCopyOfSlideFromAnotherPresentaion("slide-sample.pptx", 1, Utils.CloudStorage_Input_Folder + "/slide-sample.pptx", 2, Utils.CloudStorage_Output_Folder);
                System.Threading.Thread.Sleep(3000); // Just for testing
                SlideResponse slideResponse = slidesService.Slides.ReadSlideInfo("slide-sample.pptx", 1, Utils.CloudStorage_Output_Folder);
                slidesService.Slides.ConvertSlideToSomeFormat("slide-sample.pptx", 1, SlidesImageFormat.Tiff, Utils.CloudStorage_Output_Folder, Utils.Local_Output_Path + "slide-out.tiff");
                System.Threading.Thread.Sleep(3000); // Just for testing
                SlidesBackgroundResponse slidesBackgroundResponse = slidesService.Slides.ReadPresentationSlideBackgroundColorType("slide-sample.pptx", 1, Utils.CloudStorage_Output_Folder);

                //slidesService.Slides.SetPresentationSlideBackgroundColor("slide-sample.pptx", 1, Utils.CloudStorage_Output_Folder, "black");
                slidesService.Slides.RemovePresentationSlideBackgroundColor("slide-sample.pptx", 1, Utils.CloudStorage_Output_Folder);
                System.Threading.Thread.Sleep(3000); // Just for testing
                SlidesCommentsResponse slidesCommentsResponse = slidesService.Slides.ReadPresentationSlideComments("slide-sample.pptx", 1, Utils.CloudStorage_Output_Folder);
                slidesService.Slides.DeletePresentationSlideByItsIndex("slide-sample.pptx", 1, Utils.CloudStorage_Output_Folder);
                System.Threading.Thread.Sleep(3000); // Just for testing
                slidesService.Slides.DeletePresentationSlides("slide-sample.pptx", Utils.CloudStorage_Output_Folder);
            }
            catch (Exception ex)
            {
                Assert.Fail(ex.Message);
            }
        }
        public SlidesResponse GetContentChannel(string id)
        {
            var rockContext           = new RockContext();
            var contentChannelService = new ContentChannelService(rockContext);
            var response = new SlidesResponse();

            var contentChannel = contentChannelService.Get(id.AsInteger());

            if (contentChannel != null)
            {
                response.Contents = GetContentChannelItems(new List <int>(), contentChannel, rockContext);
            }

            response.GenerateHash();

            return(response);
        }
        public SlidesResponse GetSlides(string id)
        {
            var rockContext           = new RockContext();
            var deviceService         = new DeviceService(rockContext);
            var scheduleService       = new ScheduleService(rockContext);
            var contentChannelService = new ContentChannelService(rockContext);
            var response = new SlidesResponse();

            Device device = deviceService.Get(id.AsInteger());

            if (device != null)
            {
                var campuses = device.Locations.Select(l => l.CampusId).Where(c => c.HasValue && c.Value != 0).Select(c => c.Value).ToList();

                device.LoadAttributes(rockContext);
                var definedValueGuids = device.GetAttributeValue("com_shepherdchurch_ContentSchedules").SplitDelimitedValues().AsGuidList();
                List <DefinedValueCache> definedValues = new List <DefinedValueCache>();

                //
                // Build a list of the cached defined values so we can then sort by Order.
                //
                foreach (var definedValueGuid in definedValueGuids)
                {
                    var definedValue = DefinedValueCache.Get(definedValueGuid);

                    if (definedValue != null)
                    {
                        definedValues.Add(definedValue);
                    }
                }

                //
                // Check each defined value they have selected on this device and look for the
                // first one that is active.
                //
                foreach (var definedValue in definedValues.OrderBy(d => d.Order))
                {
                    var contentChannel = contentChannelService.Get(definedValue.GetAttributeValue("com_shepherdchurch_ContentChannel").AsGuid());

                    if (contentChannel != null)
                    {
                        var  schedules      = definedValue.GetAttributeValues("com_shepherdchurch_Schedules").AsGuidList();
                        bool scheduleActive = false;

                        //
                        // Check if either no schedules (match by default) or any single schedule
                        // is currently active.
                        //
                        if (!schedules.Any())
                        {
                            scheduleActive = true;
                        }
                        else
                        {
                            foreach (var guid in schedules)
                            {
                                var schedule = scheduleService.Get(guid);

                                if (schedule.WasScheduleActive(RockDateTime.Now))
                                {
                                    scheduleActive = true;
                                    break;
                                }
                            }
                        }

                        //
                        // If the schedule is active, then this is the content channel we are going
                        // to work with. Build our list of image URLs and audio URLs.
                        //
                        if (scheduleActive)
                        {
                            response.Contents = GetContentChannelItems(campuses, contentChannel, rockContext);

                            break;
                        }
                    }
                }

                response.GenerateHash();
            }

            return(response);
        }