public void ShowForm(UIApplication uiapp)
        {
            if (_$safeprojectname$UserControl == 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.


                _$safeprojectname$UserControl = new $safeprojectname$UserControl(exEvent);
                BitmapImage pb1Image = new BitmapImage(new Uri("pack://application:,,,/$safeprojectname$;component/Resources/icon.ico"));

                Window.Content = _$safeprojectname$UserControl;
                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.$safeprojectname$Button.Enabled = false;
            }
        }
 public void OnClosing(object sender, EventArgs e)
 {
     App.$safeprojectname$Button.Enabled   = true;
     WpfWindowController.Instance          = null;
     $safeprojectname$UserControl.Instance = null;
 }