Beispiel #1
0
        private SliceSettingsOrganizer()
        {
            LoadAndParseSettingsFiles();

#if false
            Categories.Add(CreatePrintSettings());

            SettingsCategory filamentSettingsCategory = new SettingsCategory("Filament Settings");
            Categories.Add(filamentSettingsCategory);

            SettingsCategory printerSettingsCategory = new SettingsCategory("Printer Settings");
            Categories.Add(printerSettingsCategory);
#endif
        }
Beispiel #2
0
        SliceSettingsOrganizer()
        {
            string layouts    = Path.Combine(ApplicationDataStorage.Instance.ApplicationStaticDataPath, "SliceSettings", "Layouts.txt");
            string properties = Path.Combine(ApplicationDataStorage.Instance.ApplicationStaticDataPath, "SliceSettings", "Properties.txt");

            LoadAndParseSettingsFiles(properties, layouts);
#if false
            Categories.Add(CreatePrintSettings());

            SettingsCategory filamentSettingsCategory = new SettingsCategory("Filament Settings");
            Categories.Add(filamentSettingsCategory);

            SettingsCategory printerSettingsCategory = new SettingsCategory("Printer Settings");
            Categories.Add(printerSettingsCategory);
#endif
        }
        private string EnumToString(SettingsCategory category)
        {
            switch (category)
            {
            case SRTS.SettingsCategory.Settings:
                return("MainSettings".Translate());

            case SRTS.SettingsCategory.Stats:
                return("DefSettings".Translate());

            case SRTS.SettingsCategory.Research:
                return("ResearchSettings".Translate());
            }
            Log.Warning("Setting Category " + category.ToString() + " not yet implemented. - Smash Phil");
            return(category.ToString());
        }
Beispiel #4
0
        public PengaturanWindow(Pengguna user, SettingsCategory category) : this(user)
        {
            switch (category)
            {
            case SettingsCategory.Cuaca:
                tabitemCuaca.IsSelected = true;
                break;

            case SettingsCategory.JadwalObat:
                tabitemJadwalObat.IsSelected = true;
                break;

            case SettingsCategory.TekananDarah:
                tabitemTekananDarah.IsSelected = true;
                break;

            default:
                break;
            }
        }
Beispiel #5
0
        public IActionResult Put(long id, [FromBody] SettingsCategory settingCategory)
        {
            if (settingCategory == null)
            {
                return(BadRequest("Category is null."));
            }

            SettingsCategory settingCategoryToUpdate = _dataRepository.Get(id);

            if (settingCategoryToUpdate == null)
            {
                return(NotFound("The Settings Category record couldn't be found."));
            }

            var service = new SettingsCategoryService();

            service.Update(settingCategoryToUpdate, settingCategory);
            _dataRepository.Save();
            return(Ok(settingCategoryToUpdate));
        }
        public void Update(SettingsCategory dbSettingsCategory, SettingsCategory requestSettingsCategory)
        {
            var settingCategoryDataIds = dbSettingsCategory.CategoryData.Select(x => x.Id).ToList();
            var requestCategoryDataIds = requestSettingsCategory.CategoryData.Select(x => x.Id).ToList();

            var settingsCategoryDatasToDelete = dbSettingsCategory.CategoryData
                                                .Where(x => requestCategoryDataIds.Contains(x.Id) == false)
                                                .ToList();

            foreach (var categoryData in requestSettingsCategory.CategoryData)
            {
                if (categoryData.Id == 0)
                {
                    //Add
                    dbSettingsCategory.CategoryData.Add(new SettingsCategoryData()
                    {
                        Key   = categoryData.Key,
                        Value = categoryData.Value
                    });
                }
                else if (settingCategoryDataIds.Contains(categoryData.Id))
                {
                    //Update
                    var categoryDataToUpdate = dbSettingsCategory.CategoryData.Single(x => x.Id == categoryData.Id);
                    //categoryDataToUpdate = categoryData;
                    categoryDataToUpdate.Key   = categoryData.Key;
                    categoryDataToUpdate.Value = categoryData.Value;
                }
            }

            if (settingsCategoryDatasToDelete.Any())
            {
                //Mark for deletion
                foreach (var item in settingsCategoryDatasToDelete)
                {
                    dbSettingsCategory.CategoryData.Remove(item);
                }
            }
        }
