xsharp.eu • Attempting to create web-based version of application with VS
Page 1 of 2

Attempting to create web-based version of application with VS

Posted: Thu Feb 17, 2022 6:08 pm
by ThomasWYale
Please forgive my ignorance. Though I have viewed Robert's video "Beginner Level: New features in the X# support for Visual Studio," I'm afraid it assumes prior background with Visual Studio, which I do not have. I suppose the best way to explain things is to list separate issues one by one. Also, the forum doesn't permit me to insert images within the text, so I include them at the end.

1) My goal is to create a version of an application, which I have successfully migrated from VO 2.8 to X#, which run online from a web page. My application has 88,035 lines of code, consists of a main dialog window from which a total of 68 different forms can be opened (of course not all at one time), has 4 DB servers, and opens a maximum of 138 DBF's with a maximum of 215 indexes—all of which should give you a good idea how enormous it is. (First image is a screenshot of the main interface)

2) Another forum commenter told me that I need to draw aspx pages, presumably to build forms identical to those in my application, with the same kind of controls (comboboxes, treeviews, listviews, et al). ASP seems to be associated with Web Forms. So to this end, I have upgraded from Windows 7 to 10 to install Visual Studio 2022, and merely assumed that I should install the workload "ASP.NET and web development". I did so and selected what I thought would be the necessary options as shown in the following screenshot. (Second image is a screenshot of the options I selected in the installer)

3) I then created a new project using "ASP.NET Web Application (.NET Framework)" project type. I merely assumed—and of this I admit that I'm totally wrong—that there would be something like a form designer as found in VO and X#, but the Toolbox was empty. At this point, I'm totally at sea. I have no idea what to do, or what options to choose. (Third image is of the VS interface with the project open)

4) The forum commenter also advised me to have the aspx pages "recall" the logic placed in DLL's. As far as the logic goes, this is somewhat vague. Does it include all classes and their methods, and everything else minus all references to forms and dialogs, while retaining methods for mouse, window, control, menu, treeview and listview events, as well as pushbutton clicks? To do this, would it be advisable to create another project specifically for this purpose in X#? And how is this content placed in a DLL (which I also assume is through X#)?

I'm not even sure whether something like this could be done with an application of this magnitude. If not, perhaps I can publicize and market my software in a way other than from a web application, and try to motivate potential users to download it to their own machines, despite that a web-based version seems to be preferable.

Attempting to create web-based version of application with VS

Posted: Thu Feb 17, 2022 9:34 pm
by ic2
Hello Thomas,

First of all, you have multiple options to create web-based programs. We have always used CGI, which basically means that a VO or X# exe produces HTML pages which are issued. When a user presses e.g. a button, a new resulting HTML page is created and issued. Advantage is that the business logic can closely resemble that of a desktop/server app. Disadvantage is that not every hosting company allows exe's to run, but you can solve that with a VPS for example. And you will need a Windows server.

