Esempio n. 1
0
 void Start()
 {
     instance    = this;
     answer      = 0;
     question    = new int[3];
     question[0] = 9;
     question[1] = 6;
     question[2] = 2;
     if (index == 1)
     {
         questions[0].gameObject.SetActive(true);
         questions[0].gameObject.SetActive(false);
         questions[0].gameObject.SetActive(false);
     }
     if (index == 1)
     {
         questions[0].gameObject.SetActive(false);
         questions[0].gameObject.SetActive(true);
         questions[0].gameObject.SetActive(false);
     }
     if (index == 2)
     {
         questions[0].gameObject.SetActive(false);
         questions[1].gameObject.SetActive(false);
         questions[2].gameObject.SetActive(true);
     }
 }
Esempio n. 2
0
        public void ApplyDefaultChapterSequencing()
        {
            var seq = new Sequencing();

            SequencingPatternManager.ApplyDefaultChapterSequencing(seq);

            Assert.AreEqual(seq.ControlMode.Flow, true);
            Assert.AreEqual(seq.ControlMode.Choice, true);
        }
Esempio n. 3
0
        public string ToString(HL7Table.HL7Version version)
        {
            List <string> lst = new List <string>()
            {
                SortBy.ToString(version),
                Sequencing.Value()
            };

            return(string.Join("^", lst));
        }
Esempio n. 4
0
        public void ApplyRandomSetSequencingPattern()
        {
            var       seq   = new Sequencing();
            const int count = 10;

            SequencingPatternManager.ApplyRandomSetSequencingPattern(seq, count);

            Assert.AreEqual(seq.RandomizationControls.ReorderChildren, true);
            Assert.AreEqual(seq.RandomizationControls.SelectionTiming, Timing.Once);
            Assert.AreEqual(seq.RandomizationControls.SelectCount, count);
        }
Esempio n. 5
0
        public static Sequencing ApplyDefaultChapterSequencing(Sequencing sequencing)
        {
            sequencing.ControlMode           = new ControlMode();
            sequencing.LimitConditions       = null;
            sequencing.RandomizationControls = null;

            sequencing.ControlMode.Choice = true;
            sequencing.ControlMode.Flow   = true;

            return(sequencing);
        }
        public static Sequencing ApplyDefaultChapterSequencing(Sequencing sequencing)
        {
            if (sequencing.ControlMode == null)
            {
                sequencing.ControlMode = new ControlMode();
            }
            sequencing.ControlMode.Choice = true;
            sequencing.ControlMode.Flow   = true;

            return(sequencing);
        }
Esempio n. 7
0
        public void ApplyControlChapterSequencing()
        {
            var seq = new Sequencing();

            SequencingPatternManager.ApplyControlChapterSequencing(seq);

            Assert.AreEqual(seq.ControlMode.Choice, false);
            Assert.AreEqual(seq.ControlMode.Flow, true);
            Assert.AreEqual(seq.ControlMode.ForwardOnly, true);
            Assert.AreEqual(seq.ControlMode.ChoiceExit, false);
            Assert.AreEqual(seq.LimitConditions.AttemptLimit, 1);
        }
Esempio n. 8
0
        public static Sequencing ApplyRandomSetSequencingPattern(Sequencing sequencing, int selectCount)
        {
            sequencing.RandomizationControls = new RandomizationControls();
            sequencing.ControlMode           = new ControlMode();
            sequencing.LimitConditions       = null;

            sequencing.RandomizationControls.ReorderChildren = true;
            sequencing.RandomizationControls.SelectionTiming = Timing.Once;
            sequencing.RandomizationControls.SelectCount     = selectCount;

            return(sequencing);
        }
