Esempio n. 1
0
        private void InitRecentProjects()
        {
            RecentProjects.Clear();

            XmlDocument doc  = new XmlDocument();
            var         path = App.LocalRPAStudioDir + @"\Config\RecentProjects.xml";

            doc.Load(path);
            var rootNode = doc.DocumentElement;

            var maxShowCount = Convert.ToInt32(rootNode.GetAttribute("MaxShowCount"));
            var projectNodes = rootNode.SelectNodes("Project");

            foreach (XmlNode dir in projectNodes)
            {
                var filePath    = (dir as XmlElement).GetAttribute("FilePath");
                var name        = (dir as XmlElement).GetAttribute("Name");
                var description = (dir as XmlElement).GetAttribute("Description");

                var item = new RecentProjectItem();
                item.ProjectFilePath    = filePath;
                item.ProjectName        = name;
                item.ProjectDescription = description;

                RecentProjects.Add(item);

                maxShowCount--;
                if (maxShowCount == 0)
                {
                    break;
                }
            }
        }
Esempio n. 2
0
        /// <summary>
        /// Initializes a new instance of the StartViewModel class.
        /// </summary>
        public StartViewModel()
        {
            var item = new RecentProjectItem();

            InitRecentProjects();

            //注册事件
            Messenger.Default.Register <MessengerObjects.RecentProjectsModify> (this, (obj) => {
                Common.RunInUI(() => {
                    InitRecentProjects();
                });
            });


            Messenger.Default.Register <ProjectSettingsViewModel>(this, "ProjectSettingsModify", (obj) => {
                Common.RunInUI(() =>
                {
                    ProjectSettingsModify(obj);
                });
            });
        }