Наследование: MonoBehaviour
Пример #1
0
        public PreviewInfo PreviewApplyStyle(ImageItem source, Slide contentSlide, 
            float slideWidth, float slideHeight, StyleOption option)
        {
            SetStyleOptions(option);
            SlideWidth = slideWidth;
            SlideHeight = slideHeight;

            var previewInfo = new PreviewInfo();
            var handler = CreateEffectsHandlerForPreview(source, contentSlide);

            // use thumbnail to apply, in order to speed up
            var fullSizeImgPath = source.FullSizeImageFile;
            var originalThumbnail = source.ImageFile;
            source.FullSizeImageFile = null;
            source.ImageFile = source.CroppedThumbnailImageFile ?? source.ImageFile;

            ApplyStyle(handler, source, isActualSize: false);

            // recover the source back
            source.FullSizeImageFile = fullSizeImgPath;
            source.ImageFile = originalThumbnail;
            handler.GetNativeSlide().Export(previewInfo.PreviewApplyStyleImagePath, "JPG",
                    GetPreviewWidth(), PreviewHeight);

            handler.Delete();
            return previewInfo;
        }
Пример #2
0
        public void ApplyStyle(ImageItem source, Slide contentSlide,
            float slideWidth, float slideHeight, StyleOptions option = null)
        {
            if (Globals.ThisAddIn != null)
            {
                Globals.ThisAddIn.Application.StartNewUndoEntry();
            }
            if (option != null)
            {
                SetStyleOptions(option);
            }

            // try to use cropped/adjusted image to apply
            var fullsizeImage = source.FullSizeImageFile;
            source.FullSizeImageFile = source.CroppedImageFile ?? source.FullSizeImageFile;
            source.OriginalImageFile = fullsizeImage;
            
            var effectsHandler = new EffectsDesigner(contentSlide, 
                slideWidth, slideHeight, source);

            ApplyStyle(effectsHandler, source, isActualSize: true);

            source.FullSizeImageFile = fullsizeImage;
            source.OriginalImageFile = null;
        }
Пример #3
0
 public Presenterd(Settings settings, Bus bus)
 {
     currentSlide = Slide.UpcomingCompetitions;
     pausedFor = 0;
     this.settings = settings;
     this.bus = bus;
 }
Пример #4
0
 public override Source CreateNewSource(Slide slide, ModuleConfiguration moduleConfiguration, Dictionary<String, IList<DeviceResourceDescriptor>> resources, Display display)
 {
     return new ArcGISMapSourceDesign 
     { 
         Type = this
     };
 }
Пример #5
0
 public static void divideToLines(Slides slides, Slide slide, TextRange textRange)
 {
     var slideNumber = slide.SlideIndex;
     float slideDuration = slide.SlideShowTransition.AdvanceTime;
     int divisionNumber = textRange.Lines().Count;
     float duration = durationAfterDivisions(slideDuration, divisionNumber / 2);
     string textFrmLines = "";
     foreach (TextRange line in textRange.Lines())
     {
         if (textFrmLines.Length > 0)
         {
             textFrmLines += line.Text;
             SlidesManipulation.createNewSlide(slides, ++slideNumber, textFrmLines.Trim(), duration);
             SlidesManipulation.createNewSlide(slides, ++slideNumber, "", 0.01F);
             textFrmLines = "";
         }
         else
         {
             textFrmLines += line.Text;
         }
     }
     //add the rest of textFrmLines
     if (textFrmLines.Length > 0)
     {
         SlidesManipulation.createNewSlide(slides, ++slideNumber, textFrmLines, duration);
         SlidesManipulation.createNewSlide(slides, ++slideNumber, "", 0.1F);
     }
         //delete slides
         slide.Delete();
         slides[slideNumber].Delete();
 }
        public ActionResult Create(Slide model)
        {
            try
            {
                if (FileHelpers.ValidImage(model.image) == false)
                {
                    ModelState.AddModelError("image", "Please choose either a GIF, JPG or PNG image.");
                }

                if (ModelState.IsValid)
                {
                    _slideRepository.Add(model);
                    return RedirectToAction("Index");
                }
            }
            catch (Exception ex)
            {
                ModelState.AddModelError("", ex.Message);
            }

            model.image = null;
            model.alt_text = null;

            IEnumerable<ISlide> lstSlides = _slideRepository.GetList();
            List<Slide> slides = _slideMapper.ToList(lstSlides);

            ViewData["SlideCount"] = slides.Count;
            ViewData["Slides"] = slides;

            return View(model);
        }
        public PreviewInfo PreviewApplyStyle(ImageItem source, Slide contentSlide, 
            float slideWidth, float slideHeight, StyleOption option)
        {
            Logger.Log("PreviewApplyStyle begins");
            SetStyleOptions(option);
            SlideWidth = slideWidth;
            SlideHeight = slideHeight;

            var previewInfo = new PreviewInfo();
            EffectsDesignerForPreview.PreparePreviewing(contentSlide, slideWidth, slideHeight, source);

            // use thumbnail to apply, in order to speed up
            source.BackupFullSizeImageFile = source.FullSizeImageFile;
            var backupImageFile = source.ImageFile;
            source.FullSizeImageFile = null;
            source.ImageFile = source.CroppedThumbnailImageFile ?? source.ImageFile;

            GenerateStyle(EffectsDesignerForPreview, source, isActualSize: false);

            // recover the source back
            source.FullSizeImageFile = source.BackupFullSizeImageFile;
            source.ImageFile = backupImageFile;
            EffectsDesignerForPreview.GetNativeSlide().Export(previewInfo.PreviewApplyStyleImagePath, "JPG",
                    GetPreviewWidth(), PreviewHeight);
            Logger.Log("PreviewApplyStyle done");
            return previewInfo;
        }
Пример #8
0
		private void SubmitScore(Slide slide)
		{
			var userId = User.Identity.GetUserId();

			var ltiRequest = ltiRequestsRepo.Find(userId, slide.Id);
			if (ltiRequest == null)
				throw new Exception("LtiRequest for user '" + userId + "' not found");

			var consumerSecret = consumersRepo.Find(ltiRequest.ConsumerKey).Secret;

			var score = visitersRepo.GetScore(slide.Id, userId);

			// TODO: fix outcome address in local edx (no localhost and no https)
			var uri = new UriBuilder(ltiRequest.LisOutcomeServiceUrl);
			if (uri.Host == "localhost")
			{
				uri.Host = "192.168.33.10";
				uri.Port = 80;
				uri.Scheme = "http";
			}

			var result = OutcomesClient.PostScore(uri.ToString(), ltiRequest.ConsumerKey, consumerSecret,
				ltiRequest.LisResultSourcedId, score / (double)slide.MaxScore);

			if (!result.IsValid)
				throw new Exception(uri + "\r\n\r\n" + result.Message);
		}
