private void CalculateOvertime() { try { if (overtimeWindow == null || overtimeWindow.IsClosed) { overtimeWindow = new OvertimeWindow(null, Properties.Resources.TITLE_OVERTIME, database); overtimeWindow.Show(); } else { overtimeWindow.Activate(); } } catch (Exception ex) { HandleError(ex); } }
private void Window_Closing(object sender, System.ComponentModel.CancelEventArgs e) { try { if (overtimeWindow != null) { if (overtimeWindow.ConfigureNonWorkingDaysWindow != null && !overtimeWindow.ConfigureNonWorkingDaysWindow.IsClosed) { overtimeWindow.ConfigureNonWorkingDaysWindow.Close(); overtimeWindow.ConfigureNonWorkingDaysWindow = null; } if (!overtimeWindow.IsClosed) { overtimeWindow.Close(); overtimeWindow = null; } } Stop(); if (WindowState == WindowState.Normal) { Properties.Settings.Default.Left = Left; Properties.Settings.Default.Top = Top; Properties.Settings.Default.Width = Width; Properties.Settings.Default.Height = Height; } if (comboBoxProject.SelectedItem is Project lastUsedProject) { Properties.Settings.Default.LastUsedProject = lastUsedProject.Name; } Properties.Settings.Default.Save(); } catch (Exception ex) { HandleError(ex); } }