-
Jul 7th, 2023, 09:53 AM
#1
Thread Starter
PowerPoster
[RESOLVED] Convert Windows Desktop Code to Mobile
For the past 7 years I've been working on a Winforms application developed in Visual Studio, written in C# and DevExpress controls, using SQL Server databases.
We'd like to develop a stripped down version that our employees can access on their phones, out on the road.
If @szlamany sees this, he will remember talking about it with me a few years ago. It's still on my to-do list. But now it's my to-do to do it, not just find a contractor to do it. I can attend training.
I have general questions on how to get started. I haven't even done web programming in years, and never mobile development.
Does it matter if it's Apple or Android? I think we have control over this, as it's only for our employees and we give them company phones.
I'd love to just write *something*, get it on a phone and try it out! Doesn't even have to access a database yet. I can start very simple and gradually build it up. Have a main form, hit a button and open another form - that would be major progress!
Thanks and sorry for the wide open quesiton but I don't know anything yet. The more fun questions I'm sure are yet to come.
There are 10 kinds of people in this world. Those who understand binary, and those who don't.
-
Jul 7th, 2023, 12:25 PM
#2
Re: Convert Windows Desktop Code to Mobile
Given that you have experience in C#, a good way to go is Xamarin, which uses C# code to create apps (and you can do it in Visual Studio).
You can target Android and/or Apple, but I'd recommend starting with Android (for Apple you need an Apple computer to compile it, plus other extra bits of effort/cost).
A good resource for info is: https://learn.microsoft.com/en-us/xamarin/android/
It includes lots of stuff, including "hello world" type examples to get you going.
Phone apps have a different way of working as they need to minimise memory usage, so you get various changes like only being able to have one screen open at a time - and that screen can be closed by the operating system when the user switches apps, so when your app restarts (on that screen) you need to deal with it appropriately.
-
Jul 7th, 2023, 12:33 PM
#3
Thread Starter
PowerPoster
Re: Convert Windows Desktop Code to Mobile
There are 10 kinds of people in this world. Those who understand binary, and those who don't.
-
Jul 13th, 2023, 08:09 AM
#4
Thread Starter
PowerPoster
Re: Convert Windows Desktop Code to Mobile
OK, so that went well. I am running a xamarin application on an android emulator.
https://learn.microsoft.com/en-us/xa...pivots=windows
I mentioned we are using DevExpress controls so I googled "devexpress xamarin documentation". Xamarin will be going away??? Microsoft will end Xamarin-related support services on May 1, 2024 and shift development focus to the .NET MAUI platform.
Should I switch now before I go too far, or switching over won't be too bad? I would need to upgrade my version of VS from 2019 to 2022.
Last edited by MMock; Jul 13th, 2023 at 08:20 AM.
There are 10 kinds of people in this world. Those who understand binary, and those who don't.
-
Jul 13th, 2023, 08:27 AM
#5
Re: Convert Windows Desktop Code to Mobile
Ah, it seems I'm a bit behind on the news there... I knew there were Xamarin updates late last year, but didn't know they'd switched paths.
In that case .NET MAUI is probably a more sensible way for you to go.
-
Jul 13th, 2023, 08:35 AM
#6
Thread Starter
PowerPoster
Re: Convert Windows Desktop Code to Mobile
Yes, still thinking about it, and asked management their thoughts. No worries. Being behind on the news puts us all in good company.
It's now July 2023 and I'm finding info from late last year - how you never know with MS what they're going to follow through and release or give up.
I might just continue a bit for now. Still learning and when I get to the point where I have a form or functionality I want to keep, I could convert just that little bit. I have a long way to go to develop entire app.
There are 10 kinds of people in this world. Those who understand binary, and those who don't.
-
Jul 13th, 2023, 09:10 AM
#7
Re: Convert Windows Desktop Code to Mobile
Going the way of a Microsoft product used to be THE way to ensure stability and continuity Nowadays, they are more likely than not to cancel the whole product just as it is gaining some traction with a userbase. It leaves a nasty taste in the mouth and the desire to look for something more open. I no longer consider Microsoft a viable partner. That is across the board from desktops to mobiles.
https://github.com/yereverluvinunclebert
Skillset: VMS,DOS,Windows Sysadmin from 1985, fault-tolerance, VaxCluster, Alpha,Sparc. DCL,QB,VBDOS- VB6,.NET, PHP,NODE.JS, Graphic Design, Project Manager, CMS, Quad Electronics. classic cars & m'bikes. Artist in water & oils. Historian.
By the power invested in me, all the threads I start are battle free zones - no arguing about the benefits of VB6 over .NET here please. Happiness must reign.
-
Jul 14th, 2023, 07:41 AM
#8
Thread Starter
PowerPoster
Re: Convert Windows Desktop Code to Mobile
Good morning. I am going to rephrase my OP. Italicized text was my first two opening lines from OP.
For the past 7 years I've been working on a Winforms application developed in Visual Studio, written in C# and DevExpress (DX) controls, using SQL Server databases.
We'd like to develop a stripped down version that our employees can access on their phones, out on the road.
This is going to be developed in VS 2022 using Maui. DX supports MAUI so I wil be using their controls again.
Some unknowns that are bothering me are...What do I need to know about *database* access? Is it possible to access *files* on a network drive in our office?
I am going to start with some kind of form navigation, I guess. Actually, starting with one form that has some labels and buttons. That will be an accomplishment!
Can I also complain about MS naming it MAUI? I love this forum, it's my favorite, and if I do an advanced search on Maui I get a lot of hits to the Hawaiin Island
There are 10 kinds of people in this world. Those who understand binary, and those who don't.
-
Jul 14th, 2023, 11:07 AM
#9
Re: Convert Windows Desktop Code to Mobile
@mmock - late to the game here!
Are you married to going with a heavy app on the mobile device, as opposed to a browser app?
My life has been all browser for some time now - using IIS for the backend, which means it's still VS.Net anyway.
Nice thing about this setup is the browser only accesses the web server, using TLS/SSL for security - no direct access to the SQL database.
With your heavy app, don't you have to open ports like 1433 for SQL access?
btw - I've always said that Mustangs were girl cars - you are backing me up here! Thanks!
-
Jul 14th, 2023, 11:15 AM
#10
Thread Starter
PowerPoster
Re: Convert Windows Desktop Code to Mobile
Hi. I'll share your thoughts with the higher-ups to see what they think.
The Mustang is my 3rd. But I bought it from my brother; it was his 2nd. (I think both of us had a Mustang for our very first car). So not sure there's a gender thing going on. P.S. It's orange and the marker is MADSTNG. Look for me! (MMOCK is my Hummer H3 plate [which I still have because...New England!]).
There are 10 kinds of people in this world. Those who understand binary, and those who don't.
-
Jul 14th, 2023, 11:56 AM
#11
Thread Starter
PowerPoster
Re: Convert Windows Desktop Code to Mobile
One of the higher-ups said "I actually thought we were doing a browser app. But I also don’t know what I’m talking about." Even though she "liked" my comment earlier that I was going to use Xamarin (now MAUI). Maybe she thought they were one and the same. So, a "browser app" is just a web application that you run on your phone? So, I would be converting WinForms to WebForms? This is a stupid question (because neither do I know what I'm talking about), but I run Hotmail on my phone and that's just accessing Chrome and typing in the URL of the web application - is it a browser app? Versus my banking app which I installed from Google Play and is a true mobile app???
There are 10 kinds of people in this world. Those who understand binary, and those who don't.
-
Jul 14th, 2023, 12:50 PM
#12
Re: Convert Windows Desktop Code to Mobile
 Originally Posted by MMock
So, a "browser app" is just a web application that you run on your phone? So, I would be converting WinForms to WebForms? This is a stupid question (because neither do I know what I'm talking about), but I run Hotmail on my phone and that's just accessing Chrome and typing in the URL of the web application - is it a browser app? Versus my banking app which I installed from Google Play and is a true mobile app???
That is all correct.
Accessing via the internet (rather than wifi in the office) is a security risk, but I suspect that a web app rather than a mobile app doesn't make it worse in that respect (the browser is likely to be updated regularly for new security threats).
-
Jul 15th, 2023, 05:51 AM
#13
Re: Convert Windows Desktop Code to Mobile
Post 1 of 2 - code example first - next post will go into a bit of the architecture of this type of application.
Basically from the web page you run JavaScript code like this - here I have a function called i_sproc_async which runs a SPROC on the server...selector is an HTML ID of a element on the web page, the one that was clicked causing this function to be called. Notice the URL is "WebService.asmx/SourceService" - this tells the AJAX POST to find a "page" called WebService.asmx and find a function called SourceService in that back end code. Since this is an ASYNC call - there are callback functions for SUCCESS, FAILURE and ERROR. That function runs when the web POST to the server returns data. I'll show that function at the bottom of this post - ajaxAsyncFinished.
Code:
var i_sproc_async = function (selector, sproc, options) {
var objWebParam = {};
objWebParam.sproc = sproc;
objWebParam.sguid = window.bootguid || "";
objWebParam.username = window.username || "";
objWebParam.mobile = (g_isMobile ? "Y" : "N");
objWebParam.objReturn = {};
findDynamic(selector, objWebParam.objReturn);
var strWebParam = $.toJSON(objWebParam);
$.ajax({
type: "POST",
url: "WebService.asmx/SourceService",
dataType: "json",
data: strWebParam,
contentType: "application/json; charset=utf-8",
success: function (msg) {
ajaxAsyncFinished(msg, selector, "success", options);
},
failure: function (msg) {
ajaxAsyncFinished(msg, selector, "failure", {});
if (selector.length != 0) {
$("#" + selector).val("Loading...failure...");
}
},
error: function (msg) {
ajaxAsyncFinished(msg, selector, "error", {});
if (selector.length != 0) {
$("#" + selector).val("Loading...error...");
}
}
});
};
As I said, the POST from the webpage runs a .Net function - this is VB.Net. Could be C#. The "arguments" to this function match the objWebParam JSON object variable that was setup in the function above. objWebParam.sproc, .sguid, .username, .mobile and a dictionary like object called .objReturn.
If you look at the .Net function below all it does is call the sproc and return record rows with LABEL and VALUE fields. Data will be used for a drop down type of lookup field - one I'm sure you are very familiar with in Win Forms.
Code:
<WebMethod()> _
<ScriptMethod(ResponseFormat:=ResponseFormat.Json, UseHttpGet:=False)> _
Public Function SourceService(ByVal sproc As String _
, ByVal objReturn As Dictionary(Of String, String) _
, ByVal sguid As String _
, ByVal username As String) As String
Dim rtnString As String = ""
Try
If checkGuid(sguid, username) Then
...
Dim JsonMaker As JsonWriter = New JsonWriter
With JsonMaker
.StartArray()
Dim blnDidFirstObject As Boolean
Try
Using dcn As New SqlConnection(System.Web.Configuration.WebConfigurationManager.ConnectionStrings("LocalSQLServerAWC" & credDB).ToString)
Using cmd As New SqlCommand
cmd.CommandType = CommandType.StoredProcedure
cmd.CommandText = "dbo." & sproc
cmd.Connection = dcn
cmd.CommandTimeout = 0
DetermineParameters(dcn, cmd)
SetParameters(cmd, False, "", objReturn, Nothing, "", "", username)
dcn.Open()
...
Using sdrReader As SqlDataReader = cmd.ExecuteReader
While sdrReader.Read
If Not blnDidFirstObject Then
blnDidFirstObject = True
Else
.Seperate()
End If
.StartObject()
.NewObject("label", sdrReader(0).ToString, True, True)
.Seperate()
.NewObject("value", sdrReader(1).ToString, True, True)
.EndObject()
End While
End Using
End If
End Using
End Using
Catch ex As Exception
.ResetJson()
.StartObject()
.NewObject("%%dalerror%%", ex.Message.Replace("""", "'").Replace("\", "\\"))
.EndObject()
End Try
.EndArray()
End With
rtnString = JsonMaker.GetJson()
Else
rtnString = "{""LoginRequired"": true}"
LogOutput("GUID not found (SourceService): " & username)
End If
Catch ex As Exception
LogOutput(ex.Message & " (SourceService): " & username)
End Try
Return rtnString
End Function
And just to finish up this example, the web page will get the data that is returned (bottom of above function - Return rtnString) and process that as the msg variable in this JavaScript function - the one that was the callback function to that async AJAX POST at the top - ajaxAsyncFinished.
Code:
function ajaxAsyncFinished(msg, strWho, rtnstatus, objOptions) {
var objReturn = {};
if (rtnstatus == "error") {
errorMessage("ajaxAsyncFinished", msg.responseText);
} else if (rtnstatus == "failure") {
errorMessage("ajaxAsyncFinished", msg.responseText);
} else {
objReturn = $.parseJSON(msg.d);
if (objReturn.LoginRequired || false) {
errorMessage("Login Required", "Session has timed out - please login again!");
} else {
if (!(typeof objReturn["%%dalerror%%"] == "undefined")) {
errorMessage("ajaxAsyncFinished", objReturn["%%dalerror%%"]);
} else {
g_GAWorker.sproc_return(strWho, objOptions, objReturn);
}
}
}
}
Last edited by szlamany; Jul 15th, 2023 at 05:59 AM.
-
Jul 15th, 2023, 06:03 AM
#14
Re: Convert Windows Desktop Code to Mobile
Post 2 of 2 - architecture...
You only write a handful of backend webservice functions - like the SourceService function in the post above.
So re-use is key here.
And with that said, since you only have a handful of webservices - SourceService, as our example. This means the SQL that the SPROC uses for a "source service" type of SQL, must all return similar SELECT statements.
You have to sit back and look at all the data access your web app will need - and it will be less than the win form hopefully. Once that is done, distill it down to a series of .Net backend functions. You need one JavaScript function to call that backend .Net code and then one JavaScript call back function to receive that data in the web page. So - three functions to handle the round trip call to the backend to give you some data, or save some data, or create an EXCEL file.
Even if you write a MOBILE app - a heavy weight one - you still need these exact same web services. How else would you safely access data over the interweb? When I experimented with an Android app, using Eclipse to develop it - I still called .Net functions running in IIS.
Code:
Public Function AndroidService(ByVal ctrloption As String, ByVal objReturn As Dictionary(Of String, String) _
, ByVal username As String) As String
'Using fs1 As FileStream = New FileStream("d:\ctrl.txt", FileMode.Append, FileAccess.Write)
' Using s1 As StreamWriter = New StreamWriter(fs1)
' s1.Write(DateTime.Now.ToString & vbCrLf)
' s1.Write("Android Service: " & ctrlOption & vbCrLf)
' s1.Close()
' fs1.Close()
' End Using
'End Using
Dim JsonMaker As JsonWriter = New JsonWriter
With JsonMaker
Select Case ctrloption
Case "boot"
Dim nGuid As Guid = Guid.NewGuid
.StartObject()
'.StartObject()
Dim blnDidFirstObject As Boolean = False
Dim blnStartedControl As Boolean = False
Dim blnDidControlObject As Boolean = False
Dim blnStartedArray As Boolean = False
Dim blnNeedNewObject As Boolean = False
Try
Using dcn As New SqlConnection(System.Web.Configuration.WebConfigurationManager.ConnectionStrings("LocalSQLServerAWC" & credDB).ToString)
Using cmd As New SqlCommand
cmd.CommandType = CommandType.StoredProcedure
cmd.CommandText = "dbo.awc_MobileBoot"
cmd.Connection = dcn
cmd.CommandTimeout = 0
cmd.Parameters.AddWithValue("@SQLGuid", nGuid.ToString)
cmd.Parameters.AddWithValue("@username", username)
dcn.Open()
Using sdrReader As SqlDataReader = cmd.ExecuteReader
While sdrReader.Read
If Not blnDidFirstObject Then
blnDidFirstObject = True
Else
If Not blnStartedArray Then .Seperate()
End If
Select Case sdrReader(0).ToString
Case "1"
.NewObject("BootInfo", sdrReader(3).ToString)
Case "2"
If Not blnStartedControl Then
.NameObject("Controls")
.StartArray()
blnStartedControl = True
blnDidControlObject = False
End If
If sdrReader(4).ToString <> "array" Then
If Not blnDidControlObject Then
.StartObject()
blnDidControlObject = True
End If
If blnStartedArray Then
.EndArray()
.EndObject()
blnStartedArray = False
End If
If blnNeedNewObject Then
.Seperate()
.StartObject()
blnNeedNewObject = False
End If
If sdrReader(4).ToString = "boolean" Then
.NewObject(sdrReader(2).ToString, CBool(sdrReader(3)))
Else
.NewObject(sdrReader(2).ToString, sdrReader(3).ToString)
End If
Else
If Not blnStartedArray Then
.NameObject(sdrReader(2).ToString)
.StartArray()
blnStartedArray = True
blnNeedNewObject = True
End If
.PushArray(sdrReader(3).ToString, False)
End If
End Select
End While
End Using
End Using
End Using
Catch ex As Exception
.ResetJson()
.StartObject()
.NewObject("%%dalerror%%", ex.Message.Replace("""", "'").Replace("\", "\\"))
End Try
If blnStartedArray Then
.EndArray()
.EndObject()
.EndArray()
blnStartedArray = False
End If
.EndObject()
'.ValueObject("{ ""BootInfo"": { ""Portrait"": true, ""Source"": ""awcEstablishment_autocompleteid"" } " _
' & ", ""Controls"": [ { ""Field"": ""Field1"", ""Color"": ""Yellow"", ""Lookup"": true, ""Content"": [ { ""Type"": ""EditText"", ""Width"": 300 }, { ""Type"": ""Button"", ""Width"": 100, ""Content"": ""Go"" } ] }" _
' & ", { ""Field"": ""Field2"", ""Color"": ""White"", ""Content"": [ { ""Type"": ""Text"", ""Width"": 50, ""Content"": ""1"" }, { ""Type"": ""Text"", ""Width"": 150, ""Content"": ""This is longer text that will hopefully wrap and wrap and wrap as it needs to "" }, { ""Type"": ""Text"", ""Width"": 50, ""Content"": ""4"" }, { ""Type"": ""Checkbox"", ""Width"": 50 } ] } " _
' & ", { ""Field"": ""Field3"", ""Color"": ""Gray"", ""Content"": [ { ""Type"": ""Text"", ""Width"": 50, ""Content"": ""1"" }, { ""Type"": ""Text"", ""Width"": 150, ""Content"": ""This is short text"" }, { ""Type"": ""Text"", ""Width"": 50, ""Content"": ""4"", ""Color"": ""Red"" }, { ""Type"": ""Checkbox"", ""Width"": 50 } ] } " _
' & ", { ""Field"": ""Field4"", ""Color"": ""White"", ""Content"": [ { ""Type"": ""Text"", ""Width"": 50, ""Content"": ""1"" }, { ""Type"": ""Text"", ""Width"": 150, ""Content"": ""This is short text"" }, { ""Type"": ""Text"", ""Width"": 50, ""Content"": ""4"", ""Color"": ""Red"" }, { ""Type"": ""Checkbox"", ""Width"": 50 } ] } ] }")
Case "source"
.StartArray()
'.StartObject()
Dim blnDidFirstObject As Boolean
Try
Using dcn As New SqlConnection(System.Web.Configuration.WebConfigurationManager.ConnectionStrings("LocalSQLServerAWC" & credDB).ToString)
Using cmd As New SqlCommand
cmd.CommandType = CommandType.StoredProcedure
cmd.CommandText = "dbo." & objReturn("sproc")
cmd.Connection = dcn
cmd.CommandTimeout = 0
DetermineParameters(dcn, cmd)
SetParameters(cmd, False, "", objReturn, Nothing, "", "", username)
dcn.Open()
Using sdrReader As SqlDataReader = cmd.ExecuteReader
While sdrReader.Read
If Not blnDidFirstObject Then
blnDidFirstObject = True
Else
.Seperate()
End If
.StartObject()
.NewObject("label", sdrReader(0).ToString, True, True)
.Seperate()
.NewObject("value", sdrReader(1).ToString, True, True)
.EndObject()
End While
End Using
End Using
End Using
Catch ex As Exception
.ResetJson()
.StartObject()
.NewObject("%%dalerror%%", ex.Message.Replace("""", "'").Replace("\", "\\"))
End Try
.EndArray()
'If objReturn("sproc") = "awcEstablishment_autocomplete" Then
' .ValueObject("[{ ""label"": ""A & S"", ""value"": ""0242""},{ ""label"": ""bbb"", ""value"": ""0123""},{ ""label"": ""CCC"", ""value"": ""0456""},{ ""label"": ""D D D"", ""value"": ""0789""},{ ""label"": ""E E AND THIS IS A LONG ONE"", ""value"": ""0999""}]")
'Else
' .StartObject()
' .NewObject("%%dalerror%%", "Unknown AndroidService source procedure: " & objReturn("sproc"))
' .EndObject()
'End If
Case "get"
.StartObject()
.NameObject("GetInfo")
.StartObject()
.NewObject("Key", objReturn("key"))
.Seperate()
.NameObject("Source")
.StartArray()
Try
Using dcn As New SqlConnection(System.Web.Configuration.WebConfigurationManager.ConnectionStrings("LocalSQLServerAWC" & credDB).ToString)
Using cmd As New SqlCommand
cmd.CommandType = CommandType.StoredProcedure
cmd.CommandText = "dbo." & objReturn("sproc")
cmd.Connection = dcn
cmd.CommandTimeout = 0
DetermineParameters(dcn, cmd)
SetParameters(cmd, False, "", objReturn, Nothing, "", "", username)
dcn.Open()
Using sdrReader As SqlDataReader = cmd.ExecuteReader
While sdrReader.Read
For i = 0 To sdrReader.FieldCount - 1
If i > 0 Then .Seperate()
.StartObject()
Dim strFieldName = sdrReader.GetName(i)
Dim strValue = sdrReader(i).ToString
If strFieldName.StartsWith("~binary~") Then
strFieldName = strFieldName.Substring(8)
.NewObject("Field", strFieldName)
.Seperate()
If strValue = "1" Then
.NewObject("Value", True)
Else
.NewObject("Value", False)
End If
Else
.NewObject("Field", strFieldName)
.Seperate()
.NewObject("Value", strValue)
End If
.EndObject()
Next
End While
End Using
End Using
End Using
.EndArray()
.EndObject()
Catch ex As Exception
.ResetJson()
.StartObject()
.NewObject("%%dalerror%%", ex.Message.Replace("""", "'").Replace("\", "\\"))
End Try
.EndObject()
'.ValueObject("{ ""GetInfo"": { ""Key"": """ & objReturn("key") & """ , ""Source"": [{ ""Field"": ""TopInfo"", ""Value"": ""this is a name""}, { ""Field"": ""Field1"", ""Value"": true}, { ""Field"": ""Field2"", ""Value"": false}] } }")
Case "put"
'.ValueObject("{ ""PutInfo"": { ""Key"": """ & objReturn("key") & """ , ""Status"": ""Failure"", ""Message"": ""This was no good!"" } }")
.StartObject()
Dim strMessage As String = ""
Try
Using dcn As New SqlConnection(System.Web.Configuration.WebConfigurationManager.ConnectionStrings("LocalSQLServerAWC" & credDB).ToString)
Using cmd As New SqlCommand
cmd.CommandType = CommandType.StoredProcedure
cmd.CommandText = "dbo." & objReturn("sproc") & "_Save"
cmd.Connection = dcn
cmd.CommandTimeout = 0
DetermineParameters(dcn, cmd)
SetParameters(cmd, False, "", objReturn, Nothing, "", "", username)
dcn.Open()
strMessage = cmd.ExecuteScalar().ToString
End Using
End Using
.NameObject("PutInfo")
.StartObject()
.NewObject("Key", objReturn("key"))
.Seperate()
.NewObject("Status", "Success")
.EndObject()
Catch ex As Exception
.ResetJson()
.StartObject()
.NewObject("%%dalerror%%", ex.Message.Replace("""", "'").Replace("\", "\\"))
End Try
.EndObject()
Case Else
.StartObject()
.NewObject("%%dalerror%%", "Unknown AndroidService option: " & ctrloption)
.EndObject()
End Select
End With
Return JsonMaker.GetJson()
End Function
Last edited by szlamany; Jul 17th, 2023 at 08:11 AM.
-
Jul 17th, 2023, 07:57 AM
#15
Thread Starter
PowerPoster
Re: Convert Windows Desktop Code to Mobile
@szlamany - Thanks, I will definitely take a look at this.
There are 10 kinds of people in this world. Those who understand binary, and those who don't.
-
Jul 18th, 2023, 08:01 AM
#16
Thread Starter
PowerPoster
Re: Convert Windows Desktop Code to Mobile
OK, so if I go through a couple of the Microsoft tutorials online, I will have enought knowledge to understand where your code examples fit in?
There are 10 kinds of people in this world. Those who understand binary, and those who don't.
-
Jul 18th, 2023, 08:18 AM
#17
Re: Convert Windows Desktop Code to Mobile
I would start a new thread in the JavaScript forum here - asking about tutorials or quick sample code of the latest and best JS library for AJAX calls to IIS backend services.
I use jQuery - which I'm sure some would find too old.
I purchased a book on working with jQuery for just these purposes. Was incredibly helpful.
Ask DDAY for some advice - he might know more about easy entry into this method of coding.
[edit] I just PM'd him... [/edit]
-
Jul 18th, 2023, 08:23 AM
#18
Thread Starter
PowerPoster
Re: Convert Windows Desktop Code to Mobile
There are 10 kinds of people in this world. Those who understand binary, and those who don't.
-
Jul 18th, 2023, 08:42 AM
#19
Re: Convert Windows Desktop Code to Mobile
Server-Side
I work with ASP.NET in both the .NET framework and .NET core (I think we're working on 6 at the moment) at work. I also do a lot of PHP and NodeJS development for contract work.
Razor pages are similar to PHP in that you can have server-side code executed directly on a front-end web page. Personally, I use very little Razor code in my front-end code. Similarly I never use any PHP code in my front-end code either. I stick with the idea that my front-end and back-end are two entirely different apps.
However, you can do some nifty things leveraging Razor. Take for example you have an entity that you want to setup a single-page application (SPA) create/read/update/delete (CRUD) implementation for. You can have your index.cshtml handle the routing and shared datasources then have separate _search.cshtml, _create.cshtml, and _update.cshtml partials that handle the specific CRUD operation. At the end of the day the partials will all be rendered into the index page, but this allows you to manage the files more practically and allows you to separate the various functions.
Front-End
I started with jQuery, but to be honest most modern browsers support features that caused jQuery to be introduced in the first place (not to mention IE is finally sunset), so I have been using more plain JavaScript rather than jQuery the past couple of years.
There are also JavaScript frameworks like Angular, React, and Vue. I have worked with those three and I don't think they're worth the overhead. I love TypeScript which is what Angular uses but I find that I wind up fighting with the framework more than actually implementing business logic/features.
Notes
In my experience, web development isn't very difficult but deployment is always a pain in the rear. Using ASP.NET MVC will help ease the pain of deployment but if you go with PHP or NodeJS then you need to be familiar with not only locking down the filesystem that users can only access files you want them to access but you will also need to be familiar with Linux because 9 times out of 10 you're deploying on a Linux machine.
Last edited by dday9; Jul 18th, 2023 at 08:45 AM.
-
Jul 18th, 2023, 09:23 AM
#20
Thread Starter
PowerPoster
Re: Convert Windows Desktop Code to Mobile
I mentioned we are using DevExpress controls so I am looking into what they have. Under WEB CONTROLS, they list Blazor. Then Angular, React, Vue and jQuery are together. Finally, ASP.NET Core. That means I have to pick one of these?
There are 10 kinds of people in this world. Those who understand binary, and those who don't.
-
Jul 18th, 2023, 10:39 AM
#21
Re: Convert Windows Desktop Code to Mobile
You are going to have to do a bit of research here, if no one has experience with these tools in DevExpress.
Bottom line is that some function will run on the server to return/process data with the database. Does not matter if you are doing a remote heavy executable Android mobile app, or a lightweight web page.
Someone has to package the request (client side), send the request (client side), receive and process the request (server), return the data (server), and then display that result in the client user interface (client).
I prefer doing all this myself.
Others rely on tools to hide this interaction - but in the long run, it's always going on.
Since your experience in the web-client side is not huge, relying on a package like DevExpress to handle that end could be very beneficial.
If you are going to have only a handful of data entry fields on the client side, I would explore other ways of doing this without DevExpress.
If you are expecting a complex UI, and want similarity with the DevExpress WinForm you have now, then DevExpress web tools might be a requirement here.
-
Jul 18th, 2023, 10:51 AM
#22
Thread Starter
PowerPoster
Re: Convert Windows Desktop Code to Mobile
Yes, thank you. I found this headline in a VisualStudio Magazine article: How to Do Web Forms in VS 2022 (Even Though Microsoft Recommends Blazor/.NET 6) so I am trying to download the DX Blazor controls and code something. ("Trying" because I need the password for our DX subscription, but that should be forthcoming).
There are 10 kinds of people in this world. Those who understand binary, and those who don't.
-
Jul 18th, 2023, 01:10 PM
#23
Re: Convert Windows Desktop Code to Mobile
I apologize because I didn't realize that the idea was to move to mobile and not specifically web development.
Also just a heads up, but I have never used DevExpress.
If you are wanting to create a mobile application using web technologies rather than native languages (i.e. swift) then I would recommend using Ionic/Cordova with Angular. The way that it works is it uses essentially a web wrapper with plugins that access phone specific features (like geolocation, recognizing the side button being pushed, etc.) so that you can use common web development techniques that get transpiled to native languages. I personally hate mobile development because there are so many nuances and prefer to just do progressive web apps that use a phone's browser.
-
Jul 18th, 2023, 01:47 PM
#24
Thread Starter
PowerPoster
Re: Convert Windows Desktop Code to Mobile
@dday9 - Our company application (for in-house employees only) is a Windows Desktop application. Our technicians go out on the road to customers. It'd be nice for them to be able to type a case resolution and other relevant data into something on their phones as it happens and not have to "catch up" when they're back in the office. So the idea is to get it off of Windows. We are a Microsoft shop. I am a C#/SQL Server developer. So we'd want to stay with what I mostly know and not have a huge learning curve.
There are 10 kinds of people in this world. Those who understand binary, and those who don't.
-
Jul 18th, 2023, 02:00 PM
#25
Re: Convert Windows Desktop Code to Mobile
Web app is less learning curve than doing an actual Mobile app, imo.
Mobile apps have to follow all kinds of button and click rules - home buttons and back buttons. It's a whole new paradigm. Activities, Intents and Events - there is only ONE program on the screen at a time!
and of course it's either Android or IPhone - not both, at least not easily.
-
Jul 18th, 2023, 03:25 PM
#26
Re: Convert Windows Desktop Code to Mobile
Yeah, I completely agree with szlamany's approach.
If I were in your position I'd create a C# MVC ASP.NET core web application where the views/partials represent a progressive web application.
You can move all the business logic from the windows desktop application to the API, then have the desktop app and web app hit the same API endpoints so that you can have a single source of truth.
-
Jul 20th, 2023, 10:23 AM
#27
Re: Convert Windows Desktop Code to Mobile
 Originally Posted by dday9
You can move all the business logic from the windows desktop application to the API, then have the desktop app and web app hit the same API endpoints so that you can have a single source of truth.
Single Source of Truth! I love that statement - thank you so much David! It applies to so much. I've always told those that have worked for me that there is only "one right way to do something". In IT that is really the truth, imo! And you now have me with a new slogan!
-
Jul 20th, 2023, 01:38 PM
#28
Thread Starter
PowerPoster
Re: Convert Windows Desktop Code to Mobile
That is nice you guys 🥰
My next question is what forum is best suited to post my Blazor Server development questions? Because I am sure, now that you've steered me away from a mobile app, tht I should get the heck out of dodge (i.e., this forum). What I want to do is connect to my database. But just to have some fun, not for real, so it doesn't need to be all that secure. Can't I just add a connection string to appsettings.json and be on my merry way? I coded a cute little page with a grid that displays data for *one* of our customers. I hardcoded it all 🙁. I would like to switch to a new customer (that should also come from our database so I can list them all) and load new data. Can't I just test this without getting all serious about database access? (And if I get some direction about the appropriate forum I will create a new post there). Thanks!
There are 10 kinds of people in this world. Those who understand binary, and those who don't.
-
Jul 20th, 2023, 01:44 PM
#29
Re: Convert Windows Desktop Code to Mobile
You have a couple of options, the ASP.NET forum, the MVC forum, or just the plain ole C# forum.
My gut tells me it should probably be the ASP.NET forum.
-
Jul 20th, 2023, 01:59 PM
#30
Thread Starter
PowerPoster
Re: Convert Windows Desktop Code to Mobile
TY, I will close this thread. Everyone here has been very helpful, I appreciate it!
There are 10 kinds of people in this world. Those who understand binary, and those who don't.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|