Пример #9
0
 public bool SaveSlideToFile(int slideNumber, string fileName, int width, int height)
 {
     if (_presentation == null)
         throw new NullReferenceException("PowerPoint Presentation is null");
     if (slideNumber > _presentation.Slides.Count) return false;
     //_presentation.Slides[slideNumber].Select();
     //_presentation.SaveAs(fileName, PpSaveAsFileType.ppSaveAsPNG, MsoTriState.msoTrue);
     _slide = _presentation.Slides[slideNumber];
     if (_slide == null) return false;
     MethodInfo mi = _slide.GetType().GetMethod("Export");
     if ((width == -1) || (height == -1))
         mi.Invoke(_slide, new object[] { fileName, "PNG", Missing.Value, Missing.Value });
     else
     {
         // надо ввсети ограничение, чтобы не было больше MAGIC_NUMBER, если будет больше, PPT 2007 хреново работает
         int new_width = width;
         int new_height = height;
         int maxSize = Math.Max(new_width, new_height);
         if (maxSize > MAGIC_NUMBER)
         {
             new_width = (int)(MAGIC_NUMBER/(maxSize*1.0)*new_width);
             new_height = (int) (MAGIC_NUMBER/(maxSize*1.0)*new_height);
         }
         mi.Invoke(_slide, new object[] {fileName, "PNG", new_width, new_height});
     }
     //_presentation.Slides[slideNumber].Export(fileName, "PNG", Missing.Value, Missing.Value);
     return true;
 }
Пример #10
0
        //[XmlIgnore]
        //[Browsable(false)]
        //public override bool IsSupportPreview
        //{
        //    get { return true; }
        //}


        public override Source CreateNewSource(Slide slide, ModuleConfiguration moduleConfiguration, Dictionary<string, IList<DeviceResourceDescriptor>> resources, Display display)
        {
            //IEDocumentSourceDesign source = new IEDocumentSourceDesign() { Type = this };
            //return source;

            return new IEDocumentSourceDesign { Type = this };
        }
    void SwitchSlide(int amount)
    {
        direction = amount > 0 ? 1 : -1;

        if(currentSlide.state == Slide.State.Active && amount > 0)
        {
            currentSlide.OnSlideExit();

        //			if(currentIndex + amount < slides.Count && currentIndex + amount > 0)
        //				slides[currentIndex + amount].OnSlideInit();
        //
        //			if(currentIndex - amount < slides.Count && currentIndex - amount > 0)
        //				slides[currentIndex - amount].OnSlideInit();
        }
        else
        {
            currentSlide.OnSlideFinalise();
            currentIndex += amount;

            currentSlide = slides[currentIndex];
            slides[currentIndex].SetCameraTarget(cameraTransitionSpeed);

            slides[currentIndex].OnSlideEnter(this);

        }
    }
Пример #12
0
        public ActionResult Frontpage(RenderModel model)
        {
            IPublishedContent page = model.Content;
            FrontpageRenderModel newModel = new FrontpageRenderModel(page);

            newModel.Header = page.GetPropertyValue<string>("header");
            newModel.Bodytext = page.GetPropertyValue<IHtmlString>("bodyText");
            newModel.CreateReviewUserForm = new CreateReviewUserForm();

            var slideFolder = Umbraco.TypedMedia(page.GetPropertyValue<int>("slideFolder"));

            if (slideFolder != null)
            {
                List<Slide> slides = new List<Slide>();

                foreach (var image in slideFolder.Children)
                {
                    Slide s = new Slide();

                    s.ImageUrl = image.Url;
                    slides.Add(s);
                }
                newModel.Slides = slides;
            }

            //Do some stuff here, then return the base method
            return View(newModel);
        }
Пример #13
0
 private void validateIntersection(Slide slide, IList<JupiterWindow> list)
 {
     for (int i = 0; i < list.Count - 1; i++)
     {
         for (int j = i + 1; j < list.Count; j++)
         {
             Window current = list[i];
             Window other = list[j];
             Rectangle rect1 = new Rectangle(current.Left, current.Top, current.Width, current.Height);
             Rectangle rect2 = new Rectangle(other.Left, other.Top, other.Width, other.Height);
             string currentResourceInfoName = current.Source.ResourceDescriptor == null
                                                  ? string.Empty
                                                  : current.Source.ResourceDescriptor.ResourceInfo.Name;
             string otherResourceInfoName = other.Source.ResourceDescriptor == null
                              ? string.Empty
                              : other.Source.ResourceDescriptor.ResourceInfo.Name;
             if (rect1.IntersectsWith(rect2))
                 throw new Exception(String.Concat(
                     "Сохранение сцены ",
                     slide.Name,
                     " невозможно. На раскладке сцены окна с источниками ",
                     currentResourceInfoName,
                     " и ",
                     otherResourceInfoName,
                     " не должны перекрываться между собой"));
         }
     }
 }
Пример #14
0
        public void RemoveSlide_InvalidSlide_SlideRemoved()
        {
            Slide slide = new Slide(Duration.From(10), Transition.From(TransitionType.None), "Untitled");

            Slideshow slideshow = make_Slideshow("Test");
            slideshow.RemoveSlide(slide);
        }
Пример #15
0
        public SlideLayout(IEnumerable<Display> ADisplays, Slide ASlide)
        {
            m_slide = ASlide;
            m_displays = new List<Display>();
            foreach (Display d in ADisplays)
            {
                if (!WeContainDisplay(d))
                {
                    AddDisplayToSlide(d);
                }
                else
                {
                    m_displays.Add(FindDisplay(d));
                }
            }

            if (m_displays.Count > 0)
            {
                m_windowList = new List<Window>(m_displays[0].WindowList);
                firstDisplay = m_displays.First();
            }
            else
                m_windowList = new List<Window>();

            UpdateDisplayLayout();
        }
