|
@@ -0,0 +1,70 @@
|
|
|
+using System;
|
|
|
+using System.Collections.Generic;
|
|
|
+using System.Linq;
|
|
|
+using System.Text;
|
|
|
+using System.Threading.Tasks;
|
|
|
+
|
|
|
+namespace VRTC.WpfClient
|
|
|
+{
|
|
|
+ //Create a device class for C#
|
|
|
+
|
|
|
+ public class Device
|
|
|
+ {
|
|
|
+
|
|
|
+
|
|
|
+ // This property is used to store the name of an object.
|
|
|
+ public string Name { get; set; }
|
|
|
+
|
|
|
+ /// <summary>
|
|
|
+ /// Gets or sets the model of the object.
|
|
|
+ /// </summary>
|
|
|
+ public string Model { get; set; }
|
|
|
+
|
|
|
+
|
|
|
+ /// <summary>
|
|
|
+ /// Property to get and set the Manufacturer of an object.
|
|
|
+ /// </summary>
|
|
|
+ public string Manufacturer { get; set; }
|
|
|
+ public string
|
|
|
+ OperatingSystem
|
|
|
+ { get; set; }
|
|
|
+ public string SerialNumber { get; set; }
|
|
|
+ public string Version { get; set; }
|
|
|
+
|
|
|
+ public Device(string name, string model,
|
|
|
+ string manufacturer, string operatingSystem, string serialNumber, string version)
|
|
|
+ {
|
|
|
+ Name = name;
|
|
|
+ Model = model;
|
|
|
+ Manufacturer = manufacturer
|
|
|
+ ;
|
|
|
+ OperatingSystem = operatingSystem;
|
|
|
+ SerialNumber = serialNumber;
|
|
|
+ Version = version;
|
|
|
+ }
|
|
|
+
|
|
|
+ string ToJson()
|
|
|
+ {
|
|
|
+ StringBuilder sb = new StringBuilder();
|
|
|
+ sb.Append("{");
|
|
|
+ sb.Append("\"Name\":\"" + Name + "\",");
|
|
|
+ sb.Append("\"Age\":\"" + Age + "\"");
|
|
|
+ sb.Append("}");
|
|
|
+ return sb.ToString();
|
|
|
+ }
|
|
|
+
|
|
|
+ Bug: The Age property is being added to the JSON string as a string, when it should be added as a number.
|
|
|
+
|
|
|
+
|
|
|
+public string ToJson()
|
|
|
+ {
|
|
|
+ return JsonConvert.SerializeObject(this);
|
|
|
+ }
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+}
|