Esempio n. 9
0
        public virtual void Parse(int courseId)
        {
            var db     = this.GetDbContext();
            var course = db.Courses.Single(c => c.Id == courseId);

            if (!course.Locked.Value)
            {
                return;
            }

            var coursePath     = this.GetCoursePath(course.Id);
            var courseTempPath = this.GetCourseTempPath(course.Id);
            var manifestPath   = Path.Combine(courseTempPath, SCORM.ImsManifset);

            Zipper.ExtractZipFile(coursePath + ".zip", courseTempPath);

            var manifest = Manifest.Deserialize(manifestPath);

            var importer = new Importer(manifest, course, this);

            importer.Import();

            // QUICK FIX for importing images
            var imagesPath = Path.Combine(courseTempPath, "Node");

            if (Directory.Exists(imagesPath))
            {
                FileHelper.DirectoryCopy(imagesPath, Path.Combine(coursePath, "Node"));
            }

            // QUICK FIX for "Row not found or changed." exception
            db            = this.GetDbContext();
            course        = db.Courses.Single(c => c.Id == courseId);
            course.Locked = false;

            var xml = new XmlSerializer(typeof(Sequencing));

            // try to apply sequencing from imported course
            try
            {
                var sequencing = manifest.SequencingCollection.Sequencings[0];
                course.Sequencing = xml.SerializeToXElemet(sequencing);
            }
            catch (Exception) // apply default sequencing if any errors occured
            {
                var sequencing = new Sequencing();
                sequencing        = SequencingPatternManager.ApplyDefaultChapterSequencing(sequencing);
                course.Sequencing = xml.SerializeToXElemet(sequencing);
            }

            db.SubmitChanges();
        }
Esempio n. 10
0
        public static Sequencing ApplyControlChapterSequencing(Sequencing sequencing)
        {
            sequencing.ControlMode           = new ControlMode();
            sequencing.LimitConditions       = new LimitConditions();
            sequencing.RandomizationControls = null;

            sequencing.ControlMode.Choice      = false;
            sequencing.ControlMode.Flow        = true;
            sequencing.ControlMode.ForwardOnly = true;
            sequencing.ControlMode.ChoiceExit  = false;


            sequencing.LimitConditions.AttemptLimit = 1;

            return(sequencing);
        }
Esempio n. 11
0
        //private bool _part6Compete;
        private void Part6Button_Click(object sender, RoutedEventArgs e)
        {
            _sequenceLayers = _interpolationPointLayers.ToDictionary(ci => ci.Key, ci => new Layer <SequencePath>
            {
                Paths = ci.Value.Paths.Select(path => new SequencePath
                {
                    Path      = path,
                    Sequences = Sequencing.Create(path.Points.Select(p => p.Direction).ToList()).ToList()
                }).ToList()
            });
            var sequences = _sequenceLayers.SelectMany(cl => cl.Value.Paths.SelectMany(p => p.Sequences.Select(s => new { Color = cl.Key }))).ToList();

            Part6ComboBox.ItemsSource = sequences.Select((cs, i) => new ColorSelectionItem(cs.Color, i)).ToList();
            SequenceCount.Content     = sequences.Count;
            Part6Button.IsEnabled     = false;
        }
Esempio n. 12
0
        ////////////////////////////////////////////////////////////

        // Tracing ImageData, then returning PaddedPaletteImage with tracedata in layers
        private static TracedImage PaddedPaletteImageToTraceData(Bitmap image, Tracing tracing, SvgRendering rendering)
        {
            // Selective Gaussian blur preprocessing
            //if (options.Blur.BlurRadius > 0)
            //{
            //    // TODO: This seems to not work currently.
            //    imgd = Blur(imgd, options.Blur.BlurRadius, options.Blur.BlurDelta);
            //}

            // 1. Color quantization
            var colors      = image.ChangeFormat(PixelFormat.Format32bppArgb).ToColorReferences();
            var colorGroups = ColorGrouping.Convert(colors, image.Width, image.Height, Palette);
            // 2. Layer separation and edge detection
            var rawLayers = Layering.Convert(colorGroups, image.Width, image.Height, Palette);
            // 3. Batch pathscan
            var pathPointLayers = rawLayers.ToDictionary(cl => cl.Key, cl => new Layer <PathPointPath>
            {
                Paths = Pathing.Scan(cl.Value, tracing.PathOmit).ToList()
            });
            // 4. Batch interpollation
            var interpolationPointLayers = pathPointLayers.ToDictionary(cp => cp.Key, cp => Interpolation.Convert(cp.Value));
            // 5. Batch tracing
            var sequenceLayers = interpolationPointLayers.ToDictionary(ci => ci.Key, ci => new Layer <SequencePath>
            {
                Paths = ci.Value.Paths.Select(path => new SequencePath
                {
                    Path      = path,
                    Sequences = Sequencing.Create(path.Points.Select(p => p.Direction).ToList()).ToList()
                }).ToList()
            });

            var segmentLayers = sequenceLayers.ToDictionary(ci => ci.Key, ci => new Layer <SegmentPath>
            {
                Paths = ci.Value.Paths.Select(path => new SegmentPath
                {
                    Segments = path.Sequences.Select(s => Segmentation.Fit(path.Path.Points, s, tracing, rendering)).SelectMany(s => s).ToList()
                }).ToList()
            });

            return(new TracedImage(segmentLayers, image.Width, image.Height));
        }
 public EnumerationBenchmarks(Func <uint, Enumerations <uint> > classics, Sequencing <uint> subject)
 {
     _classics = classics;
     _subject  = subject;
 }