Пример #16
0
        static void DrawArrow(Slide slide)
        {
            if (!DrawRObject && !DrawRObject)
            {
                return;
            }

            var color = slide.Type == 1 ? Color.DarkRed : Color.DeepPink;
            var width = 4;

            var circle = new Geometry.Circle2(slide.Position.To2D(), 150f, Game.Time * 300 - slide.StartTime * 300, slide.EndTime * 300 - slide.StartTime * 300).ToPolygon();
            circle.Draw(color, width);

            var startpos = ObjectManager.Player.Position;
            var endpos = slide.Position;
            if (startpos.Distance(endpos) > 100)
            {
                var endpos1 = slide.Position + (startpos - endpos).To2D().Normalized().Rotated(25 * (float)Math.PI / 180).To3D() * 75;
                var endpos2 = slide.Position + (startpos - endpos).To2D().Normalized().Rotated(-25 * (float)Math.PI / 180).To3D() * 75;

                var x1 = new LeagueSharp.Common.Geometry.Polygon.Line(startpos, endpos);
                x1.Draw(color, width - 2);
                var y1 = new LeagueSharp.Common.Geometry.Polygon.Line(endpos, endpos1);
                y1.Draw(color, width - 2);
                var z1 = new LeagueSharp.Common.Geometry.Polygon.Line(endpos, endpos2);
                z1.Draw(color, width - 2);
            }
        }
 public Experience(Experience e)
 {
     this.b = e.GetBehavior ();
     this.target = e.GetTarget ();
     this.models = e.GetGameObjects ();
     this.owner = e.GetOwner ();
 }
Пример #18
0
		public static void SubmitScore(Slide slide, string userId)
		{
			var ltiRequestsRepo = new LtiRequestsRepo();
			var consumersRepo = new ConsumersRepo();
			var visitsRepo = new VisitsRepo();

			var ltiRequest = ltiRequestsRepo.Find(userId, slide.Id);
			if (ltiRequest == null)
				throw new Exception("LtiRequest for user '" + userId + "' not found");

			var consumerSecret = consumersRepo.Find(ltiRequest.ConsumerKey).Secret;

			var score = visitsRepo.GetScore(slide.Id, userId);

			var uri = new UriBuilder(ltiRequest.LisOutcomeServiceUrl);
			if (uri.Host == "localhost")
			{
				uri.Host = "192.168.33.10";
				uri.Port = 80;
				uri.Scheme = "http";
			}

			var outputScore = score / (double)slide.MaxScore;
			/* Sometimes score is bigger then slide's MaxScore, i.e. in case of manual checking */
			if (score > slide.MaxScore)
				outputScore = 1;
			var result = OutcomesClient.PostScore(uri.ToString(), ltiRequest.ConsumerKey, consumerSecret,
				ltiRequest.LisResultSourcedId, outputScore);

			if (!result.IsValid)
				throw new Exception(uri + "\r\n\r\n" + result.Message);
		}
Пример #19
0
		private string RenderSlide(Slide slide)
		{
			var page = StandaloneLayout.Page(course, slide, CreateToc(slide), GetCssFiles(), GetJsFiles());
			foreach (var block in slide.Blocks.OfType<MdBlock>())
				CopyLocalFiles(block.Markdown, slide.Info.Directory.FullName);
			return "<!DOCTYPE html>\n" + page.ToHtmlString();
		}
 public void BindSelectedColor(Color color, Slide contentSlide, float slideWidth, float slideHeight)
 {
     BindColorToStyle(color);
     BindColorToVariant(color);
     if (View.IsDisplayDefaultPicture())
     {
         View.EnableUpdatingPreviewImages();
         UpdatePreviewImages(
             View.CreateDefaultPictureItem(),
             contentSlide,
             slideWidth,
             slideHeight);
         View.DisableUpdatingPreviewImages();
         BindStyleToColorPanel();
     }
     else
     {
         UpdatePreviewImages(
             ImageSelectionListSelectedItem.ImageItem ??
             View.CreateDefaultPictureItem(),
             contentSlide,
             slideWidth,
             slideHeight);
     }
 }
Пример #21
0
        public static void IsSameLooking(Slide expSlide, Slide actualSlide)
        {
            var hashCode = DateTime.Now.GetHashCode();
            actualSlide.Export(PathUtil.GetTempPath("actualSlide" + hashCode), "PNG");
            expSlide.Export(PathUtil.GetTempPath("expSlide" + hashCode), "PNG");

            IsSameLooking("expSlide" + hashCode, "actualSlide" + hashCode);
        }
Пример #22
0
		private int GetMaxScoreWithoutManualChecking(Slide slide)
		{
			if (slide is ExerciseSlide)
				return (slide as ExerciseSlide).Exercise.CorrectnessScore;
			if (slide is QuizSlide)
				return (slide as QuizSlide).Quiz.ManualCheck ? 0 : slide.MaxScore;
			return slide.MaxScore;
		}
Пример #23
0
		public BlockRenderContext(Course course, Slide slide, string baseUrl, dynamic[] blockData)
		{
			Course = course;
			Slide = slide;
			BaseUrl = baseUrl;
			BlockData = blockData;
			if (BlockData.Length != Slide.Blocks.Length)
				throw new ArgumentException("BlockData.Length should be slide.Blocks.Length");
		}
Пример #24
0
 void Instance_OnSlideChangedExternally(Slide slide)
 {
     if (slide == _selectedSlide)
     {
         populateCategories();
         if (OnSourcesChanged != null)
             OnSourcesChanged();
     }
 }
Пример #25
0
        public void RemoveSlide_ValidSlide_RemoveSlide()
        {
            Slide slide = new Slide(Duration.From(10), Transition.From(TransitionType.None), "Untitled");

            Slideshow slideshow = make_Slideshow("Test");
            slideshow.Insert(slide);
            slideshow.RemoveSlide(slide);
            Assert.AreEqual(slideshow.Slides.Count(), 0);
        }
Пример #26
0
 public void AddLink(Slide slideFrom, Slide slideTo)
 {
     if (_addLinkDelegate != null)
     {
         if (!_addLinkDelegate.Invoke(new[] { slideFrom, slideTo }))
             throw new ApplicationException(string.Format("Не удалось создать линк между сценами: {0} и {1}",
                 slideFrom.Name, slideTo.Name));
     }
 }
 public static int GetShapeIndex(Slide slide, Shape shape)
 {
     for (int i = 1; i <= slide.Shapes.Count; i++)
     {
         if (slide.Shapes[i] == shape)
             return i;
     }
     return -1;
 }
Пример #28
0
		public PrevNextButtonsModel(Course course, Guid slideId, bool nextIsAcceptedSolutions, Slide nextSlide, Slide prevSlide, bool isGuest)
		{
			this.course = course;
			SlideId = slideId;
			NextIsAcceptedSolutions = nextIsAcceptedSolutions;
			NextSlide = nextSlide;
			PrevSlide = prevSlide;
			IsGuest = isGuest;
		}