Beispiel #7
0
        private void LoadScreen(SettingsCategory category)
        {
            PreferenceFragmentCompat newFragment;

            switch (category)
            {
            case SettingsCategory.Main:
                newFragment = new SettingsFragment();
                break;

            case SettingsCategory.Developer:
                newFragment = new DeveloperSettingsFragment();
                break;

            default:
                Log.Error(nameof(SettingsFragment), "Not implemented Settings category");
                return;
            }

            currentCategory = category;
            SupportFragmentManager.BeginTransaction().Replace(Resource.Id.fragment_container,
                                                              newFragment).Commit();
        }
        SliceSettingsOrganizer()
        {
			string layouts = Path.Combine(ApplicationDataStorage.Instance.ApplicationStaticDataPath, "SliceSettings", "Layouts.txt");
            string properties = Path.Combine(ApplicationDataStorage.Instance.ApplicationStaticDataPath, "SliceSettings", "Properties.txt");

            LoadAndParseSettingsFiles(properties, layouts);
#if false
            Categories.Add(CreatePrintSettings());

            SettingsCategory filamentSettingsCategory = new SettingsCategory("Filament Settings");
            Categories.Add(filamentSettingsCategory);

            SettingsCategory printerSettingsCategory = new SettingsCategory("Printer Settings");
            Categories.Add(printerSettingsCategory);
#endif
        }
Beispiel #9
0
        private void DrawNode(IBuildVariant inspectedBuildVariant,
                              IProjectSettingsFile projectSettingsFile, SettingsCategory category, YamlNode node, YamlNode labelNode = null)
        {
            if (node == null)
            {
                return;
            }
            EditorGUI.indentLevel++;

            Action revertAction = null;
            Action saveAction   = null;

            if (category == SettingsCategory.ActualSettingsDiff || category == SettingsCategory.ActualRevertableSettingsDiff)
            {
                saveAction = () => {
                    inspectedBuildVariant.Merge(projectSettingsFile, node);
                    _projectSettingsController.InvalidateDiffCache();
                };
                if (category == SettingsCategory.ActualRevertableSettingsDiff)
                {
                    revertAction = () => {
                        _projectSettingsController.BuildAndApplyProjectSettings(inspectedBuildVariant,
                                                                                _projectSettingsController.GetDiffWithActualSettings(inspectedBuildVariant),
                                                                                projectSettingsFile, node);
                    }
                }
                ;
            }
            else if (category == SettingsCategory.VariantDiff)
            {
                revertAction = () => {
                    var currentDiff = _projectSettingsController.GetDiffWithActualSettings(inspectedBuildVariant).ToList();
                    inspectedBuildVariant.Revert(projectSettingsFile, node);
                    _projectSettingsController.BuildAndApplyProjectSettings(inspectedBuildVariant, currentDiff);
                };
            }

            if (node.NodeType == YamlNodeType.Mapping)
            {
                EditorGUILayout.BeginHorizontal();
                var expanded = inspectedBuildVariant.IsFieldExpanded(string.Format("{0}_{1}_{2}",
                                                                                   category.ToString(), projectSettingsFile.FileName, labelNode));

                expanded = EditorGUILayout.Foldout(expanded, string.Format("{0} ({1})",
                                                                           labelNode, ((YamlMappingNode)node).Children.Count));
                inspectedBuildVariant.SetFieldExpanded(string.Format("{0}_{1}_{2}",
                                                                     category.ToString(), projectSettingsFile.FileName, labelNode), expanded);
                DrawSaveRevert(revertAction, saveAction);
                EditorGUILayout.EndHorizontal();
                if (expanded)
                {
                    foreach (var keyValue in ((YamlMappingNode)node).Children)
                    {
                        DrawNode(inspectedBuildVariant, projectSettingsFile, category, keyValue.Value, keyValue.Key);
                    }
                }
            }
            else if (node.NodeType == YamlNodeType.Scalar || node.NodeType == YamlNodeType.Sequence)
            {
                EditorGUILayout.BeginHorizontal();
                if (labelNode != null)
                {
                    EditorGUILayout.LabelField(labelNode.ToString());
                }
                EditorGUILayout.HelpBox(node.ToString(), MessageType.None);
                DrawSaveRevert(revertAction, saveAction);
                EditorGUILayout.EndHorizontal();
            }

            EditorGUI.indentLevel--;
        }
Beispiel #10
0
 protected override void LoadData(XElement xmlElement)
 {
     this.Settings      = GetSubElementValue <SettingsCategory>(f => SettingsCategory.GetInstance(f), xmlElement, "Settings");
     this.LatestVersion = GetSubElementValue <LatestVersionCategory>(f => LatestVersionCategory.GetInstance(f), xmlElement, "LatestVersion");
 }
Beispiel #11
0
 public ExpansionSettingsBase(SettingsCategory in_category, string in_expansion_name) : base(in_category, in_expansion_name)
 {
     ExpansionIndex = -1;
     Active         = false;
 }
