private void BtnSend_Click(object sender, EventArgs e) { if (TextBoxTitle.Text.Length == 0) { MessageBox.Show("공지 제목을 적어 주세요", "알림", MessageBoxButtons.OK, MessageBoxIcon.Information); TextBoxTitle.Focus(); return; } if (richTextBoxContent.Text.Length != 0) { String NoticeTime = DateTime.Now.ToString(); NoticeObj obj = new NoticeObj(); obj.IsEmergency = ToggleButtonNormalNotice.Pressed; obj.Title = TextBoxTitle.Text; obj.Content = richTextBoxContent.Text; obj.NoticeTime = Utils.TimeKey(); NoticeRegisterRequested(this, new CustomEventArgs(obj)); Close(); } else { MessageBox.Show("공지할 내용을 적어 주세요", "알림", MessageBoxButtons.OK, MessageBoxIcon.Information); richTextBoxContent.Focus(); } }
private void AddTask(object sender, MouseButtonEventArgs e) { if (TextBoxTitle.Text == "") { TextBoxTitle.Focus(); } else if (PickerDate.SelectedDate == null || PickerHeureDebut.SelectedTime == null || PickerHeureFin.SelectedTime == null) { MessageBox.Show("Veuillez choisir la date exacte"); } else if ((ComboBoxPriorité.SelectedIndex != 0) && (ComboBoxPriorité.SelectedIndex != 1) && (ComboBoxPriorité.SelectedIndex != 2)) { MessageBox.Show("Veuillez choisir la priorité"); } else if (((string)((ComboBoxItem)ComboBoxActivities.SelectedItem).DataContext) == "Activité scolaire" && DataSupervisor.ds.user.JoursFeries.Keys.Contains(PickerDate.SelectedDate.Value)) { MessageBox.Show("Le jour choisit est ferie"); } else { Tache t = new Tache(); DateTime?selectedDay = PickerDate.SelectedDate; DateTime dateDebut = new DateTime(selectedDay.Value.Year, selectedDay.Value.Month, selectedDay.Value.Day, PickerHeureDebut.SelectedTime.Value.Hour, PickerHeureDebut.SelectedTime.Value.Minute, PickerHeureDebut.SelectedTime.Value.Second); DateTime dateFin = new DateTime(selectedDay.Value.Year, selectedDay.Value.Month, selectedDay.Value.Day, PickerHeureFin.SelectedTime.Value.Hour, PickerHeureFin.SelectedTime.Value.Minute, PickerHeureFin.SelectedTime.Value.Second); t.dateDebut = dateDebut; t.dateFin = dateFin; foreach (String s in this.files) { t.Fichiers.Add(s); } t.title = TextBoxTitle.Text; t.Details = TextBoxDescription.Text; switch (ComboBoxPriorité.SelectedIndex) { case 0: t.priorite = "Urgente"; break; case 1: t.priorite = "Normale"; break; case 2: t.priorite = "Basse"; break; default: return; } t.Activitee = (string)((ComboBoxItem)ComboBoxActivities.SelectedItem).DataContext; t.Alarms = new List <Notif>(); foreach (KeyValuePair <Chip, Notif> n in NotificationDict) { t.Alarms.Add(n.Value); } DataSupervisor.ds.AddTache(t); windowParent.Close(); } }
private async void ShowPost(object sender, SelectionChangedEventArgs e) { if (!(TitleList.SelectedValue is Post selectedPost)) { return; } DropState(); var dbPost = await _postService.Get(selectedPost.Id); _currentPost = selectedPost; _currentPost.Body = dbPost.Body; TextBoxTitle.Text = _currentPost.Title; Display.Document.SetText(TextSetOptions.FormatRtf, _currentPost.Body); BodyStackPanel.Visibility = Visibility.Visible; TextBoxTitle.Visibility = Visibility.Visible; BodySearchBox.Visibility = Visibility.Visible; if (TextBoxTitle.Text == Constant.DefaultTitle) { TextBoxTitle.Focus(FocusState.Programmatic); TextBoxTitle.SelectAll(); } ClosePaneButton.Visibility = Visibility; }
private void Add_Executed(object sender, ExecutedRoutedEventArgs e) { SmpUcFormStateLabel.CurrentState = FormCurrentState.Add; var newItem = new City { Title = ResourceAccessor.Labels.GetString("New") }; Cities.Add(newItem); DataGridCities.SelectedItem = newItem; CollectionViewSource.GetDefaultView(DataGridCities.ItemsSource)?.Refresh(); DataGridCities.ScrollIntoView(newItem); TextBoxTitle.Focus(); }
private bool IsCheckInput() { if (string.IsNullOrEmpty(this.TextBoxTitle.Text.Trim())) { MessageBox.Show("视频标题不能为空!", "提示"); TextBoxTitle.Focus(); return(false); } if (string.IsNullOrEmpty(this.TextFrontImg.GetUrl().Trim())) { MessageBox.Show("封面图不能为空!", "提示"); TextFrontImg.Focus(); return(false); } if (string.IsNullOrEmpty(this.TextVideo.GetUrl().Trim())) { MessageBox.Show("视频信息不能为空!", "提示"); TextVideo.Focus(); return(false); } if (string.IsNullOrEmpty(this.TextVideoDuration.Text.Trim())) { MessageBox.Show("视频时长不能为空!", "提示"); TextVideoDuration.Focus(); return(false); } if (string.IsNullOrEmpty(this.TextBrief.Text.Trim())) { MessageBox.Show("简易描述不能为空!", "提示"); TextBrief.Focus(); return(false); } if (string.IsNullOrEmpty(this.TextIntro.Text.Trim())) { MessageBox.Show("详细描述不能为空!", "提示"); TextIntro.Focus(); return(false); } if (string.IsNullOrEmpty(this.ArtTags.Label1.Trim())) { MessageBox.Show("艺术标签不能为空!", "提示"); ArtTags.Focus(); return(false); } return(true); }
private void Edit_Executed(object sender, ExecutedRoutedEventArgs e) { SmpUcFormStateLabel.CurrentState = FormCurrentState.Edit; TextBoxTitle.Focus(); }