public bool LoadProfile(Uri teamProjectUri, string profileName) { SimpleLogger.Log(SimpleLogLevel.Info, "LoadProfile: " + profileName); if (teamProjectUri == null) { teamProjectUri = Repository.Instance.TfsBridgeProvider.ActiveTeamProject.ArtifactUri; } SerializableDictionary <string, ProfileSettings> result = null; if (Profiles.TryGetValue(teamProjectUri.ToString(), out result) == false) { result = new SerializableDictionary <string, ProfileSettings>(); Profiles.Set(teamProjectUri.ToString(), result); } if (!result.ContainsKey(profileName)) { return(false); } result[profileName].CopyTo(GetDefaultProfile(teamProjectUri)); SetProfileDirty(GetDefaultProfile(teamProjectUri)); _activeProfile = result[profileName]; return(true); }
public void ReloadFromSettings() { _profiles = Repository.Instance.Settings.FetchSettings <SerializableDictionary <string, SerializableDictionary <string, ProfileSettings> > >(Constants.Settings.ProfileKey); if (_profiles == null) { _profiles = new SerializableDictionary <string, SerializableDictionary <string, ProfileSettings> >(); } _activeProfile = null; }
private void LoadProfile(IProfileSettings profile) { try { Repository.Instance.ProfileProvider.LoadProfile(null, profile.Name); } catch (Exception ex) { SimpleLogger.Log(ex, true, true); } }
public void SetProfileDirty(IProfileSettings profileSettings) { if (profileSettings != null && profileSettings.Name == "__Default" && DefaultProfileChanged != null) { DefaultProfileChanged(this, new DefaultProfileChangedEventArgs(profileSettings)); } if (profileSettings != null && profileSettings.Name == "__Default" && ProfilesChanged != null) { ProfilesChanged(this, new DefaultProfileChangedEventArgs(profileSettings)); } Repository.Instance.Settings.SetSettings(Constants.Settings.ProfileKey, Profiles); }
public void CopyTo(IProfileSettings other) { other.ChangesetIncludeCommentFilter = ChangesetIncludeCommentFilter; other.ChangesetExcludeCommentFilter = ChangesetExcludeCommentFilter; other.CSQueryName = CSQueryName; other.CSSourceBranch = CSSourceBranch; other.CSTargetBranch = CSTargetBranch; other.CSSourcePathFilter = CSSourceBranch; other.DateFromFilter = DateFromFilter; other.DateToFilter = DateToFilter; other.WIQueryName = WIQueryName; other.WISourceBranch = WISourceBranch; other.WISourcePathFilter = WISourcePathFilter; other.WITargetBranch = WITargetBranch; }
public bool SaveProfileAs(Uri teamProjectUri, string profileName, bool overwrite) { SimpleLogger.Log(SimpleLogLevel.Info, "Save Profile: " + profileName); if (teamProjectUri == null) { teamProjectUri = Repository.Instance.TfsBridgeProvider.ActiveTeamProject.ArtifactUri; } SerializableDictionary <string, ProfileSettings> result = null; if (Profiles.TryGetValue(teamProjectUri.ToString(), out result) == false) { SimpleLogger.Log(SimpleLogLevel.Info, "Create new Profile SerializableDictionary"); result = new SerializableDictionary <string, ProfileSettings>(); Profiles.Set(teamProjectUri.ToString(), result); } if (result.ContainsKey(profileName) && !overwrite) { return(false); } var teamProjectName = GetTeamProjectName(teamProjectUri);//Repository.Instance.TfsBridgeProvider.VersionControlServer.GetAllTeamProjects(false).Where(tp => tp.ArtifactUri.Equals(teamProjectUri)).FirstOrDefault(); var settings = new ProfileSettings(teamProjectUri.ToString(), teamProjectName, profileName, SetProfileDirty); var defaultProfile = GetDefaultProfile(teamProjectUri); if (defaultProfile != null) { (defaultProfile as ProfileSettings).CopyTo(settings); } result[profileName] = settings; if (ActiveProjectProfileListChanged != null && !teamProjectUri.ToString().Equals("http://www.haufe.de/") && teamProjectUri == Repository.Instance.TfsBridgeProvider.ActiveTeamProject.ArtifactUri) { ActiveProjectProfileListChanged(this, EventArgs.Empty); } if (ProfilesChanged != null) { ProfilesChanged(this, EventArgs.Empty); } _activeProfile = result[profileName]; SimpleLogger.Log(SimpleLogLevel.Info, "Save Profile finished: " + profileName); return(true); }
private void DeleteProfile(IProfileSettings profileSettings) { MessageBoxViewModel mbvm = new MessageBoxViewModel("Delete profile?", String.Format("You are about to delete the profile '{0}'. This action cannot be undone.\r\nProceed?", profileSettings.Name), MessageBoxViewModel.MessageBoxButtons.None); var yesButton = new MessageBoxViewModel.MessageBoxButton("_Yes"); mbvm.ConfirmButtons.Add(yesButton); mbvm.ConfirmButtons.Add(new MessageBoxViewModel.MessageBoxButton("_No")); Repository.Instance.ViewManager.ShowModal(mbvm); if (yesButton.IsChecked) { if (Repository.Instance.ProfileProvider.DeleteProfile(profileSettings)) { Profiles.Remove(profileSettings); } } }
public bool GetActiveProfile(out IProfileSettings mostRecentSettings, out bool alreadyModified) { var defaultProfile = GetDefaultProfile(); mostRecentSettings = _activeProfile; alreadyModified = false; if (defaultProfile == null) { return(false); } if (mostRecentSettings == null) { alreadyModified = true; } else { alreadyModified = !mostRecentSettings.Equals(defaultProfile); } return(true); }
public ProfileViewModelBase(Type callerType, IProfileSettings profile) : base(callerType) { var tfsUri = profile.TeamProject; var tfsProject = profile.TeamProjectFriendlyName; TfsUri = tfsUri; TfsProject = tfsProject; ChangesetSelectionType = String.IsNullOrEmpty(profile.CSQueryName) ? "Merge candidates" : "Query"; ChangesetSourceBranch = profile.CSSourceBranch; ChangesetTargetBranch = profile.CSTargetBranch; ChangesetQuery = profile.CSQueryName; ChangesetIncludeFilterRegEx = String.IsNullOrEmpty(profile.ChangesetIncludeCommentFilter) ? "<not set>" : profile.ChangesetIncludeCommentFilter; ChangesetExcludeFilterRegEx = String.IsNullOrEmpty(profile.ChangesetExcludeCommentFilter) ? "<not set>" : profile.ChangesetExcludeCommentFilter; ChangesetFilterMinDate = (profile.DateFromFilter != null) ? profile.DateFromFilter.Value.ToString(CultureInfo.InvariantCulture.DateTimeFormat) : "<not set>"; ChangesetFilterMaxDate = (profile.DateToFilter != null) ? profile.DateToFilter.Value.ToString(CultureInfo.InvariantCulture.DateTimeFormat) : "<not set>"; WorkItemSelectionType = String.IsNullOrEmpty(profile.WIQueryName) ? "Merge candidates" : "Query"; WorkItemSourceBranch = profile.WISourceBranch; WorkItemTargetBranch = profile.WITargetBranch; WorkItemQuery = profile.WIQueryName; }
public bool DeleteProfile(Uri teamProjectUri, string profileName) { if (_activeProfile != null && _activeProfile.TeamProject == teamProjectUri.ToString() && _activeProfile.Name == profileName) { _activeProfile = null; } if (teamProjectUri == null) { teamProjectUri = Repository.Instance.TfsBridgeProvider.ActiveTeamProject.ArtifactUri; } SerializableDictionary <string, ProfileSettings> result = null; if (Profiles.TryGetValue(teamProjectUri.ToString(), out result) == false) { result = new SerializableDictionary <string, ProfileSettings>(); Profiles.Set(teamProjectUri.ToString(), result); } if (!result.ContainsKey(profileName)) { return(false); } result.Remove(profileName); if (ActiveProjectProfileListChanged != null && teamProjectUri == Repository.Instance.TfsBridgeProvider.ActiveTeamProject.ArtifactUri) { ActiveProjectProfileListChanged(this, EventArgs.Empty); } if (ProfilesChanged != null) { ProfilesChanged(this, EventArgs.Empty); } SetProfileDirty(null); return(true); }
public override bool Equals(object obj) { IProfileSettings other = obj as IProfileSettings; if (other == null) { return(false); } if (DateFromFilter.HasValue != other.DateFromFilter.HasValue) { return(false); } if (DateToFilter.HasValue != other.DateToFilter.HasValue) { return(false); } if (DateFromFilter.HasValue && DateFromFilter.Value != other.DateFromFilter.Value) { return(false); } if (DateToFilter.HasValue && DateToFilter.Value != other.DateToFilter.Value) { return(false); } return (other.ChangesetIncludeCommentFilter == ChangesetIncludeCommentFilter && other.ChangesetExcludeCommentFilter == ChangesetExcludeCommentFilter && other.CSQueryName == CSQueryName && other.CSSourceBranch == CSSourceBranch && other.CSTargetBranch == CSTargetBranch && other.CSSourcePathFilter == CSSourceBranch && other.WIQueryName == WIQueryName && other.WISourceBranch == WISourceBranch && other.WISourcePathFilter == WISourcePathFilter && other.WITargetBranch == WITargetBranch); }
public bool SaveProfileAs(Uri teamProjectUri, string profileName, bool overwrite) { if (teamProjectUri == null) { teamProjectUri = Repository.Instance.TfsBridgeProvider.ActiveTeamProject.ArtifactUri; } SerializableDictionary <string, ProfileSettings> result = null; if (Profiles.TryGetValue(teamProjectUri.ToString(), out result) == false) { result = new SerializableDictionary <string, ProfileSettings>(); Profiles[teamProjectUri.ToString()] = result; } if (result.ContainsKey(profileName) && !overwrite) { return(false); } var teamProject = Repository.Instance.TfsBridgeProvider.VersionControlServer.GetAllTeamProjects(false).Where(tp => tp.ArtifactUri.Equals(teamProjectUri)).FirstOrDefault(); var settings = new ProfileSettings(teamProjectUri.ToString(), teamProject.Name, profileName, SetProfileDirty); (GetDefaultProfile(teamProjectUri) as ProfileSettings).CopyTo(settings); result[profileName] = settings; if (ActiveProjectProfileListChanged != null && teamProjectUri == Repository.Instance.TfsBridgeProvider.ActiveTeamProject.ArtifactUri) { ActiveProjectProfileListChanged(this, EventArgs.Empty); } if (ProfilesChanged != null) { ProfilesChanged(this, EventArgs.Empty); } _activeProfile = result[profileName]; return(true); }
public void ReloadFromSettings() { SimpleLogger.Log(SimpleLogLevel.Info, "ProfileProvider.ReloadFromSettings "); _profiles = Repository.Instance.Settings.ProfilesSettings; _activeProfile = null; }
public bool DeleteProfile(IProfileSettings profile) { return(DeleteProfile(new Uri(profile.TeamProject), profile.Name)); }
private void ViewProfile(IProfileSettings profileSettings) { var vm = new ViewProfileViewModel(profileSettings); var dlg = Repository.Instance.ViewManager.ShowModal(vm); }
public ViewProfileViewModel(IProfileSettings profile) : base(typeof(ViewProfileViewModel), profile) { OKCommand = new RelayCommand((o) => OK()); }
private void LoadProfile(IProfileSettings profile) { Repository.Instance.ProfileProvider.LoadProfile(null, profile.Name); }
public DefaultProfileChangedEventArgs(IProfileSettings settings) { Settings = settings; }