Exemple #1
0
        private static void Import(IPropertySet values, JsonObject jsonObject)
        {
            values.Clear();

            foreach (string key in jsonObject.Keys)
            {
                IJsonValue jsonValue = jsonObject[key];

                switch (jsonValue.ValueType)
                {
                case JsonValueType.String:
                    values.Add(key, jsonObject[key].GetString());
                    break;

                case JsonValueType.Number:
                    values.Add(key, jsonObject[key].GetNumber());
                    break;

                case JsonValueType.Boolean:
                    values.Add(key, jsonObject[key].GetBoolean());
                    break;

                case JsonValueType.Null:
                    values.Add(key, null);
                    break;

                default:
                    throw new Exception("Not supported JsonValueType.");
                }
            }
        }
Exemple #2
0
        /// <summary>
        /// Run all required provision tasks asynchronously.
        /// </summary>
        /// <returns>Task that represents the asynchronous provision operation.</returns>
        public async Task RunProvisionTasksAsync()
        {
            foreach (var def in m_provDef)
            {
                var required = true;
                if (m_provisionHistory.ContainsKey(def.TaskName))
                {
                    var currentVersion = Version.Parse((string)m_provisionHistory[def.TaskName]);
                    required = currentVersion >= def.RequiredVersion;
                }

                if (required)
                {
                    await RunSingleProvisionTaskAsync(def);
                }
            }

            foreach (var task in m_podQueue)
            {
                var pTask = (IProvisionTask)Activator.CreateInstance(Type.GetType((string)task.Value));
                await pTask.ProvisionAsync();
            }

            m_podQueue.Clear();
        }
 public void createPropertySet(IPropertySet property)
 {
     property.Clear();
     for (int i = 0; i < m_InOutBanks.Count; i++)
     {
         GPIOOBank obj = m_InOutBanks[i];
         obj.createPropertySet(property);
     }
 }
 public void Clear(bool deep, IPropertySet values, ApplicationDataContainer container)
 {
     values.Clear();
     if (deep)
     {
         foreach (var item in container.Containers.ToArray())
         {
             container.DeleteContainer(item.Key);
         }
     }
 }
        void OnApplicationSuspending(object sender, SuspendingEventArgs args)
        {
            appSettings.Clear();

            for (int index = 0; index < uniformGrid.Children.Count; index++)
            {
                TimeZoneClock          timeZoneClock = uniformGrid.Children[index] as TimeZoneClock;
                TimeZoneClockViewModel viewModel     =
                    timeZoneClock.DataContext as TimeZoneClockViewModel;
                string preface = index.ToString();

                appSettings[preface + "Location"]    = viewModel.Location;
                appSettings[preface + "TimeZoneKey"] = viewModel.TimeZoneKey;
                appSettings[preface + "Foreground"]  = viewModel.ForegroundName;
                appSettings[preface + "Background"]  = viewModel.BackgroundName;
            }
        }
 public void Clear()
 {
     _values.Clear();
 }
#pragma warning disable CS1998 // Async method lacks 'await' operators and will run synchronously

        public async Task ClearAsync() => _settings.Clear();
Exemple #8
0
        private static void Import(IPropertySet values, JsonObject jsonObject)
        {
            values.Clear();

            foreach (string key in jsonObject.Keys)
            {
                IJsonValue jsonValue = jsonObject[key];

                switch (jsonValue.ValueType)
                {
                    case JsonValueType.String:
                        values.Add(key, jsonObject[key].GetString());
                        break;
                    case JsonValueType.Number:
                        values.Add(key, jsonObject[key].GetNumber());
                        break;
                    case JsonValueType.Boolean:
                        values.Add(key, jsonObject[key].GetBoolean());
                        break;
                    case JsonValueType.Null:
                        values.Add(key, null);
                        break;
                    default:
                        throw new Exception("Not supported JsonValueType.");
                }
            }
        }
 public static void Clear()
 {
     settings.Clear();
 }