Esempio n. 14
0
        private ActivityDefinition GetActivityInteraction(int interactionIndex)
        {
            ActivityDefinition interactionDef = null;

            using (SqlConnection connection = new SqlConnection(DbUtils.GetConnectionString()))
            {
                SqlDataReader reader  = null;
                SqlCommand    command = new SqlCommand(GetActivityInteractionQuery, connection);
                command.Parameters.AddWithValue("@id", interactionIndex);
                try
                {
                    connection.Open();
                    reader = command.ExecuteReader();
                    if (reader.Read())
                    {
                        InteractionType type = reader.GetString(1);
                        interactionDef = type.CreateInstance(new JObject(), ApiVersion.GetLatest());
                        if (!reader.IsDBNull(2))
                        {
                            JsonString json  = reader.GetString(2);
                            var        sList = new List <string>();
                            var        crp   = json.ToJArray();
                            foreach (var jstring in crp)
                            {
                                sList.Add(jstring.Value <string>());
                            }
                            (interactionDef as InteractionActivityDefinitionBase).CorrectResponsesPattern = sList.ToArray();
                        }
                        if (!reader.IsDBNull(3))
                        {
                            Choice     cho = interactionDef as Choice;
                            Sequencing seq = interactionDef as Sequencing;
                            if (cho != null)
                            {
                                cho.Choices = new InteractionComponentCollection(reader.GetString(3));
                            }
                            else if (seq != null)
                            {
                                seq.Choices = new InteractionComponentCollection(reader.GetString(3));
                            }
                        }
                        if (!reader.IsDBNull(4))
                        {
                            Likert def = interactionDef as Likert;
                            if (def != null)
                            {
                                def.Scale = new InteractionComponentCollection(reader.GetString(4));
                            }
                        }
                        if (!reader.IsDBNull(5))
                        {
                            Matching match = interactionDef as Matching;
                            if (match != null)
                            {
                                match.Source = new InteractionComponentCollection(reader.GetString(5));
                            }
                        }
                        if (!reader.IsDBNull(6))
                        {
                            Matching match = interactionDef as Matching;
                            if (match != null)
                            {
                                match.Target = new InteractionComponentCollection(reader.GetString(6));
                            }
                        }
                        if (!reader.IsDBNull(7))
                        {
                            Performance perf = interactionDef as Performance;
                            if (perf != null)
                            {
                                perf.Steps = new InteractionComponentCollection(reader.GetString(7));
                            }
                        }
                    }
                }
                catch (Exception ex)
                {
                    return(null);
                }
                finally
                {
                    if (reader != null && !reader.IsClosed)
                    {
                        reader.Close();
                    }
                }
            }
            return(interactionDef);
        }
