예제 #1
0
        public void init()
        {
            var lst = MainModel.ins.configModel.lstLastProject;

            string rootPath = SysConst.rootPath();

            for (int i = 0; i < lst.Count; ++i)
            {
                lst[i].path = MainCtl.formatPath(lst[i].path);
            }

            lst.Sort((a, b) => b.lastOpenTime.CompareTo(a.lastOpenTime));

            lstVM.Clear();
            for (int i = 0; i < lst.Count; ++i)
            {
                LastProjectVM vm = new LastProjectVM(lst[i]);

                lstVM.Add(vm);
            }

            if (lstVM.Count > 0)
            {
                lstVM.Last().IsLast = true;
            }
        }
예제 #2
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();
        }
예제 #3
0
파일: MainCtl.cs 프로젝트: xxxxst/gifEdit
        public static string getFullPath(string path)
        {
            if (isAbsolutePath(path))
            {
                return(path);
            }

            return(SysConst.rootPath() + "/" + path);
        }
예제 #4
0
        public HttpServerMd createNewModel()
        {
            HttpServerMd md = new HttpServerMd();

            md.port = SystemCtl.getFreePort(MainMd.ins.maxStartPort());

            md.desc = md.ip + ":" + md.port;
            md.path = SysConst.rootPath();
            return(md);
        }
예제 #5
0
        private void BtnRegFile_Click(object sender, RoutedEventArgs e)
        {
            if (isRegFile)
            {
                regCtl.remove(strRegFile);
            }
            else
            {
                regCtl.setValue(strRegFile, Lang.ins.langAppName);
                regCtl.setValue(strRegFile + "Icon", SysConst.exePath());
                regCtl.setValue(strRegFile + "command\\", "\"" + SysConst.exePath() + "\" -s \"%V\"");
            }

            isRegFile = !isRegFile;
            updataeRegBtnDesc();
        }
예제 #6
0
파일: MainCtl.cs 프로젝트: xxxxst/gifEdit
        public static string formatPath(string path)
        {
            string rootPath = SysConst.rootPath();

            if (!isAbsolutePath(path))
            {
                return(path);
            }

            path = Path.GetFullPath(path);
            if (path.IndexOf(rootPath) == 0)
            {
                path = path.Substring(rootPath.Length);
            }

            path = new Regex("[/\\\\]+").Replace(path, "/");

            return(path);
        }
예제 #7
0
        public MainWindow()
        {
            InitializeComponent();

            MainModel.ins.mainWin       = this;
            btnExportProject.Visibility = Visibility.Collapsed;

            var md = MainModel.ins.configModel;

            try{
                md.srv.load(md, SysConst.configPath());
                md.brgSrv.load(md, this);
            } catch (Exception) {
            }

            var lastProjectCtl = MainCtl.ins.lastProjectCtl;

            lastProjectCtl.init();
            lstLastOpenProject.ItemsSource = lastProjectCtl.lstVM;
        }
예제 #8
0
        private void loadConfig()
        {
            try {
                string path = SysConst.configPath();
                parser = new IniParse(path);

                if (!File.Exists(path))
                {
                    WindowStartupLocation = WindowStartupLocation.CenterScreen;
                    return;
                }

                Left = parser["win"].getInt("x", 100);
                Top  = parser["win"].getInt("y", 100);

                // language
                string str = parser["win"]["language"];
                Lang.ins.setLang(str);

                str = parser["config"]["miniMode"];
                if (str != "" && str != "0")
                {
                    setMiniMode(true);
                }

                str = parser["config"]["checked"];
                string[] arr = str.Split('$');
                for (int i = 0; i < arr.Length; ++i)
                {
                    var tmp = arr[i].Split(',');
                    if (tmp.Length < 2)
                    {
                        continue;
                    }
                    var r = getInt(tmp[0]);
                    var c = getInt(tmp[1]);
                    if (r < 0 || r >= arrCheckBox.Length)
                    {
                        continue;
                    }
                    if (c < 0 || c >= arrCheckBox[r].Length)
                    {
                        continue;
                    }

                    arrCheckBox[r][c].IsChecked = true;
                }

                // outType
                str = parser["config"]["outType"];
                int.TryParse(str, out int outType);
                if (outType < 0 || outType >= cbxOutType.Items.Count)
                {
                    outType = 0;
                }
                cbxOutType.SelectedIndex = outType;
                lblShowOutType.Content   = cbxOutType.Items[outType].ToString();

                // operate
                str = parser["config"]["operate"];
                int.TryParse(str, out int operate);
                if (operate < 0 || operate >= cbxOperate.Items.Count)
                {
                    operate = 0;
                }
                cbxOperate.SelectedIndex = operate;
                lblShowOperate.Content   = cbxOperate.Items[operate].ToString();

                // merge output
                str = parser["config"]["mergeOutput"];
                int.TryParse(str, out int mergeOutput);
                chkMergeOutput.IsChecked  = (mergeOutput != 0);
                stkMergeOutput.Visibility = (chkMergeOutput.IsChecked == true ? Visibility.Visible : Visibility.Collapsed);
            } catch (Exception ex) { Debug.WriteLine(ex); }
        }