Smobiler上海石磨_.NET移动开发平台

标题: 如何一健返回首页或跳转到指定页面 [打印本页]

作者: gxlei26    时间: 2020-11-14 09:52
标题: 如何一健返回首页或跳转到指定页面
form1(首页),有一个TabPageView,
分别加载UserControl1和UserControl2,UserControl3;
比如现在UserControl2中有一个listview为商品的列表,
listview模板中button1点击弹出form2商品详情,
form2中有button1返回首页和button2加入购物;
这个button1返回首页的事件怎么写呢?
1、用this.Form.Show(c,(obj,args)=>{this.Close()回调事件,这个比较麻烦,因为可能有跳转多个窗口的,不能辨断是否点击的返回首页按钮。
2、Client.ReStart()重启客户端回到起始窗体,我的起始窗体是密码登陆界面。


作者: Lula.Jin    时间: 2020-11-16 10:07
可以通过show的回调来实现

窗体a中写代码跳转b,this.Form.Show(b,(obj,args)=>{this.Close();//回调事件2在b关闭后触发,this指a窗体});

窗体b中写代码跳转c,this.Form.Show(c,(obj,args)=>{this.Close();//回调事件在c关闭后触发,this指b窗体});

c页面中执行this.Close();//可以在窗体c中加入button,在button的点击事件中写this.Close()

这样点击c中的button 关闭窗体c 时会执行回调中的方法关闭b,关闭a的
作者: lichao8872    时间: 2020-11-17 14:38
我知道怎么在多级窗口中一键返回首页,但是呢你发个红包我告诉你,哈哈
作者: gxlei26    时间: 2020-11-20 10:03
lichao8872 发表于 2020-11-17 14:38
我知道怎么在多级窗口中一键返回首页,但是呢你发个红包我告诉你,哈哈 ...

好的,联系我哈




欢迎光临 Smobiler上海石磨_.NET移动开发平台 (https://www.smobiler.com/) Powered by Discuz! X3.2