Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- using System.ComponentModel;
- using System.Windows.Forms;
- namespace R721WPFEnWindowsForms
- {
- public partial class Principal : Form
- {
- private VentanaWPF ventanaWpfNoModal;
- private CancelEventHandler ventanaNoModalHandlerCierre;
- public Principal()
- {
- InitializeComponent();
- ventanaNoModalHandlerCierre = new CancelEventHandler(Window_Closing);
- }
- private void btnAbrirVentanaWPFNoModal_Click(object sender, EventArgs e)
- {
- if (ventanaWpfNoModal == null)
- {
- ventanaWpfNoModal = new VentanaWPF();
- ventanaWpfNoModal.Closing += ventanaNoModalHandlerCierre;
- btnAbrirVentanaWPFNoModal.Text = "Cerrar Ventana WPF No-Modal";
- ventanaWpfNoModal.Show();
- }
- else
- {
- ventanaWpfNoModal.Close();
- }
- }
- private void btnVentanaWFPModal_Click(object sender, EventArgs e)
- {
- VentanaWPF ventanaWpfModal = new VentanaWPF();
- ventanaWpfModal.ShowDialog();
- }
- private void Window_Closing(object sender, CancelEventArgs e)
- {
- ventanaWpfNoModal.Closing -= ventanaNoModalHandlerCierre;
- ventanaWpfNoModal = null;
- btnAbrirVentanaWPFNoModal.Text = "Abrir Ventana WPF No-Modal";
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement