/// <summary> /// Initializes a new instance of the <see cref="MultilineTextBox"/> class. /// </summary> /// <param name="name">The name.</param> public MultilineTextBox(string name) : base(name) { this.text = "I am still empty"; this.textLines = new List <string>(); this.uniqueNameCreator = UniqueNameCreator.CreateInstance(); this.MyLines = new Collection <Label>(); }
/// <summary>Creates a image from given URL.</summary> /// <param name="preferredName">Name of the preferred.</param> /// <param name="imageLocation">The image location on disk.</param> /// <returns>The location of the created resource.</returns> /// <exception cref="ArgumentNullException">PreferredName or imageLocation. </exception> public string CreateFromUrl(string preferredName, string imageLocation) { #if DEBUG if (string.IsNullOrEmpty(preferredName)) { throw new ArgumentNullException("preferredName"); } if (imageLocation == null) { throw new ArgumentNullException("imageLocation"); } if (string.IsNullOrEmpty(imageLocation.ToString())) { throw new ArgumentNullException("imageLocation"); } #endif var texture = this.contentManager.Load <Texture2D>(imageLocation.ToString()); var resourceName = UniqueNameCreator.GetUniqueName(preferredName); Resources.Add(resourceName, texture); return(resourceName); }
public void When_getting_many_names_they_are_different() { var randomNameCreator = new UniqueNameCreator(); var names = Enumerable.Range(1, 10).Select(_ => randomNameCreator.GetNextRandomName()).ToList(); names.Should().OnlyHaveUniqueItems(); }
/// <summary>This constructor should be hidden from the outside</summary> private DefaultActorSystemFactory() { UniqueNameCreator = new UniqueNameCreator(); LocalActorRefFactory = new DefaultLocalActorRefFactory(); DeadLetterActorCreator = (path, system) => new DeadLetterActorRef(path, system); Scheduler = new ThreadPoolScheduler(); DefaultMailboxCreator = scheduler => new UnboundedMailbox(scheduler); }
public TestBootstrapper() { UniqueNameCreator = new UniqueNameCreator(); LocalActorRefFactory = new DefaultLocalActorRefFactory(); DeadLetterActorCreator = (path, system) => new DeadLetterActorRef(path, system); Scheduler = new SynchronousScheduler(); DefaultMailboxCreator = scheduler => new UnboundedMailbox(scheduler); Settings = new Settings.Settings(); }
public Bootstrapper() { UniqueNameCreator = new UniqueNameCreator(); LocalActorRefFactory = new DefaultLocalActorRefFactory(); DeadLetterActorCreator = (path, system) => new DeadLetterActorRef(path, system); ActionScheduler = new ThreadPoolActionScheduler(); DefaultMailboxCreator = scheduler => new UnboundedMailbox(ActionScheduler); Settings = new Settings.Settings(); Scheduler = new TaskBasedScheduler(); }
public string CreateRenderTarget(string preferredName, int width, int height, bool mipMap) { var renderTarget = new RenderTarget2D( this.device, width, height, mipMap, SurfaceFormat.Color, DepthFormat.Depth24); var resourceName = UniqueNameCreator.GetUniqueName(preferredName); Resources.Add(resourceName, renderTarget); return(resourceName); }
/// <summary>Creates the texture.</summary> /// <param name="name">The name of the texture.</param> /// <param name="width">The width of the texture.</param> /// <param name="height">The height of the texture.</param> /// <param name="color">The color of texture.</param> /// <returns>The created texture.</returns> /// <exception cref="ArgumentNullException">Name is null.</exception> /// <exception cref="ArgumentOutOfRangeException">width can not be smaller then 1 and height can not be smaller then 1. </exception> public string Create(string name, int width, int height, GUIColor color) { #if DEBUG if (string.IsNullOrEmpty(name)) { throw new ArgumentNullException("name"); } if (width < 1) { throw new ArgumentOutOfRangeException("width", "width can not be smaller then 1"); } if (height < 1) { throw new ArgumentOutOfRangeException("height", "height can not be smaller then 1"); } #endif var texture = new Texture2D(this.device, width, height, false, SurfaceFormat.Color); var count = width * height; var array = new GUIColor[count]; for (var i = 0; i < array.Length; i++) { array[i] = color; } texture.SetData(array); var resourceName = UniqueNameCreator.GetUniqueName(name); texture.Name = resourceName; Resources.Add(resourceName, texture); return(resourceName); }