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

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

作者:互联网

修改窗体模式

<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>
/// <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();//主窗口关闭推出程序
    }
}

界面

<Button Content="登    录" Grid.Row="3" Height="42" Foreground="White" FontSize="16"
                        Template="{StaticResource LoginButtonTemplate}"
                        Command="{Binding LoginCommand}"
                        CommandParameter="{Binding ElementName=window}"/>
Application.Current.Dispatcher.Invoke(new Action(() =>
                    {
                        (o as Window).DialogResult = true;
                    }));

标签:26,01,Current,Application,OnStartup,ShowDialog,跳转,new,true
来源: https://blog.csdn.net/aa2528877987/article/details/113205443