/// <summary> /// Serializes the state object and returns the state as JSON /// </summary> /// <param name="stateObject">Object to serialize</param> /// <returns>State JSON</returns> public virtual string SerializeToJson(object stateObject) { try { var window = stateObject as Window; if (window == null) { return(string.Empty); } var jsonBuilder = new JsonBuilder(); jsonBuilder.Append("Top", window.Top); jsonBuilder.Append("Left", window.Left); jsonBuilder.Append("Height", window.Height); jsonBuilder.Append("Width", window.Width); jsonBuilder.Append("WindowState", window.WindowState); jsonBuilder.Append("Timestamp", DateTime.Now); var json = jsonBuilder.ToString(); return(json); } catch { return(string.Empty); } }