public ChooseSuperActionWindow()
 {
     InitializeComponent();
     var mainWin = DesignerMainWindow.GetInstance();
     _selectedActions = new List<int>();
     SuperAction = Practice.GetInstance().GetSlideByPosition(mainWin.GetCurrentSlideNr()).SuperAction;
     foreach (object elem in mainWin.canMainCanvas.Children)
     {
         foreach (StackPanel sp in PutElemInBorder(elem as UIElement))
             if(sp != null)
                 lbActions.Items.Add(sp);
     }
     if (lbActions.Items.IsEmpty)
     {
         lbActions.Items.Add(new TextBlock
             {
                 Text = "Trenutno u vježbi ne postoje akcije, nije moguće uvjetovati navigaciju sa slajda",
                 FontSize = 15,
                 HorizontalAlignment = HorizontalAlignment.Center,
                 VerticalAlignment = VerticalAlignment.Center,
                 TextAlignment = TextAlignment.Justify
             });
     }
 }
 private void AddSuperActionToSlide(Picture correctPic)
 {
     //add SuperAction - can jump to next slide after correctPic is chosen
     IsSwitchable = false;
     var act = new ChangeSlide(EventType.conditionSatisfied, SlideId + 1, SlideId + 1);
     //TODO: pametniji način za slajdId
     var mainWin = DesignerMainWindow.GetInstance();
     SuperAction = new SuperAction(mainWin.GetCurrentSlideId(), act.ActionId, act);
     SuperAction.AddRequiredAction(correctPic.Actions[0].ActionId);
 }
 private void btnSuperAction_Click(object sender, RoutedEventArgs e)
 {
     var w = new JumpToSlideWindow();
     if (w.ShowDialog() != true) return;
     var mainWin = DesignerMainWindow.GetInstance();
    // int slideId = Practice.GetInstance().GetSlideByPosition(mainWin.GetCurrentSlideNr()).SlideId;
     int slideId = Practice.GetInstance().GetSlideByPosition(w.SelectedSlideIndex).SlideId;
     var act = new ChangeSlide(EventType.conditionSatisfied, slideId, w.SelectedSlideIndex);
     SuperAction = new SuperAction(slideId, act.ActionId, act);
 }
Beispiel #4
0
        private XmlElement writeSuperAction(SuperAction superAction, XmlDocument saveFile, XmlElement objectDescription)
        {
            var action = superAction.PerformedAction;
            XmlElement actionElement = saveFile.CreateElement(action.Type.ToString());
            actionElement.SetAttribute("actionID", action.ActionId.ToString());
            actionElement.SetAttribute("event", EventType.onClick.ToString());
            actionElement.SetAttribute("global", true.ToString());
            

            switch (action.Type)
            {
                case ActionType.changeSlide:
                    actionElement = writeChangeSlide(action, actionElement, superAction.SlideId);
                    break;
                case ActionType.changeVisibility:
                    actionElement = writeObjectVisibility(action, actionElement);
                    break;
                case ActionType.playSound:
                    actionElement = writePlaySound(action, actionElement);
                    break;
                case ActionType.playVideo:
                    actionElement = writePlayVideo(action, actionElement);
                    break;
                case ActionType.changeFontSize:
                    actionElement = writeChangeFontSize(action, actionElement);
                    break;
            }


            //Dodijeli svim potrebnim akcijama mandatory atribut
            var allActions = Practice.GetAllActions();
            foreach (var id in superAction.RequiredActions)
            {
                allActions.First(a => a.ActionId == id).Mandatory = true;
            }

            //XmlElement action = saveFile.CreateElement("superAction");
            //action.SetAttribute("superActionId", superAction.SuperActionId.ToString());
            //action.SetAttribute("performedActionId", superAction.ActionId.ToString());
            //action.SetAttribute("requiredActions", superAction.RequiredActions.ToString());
            ////TODO: neznam da li izbacuje sve elemente stringane
            //action.SetAttribute("slideId", superAction.SlideId.ToString());

            objectDescription.AppendChild(actionElement);

            return objectDescription;
        }