Пример #29
0
 public static void addTimecodeToSlide(Slide oSlide, float advanceSec)
 {
     //only if advanced not after 0 sec, it turns on, AdvanceOnClick is still true
     if (advanceSec != 0)
     {
         oSlide.SlideShowTransition.AdvanceOnTime = MsoTriState.msoTrue;
         oSlide.SlideShowTransition.AdvanceTime = roundingCorrection(advanceSec);
         //oSlide.SlideShowTransition.AdvanceOnClick = MsoTriState.msoTrue;
     }
 }
 public void Init()
 {
     _designer = new StylesDesigner(App);
     _sourceImage = new ImageItem
     {
         ImageFile = PathUtil.GetDocTestPath() + "koala.jpg",
         Tooltip = "some tooltip"
     };
     _contentSlide = PpOperations.SelectSlide(1);
 }
Пример #31
0
 public void Update(Slide slide)
 {
     _slideRepository.Update(slide);
 }
Пример #32
0
 private string GenerateSubmissionName(Slide exerciseSlide)
 {
     return(string.Format("{0}: {1} - {2}", User.Identity.Name, exerciseSlide.Info.UnitName, exerciseSlide.Title));
 }
Пример #33
0
 public ActionResult <Slide> Post([FromBody] Slide slide)
 {
     UnitOfWork.SlideRepository.Add(slide);
     UnitOfWork.CommitChanges();
     return(Ok(slide));
 }
Пример #34
0
 public PrevNextButtonsModel(Course course, Guid slideId, bool nextIsAcceptedSolutions, bool hideShowSolutionsButton, Slide nextSlide, Slide prevSlide, bool isGuest)
 {
     this.course             = course;
     SlideId                 = slideId;
     NextIsAcceptedSolutions = nextIsAcceptedSolutions;
     HideShowSolutionsButton = hideShowSolutionsButton;
     NextSlide               = nextSlide;
     PrevSlide               = prevSlide;
     IsGuest                 = isGuest;
 }
Пример #35
0
 private static string GenerateSubmissionName(Slide exerciseSlide, string userName)
 {
     return($"{userName}: {exerciseSlide.Info.Unit.Title} - {exerciseSlide.Title}");
 }
Пример #36
0
        public ActionResult Show(int id)
        {
            Slide slide = slideManagementService.Get(id);

            return(View(slide));
        }
Пример #37
0
        /// <summary>
        /// This method implements the way to guide the user step by step to customize
        /// style
        /// </summary>
        public void UpdateStepByStepStylesVariationImages(ImageItem source, Slide contentSlide,
                                                          float slideWidth, float slideHeight)
        {
            Logger.Log("Check for step by step preview");
            Logger.Log("current variation list selected id is " + StylesVariationListSelectedId.Number);
            Logger.Log("variants category count is " + VariantsCategory.Count);
            if (StylesVariationListSelectedId.Number < 0 ||
                VariantsCategory.Count == 0)
            {
                return;
            }

            Logger.Log("Step by step preview begins");
            var targetVariationSelectedIndex = StylesVariationListSelectedId.Number;
            var targetVariant = _styleVariants[_previousVariantsCategory][targetVariationSelectedIndex];

            foreach (var option in _styleOptions)
            {
                targetVariant.Apply(option);
            }

            var currentVariantsCategory = CurrentVariantCategory.Text;

            if (currentVariantsCategory != TextCollection.PictureSlidesLabText.VariantCategoryFontColor &&
                _previousVariantsCategory != TextCollection.PictureSlidesLabText.VariantCategoryFontColor)
            {
                // apply font color variant,
                // because default styles may contain special font color settings, but not in variants
                var fontColorVariant = new StyleVariant(new Dictionary <string, object>
                {
                    { "FontColor", _styleOptions[targetVariationSelectedIndex].FontColor }
                });
                foreach (var option in _styleOptions)
                {
                    fontColorVariant.Apply(option);
                }
            }

            var nextCategoryVariants = _styleVariants[currentVariantsCategory];

            if (currentVariantsCategory == TextCollection.PictureSlidesLabText.VariantCategoryFontFamily)
            {
                var isFontInVariation = false;
                var currentFontFamily = _styleOptions[targetVariationSelectedIndex].FontFamily;
                foreach (var variant in nextCategoryVariants)
                {
                    if (currentFontFamily == (string)variant.Get("FontFamily"))
                    {
                        isFontInVariation = true;
                    }
                }
                if (!isFontInVariation &&
                    targetVariationSelectedIndex >= 0 &&
                    targetVariationSelectedIndex < nextCategoryVariants.Count)
                {
                    nextCategoryVariants[targetVariationSelectedIndex]
                    .Set("FontFamily", currentFontFamily);
                    nextCategoryVariants[targetVariationSelectedIndex]
                    .Set("OptionName", currentFontFamily);
                }
            }

            int pictureIndexToSelect = -1;

            // Enter picture variation for the first time
            if (CurrentVariantCategory.Text == TextCollection.PictureSlidesLabText.VariantCategoryPicture &&
                !_isPictureVariationInit)
            {
                _8PicturesInPictureVariation = GetLast8Pictures(targetVariationSelectedIndex);
                _isPictureVariationInit      = true;
            }
            // Enter picture variation again
            else if (CurrentVariantCategory.Text == TextCollection.PictureSlidesLabText.VariantCategoryPicture &&
                     _isPictureVariationInit)
            {
                var isPictureSwapped = false;
                for (var i = 0; i < _8PicturesInPictureVariation.Count; i++)
                {
                    // swap the picture to the current selected id in
                    // variation list
                    var picture = _8PicturesInPictureVariation[i];
                    if ((ImageSelectionListSelectedItem.ImageItem == null &&
                         picture.ImageFile == StoragePath.NoPicturePlaceholderImgPath) ||
                        (ImageSelectionListSelectedItem.ImageItem != null &&
                         picture.ImageFile == ImageSelectionListSelectedItem.ImageItem.ImageFile))
                    {
                        var tempPic = _8PicturesInPictureVariation[targetVariationSelectedIndex];
                        _8PicturesInPictureVariation[targetVariationSelectedIndex]
                            = picture;
                        _8PicturesInPictureVariation[i] = tempPic;
                        isPictureSwapped = true;
                        break;
                    }
                }
                if (!isPictureSwapped)
                {
                    // if the current picture doesn't exist in the _8PicturesInPictureVariation
                    // directly overwrite the existing one at the selected id
                    UpdateSelectedPictureInPictureVariation();
                }
            }
            // Exit picture variation
            else if (_previousVariantsCategory == TextCollection.PictureSlidesLabText.VariantCategoryPicture)
            {
                // use the selected picture in the picture variation to preview
                var targetPicture = _8PicturesInPictureVariation[targetVariationSelectedIndex];
                if (targetPicture.ImageFile != StoragePath.NoPicturePlaceholderImgPath)
                {
                    var indexForTargetPicture = ImageSelectionList.IndexOf(targetPicture);
                    if (indexForTargetPicture == -1)
                    {
                        ImageSelectionList.Add(targetPicture);
                        pictureIndexToSelect = ImageSelectionList.Count - 1;
                    }
                    else
                    {
                        pictureIndexToSelect = indexForTargetPicture;
                    }
                }
                else // target picture is the default picture
                {
                    // enter default picture mode
                    View.EnterDefaultPictureMode();
                    source = View.CreateDefaultPictureItem();
                }
            }

            var variantIndexWithoutEffect = -1;

            for (var i = 0; i < nextCategoryVariants.Count; i++)
            {
                if (nextCategoryVariants[i].IsNoEffect(_styleOptions[targetVariationSelectedIndex]))
                {
                    variantIndexWithoutEffect = i;
                    break;
                }
            }
            // swap the no-effect variant with the current selected style's corresponding variant
            // so that to achieve an effect: jumpt between different category wont change the
            // selected style
            if (variantIndexWithoutEffect != -1)
            {
                var temp = nextCategoryVariants[variantIndexWithoutEffect];
                nextCategoryVariants[variantIndexWithoutEffect] =
                    nextCategoryVariants[targetVariationSelectedIndex];
                nextCategoryVariants[targetVariationSelectedIndex] = temp;
            }

            for (var i = 0; i < nextCategoryVariants.Count && i < _styleOptions.Count; i++)
            {
                nextCategoryVariants[i].Apply(_styleOptions[i]);
            }

            _previousVariantsCategory = currentVariantsCategory;
            Logger.Log("picture index to select is " + pictureIndexToSelect);
            if (pictureIndexToSelect == -1 ||
                pictureIndexToSelect == ImageSelectionListSelectedId.Number)
            {
                UpdateStylesVariationImagesAfterOpenFlyout(source, contentSlide,
                                                           slideWidth, slideHeight);
            }
            else
            {
                ImageSelectionListSelectedId.Number = pictureIndexToSelect;
            }
            Logger.Log("Step by step preview done");
        }
