private void EditSiteButton_Tapped(object sender, TappedRoutedEventArgs e) { var selectedSite = (Model.Site)SitesView.SelectedItem; SetSelectionEnabled(false); SiteProperties.Operation = Controls.FormOperation.Edit; SiteProperties.Site = selectedSite ?? throw new Exception("Edit site button should not be active when no device is selected"); SiteProperties.Visibility = Visibility.Visible; SiteProperties.SetInitialFocus(); }
private void AddSiteButton_Tapped(object sender, TappedRoutedEventArgs e) { var selectedTenant = TenantsView.SelectedItem as Model.Tenant; if (selectedTenant == null) { throw new Exception("It should not be possible to select add site if no tenant is selected"); } SetSelectionEnabled(false); SiteProperties.Operation = Controls.FormOperation.Add; SiteProperties.Site = null; SiteProperties.ClearForm(); SiteProperties.TenantId = selectedTenant.Id; SiteProperties.Visibility = Visibility.Visible; SiteProperties.SetInitialFocus(); }