Esempio n. 1
0
        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);
        }
Esempio n. 2
0
 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);
        }
Esempio n. 5
0
        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);
        }
Esempio n. 6
0
        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);
        }
Esempio n. 8
0
        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;
 }