Exemple #1
0
        public static new AssessmentModel deserialize(JsonObject input)
        {
            var model = (AssessmentModel)BMM.deserialize(input);
            var swot  = input.GetNamedNumber("swot", -1);

            if (swot != -1)
            {
                model.swotControl.SelectedIndex = (int)swot;
            }
            return(model);
        }
Exemple #2
0
        public static new BusinessRuleModel deserialize(JsonObject input)
        {
            var model = (BusinessRuleModel)BMM.deserialize(input);
            var level = input.GetNamedNumber("enforcement-level", -1);

            if (level != -1)
            {
                model.enforcementCombo.SelectedIndex = (int)level;
            }
            return(model);
        }
Exemple #3
0
        public static new InfluencerModel deserialize(JsonObject input)
        {
            var model      = (InfluencerModel)BMM.deserialize(input);
            var influencer = input.GetNamedNumber("influencer", -1);

            if (influencer != -1)
            {
                model.influencerCombo.SelectedIndex = (int)influencer;
            }

            return(model);
        }
Exemple #4
0
        private bool deserialize(string input)
        {
            JsonObject data;

            if (JsonObject.TryParse(input, out data) == false)
            {
                return(false);
            }

            var modelArray = data.GetNamedArray("models", null);

            foreach (var entry in modelArray)
            {
                var value = entry.GetObject().GetNamedNumber("category", -1);
                if (value == -1)
                {
                    return(false);
                }
                var       type  = (Category)value;
                BaseModel model =
                    (type == Category.NOTE) ? (BaseModel)NoteModel.deserialize(entry.GetObject()) :
                    (type == Category.BUSINESS_RULE) ? BusinessRuleModel.deserialize(entry.GetObject()) :
                    (type == Category.INFLUENCER) ? InfluencerModel.deserialize(entry.GetObject()) :
                    (type == Category.ASSESSMENT) ? AssessmentModel.deserialize(entry.GetObject()) :
                    BMM.deserialize(entry.GetObject());
                if (model != null)
                {
                    workspace.Children.Add(model);
                    models.Add(model);
                }
            }
            var linkArray = data.GetNamedArray("links", null);

            foreach (var entry in linkArray)
            {
                var link = Link.deserialize(entry.GetObject());
                if (link != null)
                {
                    workspace.Children.Add(link);
                    link.sourceModel.MovedEvent += link.sourceMoved;
                    link.targetModel.MovedEvent += link.targetMoved;
                }
            }
            return(true);
        }