Ejemplo n.º 1
0
        public MainWindow()
        {
            InitializeComponent();

            ins = this;
            MainModel.ins.mainWin = this;

            //xmlCfg = new XmlCtl();
            //xmlCfg.load("config.xml");
            string configPath = SysConst.configPath();

            MainModel.ins.cfgMd = new ConfigModel();
            xmlCfgServer        = new XmlModelServer(MainModel.ins.cfgMd, configPath);
            try{
                xmlCfgServer.loadFromXml();
                //ConfigModel md = MainModel.ins.cfgMd;

                //for(int i = 0; i < md.lstBox.Count; ++i) {
                //	Debug.WriteLine("11:" + md.lstBox[i].timer);
                //}
            } catch (Exception ex) {
                Debug.WriteLine(ex.ToString());
            }
            cfgCtl.load();
            if (!File.Exists(configPath))
            {
                saveConfig();
            }

            EventServer.ins.onConfigLoaded();

            //ignoreMouseEvent();
            setPos();
        }
Ejemplo n.º 2
0
        public void load(string path)
        {
            path = path.Trim(new char[] { '/', '\\', ' ', '\t' });
            string xmlPath = path + "/config.gife";

            md      = new ParticleEditModel();
            md.path = path;
            md.name = new Regex(".*?([^\\/]*$)").Replace(path, "$1");

            srv    = new XmlModelServer(md, xmlPath);
            md.srv = srv;
            md.srv.loadFromXml();

            MainModel.ins.particleEditModel = md;

            //md.srv.save();

            lstVM.Clear();
            for (int i = 0; i < md.lstResource.Count; ++i)
            {
                string         imgPath = md.lstResource[i].path;
                ImageSource    img     = loadImage(imgPath, path);
                ParticleEditVM vm      = new ParticleEditVM()
                {
                    idx     = i,
                    md      = md.lstResource[i],
                    Image   = img,
                    ImgName = Path.GetFileName(imgPath)
                };
                lstVM.Add(vm);
            }

            if (lstVM.Count > 0)
            {
                lstVM.Last().IsLast = true;
            }
        }