MainForm是实现SPA的单个网站首页窗体,该网站首页窗体将在成功登录(或者如果没有LoginForm存在)后创建并显示。通常,MainForm是用于使用菜单或其他导航工具导航到其他网页窗体的应用程序网站首页窗体。创建新项目时,将自动创建MainForm网站首页窗体。每个Web会话都有其自己的MainForm专用副本,关闭MainForm将终止该会话。

MainForm在单元的initialization 注册,以便uniGUI能够将它与其他网页窗体分开来,实现代码如下。
initialization
RegisterAppFormClass(TMainForm);
end.
关于MainForm的相关论坛帖子:欢迎加入Delphi开发局QQ群:32422310 Delphi控件源码下载网站
1、可否在2个MainForm网站首页窗体之间切换?基于登录用户的不同显示不同的网站首页MainForm内容?
解决思路:根据您在它们之间进行切换的条件,您可以使用带有uniContainerPanel的“空”主窗体。然后,您将构建两个单独的uniFrame,并在运行时根据您的条件将其分配给容器面板。这将解决它的视觉方面,但是主要形式仍将包含背后的代码或逻辑,但对用户而言是透明的。Depending on your criteria for switching between them, you can have an "empty" main form with a uniContainerPanel. You then build two separate uniFrames which you assign at run-time to the container panel based on your criteria. That will solve the visual aspect of it, the main form however will still contain the code behind, or logic but that is transparent to the user.
译者总结:uniGUI启动后只能首先显示MainForm首页窗体,如果使用uniGUI设计一个具有前端首页和管理后台首页的网站,那么可以在MainForm上同时设计前端和管理后台的首页。也可以单独设计一个后台管理首页窗体,然后根据用户输入的浏览器url地址来切换前端首页和后台首页。代码示例:通过浏览器参数,访问网站管理后台:
procedure TMainForm.UniFormCreate(Sender: TObject);
var app:string;
begin
//浏览器:http://127.0.0.1:8077/?app=admin
app := UniApplication.Parameters.Values['app'];
if app='admin' then UniForm_Admin.ShowModal();
end;
你好,
是否有任何方法可以使服务器根据登录的用户提供不同的MainForm?
我想根据用户的类型(管理员或非管理员)来分隔用户的MainForm内容
我可以通过让非管理员用户自动查看MainForm以外的另一个Application表单来实现。问题在于,如果我从ServerModule中选择表格,那么Form仍然会带有较小的边框,并且不会像MainForm那样处于完整的mfpage模式。如果我被迫使用这种方法,那么当您从ServerModule中选择mfpage时,是否可以像MainForm一样显示有问题的表单?
答:
据此,不可能有2种主要形式,在我的应用程序中,MainForm内有3个框架(仪表板),我根据用户的喜好显示其中一个框架,我想您也可以这样做。it is not possible to have 2 main forms according to this, in my application I have 3 frames (Dashboards) inside the MainForm i show one of them depending on user preferences ,I think you can do the same
uniGUI作者答:一个MainForm不能超过一个。