zoukankan      html  css  js  c++  java
  • 窗体之间的交互,传值,关闭登录窗口

    1.          //关闭登陆窗口
                foreach (Window window in Application.Current.Windows)
                {
                    if (window.Title == "LoginWindow")
                    {
                        window.Close();
                    }
                }

    2.       通过构造函数传值,调用引用获取返回值

                RenameDialog dialog = new RenameDialog(Path.GetFileNameWithoutExtension(filename));
                if (dialog.ShowDialog() == true) // Result could be true, false, or null
                {
                    // Attempt to rename the file
                    try
                    {
                        File.Move(filename, Path.Combine(Path.GetDirectoryName(filename), dialog.NewFilename) + Path.GetExtension(filename));
                    }
                    catch (Exception ex)
                    {
                        MessageBox.Show(ex.Message, "Cannot Rename File", MessageBoxButton.OK, MessageBoxImage.Error);
                    }
                }

  • 相关阅读:
    今日总结
    今日总结
    今日总结
    今日总结
    今日总结
    今日总结
    今日总结
    今日总结
    今日总结
    Interesting Finds: 2010 02.08 ~ 02.13
  • 原文地址:https://www.cnblogs.com/gitran/p/2868169.html
Copyright © 2011-2022 走看看