protected virtual void MasterChanged(object sender, EventArgs e) { if (IsPartialView || !HasMaster) { return; } if (masterEntry.Text == oldMaster) { return; } oldMaster = masterEntry.Text; primaryPlaceholderStore.Clear(); ContentPlaceHolders.Clear(); string realPath = project.VirtualToLocalPath(oldMaster, null); if (!File.Exists(realPath)) { return; } var pd = ProjectDomService.GetParsedDocument(ProjectDomService.GetProjectDom(project), realPath) as AspNetParsedDocument; if (pd != null) { try { var visitor = new ContentPlaceHolderVisitor(); pd.RootNode.AcceptVisit(visitor); ContentPlaceHolders.AddRange(visitor.PlaceHolders); for (int i = 0; i < ContentPlaceHolders.Count; i++) { string placeholder = ContentPlaceHolders[i]; primaryPlaceholderStore.AppendValues(placeholder); if (placeholder.Contains("main") || placeholder.Contains("Main") || placeholder.Contains("content") || placeholder.Contains("Main")) { primaryPlaceholderCombo.Active = i; } } } catch (Exception ex) { LoggingService.LogError("Unhandled exception getting master regions for '" + realPath + "'", ex); } } Validate(); }
protected virtual void MasterChanged(object sender, EventArgs e) { if (IsPartialView || !HasMaster) { return; } if (masterEntry.Text == oldMaster) { return; } oldMaster = masterEntry.Text; primaryPlaceholderStore.Clear(); ContentPlaceHolders.Clear(); string realPath = project.VirtualToLocalPath(oldMaster, null); if (!File.Exists(realPath)) { return; } var pd = TypeSystemService.ParseFile(project, realPath) as WebFormsParsedDocument; if (pd != null) { try { ContentPlaceHolders.AddRange(pd.XDocument.GetAllPlaceholderIds()); for (int i = 0; i < ContentPlaceHolders.Count; i++) { string placeholder = ContentPlaceHolders[i]; primaryPlaceholderStore.AppendValues(placeholder); if (placeholder.Contains("main") || placeholder.Contains("Main") || placeholder.Contains("content") || placeholder.Contains("Content")) { placeholderCombo.Active = i; } } } catch (Exception ex) { LoggingService.LogError("Unhandled exception getting master regions for '" + realPath + "'", ex); } } Validate(); }