WindowsPhone
(Created page with "<html> <div class="outdated-alert"> <p> <span> ❗🕜 Warning: </span> this article may contain outdated information. Consider before using any descriptions/solutions, otherw...")
 
No edit summary
Line 7: Line 7:


Open up the sample that comes with ECO:
Open up the sample that comes with ECO:
[[File:MonoAndroid - 1.png|none|thumb|390x390px]]
[[File:1 - WindowsPhone.png|none|thumb|409x409px]]


Open up the sln and ignore/ok this:
Open up the sln and ignore/ok this:
[[File:MonoAndroid - 2.png|none|thumb|396x396px]]
[[File:2 - WindowsPhone.png|none|thumb|432x432px]]
 
You will see this:
You will see this:
[[File:MonoAndroid - 3.png|none|thumb]]
[[File:3 - WindowsPhone.png|none|thumb|387x387px]]


The ReadMe explains the missing projects but since you are a developer you will probably not read it.
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
Delete the missing projects. And add new references to MonoAndroidApplication1
[[File:MonoAndroid - 4.png|none|thumb|351x351px]]
 
[[File:4 - WindowsPhone.png|none|thumb|368x368px]]


Choose browse and find the assemblies you downloaded in the PhoneBuilds.zip
Choose browse and find the assemblies you downloaded in the PhoneBuilds.zip
[[File:MonoAndroid - 5.png|none|thumb|394x394px]]
 
[[File:5 - WindowsPhoone.png|none|thumb]]


Define what to start:
Define what to start:
[[File:MonoAndroid - 6.png|none|thumb|367x367px]]
[[File:6 - WindowsPhoone.png|none|thumb]]
[[File:7 - WindowsPhoone.png|none|thumb|452x452px]]
Hit F5 – three windows pop up (the phone emulator starts slowly):
 
This is a simple WPF UI that shows the information in our “database”
[[File:10 - WindowsPhone.png|none|thumb]]


This is the Root directory of our PersistenceServer
[[File:11 - WindowsPhone.png|none|thumb]]


<html>
This is the Phone App
 
[[File:12 - WindowsPhone.png|none|thumb]]
 
Press the first of the X buttons in the bottom of the PhoneApp
 
[[File:13 - WindowsPhone.png|none|thumb]]
The code on the phone: <html>
<pre class="code"><span style="color: blue;">private void </span>ApplicationBarIconButton_Click(<span style="color: blue;">object </span>sender, <span style="color: #2b91af;">EventArgs </span>e)
<pre class="code"><span style="color: blue;">private void </span>ApplicationBarIconButton_Click(<span style="color: blue;">object </span>sender, <span style="color: #2b91af;">EventArgs </span>e)
         {
         {
Line 51: Line 66:
</html>
</html>


The code makes use of some ECO services.


The other button:
[[File:14 - WindowsPhone.png|none|thumb]]


Code:
<html>
<html>


Line 69: Line 88:
</pre>
</pre>
</html>
</html>
We switch back to the WCF app – hit Refresh:
[[File:15- WindowsPhone.png|none|thumb]]
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 issues|WCF trouble-shoot]]
That is all I am going to show you about the WindowsPhone 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.

Revision as of 13:37, 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:

1 - WindowsPhone.png

Open up the sln and ignore/ok this:

2 - WindowsPhone.png

You will see this:

3 - WindowsPhone.png

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

4 - WindowsPhone.png

Choose browse and find the assemblies you downloaded in the PhoneBuilds.zip

5 - WindowsPhoone.png

Define what to start:

6 - WindowsPhoone.png
7 - WindowsPhoone.png

Hit F5 – three windows pop up (the phone emulator starts slowly):

This is a simple WPF UI that shows the information in our “database”

10 - WindowsPhone.png

This is the Root directory of our PersistenceServer

11 - WindowsPhone.png

This is the Phone App

12 - WindowsPhone.png

Press the first of the X buttons in the bottom of the PhoneApp

13 - WindowsPhone.png

The code on the phone: 

private void ApplicationBarIconButton_Click(object sender, EventArgs e)
        {
            EcoServiceHelper.GetPersistenceService(_ecospace).Refresh(true);
            EcoServiceHelper.GetAsyncSupportService(_ecospace).PerformTaskAsync(new Action(() => { 
                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;

                EcoServiceHelper.GetAsyncSupportService(_ecospace).DispatchTaskToMainThread(new Action(() => { 
                    // UI Stuff - everyone is happy to see that we do this in the main thread
                        ContentStack.Children.Add(new TextBlock() { Text = "db updated, Now C1 Total: " + noOfC1.ToString() + ",\r\n Total of C1 that has C2's " + noOfC1ThatHasC2s.ToString() + " " + extra });

                }));
            }));
        }

The code makes use of some ECO services.

The other button:

14 - WindowsPhone.png

Code:

private void ApplicationBarIconButton_Click_1(object sender, EventArgs e)
{

    Class1 c1 = new Class1(_ecospace);
    c1.Attribute1 = "Created on WindowsPhone " + DateTime.Now.ToLongTimeString();
    ContentStack.Children.Add(new TextBlock() { Text = "c1 created" });

    _ecospace.UpdateDatabase();

     
}

We switch back to the WCF app – hit Refresh:

15- WindowsPhone.png

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 WindowsPhone 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.

This page was edited 69 days ago on 02/10/2024. What links here