private void btnTeamProject_Click(object sender, EventArgs e) { TeamProjectPicker pp = new TeamProjectPicker(TeamProjectPickerMode.SingleProject, false); pp.ShowDialog(); if (pp.SelectedTeamProjectCollection != null) { TfsTeamProjectCollection tpc = pp.SelectedTeamProjectCollection; tpc.EnsureAuthenticated(); _wiStore = (WorkItemStore)tpc.GetService(typeof(WorkItemStore)); gss = (IGroupSecurityService)tpc.GetService(typeof(IGroupSecurityService)); if (pp.SelectedProjects != null) { project = _wiStore.Projects[pp.SelectedProjects[0].Name]; var setting = new TFSProjectSetting() { Collection = pp.SelectedTeamProjectCollection.Uri.ToString(), TeamProject = project.Name }; SaveTFSConnection(setting); } } InitProject(); }
private void SaveTFSConnection(TFSProjectSetting setting) { try { String appData = Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData); XmlSerializer serializer = new XmlSerializer(typeof(TFSProjectSetting)); TextWriter tw = new StreamWriter(Path.Combine(appData, "OutlookTFSWorkItemAddIn.xml")); serializer.Serialize(tw, setting); tw.Close(); } catch (System.Exception) { } }
private TFSProjectSetting LoadTFSConnection() { try { String appData = Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData); TextReader tr = new StreamReader(Path.Combine(appData, "OutlookTFSWorkItemAddIn.xml")); XmlSerializer serializer = new XmlSerializer(typeof(TFSProjectSetting)); TFSProjectSetting b = (TFSProjectSetting)serializer.Deserialize(tr); tr.Close(); return(b); } catch (System.Exception) { return(null); } }