Exemplo n.º 1
0
        public bool Save(SaveTutorialContentInputDto inputDTO)
        {
            TutorialContent tt = this.tutorialContentRepository.FindBy(x => x.ID == inputDTO.ID).FirstOrDefault();

            if (tt == null)
            {
                tt = new TutorialContent();
            }

            tt.ParentID          = inputDTO.ParentID;
            tt.Description       = Cmn.GetCompressed(inputDTO.Description);
            tt.DescriptionLength = inputDTO.Description.Length;
            tt.Title             = inputDTO.Title;
            tt.Type = inputDTO.Type;
            tt.Seq  = inputDTO.Seq;

            if (inputDTO.ID == 0)
            {
                this.tutorialContentRepository.Add(tt);
            }
            else
            {
                this.tutorialContentRepository.Update(tt);
            }

            this.unitOfWork.Commit();

            return(true);
        }
Exemplo n.º 2
0
 private void ChangeActivePage(int pageIndex)
 {
     activePagePosition = pageIndex;
     titleField.text    = titles[pageIndex];
     activePage         = pages[pageIndex];
     UpdatePageNumber(pageIndex);
 }
Exemplo n.º 3
0
        public ContentViewerViewModel(
            IConfiguration config,
            TutorialContent tutorialContent,
            int customisationId,
            int centreId,
            int sectionId,
            int tutorialId,
            int candidateId,
            int progressId
            )
        {
            CustomisationId = customisationId;
            CentreId        = centreId;
            SectionId       = sectionId;
            TutorialId      = tutorialId;
            CandidateId     = candidateId;
            ProgressId      = progressId;

            TutorialName = tutorialContent.TutorialName;
            SectionName  = tutorialContent.SectionName;
            CourseTitle  = tutorialContent.CourseTitle;

            ContentSource = ContentViewerHelper.IsScormPath(tutorialContent.TutorialPath !)
                ? GetScormSource(config, tutorialContent)
                : GetHtmlSource(config, tutorialContent);
        }
Exemplo n.º 4
0
 private string GetScormSource(IConfiguration config, TutorialContent tutorialContent)
 {
     return($"{config.GetScormPlayerUrl()}" +
            $"?CentreID={CentreId}" +
            $"&CustomisationID={CustomisationId}" +
            $"&TutorialID={TutorialId}" +
            $"&CandidateID={CandidateId}" +
            $"&Version={tutorialContent.Version}" +
            $"&tutpath={tutorialContent.TutorialPath}");
 }
Exemplo n.º 5
0
        private TutorialContent LoadTutorialContent()
        {
            TutorialContent result       = null;
            var             resourceName = "";

            foreach (var name in typeof(TutorialService).Assembly.GetManifestResourceNames())
            {
                if (name.ToLower().EndsWith(string.Format(".tutorial-{0}.json", TinyIoCContainer.Current.Resolve <ILocalization>().CurrentLanguage)))
                {
                    resourceName = name;
                    break;
                }
            }

            using (var stream = typeof(TutorialContent).Assembly.GetManifestResourceStream(resourceName))
            {
                if (stream != null)
                {
                    using (var reader = new StreamReader(stream))
                    {
                        var serializedData = reader.ReadToEnd();
                        result = serializedData.FromJson <TutorialContent>();
                    }
                }
            }

            var disabledSlidesString = _settings.Data.DisabledTutorialSlides;

            if (!string.IsNullOrWhiteSpace(disabledSlidesString))
            {
                var disabledSlides = disabledSlidesString
                                     .Split(new [] { ',' }, StringSplitOptions.RemoveEmptyEntries)
                                     .Select(int.Parse);

                var slides = disabledSlides as int[] ?? disabledSlides.ToArray();
                if (slides.Any())
                {
                    if (result != null)
                    {
                        var listOfSlides = result.Items.ToList();
                        foreach (var disabledSlide in slides)
                        {
                            var disabledItem = listOfSlides.FirstOrDefault(x => x.Position == disabledSlide);
                            if (disabledItem != null)
                            {
                                listOfSlides.Remove(disabledItem);
                            }
                        }
                        result.Items = listOfSlides.ToArray();
                    }
                }
            }

            return(result);
        }
Exemplo n.º 6
0
        public bool Delete(int ID)
        {
            TutorialContent tt = this.tutorialContentRepository.FindBy(x => x.ID == ID).FirstOrDefault();

            if (tt != null)
            {
                this.tutorialContentRepository.Delete(tt);
                this.unitOfWork.Commit();
                return(true);
            }
            return(false);
        }
Exemplo n.º 7
0
 private string GetHtmlSource(IConfiguration config, TutorialContent tutorialContent)
 {
     return($"{tutorialContent.TutorialPath}" +
            $"?CentreID={CentreId}" +
            $"&CustomisationID={CustomisationId}" +
            $"&TutorialID={TutorialId}" +
            $"&CandidateID={CandidateId}" +
            $"&Version={tutorialContent.Version}" +
            $"&ProgressID={ProgressId}" +
            "&type=learn" +
            $"&TrackURL={config.GetTrackingUrl()}");
 }
Exemplo n.º 8
0
    public Level(int index, int numberOfClick, TutorialContent tutorialContent, List <BombInfo> bombs, List <WallInfo> walls, ExtraBombInfo[] extraBombs, int normalLevel = 1, int shooterLevel = 1,
                 int waveLevel = 1, int targetLevel = 1, int acidLevel = 1)
    {
        this.index           = index;
        this.numberOfClick   = numberOfClick;
        this.tutorialContent = tutorialContent;
        this.bombs           = bombs;
        this.walls           = walls;
        this.extraBombs      = extraBombs;

        this.normalLevel  = normalLevel;
        this.shooterLevel = shooterLevel;
        this.waveLevel    = waveLevel;
        this.targetLevel  = targetLevel;
        this.acidLevel    = acidLevel;
    }
Exemplo n.º 9
0
 public Level(int index, TutorialContent tutorialContent, List <LadderInfo> ladders)
 {
     this.index           = index;
     this.tutorialContent = tutorialContent;
     this.ladders         = ladders;
 }