private void SitesCatalog_SiteOpened(object sender, SitesCatalog.SiteOpenedEventArgs e)
        {
            if (e.Site == null || string.IsNullOrWhiteSpace(e.Site.Url))
            {
                return;
            }

            BuilderApplication.Instance.CurrentSite             = e.Site;
            BuilderApplication.Instance.BuilderScreenVisibility = System.Windows.Visibility.Visible;
            BuilderApplication.Instance.CatalogScreenVisibility = System.Windows.Visibility.Collapsed;
            BuilderApplication.Instance.NewappScreenVisibility  = System.Windows.Visibility.Collapsed;

            SidePanelContainer.Visibility = System.Windows.Visibility.Collapsed;
            MapContentsHost.GoToMapContent(false);

            BuilderConfigurationProvider configProvider = ViewerApplicationControl.ConfigurationProvider as BuilderConfigurationProvider;

            if (configProvider != null)
            {
                configProvider.MapXaml = null; // clear the map xaml
            }
            string baseUrl = e.Site.Url;

            if (baseUrl.IndexOf("?", StringComparison.Ordinal) < 0 && !baseUrl.EndsWith("/", StringComparison.Ordinal)) // has no query parameter
            {
                baseUrl += '/';
            }
            ViewerApplicationControl.Instance.DefaultApplicationSettings = null;
            ViewerApplicationControl.BaseUri = new Uri(baseUrl, UriKind.Absolute);
        }
        private void SitesCatalog_SiteCopy(object sender, SitesCatalog.SiteOpenedEventArgs e)
        {
            if (e.Site == null || string.IsNullOrWhiteSpace(e.Site.Url))
            {
                return;
            }

            // Create dialog control to prompt user for site information while passing in source site id that we
            // will eventually copy from.
            CopySiteDialogControl copySiteControl = new CopySiteDialogControl(e.Site.ID);

            // Display dialog control in modal mode
            BuilderApplication.Instance.ShowWindow(ESRI.ArcGIS.Mapping.Builder.Resources.Strings.CopySite, copySiteControl, true);
        }