예제 #1
0
        private void SaveData()
        {
            try
            {
                if (_items == null)
                {
                    return;
                }
                ManualQueuesJson mqj = new ManualQueuesJson()
                {
                    ManualQueues = new ManualQueue[_items.Count()]
                };
                int i = 0;
                foreach (var item in _items)
                {
                    mqj.ManualQueues[i] = new ManualQueue()
                    {
                        QueueName = item.Title, CasesNumbers = item.CasesList.ToArray()
                    };
                    i++;
                }

                var filePath   = Path.Combine(System.Environment.GetFolderPath(System.Environment.SpecialFolder.Personal), "ManualQueues.json");
                var serialized = JsonConvert.SerializeObject(mqj);
                File.WriteAllText(filePath, serialized);
            }
            catch (Exception)
            {
                return;
            }
        }
예제 #2
0
        private void InitList()
        {
            ManualQueuesJson    msj       = ReadData();
            List <HomeMenuItem> menuItems = new List <HomeMenuItem>();

            if (msj == null)
            {
                _items = menuItems;
                return;
            }
            foreach (var item in msj.ManualQueues)
            {
                menuItems.Add(new HomeMenuItem()
                {
                    Title = item.QueueName, CasesList = item.CasesNumbers.ToList(), MenuItemType = MenuItemType.Manual
                });
            }
            _items = menuItems;
        }