Esempio n. 15
0
        public void SequencingTest()
        {
            var sequencing = new Sequencing();

            sequencing.AdlObjectives                   = new AdlObjectives();
            sequencing.AdlObjectives.Objectives        = new List <AdlObjective>();
            sequencing.AuxiliaryResources              = "res";
            sequencing.ConstrainedChoiceConsiderations = new ConstrainedChoiceConsiderations
            {
                ConstrainChoice = true, CourseId = 1, NodeId = 2, PreventActivation = false, Type = "type"
            };
            sequencing.ControlMode = new ControlMode
            {
                Choice      = true,
                ChoiceExit  = false,
                CourseId    = 1,
                Flow        = false,
                ForwardOnly = false,
                NodeId      = 2,
                Type        = "type",
                UseCurrentAttemptObjectiveInfo = false,
                UseCurrentAttemptProgressInfo  = true
            };
            sequencing.DeliveryControls = new DeliveryControls
            {
                CompletionSetByContent = true,
                CourseId = 1,
                NodeId   = 2,
                ObjectiveSetByContent = false,
                Tracked = false,
                Type    = "type"
            };
            sequencing.Id              = "id";
            sequencing.IdRef           = "ref";
            sequencing.LimitConditions = new LimitConditions
            {
                AttemptAbsoluteDurationLimit = "1", AttemptLimit = 0, CourseId = 1, NodeId = 2, Type = "type"
            };

            sequencing.Objectives            = new Objectives();
            sequencing.RandomizationControls = new RandomizationControls
            {
                CourseId            = 1,
                NodeId              = 2,
                RandomizationTiming = Timing.Once,
                ReorderChildren     = true,
                SelectCount         = 1,
                SelectionTiming     = Timing.Never
            };
            sequencing.RollupConsiderations = new RollupConsiderations
            {
                CourseId = 1,
                NodeId   = 2,
                MeasureSatisfactionIfActive = false,
                RequiredForCompleted        = Required.IfNotSkipped,
                RequiredForIncomplete       = Required.IfNotSuspended,
                RequiredForNotSatisfied     = Required.Always,
                RequiredForSatisfied        = Required.IfAttempted,
                Type = "type",
            };
            sequencing.RollupRules = new RollupRules
            {
                CourseId = 1,
                NodeId   = 2,
                ObjectiveMeasureWeight   = 1,
                RollupObjectiveSatisfied = false,
                RollupProgressCompletion = true,
                RollupRulesList          = new List <RollupRule>()
            };
            sequencing.SequencingRules = new SequencingRules
            {
                ExitConditionRule =
                    new Rule
                {
                    RuleAction = new RuleAction {
                        Action = Action.Previous
                    },
                    RuleConditions =
                        new RuleConditions
                    {
                        ConditionCombination = ConditionCombination.All,
                        RuleConditionsList   = new List <RuleCondition>()
                    }
                }
            };
            var rule = new RollupRule
            {
                ChildActivitySet = ChildActivitySet.All,
                CourseId         = 1,
                NodeId           = 2,
                Type             = "type",
                MinimumCount     = 1,
                MinimumPercent   = 1,
                RollupAction     = new RollupAction {
                    Action = RollupActions.Completed
                }
            };
            var con = new RollupConsiderations
            {
                CourseId = 1,
                NodeId   = 2,
                MeasureSatisfactionIfActive = false,
                RequiredForCompleted        = Required.Always,
                RequiredForIncomplete       = Required.IfNotSkipped,
                RequiredForNotSatisfied     = Required.IfNotSkipped,
                RequiredForSatisfied        = Required.IfAttempted,
                Type = "type"
            };

            sequencing.RollupConsiderations = con;
            sequencing.RollupRules          = new RollupRules
            {
                CourseId = 1,
                NodeId   = 2,
                ObjectiveMeasureWeight   = 1,
                RollupObjectiveSatisfied = false,
                RollupProgressCompletion = true,
                RollupRulesList          = new List <RollupRule>()
            };

            sequencing.RollupRules.RollupRulesList.Add(rule);

            var manifest = new Manifest();

            manifest.SequencingCollection             = new SequencingCollection();
            manifest.SequencingCollection.Sequencings = new List <Sequencing>();
            manifest.SequencingCollection.Sequencings.Add(sequencing);

            var path = Path.Combine(this.root, "sequencing.xml");

            manifest.Serialize(new StreamWriter(path));
            Assert.IsTrue(File.Exists(path));
        }