Example #1
0
        public override IDeepCopyable CopyTo(IDeepCopyable other)
        {
            var dest = other as Resource;

            if (dest == null)
            {
                throw new ArgumentException("Can only copy to an object of the same type", "other");
            }

            base.CopyTo(dest);
            if (IdElement != null)
            {
                dest.IdElement = (Hl7.Fhir.Model.Id)IdElement.DeepCopy();
            }
            if (Meta != null)
            {
                dest.Meta = (Hl7.Fhir.Model.Meta)Meta.DeepCopy();
            }
            if (ImplicitRulesElement != null)
            {
                dest.ImplicitRulesElement = (Hl7.Fhir.Model.FhirUri)ImplicitRulesElement.DeepCopy();
            }
            if (LanguageElement != null)
            {
                dest.LanguageElement = (Hl7.Fhir.Model.Code)LanguageElement.DeepCopy();
            }
            return(dest);
        }
Example #2
0
        public Activity CreateActivity(IBaseElement baseElement)
        {
            Activity result = new Activity();

            result.Description   = new Description();
            result.Documentation = new Documentation();
            IdElement idElement = baseElement as IdElement;

            if (idElement != null)
            {
                result.Id = idElement.GetId();
            }
            VisualElement visualElement = baseElement as VisualElement;

            if (visualElement != null)
            {
                result.NodeGraphicsInfos = new NodeGraphicsInfos();
                result.NodeGraphicsInfos.NodeGraphicsInfo = new NodeGraphicsInfo[1];
                NodeGraphicsInfo info = new NodeGraphicsInfo();
                info.SetSize(visualElement);
                result.NodeGraphicsInfos.NodeGraphicsInfo[0] = info;
            }
            ProcessActivity(result, baseElement);
            return(result);
        }
Example #3
0
        private ChoiceElement CreateChoiceGUI(VisualElement root, ConversationRow conversation,
                                              ChoiceRow choice, IList <ContentElement> contents, string language)
        {
            var choiceElem = new ChoiceElement();

            var idElem = new IdElement {
                value = choice.Id.ToString()
            };

            choiceElem.Header.Add(idElem);

            CreateChoiceContent(choiceElem.Header, choiceElem.Content, conversation, choice, contents, language);

            root.Add(choiceElem);
            return(choiceElem);
        }
Example #4
0
        private DialogueElement CreateDialogueGUI(VisualElement root, ConversationRow conversation,
                                                  DialogueRow dialogue, IList <ContentElement> contents, string language)
        {
            var dialogueElem = new DialogueElement();

            var idElem = new IdElement {
                value = dialogue.Id
            };

            dialogueElem.Header.Add(idElem);

            var defaultChoiceData = dialogue.GetChoice(0);

            if (defaultChoiceData != null)
            {
                CreateDefaultChoiceGUI(dialogueElem, conversation, defaultChoiceData, contents, language);
            }

            if (dialogue.Choices.Count > 1)
            {
                var choiceContainer = new ChoiceContainer();
                choiceContainer.Add(new Label("Choices"));

                var first = true;

                foreach (var kv in dialogue.Choices)
                {
                    if (kv.Value.Id == 0)
                    {
                        continue;
                    }

                    var choiceElem = CreateChoiceGUI(choiceContainer, conversation, kv.Value, contents, language);

                    if (first)
                    {
                        first = false;
                        choiceElem.style.marginTop = 0;
                    }
                }

                dialogueElem.Add(choiceContainer);
            }

            if (!dialogue.IsEnd())
            {
                var sb        = new StringBuilder();
                var delayElem = new DelayElement("Delay")
                {
                    value = dialogue.Delay.ToString()
                };
                dialogueElem.Add(delayElem);

                var speakerElem = new SpeakerElement("Speaker")
                {
                    value = dialogue.Speaker
                };
                dialogueElem.Add(speakerElem);

                if (HasActors(dialogue))
                {
                    CreateCharacterTableGUI(dialogueElem, out var columnContainerElem);

                    CreateCharacterList <ActorColumnElement>(columnContainerElem, "Actor",
                                                             dialogue.Actor1, dialogue.Actor2, dialogue.Actor3, dialogue.Actor4);

                    CreateCharacterList <ActionColumnElement>(columnContainerElem, "Actions",
                                                              dialogue.Actions1.BuildString(sb), dialogue.Actions2.BuildString(sb),
                                                              dialogue.Actions3.BuildString(sb), dialogue.Actions4.BuildString(sb));
                }

                var highlightElem = new HighlightElement("Highlight")
                {
                    value = dialogue.Highlight.BuildString(sb)
                };
                dialogueElem.Add(highlightElem);
            }

            if (dialogue.CommandsOnStart.Count > 0 ||
                dialogue.CommandsOnEnd.Count > 0)
            {
                CreateCommandTableGUI(dialogueElem, dialogue.CommandsOnStart, dialogue.CommandsOnEnd);
            }

            root.Add(dialogueElem);
            return(dialogueElem);
        }
 /// <summary>
 /// Gets the product id.
 /// </summary>
 /// <returns></returns>
 public virtual int GetId()
 {
     return(IdElement.TextHelper().ExtractInteger());
 }