public void ShowForm(UIApplication uiapp) { if (_AutomaticArrangementUserControl == null) { if (Instance == null) { Instance = this; } // A new handler to handle request posting by the dialog RevitHandler handler = new RevitHandler(); // External Event for the dialog to use (to post requests) ExternalEvent exEvent = ExternalEvent.Create(handler); // We give the objects to the new dialog; // The dialog becomes the owner responsible for disposing them, eventually. _AutomaticArrangementUserControl = new AutomaticArrangementUserControl(exEvent); BitmapImage pb1Image = new BitmapImage(new Uri("pack://application:,,,/AutomaticArrangement;component/Resources/icon.ico")); Window.Content = _AutomaticArrangementUserControl; Window.Icon = pb1Image; Window.Title = Util.ApplicationWindowTitle; Window.Height = Util.ApplicationWindowHeight; Window.Topmost = Util.IsApplicationWindowTopMost; Window.Width = Util.ApplicationWindowWidth; Window.WindowStartupLocation = WindowStartupLocation.CenterScreen; Window.Show(); Window.Closed += OnClosing; App.AutomaticArrangementButton.Enabled = false; } }
public void OnClosing(object sender, EventArgs e) { App.AutomaticArrangementButton.Enabled = true; WpfWindowController.Instance = null; AutomaticArrangementUserControl.Instance = null; }