private void CancelButton_Click(object sender, RoutedEventArgs e) { TaskUserControl tu = new TaskUserControl(); try { Vm.DateTask = t.DateTask; Vm.LocationTask = t.LocationTask; Vm.NameTask = t.NameTask; Vm.TypeTask = t.TypeTask; Vm.PriorityTask = t.PriorityTask; Vm.DescriptionTask = t.DescriptionTask; Vm.WhenToRemember = t.WhenToRemember; Vm.ListOfTasksId = t.ListOfTasksId; Vm.CurrentModel.Delete(); //if (tu.TaskListBox.SelectedIndex != -1) //{ // Task t = tu.TaskListBox.SelectedValue as Task; // dp_month.SelectedDate=t.DateTask; // cmb_city.Text=t.LocationTask; // TaskTitle.Text=t.NameTask; // cmb_type.Text=t.TypeTask.ToString(); // TaskPriority.Text = t.PriorityTask.ToString(); // description.Text=t.DescriptionTask; // hour1.Text = t.WhenToRemember.Hour.ToString(); // minutes1.Text = t.WhenToRemember.Hour.ToString(); //} } catch (Exception ex) { MessageBox.Show(ex.Message); } }
void System.Windows.Markup.IComponentConnector.Connect(int connectionId, object target) { switch (connectionId) { case 1: #line 19 "..\..\Manage.xaml" ((System.Windows.Controls.Button)(target)).Click += new System.Windows.RoutedEventHandler(this.Button_Click); #line default #line hidden return; case 2: this.grd_printers = ((System.Windows.Controls.Grid)(target)); return; case 3: this.family = ((ToDoList.TaskUserControl)(target)); return; case 4: this.work = ((ToDoList.TaskUserControl)(target)); return; case 5: this.studies = ((ToDoList.TaskUserControl)(target)); return; } this._contentLoaded = true; }
public void initilize() { ls = new List <ListOfTasks>(); vm = new ViewModel(popAlert); vm.getAll(ls); foreach (Control item in grd_printers.Children) { if (item is TaskUserControl) { TaskUserControl t = item as TaskUserControl; switch (t.Name) { case "family": t.TaskListBox.ItemsSource = ls[0].Tasks.ToList(); t.TaskListBox.DisplayMemberPath = "NameTask"; ListOfTasksIdUser = 1; break; case "work": t.TaskListBox.ItemsSource = ls[1].Tasks.ToList(); t.TaskListBox.DisplayMemberPath = "NameTask"; ListOfTasksIdUser = 2; break; case "studies": t.TaskListBox.ItemsSource = ls[2].Tasks.ToList(); t.TaskListBox.DisplayMemberPath = "NameTask"; ListOfTasksIdUser = 3; break; } } } }