private void LoadProject() { VSMruList hi = ListViewMru.SelectedItems[0] as VSMruList; if (hi != null) { if (File.Exists(hi.ProjectPath)) { EnvDTE80.DTE2 dte2 = Microsoft.VisualStudio.Shell.Package.GetGlobalService(typeof(DTE)) as EnvDTE80.DTE2; if (dte2 != null) { try { dte2.Solution.Open(hi.ProjectPath); } catch (Exception ex) { this.ParentSection.ShowError(ex.Message); } } } this.ParentSection.ShowError("File not found"); } }
public int CompareTo(object obj) { VSMruList tempO = obj as VSMruList; if (tempO == null) { throw new ArgumentException("Object is not VSMruList"); } return(string.Compare(this.ProjectName, tempO.ProjectName, StringComparison.Ordinal)); }
private void GetMRU() { RegistryKey userkey = RegistryKey.OpenBaseKey(RegistryHive.CurrentUser, RegistryView.Registry32); RegistryKey mruKey = userkey.OpenSubKey(@"Software\Microsoft\VisualStudio\11.0\ProjectMRUList"); if (mruKey != null) { foreach (string tmpKeyIndex in mruKey.GetValueNames()) { string tmpProjectPath = mruKey.GetValue(tmpKeyIndex).ToString(); VSMruList tmpMRU = new VSMruList { ProjectPath = Regex.Match(Environment.ExpandEnvironmentVariables(tmpProjectPath), @"[^|]{1,}").Value, ProjectName = System.IO.Path.GetFileName(Regex.Match(Environment.ExpandEnvironmentVariables(tmpProjectPath), @"[^|]{1,}").Value) }; this.mruList.Add(tmpMRU); } mruKey.Close(); this.mruList.BubbleSort(); this.ListViewMru.ItemsSource = this.mruList; } }