Пример #38
0
 private static string GetSlideUrl(Slide slide)
 {
     return(slide.Index.ToString("000") + ".html");
 }
Пример #39
0
        public static System.Web.WebPages.HelperResult Page(Course course, Slide slide, TocModel toc, IEnumerable <string> cssFiles, IEnumerable <string> jsFiles)
        {
            return(new System.Web.WebPages.HelperResult(__razor_helper_writer => {
                WebViewPage.WriteLiteralTo(@__razor_helper_writer, "\t<html>\r\n\t<head>\r\n\t\t<title>Preview: ");


                WebViewPage.WriteTo(@__razor_helper_writer, course.Title);

                WebViewPage.WriteLiteralTo(@__razor_helper_writer, " — ");


                WebViewPage.WriteTo(@__razor_helper_writer, slide.Title);

                WebViewPage.WriteLiteralTo(@__razor_helper_writer, "</title>\r\n\t\t<link rel=\"shortcut icon\" href=\"favicon.ico?v=1\" />\r\n\t\t<meta charset=" +
                                           "\'UTF-8\'>\r\n");


                foreach (var cssFile in cssFiles)
                {
                    WebViewPage.WriteLiteralTo(@__razor_helper_writer, "\t\t\t<link href=\'");


                    WebViewPage.WriteTo(@__razor_helper_writer, cssFile);

                    WebViewPage.WriteLiteralTo(@__razor_helper_writer, "\' rel=\'stylesheet\' />\r\n");
                }

                WebViewPage.WriteLiteralTo(@__razor_helper_writer, "\t</head>\r\n\t<body>\r\n\t\t<div class=\'side-bar navbar-collapse collapse navbar-nav con" +
                                           "tainer\'>\r\n\t\t\t");


                WebViewPage.WriteTo(@__razor_helper_writer, TableOfContents.Toc(toc));

                WebViewPage.WriteLiteralTo(@__razor_helper_writer, "\r\n\t\t</div>\r\n\r\n\t\t<div class=\"slide-container\">\r\n\t\t\t<div class=\"container body-cont" +
                                           "ent\">\r\n\t\t\t\t<div class=\"row\">\r\n\t\t\t\t\t");


                WebViewPage.WriteTo(@__razor_helper_writer, SlideHtml.Slide(new BlockRenderContext(course, slide, "/static/",
                                                                                                   slide.Blocks.Select(
                                                                                                       (b, i) => b is ExerciseBlock
                                                                ? new ExerciseBlockData(course.Id, (ExerciseSlide)slide)
                {
                    RunSolutionUrl = "/" + slide.Index.ToString("000") + ".html?query=submit", DebugView = true, IsGuest = false
                }
                                                                : b is AbstractQuestionBlock
                                                                        ? new QuizBlockData(new QuizModel
                {
                    AnswersToQuizes = slide.Blocks.OfType <AbstractQuestionBlock>().ToDictionary(x => x.Id, x => new List <UserQuiz>()),
                    Slide = (QuizSlide)slide
                }, i, QuizState.Total)
                                                                        : (dynamic)null
                                                                                                       ).ToArray(),
                                                                                                   false,
                                                                                                   true
                                                                                                   ),
                                                                            null));

                WebViewPage.WriteLiteralTo(@__razor_helper_writer, "\r\n\t\t\t\t</div>\r\n\t\t\t</div>\r\n\t\t</div>\r\n\r\n\r\n");


                foreach (var jsFile in jsFiles)
                {
                    WebViewPage.WriteLiteralTo(@__razor_helper_writer, "\t\t\t<script src=\'");


                    WebViewPage.WriteTo(@__razor_helper_writer, jsFile);

                    WebViewPage.WriteLiteralTo(@__razor_helper_writer, "\'></script>\r\n");
                }

                WebViewPage.WriteLiteralTo(@__razor_helper_writer, "\t</body>\r\n</html>\r\n");
            }));
        }
Пример #40
0
 public void SetPrevSlide(Slide slide)
 {
     PrevSlide = slide;
 }