Beispiel #12
0
 /// <summary>
 /// Initializes a new instance of the GetSettingsMessage class.  When a
 /// machine, operator, and category are specified, all settings are
 /// returned.
 /// </summary>
 /// <param name="machineId">The machine to get the
 /// settings for.</param>
 /// <param name="operatorId">The operator to get the settings
 /// for.</param>
 /// <param name="category">The category of settings to get.</param>
 public GetSettingsMessage(int machineId, int operatorId, SettingsCategory category)
     : this(machineId, operatorId, category, 0)
 {
 }
Beispiel #13
0
 /// <summary>
 /// Initializes a new instance of the GetSettingsMessage class.  When a
 /// machine and category are specified, no operator overridden settings
 /// are returned.
 /// </summary>
 /// <param name="machineId">The machine to get the
 /// settings for.</param>
 /// <param name="category">The category of settings to get.</param>
 public GetSettingsMessage(int machineId, SettingsCategory category)
     : this(machineId, 0, category, 0)
 {
 }
Beispiel #14
0
 public CardSettingsBase(SettingsCategory in_category, string in_module_name, int in_slot_index) : base(in_category, in_module_name)
 {
     Active         = false;
     ExpansionIndex = -1;
     SlotIndex      = in_slot_index;
 }
Beispiel #15
0
 public SettingsBase(SettingsCategory in_category, string in_module_name)
 {
     Category   = in_category;
     ModuleName = in_module_name;
 }
		private SliceSettingsOrganizer()
		{
			LoadAndParseSettingsFiles();

#if false
            Categories.Add(CreatePrintSettings());

            SettingsCategory filamentSettingsCategory = new SettingsCategory("Filament Settings");
            Categories.Add(filamentSettingsCategory);

            SettingsCategory printerSettingsCategory = new SettingsCategory("Printer Settings");
            Categories.Add(printerSettingsCategory);
#endif
		}
Beispiel #17
0
        private void DrawSettings(IBuildVariant inspectedBuildVariant, SettingsCategory category)
        {
            string categoryName;
            Action revertAction = null;
            Action saveAction   = null;
            IEnumerable <IProjectSettingsFile> settingsFiles;

            EditorGUILayout.BeginHorizontal();
            if (category == SettingsCategory.ActualSettingsDiff || category == SettingsCategory.ActualRevertableSettingsDiff)
            {
                categoryName  = "Actual project settings diff";
                settingsFiles = _projectSettingsController.GetDiffWithActualSettings(inspectedBuildVariant);
                saveAction    = () => {
                    inspectedBuildVariant.Merge(settingsFiles);
                    _projectSettingsController.InvalidateDiffCache();
                };
                if (category == SettingsCategory.ActualRevertableSettingsDiff)
                {
                    revertAction = () => _projectSettingsController.BuildAndApplyProjectSettings(inspectedBuildVariant);
                }
            }
            else if (category == SettingsCategory.VariantDiff)
            {
                categoryName  = "Variant settings";
                settingsFiles = inspectedBuildVariant.SettingsFileDiffs;
                revertAction  = () => {
                    var currentDiff = _projectSettingsController.GetDiffWithActualSettings(inspectedBuildVariant).ToList();
                    inspectedBuildVariant.Revert();
                    _projectSettingsController.BuildAndApplyProjectSettings(inspectedBuildVariant, currentDiff);
                };
            }
            else
            {
                throw new ArgumentOutOfRangeException("category", category, null);
            }

            var expanded             = inspectedBuildVariant.IsFieldExpanded(category.ToString());
            var projectSettingsFiles = settingsFiles as IProjectSettingsFile[] ?? settingsFiles.ToArray();

            expanded = EditorGUILayout.Foldout(expanded, string.Format("{0} ({1})", categoryName, projectSettingsFiles.Length));
            inspectedBuildVariant.SetFieldExpanded(category.ToString(), expanded);

            GUI.enabled = projectSettingsFiles.Length > 0;
            DrawSaveRevert(revertAction, saveAction);
            GUI.enabled = true;

            EditorGUILayout.EndHorizontal();

            if (!expanded)
            {
                return;
            }

            foreach (var settingsFileDiff in projectSettingsFiles)
            {
                var mappingNode = settingsFileDiff.RootNode as YamlMappingNode;
                if (mappingNode != null)
                {
                    foreach (var keyValue in mappingNode.Children)
                    {
                        DrawNode(inspectedBuildVariant, settingsFileDiff, category, keyValue.Value, keyValue.Key);
                    }
                }
                else
                {
                    DrawNode(inspectedBuildVariant, settingsFileDiff, category, settingsFileDiff.RootNode);
                }
            }
        }