/// <summary> /// Metoda DeleteHolidayButton_OnClick(object sender, RoutedEventArgs e) powoduje usuniecie urlopu danego pracownika /// </summary> /// <param name="sender">Argument typu object, ktory przekazuje obiekt</param> /// <param name="e">Argument typu RoutedEventArgs, ktory przekazuje wszystkie informacje o zdarzeniu </param> private void DeleteHolidayButton_OnClick(object sender, RoutedEventArgs e) { string question = "Czy jesteś pewien, że chcesz usunąć?"; //language item YesNo Result = new YesNo(question); if (Result.ShowDialog() == true) { var selectedWorker = (Worker)WorkersList.SelectedItem; var selectedMonth = (int)ListOfMonths.SelectedValue; var selectedYear = (int)ListOfYears.SelectedValue; var selectedDays = HolidaysList.SelectedItems.Cast <Day>().ToList(); using (var connection = new SQLiteConnection(App.databasePath)) { foreach (var selectedDay in selectedDays) { if (selectedDay.IsHoliday) { var holiday = holidays.Where(c => c.Date.Day.ToString() == selectedDay.DayNumber.ToString()) .ToList().First(); connection.Delete(holiday); } } } SetCalendar(); } }
private void MENU_about(object sender, RoutedEventArgs e) { try { Style z = new Style(); z = null; YesNo dlg = new YesNo(z, button_OK: "OK", title: "Информация о программе", t: $"Version: {VERSION}\nCreator: {CREATOR}\nContact E-mail: [email protected]\nhttps://github.com/UFO-from-UA/.NET"); dlg.ShowDialog(); } catch (Exception ex) { ExceptionForMail.ExceptionList.Add(new myException(this.GetType().Name, 760, ex.Message, System.Reflection.MethodInfo.GetCurrentMethod().Name)); } }
private void MENU_info(object sender, RoutedEventArgs e) { try { Style z = new Style(); z = null; YesNo dlg = new YesNo(z, button_OK: "OK", title: "Информация", t: $"It's realy easy!"); dlg.ShowDialog(); } catch (Exception ex) { ExceptionForMail.ExceptionList.Add(new myException(this.GetType().Name, 630, ex.Message, System.Reflection.MethodInfo.GetCurrentMethod().Name)); } }
private void Progress_MouseDoubleClick(object sender, MouseButtonEventArgs e) { try { Style z = new Style(); z = null; YesNo dlg = new YesNo(z, button_OK: "OK", title: "Прогресс", t: $"Всего пройдено {Progress.Value} из 60 вопросов!"); dlg.ShowDialog(); } catch (Exception ex) { ExceptionForMail.ExceptionList.Add(new myException(this.GetType().Name, 760, ex.Message, System.Reflection.MethodInfo.GetCurrentMethod().Name)); } }
private void Window_Closing(object sender, System.ComponentModel.CancelEventArgs e) { try { Style z = new Style(); z = null; YesNo exit = new YesNo(z); if (!bool.Parse(exit.ShowDialog().ToString())) { e.Cancel = true; } } catch (Exception ex) { ExceptionForMail.ExceptionList.Add(new myException(this.GetType().Name, 780, ex.Message, System.Reflection.MethodInfo.GetCurrentMethod().Name)); } }
private void shutdownBtn_Click(object sender, RoutedEventArgs e) { YesNo yn = new YesNo("ต้องการปิดโปรแกรมหรือไม่", "ยืนยันการออกจากการโปรแกรม"); yn.ShowDialog(); switch (yn.response) { case YesNo.RESULT_YES: break; case YesNo.RESULT_NO: return; default: return; } Application.Current.Shutdown(); }
private void ButtonClose_Click(object sender, RoutedEventArgs e) { bool gottenInfo; YesNo closeRequest = new YesNo("Close Request", "Are you sure you want to close this Window?"); closeRequest.ShowDialog(); gottenInfo = closeRequest.ReturnedDecision(); if (gottenInfo) { Application.Current.Shutdown(); } //if (MessageBox.Show("Are you sure you want to close this Window?", "Close Request", MessageBoxButton.YesNo, MessageBoxImage.Question) == MessageBoxResult.Yes) //{ // Application.Current.Shutdown(); //} //this.Close(); }
/// <summary> /// Metoda UserControl_IsVisibleChanged(object sender, TextChangedEventArgs e) podczas wywolania usuwa wybranego pracownika do listy i bazy danych /// </summary> /// <param name="sender">Argument typu object, ktory przekazuje obiekt</param> /// <param name="e">Argument typu RoutedEventArgs, ktory przekazuje wszystkie informacje o zdarzeniu </param> private void DatacontextItem_Delete(object sender, RoutedEventArgs e) //right click -> delete { Worker worker = WorkersList.SelectedItem as Worker; string question = "Czy jesteś pewien, że chcesz usunąć " + worker.Name + "?"; //language item YesNo Result = new YesNo(question); if (Result.ShowDialog() == true) { if (WorkersList.SelectedItem != null) { using (SQLiteConnection connection = new SQLiteConnection(App.databasePath)) { connection.CreateTable <Worker>(); connection.Delete(WorkersList.SelectedItem); } UpdateList(); } } }
private void exitBtn_Click(object sender, RoutedEventArgs e) { if (isChange()) { YesNo yn = new YesNo("ท่านต้องการออกจากหน้านี้ ซึ่งระบบจะยังไม่บันทึกข้อมูล ที่ท่านดำเนินการค้างอยู่", "ยืนยันการออกจากการหน้านี้"); yn.ShowDialog(); switch (yn.response) { case YesNo.RESULT_YES: break; case YesNo.RESULT_NO: return; default: return; } } this.Close(); }
//Right click - delete dialog private void DraggedImagePreviewMouseRightButtonDown(object sender, MouseButtonEventArgs e) { YesNo dialog = new YesNo(); dialog.ShowDialog(); if (dialog.YES == 1) { Image img = sender as Image; foreach (Species sp in Lists.MapSpecies) { if (img.Tag.Equals(sp.Mark)) { Lists.MapSpecies.Remove(sp); break; } } canvasMap.Children.Remove(img); } }
//Choosing type private void Choose_click(object sender, RoutedEventArgs e) { TypeChoose typechoose = new TypeChoose(); typechoose.ShowDialog(); TypeClass temp = typechoose.Selected_type; if (temp != null) { Type_tf.Text = temp.Type_Mark; YesNo dialog = new YesNo(); dialog.textBlock.Text = "Do you want to use type image for species?"; dialog.ShowDialog(); if (dialog.YES == 1) { Species_Icon.Source = temp.Type_Image.Source; } } }
private void CostumerRegisterDataGrid1_PreviewKeyDown2(object sender, KeyEventArgs e) { YesNo userDecision = new YesNo("Confirm Action!", "Are you sure that you want to delete this record?"); if (e.Key == Key.Delete) { userDecision.ShowDialog(); bool result = userDecision.ReturnedDecision(); if (result) { try { int Id = (costumerRegisterDataGrid1.SelectedItem as CostumerRegister).ClientID; var deleteMember = test.CostumerRegisters.Where(m => m.ClientID == Id).Single(); test.CostumerRegisters.Remove(deleteMember); test.SaveChanges(); costumerRegisterDataGrid1.ItemsSource = test.CostumerRegisters.ToList(); } catch (Exception) { //AlertOK decision = new AlertOK("Something went wrong!", ex.Message); //decision.ShowDialog(); RefreshDataGrid(); //MessageBox.Show(ex.Message); } } } else if (e.Key == Key.Up) { ScrollUp(); } else if (e.Key == Key.Down) { ScrollDown(); } }
// Shut down Button Click Event private void PopUpShutDown_Click(object sender, RoutedEventArgs e) { bool gottenInfo; YesNo closeRequest = new YesNo("Log out Request", "Are you sure you want to log out?"); closeRequest.ShowDialog(); gottenInfo = closeRequest.ReturnedDecision(); if (gottenInfo) { LogIn AnotherUser = new LogIn(); this.Close(); AnotherUser.ShowDialog(); } //if (MessageBox.Show("Are you sure you want to log out?","LogOut Request",MessageBoxButton.YesNo, MessageBoxImage.Question) == MessageBoxResult.Yes) //{ // LogIn AnotherUser = new LogIn(); // this.Close(); // AnotherUser.ShowDialog(); // //Application.Current.Shutdown(); //} }
//private void NotifyTrasition() //{ // TrasitioningPupNotifySlide.OnApplyTemplate(); // NotifyCard.Margin = new Thickness(0, 0, 150, 0); //} /// <summary> /// Delete Selection on the Data Grid View /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void BtDelete_Click(object sender, RoutedEventArgs e) { YesNo getEnquireis = new YesNo("Confirm Action!", "Are you sure that you want to delete this record?"); getEnquireis.ShowDialog(); if (getEnquireis.ReturnedDecision()) { try { int Id = (costumerRegisterDataGrid1.SelectedItem as CostumerRegister).ClientID; var deleteMember = test.CostumerRegisters.Where(m => m.ClientID == Id).Single(); test.CostumerRegisters.Remove(deleteMember); test.SaveChanges(); costumerRegisterDataGrid1.ItemsSource = test.CostumerRegisters.ToList(); } catch (Exception ex) { AlertOK alerting = new AlertOK("Something went wrong!", ex.Message); alerting.ShowDialog(); //MessageBox.Show(ex.Message); } } }