Esempio n. 1
0
        public void Hyperlink_RequestNavigate(object sender, System.Windows.Navigation.RequestNavigateEventArgs e)
        {
            var link      = (Hyperlink)sender;
            var text      = new TextRange(link.ContentStart, link.ContentEnd).Text;
            var prototype = new r.character();
            var character_belief_split = text.Split(new char[] { prototype.seperator });

            prototype.gm_name = character_belief_split[0];
            prototype         = this.CurrentGame.SingleOrCreate(this.CurrentGame.Characters, prototype, true);
            this.CurrentGame.SaveBeliefNetworkToCharacter(character_belief_split[1], prototype);

            this.Navigation.Navigate(link.NavigateUri, prototype);
        }
Esempio n. 2
0
        public void Hyperlink_RequestNavigate(object sender, System.Windows.Navigation.RequestNavigateEventArgs e)
        {
            var link = (Hyperlink)sender;
            var text = new TextRange(link.ContentStart, link.ContentEnd).Text;

            var character_prototype = new r.character();
            var belief_prototype    = new r.belief();
            var character_belief_hypothesis_split = text.Split(new char[] { character_prototype.seperator });
            var character_gm_name = character_belief_hypothesis_split[0];
            var belief_variable   = character_belief_hypothesis_split[1];
            var character         = this.CurrentGame
                                    .Characters.Single(x => x.gm_name == character_gm_name && x.partition == this.CurrentGame.Partition);
            var belief = character
                         .beliefs.Single(x => x.variable == belief_variable && x.partition == this.CurrentGame.Partition);
            var prototype = this.CurrentGame.SaveHypothesesToBelief(character_belief_hypothesis_split[2], belief);

            this.Navigation.Navigate(this, prototype);
        }
Esempio n. 3
0
        public DirectedAcyclicGraph <belief> SaveBeliefNetworkToCharacter(string json, character c)
        {
            var dg           = new DirectedGraph(json);
            var dag_subgraph = new DirectedAcyclicGraph <belief>(dg);

            foreach (var n in dag_subgraph.ToList())
            {
                n.Value.variable  = n.Key;
                n.Value.character = c;
                n.Value.partition = this.Partition;
            }

            foreach (var n in dag_subgraph.Roots)
            {
                this.CreateOrRetrieve(this.Beliefs, x => x.variable == n.variable && x.character.id == n.character.id && x.partition == n.partition, n);
            }
            return(dag_subgraph);
        }