コード例 #1
0
        public override void GetContent(Invert.Core.GraphDesigner.IDocumentationBuilder _)
        {
            base.GetContent(_);
            _.Paragraph("uFrame utilizes a new concept developed to fit the uFrame and RX paradigm of programming.  " +
                        "We like to call this \"Re-active\" state machines. ");
            _.Paragraph("The main concept of state machines in uFrame MVVM is that when defining them in your " +
                        "diagrams you don't need to focus on anything other than the states and transitions that " +
                        "make up the machine.  Making the machine come to life is a matter of wiring them to " +
                        "computed properties, command bindings, and view bindings.  But initially, you can focus " +
                        "purely on the high-level rather than implementation, once commands and transitions " +
                        "are all wired together transitions and states can be easily tweaked with minimal to " +
                        "zero changes in your code.");
            _.Paragraph("Reactive State Machines employ the concept of data subscriptions causing transitions, rather than polling data every frame, this can give a definite increase in performance.");
            _.Break();
            _.ImageByUrl("http://i.imgur.com/CPymbPH.png");
            _.Break();
            _.Title2("Manually triggering transitions");
            _.Paragraph("To set a transition in code, you'll need to access the state machine property.  This should be the property that is connected to your state machine.");
            _.CodeSnippet("{ViewModel}.{StateMachinePropertyName}Property.Transition(\"NAME OF TRANSITION HERE\");");
            _.Break();
            _.Title2("Manually setting the state");
            _.CodeSnippet("{ViewModel}.{StateMachinePropertyName}Property.SetState<STATE_CLASS_NAME>();");
            _.Title3("or");
            _.CodeSnippet("{ViewModel}.{StateMachinePropertyName}Property.SetState(\"STATE_NAME\");");
            _.Break();



//            _.AlsoSeePages(typeof(UsingStateMachines));
        }
コード例 #2
0
        public override void GetContent(Invert.Core.GraphDesigner.IDocumentationBuilder _)
        {
            base.GetContent(_);
            ElementNode elementNode;

            ScaffoldComputed(out elementNode);

            _.ImageByUrl("http://i.imgur.com/qeDjrVR.png");
            _.Paragraph("A Computed Property is an extremely powerful feature added to uFrame's ViewModel layer.  These properties can calculate their value based on other properties, and are recalculated whenever one of those change.  So for example, if you have a boolean IsDead computed property on a PlayerViewModel, dependent on a Player.Health property, uFrame will generate these three things on that PlayerViewModel for you to override:");
            _.Break();
            _.Title2("Under the hood");
            _.TemplateExample <ViewModelTemplate, ElementNode>(elementNode, true, "ComputedDependents", "ResetComputed", "Compute");

            _.Title3("ResetIsDead");
            _.Paragraph("Usually fine without overriding, used to set up the computed observable");

            _.Title3("ComputeIsDead");
            _.Paragraph("A \"getter\" used to compute the property, based on dependents");

            _.Title3("GetIsDeadDepedents");
            _.Paragraph("This where you would override and provide additional dependents, if needed");

            _.Break();
            _.Note("It's important to correctly set all the dependents, because the computed only knows when it needs to be recalculated by observing these dependents for changes.  This is done in the diagram by dragging a link from a ViewModel's property to the computed, or in code by overriding the Get{ComputedName}Dependents() function.");
        }