Ejemplo n.º 1
0
        public void SetDataTable(object sender, RoutedEventArgs e)
        {
            var table = new DataTable();

            table.Columns.Add(new DataColumn("개발내용")
            {
                ReadOnly = true
            });
            table.Columns.Add(new DataColumn("시작일")
            {
                ReadOnly = true
            });
            table.Columns.Add(new DataColumn("종료일")
            {
                ReadOnly = true
            });
            table.Columns.Add(new DataColumn("남은기간")
            {
                ReadOnly = true
            });
            foreach (var item in GanttChart0.GetTasks().Elements("Task"))
            {
                var remain    = (DateTime.Parse(item.Element("End").Value) - DateTime.Now).Days;
                var remainStr = remain.ToString();
                if (remain < 0)
                {
                    remainStr = "Expired";
                }
                table.Rows.Add(new string[] { item.Attribute("Task").Value, item.Element("Start").Value, item.Element("End").Value, remainStr });
            }

            ((CustomDataGrid0_MainWindow_ViewModel)CustomDataGrid0.DataContext).Value = table;
        }
Ejemplo n.º 2
0
        private void File_Save_MenuItem_Click(object sender, RoutedEventArgs e)
        {
            var saveDialog = new SaveFileDialog();

            saveDialog.Filter = "XML file (*.xml)|*.xml";
            if (saveDialog.ShowDialog() == true)
            {
                File.WriteAllText(saveDialog.FileName, GanttChart0.GetTasks().ToString());
            }
        }
Ejemplo n.º 3
0
        private void Button0_Click(object sender, RoutedEventArgs e)
        {
            var started = DatePicker0.SelectedDate.Value.Date;
            var ended   = DatePicker1.SelectedDate.Value.Date;

            if (DateTime.Compare(started, ended) > 0)
            {
                MessageBox.Show("The start date cannot come before the end date.", "WARNING", MessageBoxButton.OK, MessageBoxImage.Warning);
                return;
            }

            var task  = new XElement("Task", new XAttribute("Task", TextBox0.Text), new XElement("Start", started.ToShortDateString()), new XElement("End", ended.ToShortDateString()));
            var tasks = GanttChart0.GetTasks();

            tasks.Add(task);
            GanttChart0.Value = tasks.ToString();
            SetDataTable(null, null);
        }