private void OnConfigCommandMessage(ConfigCommandMessage message) { var window = new ChildWindow(); var contentControl = new NewEditServer(); contentControl.DataContext = new EditServerDetailViewModel(message.Server); window.Content = contentControl; window.Closed += (s, e) => { Messenger.Default.Unregister <CloseEditServerMessage>(this); Application.Current.RootVisual.SetValue(Control.IsEnabledProperty, true); }; Messenger.Default.Register <CloseEditServerMessage>(this, (m) => { window.DialogResult = false; window.Close(); }); window.Show(); }
private void OnConfigCommandMessage(ConfigCommandMessage message) { var window = new ChildWindow(); var contentControl = new NewEditServer(); contentControl.DataContext = new EditServerDetailViewModel(message.Server); window.Content = contentControl; window.SizeToContent = SizeToContent.WidthAndHeight; window.Topmost = true; window.WindowStartupLocation = WindowStartupLocation.CenterScreen; window.ResizeMode = ResizeMode.NoResize; window.Title = "Edit Server"; Messenger.Default.Register <CloseEditServerMessage>(this, (m) => { window.DialogResult = false; window.Close(); }); window.ShowDialog(); Messenger.Default.Unregister <CloseEditServerMessage>(this); }