Example #1
0
 static void _SetOnce(ref string propVar, string value, bool create, [CallerMemberName] string propName = null)
 {
     lock (_lock) {
         if (propVar != null)
         {
             throw new InvalidOperationException("AFolders." + propName + " is already set.");
         }
         propVar = value;
         if (create)
         {
             AFile.CreateDirectory(value);
         }
     }
 }
Example #2
0
        //note: don't use Application.ProductName etc. It loads Forms, throws if dynamic assembly, etc.

        #region set auto/once

        static string _SetAuto(ref string propVar, string value, bool create)
        {
            lock (_lock) {
                if (propVar == null)
                {
                    propVar = value;
                    if (create)
                    {
                        AFile.CreateDirectory(value);
                    }
                }
            }
            return(propVar);
        }