(精华)2020年01月26日 WPF课程管理系统项目实战(登陆界面-等待与跳转)

举报
愚公搬代码 发表于 2021/10/19 23:16:27 2021/10/19
【摘要】 修改窗体模式 <Application x:Class="Zhaoxi.CourseManagement.App" xmlns="http://schemas.micro...

修改窗体模式

<Application x:Class="Zhaoxi.CourseManagement.App"
             xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
             xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
             xmlns:local="clr-namespace:Zhaoxi.CourseManagement"
             ShutdownMode="OnExplicitShutdown">
    <Application.Resources>
         
    </Application.Resources>
</Application>

  
 
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
/// <summary>
/// App.xaml 的交互逻辑
/// </summary>
public partial class App : Application
{
    protected override void OnStartup(StartupEventArgs e)
    {
        base.OnStartup(e);

        if(new LoginView().ShowDialog() == true)
        {
            new MainView().ShowDialog();//登陆窗口关闭打开
        }
        Application.Current.Shutdown();//主窗口关闭推出程序
    }
}

  
 
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • 10
  • 11
  • 12
  • 13
  • 14
  • 15
  • 16

界面

<Button Content="登    录" Grid.Row="3" Height="42" Foreground="White" FontSize="16"
                        Template="{StaticResource LoginButtonTemplate}"
                        Command="{Binding LoginCommand}"
                        CommandParameter="{Binding ElementName=window}"/>

  
 
  • 1
  • 2
  • 3
  • 4
Application.Current.Dispatcher.Invoke(new Action(() =>
                    {
                        (o as Window).DialogResult = true;
                    }));

  
 
  • 1
  • 2
  • 3
  • 4

文章来源: codeboy.blog.csdn.net,作者:愚公搬代码,版权归原作者所有,如需转载,请联系作者。

原文链接:codeboy.blog.csdn.net/article/details/113205443

【版权声明】本文为华为云社区用户转载文章,如果您发现本社区中有涉嫌抄袭的内容,欢迎发送邮件进行举报,并提供相关证据,一经查实,本社区将立刻删除涉嫌侵权内容,举报邮箱: cloudbbs@huaweicloud.com
  • 点赞
  • 收藏
  • 关注作者

评论(0

0/1000
抱歉,系统识别当前为高风险访问,暂不支持该操作

全部回复

上滑加载中

设置昵称

在此一键设置昵称,即可参与社区互动!

*长度不超过10个汉字或20个英文字符,设置后3个月内不可修改。

*长度不超过10个汉字或20个英文字符,设置后3个月内不可修改。