示例#1
0
        private static void SyncComputer()
        {
            _computer = JsonLocalDatabase.Instance.Computer;
            if (_computer.Synced)
            {
                return;
            }
            var client   = new ServerClient();
            var response = client.PostToServer(Settings.ApiUrl, "api/Computers", _computer.ToResourceModel(), _jsonWebToken);

            if (!response.IsSuccessStatusCode)
            {
                LocalLogger.Log(response.Content.ReadAsStringAsync());
                return;
            }

            var computerId = response.Content.ReadAsAsync <int>().Result;

            _computer.Synced     = true;
            _computer.ComputerId = computerId;
            JsonLocalDatabase.Instance.Computer = _computer;
            //LocalLogger.Log($"ComputerId: {computerId}");
        }