/// <summary> /// Called when an already started fixture is being restarted. This /// establishes a fresh Cadence connection. /// </summary> public override void OnRestart() { if (keepConnection) { // We're going to continue using the same connection. return; } // Close any existing connection related objects. if (Connection != null) { Connection.Dispose(); Connection = null; } if (ConnectionClient != null) { ConnectionClient.Dispose(); ConnectionClient = null; } // Establish fresh connections. Connection = CadenceClient.ConnectAsync(settings).Result; ConnectionClient = new HttpClient() { BaseAddress = Connection.ListenUri }; }
protected override void Dispose(bool disposing) { base.Dispose(disposing); if (disposing) { if (_userProxy != null) { _userProxy.Dispose(); } if (_documentProxy != null) { _documentProxy.Dispose(); } if (_presentationProxy != null) { _presentationProxy.Dispose(); } if (_workflowProxy != null) { _workflowProxy.Dispose(); } if (_queryProxy != null) { _queryProxy.Dispose(); } if (_reportProxy != null) { _reportProxy.Dispose(); } } }
public MainScene(Location Size) : base(Size) { ConnectionClient Connection = new ConnectionClient(); Connection.Connect((Port) => { if (Port != 0) { Logger.Log("Connecting on Port " + Port); Client = new Client(Port); } else { Logger.Log("Failed to connect to remote host"); } Connection.Dispose(); }); Player = new Player(); Player.Scale = 10; Player.Layer = 10; AddChild(Player); Players.Add(Player); Tiles = new TileManager(2048, 2048, ClansGame.TestTileTexture, 8); Tiles.Scale = 5; for (int Y = 0; Y < Tiles.Height; Y++) { for (int X = 0; X < Tiles.Width; X++) { Tiles.Set(X, Y, 3 + JRandom.Next(3), 0, 1, 0); } } Tiles.Layer = -1; AddChild(Tiles); Camera.Target = Player; Snow = new SnowEffect(2); Snow.Intensity = 0; UI.AddChild(Snow); Info = new LabelNode(Font.Default, "WASD to move + and - to change the bleeding", 20); Info.Position = new Location(Size.X / 2, Size.Y * 0.3); Info.AnchorPoint.X = 0.5; Info.Color = new Color(128, 128, 130); UI.AddChild(Info); Input.ListenForKey(Keys.I, this); Input.ListenForKey(Keys.O, this); Input.ListenForKey(Keys.P, this); }
/// <summary> /// This method completely resets the fixture by removing the Cadence /// container from Docker. Use <see cref="ContainerFixture.Restart"/> /// if you just want to restart a fresh Cadence instance. /// </summary> public override void Reset() { if (Connection != null) { Connection.Dispose(); Connection = null; } if (ConnectionClient != null) { ConnectionClient.Dispose(); ConnectionClient = null; } if (ProxyClient != null) { ProxyClient.Dispose(); ProxyClient = null; } base.Reset(); }
/// <summary> /// Closes the existing Cadence connection and then restarts the Cadence /// server and establishes a new connection. /// </summary> public new void Restart() { // Disconnect. Connection.Dispose(); Connection = null; ConnectionClient.Dispose(); ConnectionClient = null; // Restart the Cadence container. base.Restart(); // Reconnect. Connection = CadenceClient.ConnectAsync(settings).Result; ConnectionClient = new HttpClient() { BaseAddress = Connection.ListenUri }; }