I've also create one small ASPX web program earlier. You will need a Windows server for that too. It looks like you did not start with a APSX project. I created a solution and added a ASP project searching ASP C# and got this:
ASPXSample1.jpg
ASPXSample1.jpg (13.81 KiB) Viewed 1546 times
Or, adding a project to an existing solution, like this (2nd option, Web Form)
ASPXSample2.jpg
ASPXSample2.jpg (38.68 KiB) Viewed 1546 times
Once you have the project in your solution Explorer it looks like this
ASPXSample3.jpg
ASPXSample3.jpg (35.61 KiB) Viewed 1546 times
I double click on Default.aspx and make sure that I click Split below the XAML screen code, so I end up with this screen (you'll see the Design/Split/Source options below the screen design view. You can also right click on Default.aspx.designer.cs and open View Designer.

It's only than that you will see, as in the picture, a regular Toolbox. You can add control on the screen and double click them for a code behind method.

It's always a bit of trial & error. As it is VS it's a lot of trial and more error. But eventually you will get something like this:
ASPXSample4.jpg
ASPXSample4.jpg (79.22 KiB) Viewed 1546 times
I hope it helps,

Dick

Attempting to create web-based version of application with VS

Posted: Fri Feb 18, 2022 2:33 am
by ThomasWYale
Thank you for your kind response. I was able to create the ASP.NET Web application as you showed it, and experimented with it, only to inadvertently delete other content when I was trying to delete controls from the Toolbox. In any event, with what was left, I clicked and dragged a treeview, then ran it, but the treeview wasn't visible at all. And there was only event associated with the treeview, TreeView1_SelectedNodeChanged, and no others, such as TreeViewItemExpanding/Expanded/SelChanged/KeyDown as in an X# or VO application. A checkbox worked, anyway.

I have my doubts that pursuing a web app this way, not merely learning how to make these controls visible and working even when I clicked and dragged them onto the form, but it could curtail the functionality of some other controls for lack of those other events. My application uses a few of them.

And I understand the reason behind running the exe directly: ISP's don't want to compromise security.

Ultimately, the VPS seems to be the best alternative. The application at present wouldn't lose any functionality for lack of events that ASP controls seem to lack. Would any VPS suffice? Perhaps this one? https://www.atlantic.net/vps-hosting/

Attempting to create web-based version of application with VS

Posted: Fri Feb 18, 2022 4:59 am
by wriedmann
Hi Thomas,
sorry if that may sound harsh: please forget it to transform a VO application to a web based application. It will simply not work.
A web application is a completely different thing and has not only to be rewritten, but also be renewed architecturally (IMHO the same is true for a migration to SQL or a GUI platform like WPF).
Your best bed would be to rent a virtual server running Windows and remote desktop services and use your application there.
I'm afraid there will be some costs for it, either using Windows server or a software layer like AADS or RemotePlus.
But these costs will be a lot lower than a complete rewrite (and we are doing the same, even if the half of our small company is doing web applications so we have the knowledge in-house).
Wolfgang

Attempting to create web-based version of application with VS

Posted: Fri Feb 18, 2022 5:31 am
by ThomasWYale
Hi, Wolfgang.

Yeah, Dick made a good point with running it through a VPS or virtual machine on a Windows server. I've already emailed a company that provides VPS cloud services and asked them about it.

Thanks,

Tom

Attempting to create web-based version of application with VS

Posted: Fri Feb 18, 2022 11:10 am
by ic2
Hello Wolfgang,
wriedmann wrote:Hi Thomas,
sorry if that may sound harsh: please forget it to transform a VO application to a web based application. It will simply not work.
A web application is a completely different thing and has not only to be rewritten, but also be renewed architecturally (IMHO the same is true for a migration to SQL or a GUI platform like WPF).
"Screenwise" you are right. Every migration, WPF or a CGI based webprogram, requires every screen to be rewritten, although VO screens to WPF could be done by Paul Piko's Facelift (https://piko.com.au/facelift/).

For CGI you have to "construct" HTML to show any screen/window which is a totally different approach to painting a screen in e.g. X#/VO, Winforms etc. But if the majority of your code is Business Logic then this doesn't need to change at all. Although CGI is not a 'hot' technology it is the easiest way to make a program web based.

Finally, bear in mind that a web application is always a front end and a back end. The front end is pure HTML/CSS (in a CGi program this is produced by the same exe which handles the back end), or JavaScript for example. Popular back end languages are Ruby and Python, but it can be anything, also C# or X#, PHP etc. ASPX is a web development framework and used for both front- and backend. I have used ASPX to build the front end (webscreen) and C# to do the back end (the logic to process the user choices).

Dick

Attempting to create web-based version of application with VS

Posted: Fri Feb 18, 2022 11:14 am
by info@task.si
Hi Thomas !
I agree with Wolfgang. Producing "Web" app is totally different thing. Almost one year I am trying to transform VO app to X# and Winforms and at the same time fron X# to web using Blazor frame. Why Blazor ? It is new technoloqy mixing C#, razor and HTML . But Blazor is capable also to use X# DLL (functions, classes writtwn in X#). I can not tell you how much code can be reusable from X#. But if it is 30% than it is reasonable.
Regards, Andrej Terkaj

Attempting to create web-based version of application with VS

Posted: Wed Feb 23, 2022 7:17 am
by TimothyS
Hi Thomas,

This is a big job. Have a look at the article Building Web apps - Danilo under Articles/User contributions. Danilo describes how to create a Web Forms app using XSharp code.
I have used his advice and it works. BUT it is pretty much a rewrite.
Putting your app on a virtual cloud server is faster, but will cost you more. This is called a hybrid cloud application and that market is getting bigger.
BTW Tried using Blazor with X#. Worked on beta Blazor, but not the production versions. Looks like we need to wait until X# will run with DotNet 5.
Regards,
Tim

Attempting to create web-based version of application with VS

Posted: Wed Feb 23, 2022 8:35 am
by info@task.si
Hi Tim !

I use Blazor also in a real production ( .Net 6 , Visual Studio 2022) . Of course using X# (.net core dialect) as a library in Blazor solutions. I could show you some screen grabs, but they are in slovene language.
I am waiting also for new X# .NET. Hoping soon.
Regards, Andrej

Attempting to create web-based version of application with VS

Posted: Wed Feb 23, 2022 2:04 pm
by kevclark64
Your application looks pretty specialized, rather than being an application everyone might use. That being the case, one would think that anyone who needed such an application would be quite willing to download it. I realize that if you made it web-based then it would be cross platform and so open up more markets for you potentially. But I can't help thinking that the effort that would go into making it a web app might be more profitably spent on marketing what you already have. Just an opinion.