Пример #41
0
        private void btnCreateMovie_Click(object sender, EventArgs e)
        {
            if (!_imageToVideo.IsRunning)
            {
                SaveFileDialog dlg = new SaveFileDialog();
                dlg.Filter = "WMV files (*.wmv)|*.wmv|AVI files (*.avi)|*.avi|All files (*.*)|*.*";

                if (tabControl2.SelectedIndex == 0)
                {
                    dlg.DefaultExt  = "*.wmv";
                    dlg.FilterIndex = 1;
                }
                else
                {
                    dlg.DefaultExt  = "*.avi";
                    dlg.FilterIndex = 2;
                }

                dlg.FileName = "movie";
                dlg.Title    = "Save generated video as";

                if (String.IsNullOrEmpty(Settings.Default.LastUsedFolder2))
                {
                    Settings.Default.LastUsedFolder2 = Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments);
                }

                dlg.InitialDirectory = Settings.Default.LastUsedFolder2;

                if (dlg.ShowDialog() == DialogResult.OK)
                {
                    Settings.Default.LastUsedFolder2 = Path.GetDirectoryName(dlg.FileName);

                    int   intValue;
                    float floatValue;

                    _imageToVideo.AutoFitImages   = cbAutoFitImages.Checked;
                    _imageToVideo.KeepAspectRatio = cbKeepAspectRatio.Checked;
                    _imageToVideo.BackgroundColor = (uint)ColorTranslator.ToOle(btnBackgroundColor.BackColor);

                    if (tbBackgroundImage.Text.Length > 0)
                    {
                        _imageToVideo.SetBackgroundPictureFileName(tbBackgroundImage.Text);
                    }

                    if (int.TryParse(tbMovieWidth.Text, out intValue))
                    {
                        _imageToVideo.OutputWidth = intValue;
                    }
                    if (int.TryParse(tbMovieHeight.Text, out intValue))
                    {
                        _imageToVideo.OutputHeight = intValue;
                    }

                    if (tbAudioTrack.Text.Length > 0)
                    {
                        _imageToVideo.ExternalAudioTrackFromFileName = tbAudioTrack.Text;
                    }

                    _imageToVideo.CurrentAudioCodec     = cmbAviAudioCodecs.SelectedIndex;
                    _imageToVideo.CurrentVideoCodec     = cmbAviVideoCodecs.SelectedIndex;
                    _imageToVideo.CurrentWMVAudioCodec  = cmbWmvAudioCodecs.SelectedIndex;
                    _imageToVideo.CurrentWMVAudioFormat = cmbWmvAudioFormats.SelectedIndex;
                    _imageToVideo.CurrentWMVVideoCodec  = cmbWmvVideoCodecs.SelectedIndex;

                    if (int.TryParse(tbBitrate.Text, out intValue))
                    {
                        _imageToVideo.WMVVideoBitrate = intValue * 1024;
                    }

                    if (float.TryParse(tbFPS.Text, out floatValue))
                    {
                        _imageToVideo.FPS = floatValue;
                    }

                    _outputFile = dlg.FileName;
                    _imageToVideo.OutputVideoFileName = _outputFile;
                    _imageToVideo.SetProgressNotifyWindow(Handle.ToInt32(), WM_CONVERSION_PROGRESS, 0);

                    _imageToVideo.Slides.Clear();

                    foreach (ListViewItem item in lvInputFiles.Items)
                    {
                        SlideOptions slideInfo = (SlideOptions)item.Tag;
                        Slide        slide     = _imageToVideo.AddImageFromFileName(slideInfo.ImageFile);
                        slide.Duration          = slideInfo.SlideDuration;
                        slide.RotationAngle     = slideInfo.SlideRotation;
                        slide.VisualEffect      = slideInfo.VisualEffect;
                        slide.Effect            = slideInfo.VisualEffectTransition;
                        slide.EffectDuration    = slideInfo.VisualEffectDuration;
                        slide.InEffect          = slideInfo.RandomTransitionEffectBefore ? GetRandomEffect() : slideInfo.TransitionEffectBefore;
                        slide.InEffectDuration  = slideInfo.TransitionEffectBeforeDuration;
                        slide.OutEffect         = slideInfo.RandomTransitionEffectAfter ? GetRandomEffect() : slideInfo.TransitionEffectAfter;
                        slide.OutEffectDuration = slideInfo.TransitionEffectAfterDuration;
                    }

                    _imageToVideo.Run();

                    toolStripStatusLabel1.Text = "Generating video...";
                    btnCreateMovie.Text        = "Stop";
                    btnCreateMovie.Image       = Resources.stop;
                }
            }
            else
            {
                // Stop generation
                _imageToVideo.Stop();

                // wait a bit the converter finished and released resources
                while (_imageToVideo.IsRunning)
                {
                    Thread.Sleep(200);
                }

                toolStripStatusLabel1.Text  = "Interrupted by user.";
                btnCreateMovie.Text         = "Create Movie";
                btnCreateMovie.Image        = Resources.film;
                toolStripProgressBar1.Value = 0;
            }
        }
Пример #42
0
 public void Edit(Slide obj)
 {
     _entities.Entry(obj).State = EntityState.Modified;
     _entities.SaveChanges();
 }
Пример #43
0
 public void Add(Slide obj)
 {
     _entities.Slides.Add(obj);
     _entities.SaveChanges();
 }
Пример #44
0
 public Slide Add(Slide slide)
 {
     return(_slideRepository.Add(slide));
 }
Пример #45
0
 public void AddPictureCitationSlide(Slide slide, List <PowerPointSlide> allSlides)
 {
     new PictureCitationSlide(slide, allSlides).CreatePictureCitations();
 }
Пример #46
0
        private string RenderSlide(Slide slide)
        {
            var page = StandaloneLayout.Page(course, slide, CreateToc(slide), GetCssFiles(), GetJsFiles());

            return("<!DOCTYPE html>\n" + page.ToHtmlString());
        }
