(Created page with "Open up the sample that comes with ECO: none|thumb|390x390px Open up the sln and ignore/ok this: [[File:MonoAndroid - 2.png|none|thumb|396x396px]...") |
No edit summary |
||
Line 1: | Line 1: | ||
<html> | |||
<div class="outdated-alert"> | |||
<p> <span> ❗🕜 Warning: </span> this article may contain outdated information. Consider before using any descriptions/solutions, otherwise it still can be helpful. <a href="https://wiki.mdriven.net/index.php/MDriven_Product_Line#Synonyms_and_name_changes"> <span> Help : Synonyms and name changes </a> | |||
</p> | |||
</div> | |||
</html> | |||
Open up the sample that comes with ECO: | Open up the sample that comes with ECO: | ||
[[File:MonoAndroid - 1.png|none|thumb|390x390px]] | [[File:MonoAndroid - 1.png|none|thumb|390x390px]] | ||
Line 42: | Line 49: | ||
The text of the button was updated. The code on the phone: | The text of the button was updated. The code on the phone: | ||
<html> | |||
<pre class="code"><span style="color: blue;">void </span>button_Click(<span style="color: blue;">object </span>sender, <span style="color: #2b91af;">EventArgs </span>e) | |||
{ | |||
<span style="color: #2b91af;">EcoServiceHelper</span>.<span style="background-color: #ffff00;">GetPersistenceService(_ecospace).Refresh</span>(<span style="color: blue;">true</span>); | |||
<span style="color: #2b91af;">Button </span>button = FindViewById<<span style="color: #2b91af;">Button</span>>(<span style="color: #2b91af;">Resource</span>.<span style="color: #2b91af;">Id</span>.MyButton); | |||
<span style="color: #2b91af;">IObjectList </span>list = <span style="color: #2b91af;">EcoServiceHelper</span>.<span style="background-color: #ffff00;">GetOclPsService(_ecospace).Execute(</span><span style="color: #a31515;"><span style="background-color: #ffff00;">"Class1.allinstances</span>->select(a|a.Class2->notempty)"</span>); | |||
<span style="color: blue;">int </span>noOfC1ThatHasC2s = list.Count; | |||
<span style="color: blue;">string </span>extra=<span style="color: #a31515;">""</span>; | |||
<span style="color: blue;">if </span>(list.Count > 0) | |||
extra = list[0].GetValue<<span style="color: #2b91af;">Class1</span>>().Attribute1; | |||
<span style="color: blue;">int </span>noOfC1 = <span style="color: #2b91af;">EcoServiceHelper</span>.<span style="background-color: #ffff00;">GetExtentService(_ecospace).AllInstances</span><<span style="color: #2b91af;">Class1</span>>().Count; | |||
button.Text = <span style="color: #a31515;">"db updated, Now C1 Total: " </span>+ noOfC1.ToString() + <span style="color: #a31515;">", Total of C1 that has C2's " </span>+ noOfC1ThatHasC2s.ToString() + <span style="color: #a31515;">" " </span>+ extra; | |||
} | |||
</pre> | |||
</html> | |||
The code makes use of some ECO services. | The code makes use of some ECO services. | ||
The other buttons Code: | The other buttons Code: | ||
<html> | |||
<pre class="code"><span style="color: blue;">void </span>button2_Click(<span style="color: blue;">object </span>sender, <span style="color: #2b91af;">EventArgs </span>e) | |||
{ | |||
<span style="color: #2b91af;">Button </span>button2 = FindViewById<<span style="color: #2b91af;">Button</span>>(<span style="color: #2b91af;">Resource</span>.<span style="color: #2b91af;">Id</span>.MyButton2); | |||
<span style="color: #2b91af;">Class1 </span>c1 = <span style="color: blue;">new </span><span style="color: #2b91af;">Class1</span>(_ecospace); | |||
c1.Attribute1 = <span style="color: #a31515;">"Created on android by mono " </span>+ <span style="color: #2b91af;">DateTime</span>.Now.ToLongTimeString(); | |||
button2.Text = <span style="color: #a31515;">"c1 created"</span>; | |||
_ecospace.UpdateDatabase(); | |||
} | |||
</pre> | |||
</html> | |||
We switch back to the WCF app – hit Refresh: | We switch back to the WCF app – hit Refresh: |
Revision as of 13:10, 4 December 2018
❗🕜 Warning: this article may contain outdated information. Consider before using any descriptions/solutions, otherwise it still can be helpful. Help : Synonyms and name changes
Open up the sample that comes with ECO:
Open up the sln and ignore/ok this:
You will see this:
The ReadMe explains the missing projects but since you are a developer you will probably not read it.
Delete the missing projects. And add new references to MonoAndroidApplication1
Choose browse and find the assemblies you downloaded in the PhoneBuilds.zip
Define what to start:
Hit F5 – This windows shows:
Start emulator Image: Pick MonoAndroid_API_10
When the Emulator runs:
you choose it:
And you get this window, the Root directory of our PersistenceServer
This is a simple WPF UI that shows the information in our “database”
This is the Phone App
Press the first button :
The text of the button was updated. The code on the phone:
void button_Click(object sender, EventArgs e) { EcoServiceHelper.GetPersistenceService(_ecospace).Refresh(true); Button button = FindViewById<Button>(Resource.Id.MyButton); IObjectList list = EcoServiceHelper.GetOclPsService(_ecospace).Execute("Class1.allinstances->select(a|a.Class2->notempty)"); int noOfC1ThatHasC2s = list.Count; string extra=""; if (list.Count > 0) extra = list[0].GetValue<Class1>().Attribute1; int noOfC1 = EcoServiceHelper.GetExtentService(_ecospace).AllInstances<Class1>().Count; button.Text = "db updated, Now C1 Total: " + noOfC1.ToString() + ", Total of C1 that has C2's " + noOfC1ThatHasC2s.ToString() + " " + extra; }
The code makes use of some ECO services.
The other buttons Code:
void button2_Click(object sender, EventArgs e) { Button button2 = FindViewById<Button>(Resource.Id.MyButton2); Class1 c1 = new Class1(_ecospace); c1.Attribute1 = "Created on android by mono " + DateTime.Now.ToLongTimeString(); button2.Text = "c1 created"; _ecospace.UpdateDatabase(); }
We switch back to the WCF app – hit Refresh:
You can play around with the WPF app and the Phone app to ensure yourself that objects created in one client can be seen in the other client after a Refresh.
If things does not work consult the WCF trouble-shoot
That is all I am going to show you about the Android Phone right now. Disappointed? Don’t be – we did a lot – strongly typed model driven business objects on the phone with a WCF connection to the server – that persists everything – and lets you find what is on the server.