Esempio n. 1
0
        public void WhenTaskIsNotRun_VerifyTimeCountEquals0Seconds()
        {
            #region Actors
            Task task = new Task("test", new TimeCounter(""));
            #endregion

            #region Activities
            #endregion

            #region Asserts
            Assert.AreEqual(new TimeSpan(0, 0, 0), task.TimeCount);
            #endregion
        }
Esempio n. 2
0
 public void ExecuteAddTaskCommand()
 {
     Task t = new Task("New Task", TimeCounter);
     _tasks.Add(new TaskViewModel(t));
     TimeCounter.Tasks.Add(t);
 }
Esempio n. 3
0
 public TaskViewModel(Task task)
 {
     Task = task;
     StartChronoCommand = new RelayCommand(ExecuteStartChronoCommand, CanExecuteStartChronoCommand);
     StopChronoCommand = new RelayCommand(ExecuteStopChronoCommand, CanExecuteStopChronoCommand);
 }
Esempio n. 4
0
        private void LoadFromXML()
        {
            string name;
            TimeSpan ts;

            if (File.Exists(XmlFile))
            {
                using (XmlTextReader _xmlTextReader = new XmlTextReader(XmlFile))
                {
                    while (_xmlTextReader.Read())
                    {
                        if (_xmlTextReader.IsStartElement())
                        {
                            if (_xmlTextReader.Name == "Task")
                            {
                                _xmlTextReader.ReadStartElement("Task");

                                _xmlTextReader.ReadStartElement("Name");
                                name = _xmlTextReader.ReadString();
                                _xmlTextReader.ReadEndElement();

                                _xmlTextReader.ReadStartElement("TimeCount");
                                TimeSpan.TryParse(_xmlTextReader.ReadString(), out ts);
                                _xmlTextReader.ReadEndElement();

                                _xmlTextReader.ReadStartElement("IsRunning");
                                bool isRunning = (_xmlTextReader.ReadString() == "True");
                                _xmlTextReader.ReadEndElement();

                                _xmlTextReader.ReadEndElement();

                                Task t = new Task(name, ts, this, isRunning);
                                Tasks.Add(t);
                            }
                        }
                    }
                }
            }
        }