Пример #47
0
        /// <summary>
        /// Add image by downloading
        /// </summary>
        /// <param name="downloadLink"></param>
        /// <param name="contentSlide"></param>
        /// <param name="slideWidth"></param>
        /// <param name="slideHeight"></param>
        public void AddImageSelectionListItem(string downloadLink,
                                              Slide contentSlide, float slideWidth, float slideHeight)
        {
            if (StringUtil.IsEmpty(downloadLink) || !UrlUtil.IsUrlValid(downloadLink)) // Case 1: If url not valid
            {
                View.ShowErrorMessageBox(TextCollection.PictureSlidesLabText.ErrorUrlLinkIncorrect);
                Logger.Log("Url link error when add internet image");
                return;
            }
            var item = new ImageItem
            {
                ImageFile   = StoragePath.LoadingImgPath,
                ContextLink = downloadLink,
                Source      = downloadLink
            };

            UrlUtil.GetMetaInfo(ref downloadLink, item);
            ImageSelectionList.Add(item);
            IsActiveDownloadProgressRing.Flag = true;

            var imagePath = StoragePath.GetPath("img-"
                                                + DateTime.Now.GetHashCode() + "-"
                                                + Guid.NewGuid().ToString().Substring(0, 7));

            ImageDownloader
            .Get(downloadLink, imagePath)
            .After(() =>
            {
                try
                {
                    Logger.Log("Add internet picture begins");
                    VerifyIsProperImage(imagePath);     // Case 2: not a proper image
                    item.UpdateDownloadedImage(imagePath);
                    UpdatePictureInPictureVariationWhenAddedNewOne(item);
                    if (ImageSelectionListSelectedItem.ImageItem != null &&
                        imagePath == ImageSelectionListSelectedItem.ImageItem.FullSizeImageFile)
                    {
                        UpdatePreviewImages(ImageSelectionListSelectedItem.ImageItem,
                                            contentSlide, slideWidth, slideHeight);
                    }
                    else if (IsInPictureVariation())
                    {
                        UpdatePreviewImages(
                            ImageSelectionListSelectedItem.ImageItem ?? View.CreateDefaultPictureItem(),
                            contentSlide, slideWidth, slideHeight);
                    }
                    Logger.Log("Add internet picture ends");
                }
                catch (Exception e)
                {
                    View.ShowErrorMessageBox(TextCollection.PictureSlidesLabText.ErrorImageDownloadCorrupted);
                    ImageSelectionList.Remove(item);
                    Logger.LogException(e, "AddImageSelectionListItem (download)");
                }
                finally
                {
                    IsActiveDownloadProgressRing.Flag = false;
                }
            })
            // Case 3: Possibly network timeout
            .OnError(e =>
            {
                IsActiveDownloadProgressRing.Flag = false;
                ImageSelectionList.Remove(item);
                View.ShowErrorMessageBox(TextCollection.PictureSlidesLabText.ErrorFailedToLoad + e.Message);
            })
            .Start();
        }
 public void Update(Slide entity)
 {
     _SlideRepository.Update(entity);
 }
Пример #49
0
        /// <summary>
        /// Install plugin
        /// </summary>
        public override void Install()
        {
            //settings
            var settings = new qBoSliderSettings
            {
                AutoPlay                = true,
                AutoPlayInterval        = 3000,
                SlideDuration           = 500,
                MinDragOffsetToSlide    = 20,
                SlideSpacing            = 0,
                BulletNavigationDisplay = 2,
                ArrowNavigationDisplay  = 1,
                WidgetZoneName          = "home_page_top"
            };

            _settingService.SaveSetting(settings);

            //install simple data
            //get sample pictures path
            var sampleImagesPath = CommonHelper.DefaultFileProvider.MapPath("~/Plugins/Widgets.qBoSlider/Content/sample-images/");
            //var slides = _sliderContext.Set<Slide>();

            var picture1 = _pictureService.InsertPicture(File.ReadAllBytes(string.Format("{0}banner1.jpg", sampleImagesPath)), "image/pjpeg", "qboslide-1").Id;
            var slide1   = new Slide()
            {
                Description = "<div style='color: #111; margin-top: 5%; margin-left: 5%; font-size: 16pt; font-family: arial,helvetica,sans-serif;'>" +
                              "<p style='margin: 0px;'><span style='font-family: tahoma,arial,helvetica,sans-serif;'><strong>NEW COMFORT MOUSE<br /></strong></span></p>" +
                              "<p style='margin-top: 10px; margin-bottom: 0px;'><span style='font-size: 12pt; font-family: tahoma,arial,helvetica,sans-serif;'><strong>CHOOSE FROM HUNDREDS<br /></strong></span></p>" +
                              "<p style='margin-top: 5px; margin-bottom: 0px;'><span style='font-size: 12pt; font-family: tahoma,arial,helvetica,sans-serif;'><strong>OF MODELS</strong></span></p>" +
                              "<p style='margin-top: 25px; color: #44b4f4; font-weight: bold;'><span style='font-size: 15pt; font-family: tahoma,arial,helvetica,sans-serif;'>FROM ONLY $59.00</span></p>" +
                              "<p style='margin-top: 10px;'><span style='font-size: 10pt; padding: 5px 10px; background: none repeat scroll 0% 0% #44b4f4; color: #ffffff; border-radius: 5px; font-family: tahoma,arial,helvetica,sans-serif;'><strong>SHOP NOW</strong></span></p></div>",
                PictureId = picture1,
                Published = true
            };

            _slideService.InsertSlide(slide1);

            var picture2 = _pictureService.InsertPicture(File.ReadAllBytes(string.Format("{0}banner2.jpg", sampleImagesPath)), "image/pjpeg", "qboslide-2").Id;
            var slide2   = new Slide()
            {
                Description = "<div style='color: #111; margin-top: 5%; margin-left: 5%; font-size: 16pt; font-family: arial,helvetica,sans-serif;'>" +
                              "<p style='margin: 0px;'><span style='font-family: tahoma,arial,helvetica,sans-serif;'><strong>HD PRO WEBCAM H320<br /></strong></span></p>" +
                              "<p style='margin-top: 10px; margin-bottom: 0px;'><span style='font-size: 12pt; font-family: tahoma,arial,helvetica,sans-serif;'><strong>720P FOR TRUE HD-QUALITY<br />VIDEO CHAT<br /></strong></span></p>" +
                              "<p style='margin-top: 25px; color: #44b4f4; font-weight: bold;'><span style='font-size: 15pt; font-family: tahoma,arial,helvetica,sans-serif;'>ONLY $79.00</span></p>" +
                              "<p style='margin-top: 10px;'><span style='font-size: 10pt; padding: 5px 10px; background: none repeat scroll 0% 0% #44b4f4; color: #ffffff; border-radius: 5px; font-family: tahoma,arial,helvetica,sans-serif;'><strong>SHOP NOW</strong></span></p></div>",
                PictureId = picture2,
                Published = true,
            };

            _slideService.InsertSlide(slide2);

            var picture3 = _pictureService.InsertPicture(File.ReadAllBytes(string.Format("{0}banner3.jpg", sampleImagesPath)), "image/pjpeg", "qboslide-3").Id;
            var slide3   = new Slide()
            {
                Description = "<div style='color: #111; margin-top: 5%; margin-left: 5%; font-size: 16pt; font-family: arial,helvetica,sans-serif;'>" +
                              "<p style='margin: 0px;'><span style='font-family: tahoma,arial,helvetica,sans-serif;'><strong>COMPACT CAMERA SP120</strong></span></p>" +
                              "<p style='margin-top: 10px; margin-bottom: 0px;'><span style='font-size: 12pt; font-family: tahoma,arial,helvetica,sans-serif;'><strong>20X WIDE ZOOM, 2.5 LCD, </strong></span></p>" +
                              "<p style='margin-top: 5px; margin-bottom: 0px;'><span style='font-size: 12pt; font-family: tahoma,arial,helvetica,sans-serif;'><strong>720P HD VIDEO</strong></span></p>" +
                              "<p style='margin-top: 25px; color: #44b4f4; font-weight: bold;'><span style='font-size: 15pt; font-family: tahoma,arial,helvetica,sans-serif;'>ONLY $159.00</span></p>" +
                              "<p style='margin-top: 10px;'><span style='font-size: 10pt; padding: 5px 10px; background: none repeat scroll 0% 0% #44b4f4; color: #ffffff; border-radius: 5px; font-family: tahoma,arial,helvetica,sans-serif;'><strong>SHOP NOW</strong></span></p>" +
                              "</div>",
                PictureId = picture3,
                Published = true
            };

            _slideService.InsertSlide(slide3);

            base.Install();
        }
