Exemplo n.º 1
0
        private void BtnNew_Click(object sender, RoutedEventArgs e)
        {
            //List<ServerMd> lstServer = ent.mainMd.lstServer;
            var lst = MainMd.ins.configMd.lstHttpServer;

            var md = getPage().createNewModel();

            ServerItem item = new ServerItem()
            {
                Tag = ++itemTag, Content = md.desc, Source = md.isRun ? LocalRes.statusRun() : LocalRes.statusStop()
            };

            md.serverItem = item;

            getPage().initData(md);
            serverItem.Insert(0, item);

            //lstServer.Add(md);
            lst.Insert(0, md);

            lstItem.ItemsSource = null;
            lstItem.ItemsSource = serverItem;

            lstItem.SelectedIndex = 0;
            lstItem.ScrollIntoView(lstItem.Items[0]);
        }
Exemplo n.º 2
0
        private void switchItem(int idx, int nextIex)
        {
            int sltIdx = lstItem.SelectedIndex;

            if (sltIdx == idx)
            {
                sltIdx = nextIex;
            }
            else if (sltIdx == nextIex)
            {
                sltIdx = idx;
            }

            var lst = MainMd.ins.configMd.lstHttpServer;
            var md  = lst[idx];

            lst[idx]     = lst[nextIex];
            lst[nextIex] = md;

            ServerItem item = serverItem[idx];

            serverItem[idx]       = serverItem[nextIex];
            serverItem[nextIex]   = item;
            lstItem.ItemsSource   = null;
            lstItem.ItemsSource   = serverItem;
            lstItem.SelectedIndex = sltIdx;
        }
Exemplo n.º 3
0
        private void initServerItem(List <HttpServerMd> lstServer)
        {
            for (int i = 0; i < lstServer.Count; ++i)
            {
                HttpServerMd md = lstServer[i];

                ServerItem item = new ServerItem()
                {
                    Tag = ++itemTag, Content = md.desc, Source = md.isRun ? LocalRes.statusRun() : LocalRes.statusStop()
                };
                md.serverItem = item;

                getPage().initData(md);

                serverItem.Add(item);
            }

            lstItem.ItemsSource = serverItem;
        }