// Alt+Home to drop a marker. Escape gets me back. public static DocView FromStorage(IDecoupledStorage storage, string parentSection, int index) { string section = parentSection + STR_DocView + index; DocView newDocView = new DocView(); newDocView.FileName = storage.ReadString(section, STR_FileName); newDocView.SelectionActive = storage.ReadInt32(section, STR_SelectionActive); newDocView.SelectionAnchor = storage.ReadInt32(section, STR_SelectionAnchor); newDocView.TopLine = storage.ReadInt32(section, STR_TopLine); return newDocView; }
private void btnSaveCurrentView_Click(object sender, EventArgs e) { SuperView superView = new SuperView(); Document activeDocument = CodeRush.Documents.Active; // activeDocument.ActiveWindow and foreach (EnvDTE.Window window in activeDocument.Windows) { //window. } if (activeDocument != null) superView.ActiveFile = activeDocument.FullName; foreach (Document document in CodeRush.Documents.AllDocuments) { DocView docView = new DocView(); docView.FileName = document.FullName; TextDocument textDocument = document as TextDocument; if (textDocument != null) { TextView firstView = textDocument.FirstView; if (firstView != null) { docView.TopLine = firstView.TopLine; TextViewSelection activeSelection = firstView.Selection; if (activeSelection != null) { docView.SelectionAnchor = activeSelection.AnchorPosition; docView.SelectionActive = activeSelection.ActivePosition; } } } superView.DocViews.Add(docView); } _AllViews.Add(superView); lstViews.SelectedItem = superView; SaveViews(); }