Пример #50
0
 private static bool IsAbleToUpdateStylesPreviewImages(ImageItem source, Slide contentSlide)
 {
     return(!(source == null ||
              source.ImageFile == StoragePath.LoadingImgPath ||
              contentSlide == null));
 }
Пример #51
0
        // GET: Admin/Slides/Create
        public IActionResult Create()
        {
            var slide = new Slide();

            return(View(slide));
        }
Пример #52
0
 // convenience method.
 public static bool IsNotReferenceslide(Slide slide)
 {
     return(!IsReferenceslide(slide));
 }
 public void Delete(Slide entity)
 {
     _SlideRepository.Delete(entity);
 }
Пример #54
0
        /// <summary>
        /// This method implements the way to guide the user step by step to customize
        /// style
        /// </summary>
        public void UpdateStepByStepStylesVariationImages(ImageItem source, Slide contentSlide,
                                                          float slideWidth, float slideHeight)
        {
            if (StylesVariationListSelectedId.Number < 0 ||
                VariantsCategory.Count == 0)
            {
                return;
            }

            var targetVariationSelectedIndex = StylesVariationListSelectedId.Number;
            var targetVariant = _styleVariants[_previousVariantsCategory][targetVariationSelectedIndex];

            foreach (var option in _styleOptions)
            {
                targetVariant.Apply(option);
            }

            var currentVariantsCategory = CurrentVariantCategory.Text;

            if (currentVariantsCategory != TextCollection.PictureSlidesLabText.VariantCategoryFontColor &&
                _previousVariantsCategory != TextCollection.PictureSlidesLabText.VariantCategoryFontColor)
            {
                // apply font color variant,
                // because default styles may contain special font color settings, but not in variants
                var fontColorVariant = new StyleVariants(new Dictionary <string, object>
                {
                    { "FontColor", _styleOptions[targetVariationSelectedIndex].FontColor }
                });
                foreach (var option in _styleOptions)
                {
                    fontColorVariant.Apply(option);
                }
            }

            var nextCategoryVariants      = _styleVariants[currentVariantsCategory];
            var variantIndexWithoutEffect = -1;

            for (var i = 0; i < nextCategoryVariants.Count; i++)
            {
                if (nextCategoryVariants[i].IsNoEffect(_styleOptions[targetVariationSelectedIndex]))
                {
                    variantIndexWithoutEffect = i;
                    break;
                }
            }
            // swap the no-effect variant with the current selected style's corresponding variant
            // so that to achieve an effect: jumpt between different category wont change the
            // selected style
            if (variantIndexWithoutEffect != -1)
            {
                var temp = nextCategoryVariants[variantIndexWithoutEffect];
                nextCategoryVariants[variantIndexWithoutEffect] =
                    nextCategoryVariants[targetVariationSelectedIndex];
                nextCategoryVariants[targetVariationSelectedIndex] = temp;
            }

            for (var i = 0; i < nextCategoryVariants.Count && i < _styleOptions.Count; i++)
            {
                nextCategoryVariants[i].Apply(_styleOptions[i]);
            }

            _previousVariantsCategory = currentVariantsCategory;
            UpdateStylesVariationImagesAfterOpenFlyout(source, contentSlide,
                                                       slideWidth, slideHeight);
        }
 public Slide Insert(Slide entity)
 {
     return(_SlideRepository.Add(entity));
 }
Пример #56
0
 public void RenderSlideToFile(Slide slide, string directory)
 {
     File.WriteAllText(Path.Combine(directory, GetSlideUrl(slide)), RenderSlide(slide));
 }
Пример #57
0
 public void ExistanceTest()
 {
     var slide = new Slide();
 }
 public void Add(Slide s)
 {
     this.slides.Add(s);
 }
Пример #59
0
 public static bool IsAnyAgendaSlide(Slide slide)
 {
     return(Decode(slide) != null);
 }
Пример #60
0
        public bool Insert(Guid websiteId, Slide slide, string url)
        {
            try
            {
                this.ConnectionHandler.StartTransaction(IsolationLevel.ReadUncommitted);
                this.SliderConnection.StartTransaction(IsolationLevel.ReadUncommitted);
                slide.IsExternal = true;

                if (!SliderComponent.Instance.SlideTransactionalFacade(this.SliderConnection).Insert(slide))
                {
                    throw new Exception("خطایی درذخیره گالری وجود دارد");
                }
                var congessSlide = new DataStructure.Slider()
                {
                    SlideId = slide.Id, WebId = websiteId
                };
                if (!new SliderBO().Insert(this.ConnectionHandler, congessSlide))
                {
                    throw new Exception("خطایی درذخیره گالری وجود دارد");
                }
                if (!string.IsNullOrEmpty(url))
                {
                    var configurationBo = new ConfigurationBO();
                    var config          = configurationBo.Get(this.ConnectionHandler, websiteId);
                    if (config == null)
                    {
                        return(false);
                    }
                    switch (url)
                    {
                    case "1":
                        config.BigSlideId = slide.Id;
                        break;

                    case "0":
                        config.AverageSlideId = slide.Id;
                        break;

                    case "-1":
                        config.MiniSlideId = slide.Id;
                        break;
                    }
                    if (!configurationBo.Update(this.ConnectionHandler, config))
                    {
                        throw new Exception("خطایی درذخیره تنظیمات وجود دارد");
                    }
                }
                this.ConnectionHandler.CommitTransaction();
                this.SliderConnection.CommitTransaction();
                return(true);
            }
            catch (KnownException knownException)
            {
                this.ConnectionHandler.RollBack();
                this.SliderConnection.RollBack();
                throw new KnownException(knownException.Message, knownException);
            }
            catch (Exception ex)
            {
                this.ConnectionHandler.RollBack();
                this.SliderConnection.RollBack();
                throw new KnownException(ex.Message, ex);
            }
        }