Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

修改App.xml.cs中的LoginOut方法,让其重新登陆时可以更改UserName. #6

Open
haijunluo opened this issue Nov 21, 2023 · 0 comments

Comments

@haijunluo
Copy link

    public static void LoginOut(IContainerProvider provider)
    {
        Application.Current.MainWindow.Hide();
        var dialog = provider.Resolve<IDialogService>();
        dialog.ShowDialog("LoginView", callback =>
        {
            if (callback.Result != ButtonResult.OK)
            {
                Environment.Exit(0);
                return;
            }

            // 获取主区域的 RegionManager
            var regionManager = provider.Resolve<IRegionManager>();
            // 移除主区域中的所有视图
            regionManager.Regions[PrismManager.MainViewRegionName].RemoveAll();

            var service = App.Current.MainWindow.DataContext as IConfigureService;
            if (service != null)
                service.Configure();

            Current.MainWindow.Show();
        });
    }
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant