Beispiel #1
0
        public void DeletePage(int Page)
        {
            for (int i = 0; i < DesktopItemList.Count; i++)
            {
                if (DesktopItemList.ElementAt(i).Page == Page)
                {
                    DesktopItemList.RemoveAt(i);
                    i--;
                }
            }

            PageList.Remove(Page);
            Dictionary <int, string> tempList = new Dictionary <int, string>();

            for (int i = 0; i < PageList.Count(); i++)
            {
                if (PageList.ElementAt(i).Key > Page)
                {
                    tempList.Add(PageList.ElementAt(i).Key - 1, PageList.ElementAt(i).Value);
                    PageList.Remove(PageList.ElementAt(i).Key);
                    i--;
                }
            }

            foreach (var item in tempList)
            {
                PageList.Add(item.Key, item.Value);
            }

            PageList = PageList.OrderBy(o => o.Key).ToDictionary(o => o.Key, p => p.Value);

            Save();
        }
Beispiel #2
0
        public void DeleteSubApp(DesktopItem Item)
        {
            int page = Item.Page;

            DesktopItemList.Remove(Item);

            if (File.Exists(Item.Config))
            {
                File.Delete(Item.Config);
            }

            bool isExist = false;

            foreach (DesktopItem i in DesktopItemList)
            {
                if (i.Page == page)
                {
                    isExist = true;
                    break;
                }
            }

            if (!isExist)
            {
                foreach (DesktopItem i in DesktopItemList)
                {
                    if (i.Page > page)
                    {
                        i.Page--;
                    }
                }

                PageList.Remove(page);
                Dictionary <int, string> tempList = new Dictionary <int, string>();
                for (int i = 0; i < PageList.Count(); i++)
                {
                    if (PageList.ElementAt(i).Key > page)
                    {
                        tempList.Add(PageList.ElementAt(i).Key - 1, PageList.ElementAt(i).Value);
                        PageList.Remove(PageList.ElementAt(i).Key);
                        i--;
                    }
                }
                foreach (var item in tempList)
                {
                    PageList.Add(item.Key, item.Value);
                }
            }

            Save();
        }
Beispiel #3
0
 public void AddSubApp(DesktopItem Item)
 {
     DesktopItemList.Add(Item);
     Save();
 }