Device |
Deletes the photo.
Namespace: Gamanet.C4.SDK
Assembly: Gamanet.C4.SimpleClient (in Gamanet.C4.SimpleClient.dll) Version: 2026.0.0.733
Syntax
C#
public void DeletePhoto( Guid deviceId )
Parameters
- deviceId Guid
- The device identifier.
Implements
ISimpleClientDeviceRepositoryV1.DeletePhoto(Guid)Example
The following example illustrates how to delete a device photo
C#
using System; using Gamanet.C4.SDK; using Gamanet.C4.SimpleInterfaces; public class Example { static void Main() { // Create instance of simple client var client = new SimpleClient(ConnectorConfiguration.HttpClient); ConnectionInfoV1 token; // Connect to local server var connectionResult = client.Connect(new Uri("https://localhost/"), "Support", "support", out token); if (connectionResult != ConnectionResult.Successful) { Console.WriteLine("Connection unsuccessful, result: {0}", connectionResult); return; } Console.WriteLine("Connection result: {0}", connectionResult); Console.WriteLine(); // Create the Example Device var exampleDevice = new SimpleDeviceV1( Guid.NewGuid(), "BUS", EntityRoot.Device, Guid.Parse("9c2246aa-5d43-414f-85d4-8c3b4e657236") ); // Create device under device root in db client.Devices.Create(exampleDevice); // Create photo for the Example Device client.Devices.CreatePhoto(exampleDevice.Id, photo); var createdPhoto = client.Devices.GetPhoto(exampleDevice.Id); using (var resultPhoto = new MemoryStream()) { createdPhoto.CopyTo(resultPhoto); resultPhoto.Position = 0; Console.WriteLine($"Photo length: {resultPhoto.Length}"); } // Delete photo client.Devices.DeletePhoto(exampleDevice.Id); var result = client.Devices.GetPhoto(exampleDevice.Id); using(var resultPhoto = new MemoryStream()) { result.CopyTo(resultPhoto); resultPhoto.Position = 0; if (resultPhoto.Length == 0) Console.WriteLine("Image was deleted"); } // Disconnect from server client.Disconnect(); } }
See Also