private void SetDarkTheme(ElevationLevel elevation) { var darkTheme = _themeColorsFactory.GetThemeColors(Theme.Dark); DarkItems.Clear(); PopulateSurfaceCaptions(DarkItems, darkTheme, elevation); }
internal static string ToSerializedValue(this ElevationLevel value) { switch (value) { case ElevationLevel.NonAdmin: return("NonAdmin"); case ElevationLevel.Admin: return("Admin"); } return(null); }
public void Load(BinaryReader reader) { terrainTypeIndex = reader.ReadByte(); elevation = (ElevationLevel)reader.ReadByte(); RefreshPosition(); featureType = reader.ReadByte(); featureDensity = reader.ReadByte(); featureVariant = reader.ReadByte(); featureVariation = reader.ReadByte(); featureTwoType = reader.ReadByte(); featureTwoVariant = reader.ReadByte(); featureTwoVariation = reader.ReadByte(); specialFeatureType = reader.ReadByte(); specialFeatureVariant = reader.ReadByte(); grassVariant = reader.ReadByte(); }
// return a value between 0 and 1 (0 to 100%) public static double GetOverlayOpacity(ElevationLevel elevation) { // elevation dp => white overlay transparency % return(elevation switch { ElevationLevel.dp0 => 0.0d, ElevationLevel.dp1 => 0.05d, ElevationLevel.dp2 => 0.07d, ElevationLevel.dp3 => 0.08d, ElevationLevel.dp4 => 0.09d, ElevationLevel.dp6 => 0.11d, ElevationLevel.dp8 => 0.12d, ElevationLevel.dp12 => 0.14d, ElevationLevel.dp16 => 0.15d, ElevationLevel.dp24 => 0.16d, _ => throw new ArgumentOutOfRangeException(nameof(elevation), elevation, null), });
void Awake() { activeElevation = ElevationLevel.Flat; SetEditMode(false); }
public void SetElevation(int elevation) { activeElevation = (ElevationLevel)elevation; }
protected void CreateBatchPool( BatchClient batchClient, Dictionary <string, string> poolMetadata) { int nodeCount = int.Parse(EnvVars[AzureEnvConstants.AZURE_BATCH_VM_NODE_COUNT]); string vmSize = EnvVars[AzureEnvConstants.AZURE_BATCH_VM_SIZE]; VirtualMachineConfiguration vmConfiguration = CreateVirtualMachineConfiguration(batchClient, CreateImageReference()); try { Console.WriteLine("Creating pool [{0}]...", PoolName); CloudPool pool = batchClient.PoolOperations.CreatePool( poolId: PoolName, targetDedicatedComputeNodes: nodeCount, // targetLowPriorityComputeNodes: PoolSpotNodeCount, virtualMachineSize: vmSize, virtualMachineConfiguration: vmConfiguration); string sshPrivateKey = new Guid().ToString(); Console.WriteLine("Batch pool VM SSH private key: {0}", sshPrivateKey); ElevationLevel lvl = EnvVars[BatchUser.USER_ELE_LEVEL].Equals("1") ? ElevationLevel.Admin : ElevationLevel.NonAdmin; UserAccount ua = new UserAccount( name: EnvVars[BatchUser.USER_NAME], password: EnvVars[BatchUser.USER_PWD], elevationLevel: lvl, linuxUserConfiguration: new LinuxUserConfiguration( uid: 1075, gid: 1075, sshPrivateKey: sshPrivateKey)); pool.UserAccounts = new List <UserAccount> { ua }; // Use start task to initialize a single node k8s cluster pool.StartTask = BatchStartTaskFactory.GetStartTask( IApplicationTypes.K8S_SINGLE_NODE, EnvVars[BatchUser.USER_NAME]); if (poolMetadata != null) { pool.Metadata = GetMetadataItems(poolMetadata); } pool.Commit(); // Sync call // PrintStartTaskInfo(pool); } catch (BatchException be) { // Accept the specific error code PoolExists as that is expected if the pool already exists if (be.RequestInformation?.BatchError?.Code == BatchErrorCodeStrings.PoolExists) { Console.WriteLine("The pool [{0}] already exists", PoolName); CloudPool pool = batchClient.PoolOperations.GetPool(poolId: PoolName); int?numDedicated = pool.CurrentDedicatedComputeNodes; int?numLowPri = pool.CurrentLowPriorityComputeNodes; Console.WriteLine("The pool [{0}] has [{1}] current Dedicated Compute Nodes", PoolName, numDedicated); Console.WriteLine("The pool [{0}] has [{1}] current Spot Nodes", PoolName, numLowPri); } else { throw be; // Any other exception is unexpected } } }
public SurfaceElevation(IThemeColors themeColors, ElevationLevel elevation) { _themeColors = themeColors; Elevation = elevation; }
private static void PopulateSurfaceCaptions(ICollection <SurfaceCaptions> themeItems, IThemeColors themeColors, ElevationLevel elevation) { var errorCaption = new SurfaceCaption { Caption = "Sample Error Text", CaptionColor = themeColors.OnError, BackgroundColor = themeColors.Error, ContrastRatio = ColorHelper.GetContrastRatio(themeColors.OnError, themeColors.Error), ContrastRatioColor = themeColors.OnError }; var surfaceElevation = new SurfaceElevation(themeColors, elevation); AddSurfaceCaption(themeItems, $"Default Surface at {elevation}", "OnSurface Text", themeColors.OnSurface, surfaceElevation.SurfaceColor, errorCaption); AddSurfaceCaption(themeItems, $"Default Surface at {elevation}", "Branded Text", themeColors.Primary, surfaceElevation.SurfaceColor, errorCaption); AddSurfaceCaption(themeItems, $"Branded Surface at {elevation}", "OnSurface Text", themeColors.OnSurface, surfaceElevation.BrandedSurfaceColor, errorCaption); AddSurfaceCaption(themeItems, $"Branded Surface at {elevation}", "Branded Text", themeColors.Primary, surfaceElevation.BrandedSurfaceColor, errorCaption); }
public void SetDarkThemeElevation(ElevationLevel elevation) { SetDarkTheme(elevation); }
public static string ToSerialString(this ElevationLevel value) => value switch {
public Color GetBrandedSurfaceColor(ElevationLevel elevation) { var opacity = ElevationHelper.GetOverlayOpacity(elevation); return(ColorHelper.CombineColors(BrandedBackground, Color.White, opacity)); }