private int GetIndexOfProgramDataPackagePath() { var programDataPath = Environment.GetFolderPath(Environment.SpecialFolder.CommonApplicationData); var programDataPackagePath = RootLocations.Where(x => x.StartsWith(programDataPath)).FirstOrDefault(); var programDataPackagePathIndex = RootLocations.IndexOf(programDataPackagePath); return(programDataPackagePathIndex); }
private int ConvertPathToIndex(object path) { if (path is int pint) { return(pint); } return(RootLocations.IndexOf(path as string)); }
private bool CanDelete(object param) { if (RootLocations.IndexOf(Resources.PackagePathViewModel_Standard_Library) == SelectedIndex) { return false; } return RootLocations.Count > 1; }
private bool CanUpdate(int param) { var programDataPackagePathIndex = GetIndexOfProgramDataPackagePath(); //editing builtin packages or programData package paths is not allowed. return(RootLocations.IndexOf(Resources.PackagePathViewModel_Standard_Library) != param && programDataPackagePathIndex != param); }
private bool CanUpdate(int param) { var programDataPackagePathIndex = GetIndexOfProgramDataPackagePath(); var appDataPackagePathIndex = GetIndexOfDefaultAppDataPackagePath(); //editing builtin packages or programData package paths is not allowed. return(RootLocations.IndexOf(Resources.PackagePathViewModel_BuiltInPackages) != param && programDataPackagePathIndex != param && appDataPackagePathIndex != param); }
private int GetIndexOfDefaultAppDataPackagePath() { var index = -1; if (PreferenceSettings is PreferenceSettings prefs) { var appDataPath = prefs.OnRequestUserDataFolder(); index = RootLocations.IndexOf(appDataPath); } return(index); }
private bool CanDelete(int param) { var programDataPackagePathIndex = GetIndexOfProgramDataPackagePath(); if (RootLocations.IndexOf(Resources.PackagePathViewModel_Standard_Library) == param || programDataPackagePathIndex == param) { return(false); } return(RootLocations.Count > 1); }
private bool CanDelete(int param) { var programDataPackagePathIndex = GetIndexOfProgramDataPackagePath(); var appDataPackagePathIndex = GetIndexOfDefaultAppDataPackagePath(); if (RootLocations.IndexOf(Resources.PackagePathViewModel_BuiltInPackages) == param || programDataPackagePathIndex == param || appDataPackagePathIndex == param) { return(false); } return(RootLocations.Count > 1); }
private bool CanUpdate(object param) { return RootLocations.IndexOf(Resources.PackagePathViewModel_Standard_Library) != SelectedIndex; }