Skip to main content

Project Conversion and Wisej.NET Startup

A clean Wisej.NET 4 shell is created on the migration branch (the WinForms original LegacyOrderDesk stays in the solution untouched), the first form (OrdersForm + its EditOrderDialog) is copied in, System.Windows.Forms becomes Wisej.Web, and the compiler errors are categorized, fixed and rebuilt (15 → 24 → 10 → 0) until the form runs in the browser. App.config's connection string moves to Web.config.

Run it

cd "LearnWisej-Samples/From WinForms to the Web Course/Module 2/OrderDesk.Web"
dotnet run -f net10.0 --urls http://localhost:5602

Then open http://localhost:5602. (Visual Studio: open OrderDesk.slnx, set OrderDesk.Web as the startup project, F5. The solution also contains LegacyOrderDesk, the WinForms original, which runs on Windows only.)

What to try

ActionWhat you should see
Page loadProgram.Main shows the ported Orders form: menu File/View/Reports/Help, the grid with 1042 Northwind Traders $4,820.00 Open first, the Order detail group and the status bar Ready · 5 orders
Double-click a rowEditOrderDialog opens modally; Save closes it, MessageBox.Show("Saved.") still works, the grid reloads. The result arrives in the ShowDialog callback and the caller disposes the dialog
New OrderThe same dialog for a new Northwind order
View › Open orders only / All ordersFilters the grid through the reused OrderService.Search
Print Invoice, Export to Excel, Attach file…, File › Settings…Not ported yet (desktop-only operations): a "not available in the web version yet" message. They are the open items in docs/CompilerErrorLog.md

Where things live

Module 2/
├─ OrderDesk.slnx both projects
├─ LegacyOrderDesk/ the WinForms original, untouched
└─ OrderDesk.Web/ the Wisej.NET 4 shell (net10.0-windows;net10.0)
├─ Default.html / Default.json / Program.cs / Startup.cs / Web.config the shell files
├─ OrderDesk.Web.csproj Microsoft.NET.Sdk.Web + PackageReference Wisej-4 4.1.0
├─ OrdersForm.cs / .Designer.cs the ported form: still a Form; MenuBar/StatusBar substitutions
├─ Dialogs/EditOrderDialog.cs ported unchanged (the caller changed: ShowDialog callback)
├─ Domain/ the reused business logic
├─ Legacy/AppState.cs the desktop statics the ported form still reads (Module 4)
├─ Views/Ui.cs toast helper
└─ docs/ the lab deliverables

Runtime facts

  • There is no AddWisej() in Wisej-4 4.1.0 (the video shows one); app.UseWisej() is the only middleware registration.
  • A Form shown with Show() floats in the browser and is disposed by Wisej.NET when it closes; a Form shown with ShowDialog(callback) is disposed by the caller. ShowDialog never blocks.
  • The projects multi-target net10.0-windows;net10.0, so dotnet run needs -f net10.0 (or -f net10.0-windows).