Project Siena is a Microsoft Win8 app that allows you to quickly create WIN8 applications without having to write code (without writing any code, of course, if it's better to have coding experience)
Through this example (from the official), learn about the development patterns and processes of project Siena.
First, in the Windows application, download and install the project Siena application.
Next, in the local computer, open the Project Siena Program (first open, there is a video tutorial, you can skip directly)
First save the project, using Ctl+s, a project file that holds a suffix (. Siena) on the local path.
On the page, add a button control to modify the size, text, and background color of the buttons.
If you come to this step, you have had countless problems, and even a long time did not find how to do, please refer to the more detailed tutorial, if still do not understand, please silently delete project Siena.
Next, it is the only part of the project Siena that needs to be written (in the official sense, we cannot interpret this as code ...). )
Find the Onselect property of the button, and write the function in the text box (where the function is actually written):
Collect (items,"Yes")
Next, copy and paste 2 buttons, modify the text and style of the button, and the function in the Onselect property
Collect (items,"no") Collect (items,"maybe")
The page works as follows
The function we write is to add the corresponding value (yes, no, maybe) to a collection of items, which is created when it is first used, when the button is clicked.
Now with F5 you can run the program directly, click the button several times in the form, then go back to the design interface via ESC, and then use Alt+d to see that when we click the button, the corresponding value of each button is recorded in a collection called items.
Next, place a label control underneath each button, set the appearance and style, and configure the Text property of each label control individually, writing the function:
CountIf (items,"Yes" in Value) CountIf (items,"no " inch Value) CountIf (items,"maybe" in Value)
In a form, COUNTIF represents the number of records in a collection that match a condition, where items is a collection, "Yes" in value is a filter condition, counts all yes values, and the other two principles are the same, showing the effect as follows:
Next, add a new form (scene), place a shape (shape) in the next arrow control in the form, and in the Onselect property, configure the navigation navigation property to jump to another form (scene)
Navigate (Screen2, screentransition! Fade)
Similarly, in the second form (scene), add a back arrow control in a shape (shape), in the Onselect property, configure the navigation navigation property, and jump back to the first form (scene)
Navigate (Screen1, screentransition! Fade)
This allows us to transform between multiple scenes (fade represents the fade transition effect)
In the second form (scene), we add a statistical chart pie chart (pie chart) to count the number of clicks of all the buttons, and in the place of a button to refresh the data, the effect is as follows:
In the Onselect property of the Refresh button, write the code, which is very long ...
Clear (report);//clears data from a report collectionCollect//re-create the report collection(report, {x:"Yes", Y:value (label1! Text)},//The first element is a collection of key-value pairs, pointing to the first label of the previous page (yes){x:"No", Y:value (label1_1! Text)},//The second element is a collection of key-value pairs, pointing to the label of the second label (no) on the previous page {x:"maybe", Y:value (label1_2! Text)}//The third element is a collection of key-value pairs, pointing to the third label on the previous page (maybe) )
Considering the comment, the function is disassembled into multiple lines, and when we write it, we use the following directly
Clear (report); Collect (report,{x: "Yes", Y:value (label1! Text)},{x: "No", Y:value (label1_1! Text)},{x: "Maybe", Y:value (label1_2! Text)})
This clears the report collection each time the button is clicked, and then, in the report collection, adds the text of the 3 label controls corresponding to Yes, no, and maybe.
Next, configure the Items property of the pie chart Chart control, point to the Report collection, and then run the program and click the Refresh button to see the following effect
Finally, using Alt+p to publish the project, the first time you publish, you need to download Installapp,
Click the Publish button, select the path where the file will be published, and you can generate a published
In the publishing folder, you can see the executable file and execute it directly to install it.
Select the installation method (use administrator to run the executable file for installation)
After successful, you can see the application you just made in this machine.
Microsoft Project Siena-Create your first project Siena projects