private bool ValidateTask() { if (String.IsNullOrEmpty(task.Name)) { TaskName.Focus(); return(false); } return(true); }
private void OnNewTask(object sender, RoutedEventArgs e) { TaskName.Text = null; DueDate.SelectedDate = DateTime.Today; Instructions.Text = null; Animals.Clear(); Candidates.Clear(); TaskName.Focus(); ScheduleTask.IsEnabled = true; NewTask.IsEnabled = false; }
private void ok_Click(object sender, RoutedEventArgs e) { if (!string.IsNullOrWhiteSpace(TaskName.Text) && !string.IsNullOrWhiteSpace(Desc.Text) && !string.IsNullOrWhiteSpace(PriorRate.Value.ToString()) && !string.IsNullOrWhiteSpace(TagInfo.Text) && !string.IsNullOrWhiteSpace(Dateinfo.SelectedDate.ToString())) { if (int.TryParse(PriorRate.Value.ToString(), out int result)) { Labname.Foreground = Brushes.Black; Labname.FontSize = 14; LabDecs.Foreground = Brushes.Black; LabDecs.FontSize = 14; LabPrior.Foreground = Brushes.Black; LabPrior.FontSize = 14; LabTag.Foreground = Brushes.Black; LabTag.FontSize = 14; LabTime.Foreground = Brushes.Black; LabTime.FontSize = 14; reference.GeneralListFromDataBase.Add(new TaskTodo() { Name = TaskName.Text, Description = Desc.Text, Prioriti = result, Tag = TagInfo.Text, DueTo = Dateinfo.SelectedDate.Value }); this.Close(); } else { PriorRate.Focus(); } } else { if (string.IsNullOrWhiteSpace(TaskName.Text)) { TaskName.Focus(); Labname.Foreground = Brushes.Red; Labname.FontSize = 18; } if (string.IsNullOrWhiteSpace(Desc.Text)) { Desc.Focus(); LabDecs.Foreground = Brushes.Red; LabDecs.FontSize = 18; } if (string.IsNullOrWhiteSpace(PriorRate.Value.ToString())) { PriorRate.Focus(); LabPrior.Foreground = Brushes.Red; LabPrior.FontSize = 18; } if (string.IsNullOrWhiteSpace(TagInfo.Text)) { TagInfo.Focus(); LabTag.Foreground = Brushes.Red; LabTag.FontSize = 18; } if (string.IsNullOrWhiteSpace(Dateinfo.SelectedDate.ToString())) { Dateinfo.Focus(); LabTime.Foreground = Brushes.Red; LabTime.FontSize = 18; } } }
private void Button_Click(object sender, RoutedEventArgs e) { if (!string.IsNullOrWhiteSpace(TaskName.Text) && !string.IsNullOrWhiteSpace(Desc.Text) && !string.IsNullOrWhiteSpace(PriorRate.Value.ToString()) && !string.IsNullOrWhiteSpace(TagInfo.Text) && !string.IsNullOrWhiteSpace(Dateinfo.SelectedDate.ToString())) { Labname.Foreground = Brushes.Black; Labname.FontSize = 14; LabDecs.Foreground = Brushes.Black; LabDecs.FontSize = 14; LabPrior.Foreground = Brushes.Black; LabPrior.FontSize = 14; LabTag.Foreground = Brushes.Black; LabTag.FontSize = 14; LabTime.Foreground = Brushes.Black; LabTime.FontSize = 14; editor.ChangeName(elemGen, TaskName.Text); editor.ChangeDescription(elemGen, Desc.Text); var tempValue = 0; int.TryParse(PriorRate.Value.ToString(), out tempValue); editor.ChangePriority(elemGen, tempValue); editor.ChangeTag(elemGen, TagInfo.Text); editor.ChangeDateDue(elemGen, Dateinfo.SelectedDate.Value); initial.SelectedTask = elemGen; this.Close(); } else { if (string.IsNullOrWhiteSpace(TaskName.Text)) { TaskName.Focus(); Labname.Foreground = Brushes.Red; Labname.FontSize = 18; } if (string.IsNullOrWhiteSpace(Desc.Text)) { Desc.Focus(); LabDecs.Foreground = Brushes.Red; LabDecs.FontSize = 18; } if (string.IsNullOrWhiteSpace(PriorRate.Value.ToString())) { PriorRate.Focus(); LabPrior.Foreground = Brushes.Red; LabPrior.FontSize = 18; } if (string.IsNullOrWhiteSpace(TagInfo.Text)) { TagInfo.Focus(); LabTag.Foreground = Brushes.Red; LabTag.FontSize = 18; } if (string.IsNullOrWhiteSpace(Dateinfo.SelectedDate.ToString())) { Dateinfo.Focus(); LabTime.Foreground = Brushes.Red; LabTime.FontSize = 18; } } }
protected override void OnAppearing() { base.OnAppearing(); TaskName.Focus(); }