(Created page with "There are so many scenarios to consider. You have your server system – do this with MDriven Turnkey. Pages that attract MANY users you create as MVC – pages that require...") |
No edit summary |
||
Line 22: | Line 22: | ||
{ | { | ||
… | … | ||
<pre> | |||
_es=new EcoProject1EcoSpace(); | |||
_es.PMapperXml.OnLoadAsXML += Pm_OnLoadAsXML; | |||
_es.PMapperXml.OnSaveAsXML += Pm_OnSaveAsXML; | |||
ViewModelDefinitionsInApplication.Init(_es); | |||
_es.Active = true; | |||
BaseViewModel.DataStore.SetEcoSpace(_es); | |||
… | |||
</pre> | |||
<pre> | |||
} | |||
private void Pm_OnSaveAsXML(object sender, Eco.Persistence.OnSaveAsXMLArgs e) | |||
{ | |||
var path = global::Android.OS.Environment.ExternalStorageDirectory.AbsolutePath; | |||
var filename = System.IO.Path.Combine(path.ToString(), e.FileName); | |||
e.XDocumentToSave.Save(filename); | |||
e.ContinueWithDefault = false; | |||
} | |||
private void Pm_OnLoadAsXML(object sender, Eco.Persistence.OnLoadAsXMLArgs e) | |||
{ | |||
var path = global::Android.OS.Environment.ExternalStorageDirectory.AbsolutePath; | |||
var filename = System.IO.Path.Combine(path.ToString(), e.FileName); | |||
if (System.IO.File.Exists(filename)) | |||
{ | |||
using (var fileStream = System.IO.File.OpenRead(filename)) | |||
{ | |||
using (var streamReader = new System.IO.StreamReader(fileStream)) | |||
{ | |||
e.LoadedDataAsXml = streamReader.ReadToEnd(); | |||
e.ContinueWithDefault = false; | |||
} | |||
} | |||
} | |||
} | |||
</pre> | |||
And this is how you instantiate a code generated viewmodel: | And this is how you instantiate a code generated viewmodel: |
Revision as of 10:29, 28 October 2018
There are so many scenarios to consider.
You have your server system – do this with MDriven Turnkey. Pages that attract MANY users you create as MVC – pages that require desktop feel you do with AngularJS – or even WPF– no need to go cheap – you can do it all – its just a setting per form.
Then you also want user to get information and supply data on the go – use Cordova to display some or all of your server system in a specific app – and with the abilities of html5 – to access position etc. – you may not even need an app for this.
When all that is done you are left with the users that work offline… GodDamnOfflineUsers – do they exist? Yes – the ones we see now work with a Hololens doing reinforce bars planning and production on ESS in Lund. Standing so close or in the middle of these steel bars effectively shields you from all radio – wifi or WCDMA. And even if we could get radio in there – they would soon be in tunnels and under ground construction sites or in special buildings designed to shield radio (hospital X-ray rooms).
Picture is shown courtesy of http://informationexperience.se – look them up for augmented reality today.
There are offline users. Bite the bullet.
In this video I take the Default Xamarin Forms template app and make it run with MDriven. I remove a lot of manual written code and make the data persistent on the device.
In future sessions – if there is interest – we can build on this and sync locally changed data to a Turnkey server using rest api’s.
We can also – again – if there is interest – we can add a Barcode scanner to the app and maybe have that look up data on the server if we are online – or just cache it if we do not have internet access.
Some important code snippets from the video:
private EcoProject1EcoSpace _es; protected override void OnCreate(Bundle bundle) { …
_es=new EcoProject1EcoSpace(); _es.PMapperXml.OnLoadAsXML += Pm_OnLoadAsXML; _es.PMapperXml.OnSaveAsXML += Pm_OnSaveAsXML; ViewModelDefinitionsInApplication.Init(_es); _es.Active = true; BaseViewModel.DataStore.SetEcoSpace(_es); …
} private void Pm_OnSaveAsXML(object sender, Eco.Persistence.OnSaveAsXMLArgs e) { var path = global::Android.OS.Environment.ExternalStorageDirectory.AbsolutePath; var filename = System.IO.Path.Combine(path.ToString(), e.FileName); e.XDocumentToSave.Save(filename); e.ContinueWithDefault = false; } private void Pm_OnLoadAsXML(object sender, Eco.Persistence.OnLoadAsXMLArgs e) { var path = global::Android.OS.Environment.ExternalStorageDirectory.AbsolutePath; var filename = System.IO.Path.Combine(path.ToString(), e.FileName); if (System.IO.File.Exists(filename)) { using (var fileStream = System.IO.File.OpenRead(filename)) { using (var streamReader = new System.IO.StreamReader(fileStream)) { e.LoadedDataAsXml = streamReader.ReadToEnd(); e.ContinueWithDefault = false; } } } }
And this is how you instantiate a code generated viewmodel: