Esempio 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]);
        }
Esempio n. 2
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;
        }
Esempio n. 3
0
        public MainWindow()
        {
            InitializeComponent();
            ins        = this;
            isWatiSave = true;

            //set icon
            Uri iconUri = new Uri(LocalRes.icon16(), UriKind.RelativeOrAbsolute);

            Icon = BitmapFrame.Create(iconUri, BitmapCreateOptions.PreservePixelFormat, BitmapCacheOption.OnLoad);

            //load config
            MainMd.ins.xmlConfig.load(MainMd.ins.configMd, "config.xml");
            loadServerConfig();
            convertOldConfig();

            MainMd.ins.mdLink.sendTo(MainMd.ins.configMd, this);
            colServer.Width = new GridLength(MainMd.ins.configMd.colServerWidth);

            //set language
            new ClassLink().sendTo(Lang.ins, this, "", LinkType.All);

            MainMd.ins.configMd.timeout = Math.Max(500, MainMd.ins.configMd.timeout);
            //MainMd.ins.configMd.mapContextType = ServerCtl.mapSuffix;
            //ServerCtl.setContentType(MainMd.ins.configMd.mapContextType);
            //ServerCtl.timeout = Math.Max(500, MainMd.ins.configMd.timeout);

            //http server init
            HttpServerGo.Init();

            HttpServerGo.HttpGlobalInfo globalInfo = new HttpServerGo.HttpGlobalInfo();
            globalInfo.HttpsCrt       = getAsmbText("server.crt");
            globalInfo.HttpsKey       = getAsmbText("server.key");
            globalInfo.MapContextType = contextTypeToSting();
            globalInfo.Timeout        = MainMd.ins.configMd.timeout;
            HttpServerGo.SetHttpGlobalInfo(ref globalInfo);

            getPage().init();

            showLog(isShowLog);
            btnLogError.IsSelect = isShowLogError;
            btnLogDebug.IsSelect = isShowLogDebug;

            //
            title = Title;
            CmdServ.cfgWaitSave.listen(() => cfgWaitSaved());
            CmdServ.cfgSaved.listen(() => cfgSaved());

            //
            var lst = MainMd.ins.configMd.lstHttpServer;

            initServerItem(lst);
            //lstItem.SelectedIndex = int.Parse(regCtl.getValue(regPath + "selectItem", "0"));
            lstItem.SelectedIndex = MainMd.ins.configMd.selectItem;

            isWatiSave = false;

            //try {
            //	HttpServerGo.HttpParamMd md = new HttpServerGo.HttpParamMd();
            //	md.Ip = MainCtl.createStrPtr("192.168.0.139");
            //	md.Port = MainCtl.createStrPtr("");
            //	md.IsHttps = true;
            //	md.Path = MainCtl.createStrPtr("");
            //	md.VirtualPath = MainCtl.createStrPtr("");
            //	md.Proxy = MainCtl.createStrPtr("");
            //	long id = HttpServerGo.Aaa(ref md);
            //	Debug.WriteLine("aaa:" + id);
            //} catch(Exception ex) { Debug.WriteLine(ex.ToString()); }
        }
Esempio n. 4
0
 public string getServerStatusImgPath(bool isRun)
 {
     return(isRun ? LocalRes.statusRun() : LocalRes.statusStop());
 }