Exemplo n.º 1
0
        private void PracticalOperate_OnBacked()
        {
            ((PracticalOperate)operateContainer.Content).OnBacked -= PracticalOperate_OnBacked;
            operateContainer.Content    = null;
            projectContainer.Visibility = Visibility.Visible;
            operateContainer.Visibility = Visibility.Collapsed;

            practicalItem.UpdateState();

            UpdateProcessBar();
        }
Exemplo n.º 2
0
        private void LoadProcess(PracticalItem[] items)
        {
            if (!File.Exists(practicalProcessFileName))
            {
                return;
            }

            XmlDocument document = new XmlDocument();

            using (StringReader reader = new StringReader(UTF8Encoding.UTF8.GetString(File.ReadAllText(practicalProcessFileName).Split(' ').Select(item => Convert.ToByte(item)).ToArray())))
                document.Load(reader);

            foreach (XmlNode practical in document.SelectSingleNode("process"))
            {
                int           practicalId   = Convert.ToInt32(practical.Attributes["id"].Value);
                PracticalItem practicalItem = items.SingleOrDefault(item => item.ID == practicalId);

                if (practicalItem == null)
                {
                    continue;
                }

                foreach (XmlNode project in practical.ChildNodes)
                {
                    int projectId = Convert.ToInt32(project.Attributes["id"].Value);
                    PracticalItemProject projectItem = practicalItem.Projects.SingleOrDefault(item => item.ID == projectId);

                    if (practicalItem == null)
                    {
                        continue;
                    }

                    projectItem.IsDone = ExistPract(practicalItem.ID) && Convert.ToBoolean(project.Attributes["hasdone"].Value);
                }

                practicalItem.UpdateState();
            }
        }