Example #1
0
        internal void AddHistory(string name, TaskRecord record)
        {
            RhinoApp.InvokeOnUiThread(new Action(() =>
            {
                TaskHistory historyGroup = GetHistoryByID(record.TaskID);

                if (historyGroup == null)
                {
                    historyGroup = new TaskHistory(name, record.TaskID);
                }

                int index = historyGroup.TaskRows.Items.Count + 1;
                // record.date.ToString("[MM/dd HH:mm:ss]")
                TaskRow taskRow       = new TaskRow(index, record);
                taskRow.RestoreEvent += task => RestoreEvent(task);
                taskRow.StoreEvent   += TaskRow_StoreEvent;
                taskRow.DeleteEvent  += TaskRow_DeleteEvent;
                historyGroup.AddRow(taskRow);

                if (historyGroup.TaskRows.Items.Count == 1)
                {
                    StackLayout.Items.Add(new StackLayoutItem(historyGroup));
                }
            }));
        }
Example #2
0
        private void TaskRow_DeleteEvent(TaskRow taskRow)
        {
            TaskHistory     historyGroup = GetHistoryByID(taskRow.TaskID);
            var             items        = historyGroup.TaskRows.Items;
            StackLayoutItem tobedel      = null;

            foreach (var item in items)
            {
                if (!(item.Control is TaskRow row) || !Equals(row.HistoryID, taskRow.HistoryID))
                {
                    continue;
                }
                tobedel = item;
            }

            if (items.Count == 1)
            {
                MessageBox.Show("至少要留一个历史记录!");
                return;
            }

            if (tobedel != null)
            {
                historyGroup.TaskRows.Items.Remove(tobedel);
            }
            DeleteEvent(taskRow);
        }
Example #3
0
 public void AddRow(TaskRow task)
 {
     TaskRows.Items.Add(task);
     Content = TaskRows;
 }
Example #4
0
 private void TaskRow_StoreEvent(TaskRow taskRow)
 {
     StoreEvent(taskRow);
 }