Пример #1
0
        private StationOptions CreateDefaultEditableStationOption(CloudTable tab, String name)
        {
            StationOptions option = new StationOptions(name);

            TableOperation insertOp = TableOperation.InsertOrReplace(option);

            //We do not need to await this
            tab.ExecuteAsync(insertOp);

            return(option);
        }
Пример #2
0
        public async Task <bool> UpdateDeviceOptions(string DeviceName, StationOptions opt)
        {
            try
            {
                var json           = JsonConvert.SerializeObject(opt);
                var commandMessage = new Message(Encoding.ASCII.GetBytes(json));
                await client.SendAsync(DeviceName, commandMessage);
            }
            catch (Exception e)
            {
                Console.WriteLine(e.Message);
                return(await Task.FromResult(false));
            }

            return(await Task.FromResult(true));
        }
Пример #3
0
        private async Task <bool> UpdateDeviceConfigSettings(StationOptions option)
        {
            CloudTableClient tableClient = storageAccount.CreateCloudTableClient();
            CloudTable       table       = tableClient.GetTableReference("DeviceConfigSettings");

            TableOperation insertOrRepOp = TableOperation.InsertOrReplace(option);

            TableResult res = await table.ExecuteAsync(insertOrRepOp);

            if (res.HttpStatusCode != 204)
            {
                Console.WriteLine("Failure updating station options");
            }

            return(true);
        }
Пример #4
0
        async void Config_Clicked(object sender, EventArgs e)
        {
            StationOptions opt = await viewModel.GetStationOptions();

            await Navigation.PushAsync(new DeviceConfigPage(opt, viewModel.Item.StationName));
        }
Пример #5
0
 public async Task <bool> UpdateStationOptions(StationOptions stationOption)
 {
     return(await UpdateDeviceConfigSettings(stationOption));
 }
Пример #6
0
 public DeviceConfigPage(StationOptions options, string devName)
 {
     InitializeComponent();
     BindingContext = stationOption = options;
     deviceName     = devName;
 }
Пример #7
0
 public WeatherStation(StationOptions givenStatOptions, long id, List <WeatherSet> sets)
 {
     statOptions   = givenStatOptions;
     rgWeatherSets = sets;
 }