Example #1
0
        public GroupsForm(AppsStructure appsstruct)
        {
            InitializeComponent();
            Options.ApplyTheme(this);

            _structure = appsstruct;

            groupBox.Items.Clear();
            if (_structure.Groups != null)
            {
                groupBox.Items.AddRange(_structure.Groups.ToArray());
                if (_structure.Groups.Count > 0)
                {
                    this.Text += $" ({_structure.Groups.Count} groups)";
                }
            }
        }
Example #2
0
        private void LoadAppsStructure()
        {
            if (System.IO.File.Exists(Options.AppsStructureFile))
            {
                _AppsStructure = JsonConvert.DeserializeObject <AppsStructure>(System.IO.File.ReadAllText(Options.AppsStructureFile));
            }
            else
            {
                _AppsStructure        = new AppsStructure();
                _AppsStructure.Apps   = new List <App>();
                _AppsStructure.Groups = new List <string>();

                using (FileStream fs = System.IO.File.Open(Options.AppsStructureFile, FileMode.CreateNew))
                    using (StreamWriter sw = new StreamWriter(fs))
                        using (JsonWriter jw = new JsonTextWriter(sw))
                        {
                            jw.Formatting = Formatting.Indented;

                            JsonSerializer serializer = new JsonSerializer();
                            serializer.Serialize(jw, _AppsStructure);
                        }
            }
        }