Beispiel #1
0
        private async Task <List <Settings> > InitializeSettingsAsync()
        {
            using (var dbFactory = new SQLiteDAL())
            {
                var settings = new List <Settings>
                {
                    new Settings
                    {
                        TitleLabel        = "Wireless Network (SSID)",
                        HelpLabel         = "Enter your Wireless Network or SSID",
                        Value             = string.Empty,
                        SettingsFieldType = FieldType.Text
                    },
                    new Settings
                    {
                        TitleLabel        = "Wireless Network Password",
                        HelpLabel         = "Password for your Wireless Network",
                        Value             = string.Empty,
                        SettingsFieldType = FieldType.Password
                    }
                };

                await dbFactory.Settings.AddRangeAsync(settings);

                await dbFactory.SaveChangesAsync();

                return(settings);
            }
        }
Beispiel #2
0
        public async void AddSensorNode(string location)
        {
            using (var db = new SQLiteDAL())
            {
                var item = new SensorNodes
                {
                    Location = location
                };

                await db.SensorNodes.AddAsync(item);

                await db.SaveChangesAsync();
            }
        }
Beispiel #3
0
        public async Task <bool> SaveSettingsAsync(List <SettingsListingResponseItem> settings)
        {
            using (var dbFactory = new SQLiteDAL())
            {
                foreach (var setting in settings)
                {
                    var dbItem = dbFactory.Settings.FirstOrDefault(a => a.ID == setting.ID);

                    if (dbItem == null)
                    {
                        continue;
                    }

                    dbItem.Value = setting.SettingValue;
                }

                await dbFactory.SaveChangesAsync();

                return(true);
            }
        }