1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677 |
- using System;
- using System.Collections.Generic;
- using System.ComponentModel;
- using System.Windows;
- using InABox.Wpf;
- namespace InABox.DynamicGrid
- {
- /// <summary>
- /// Interaction logic for NotesForm.xaml
- /// </summary>
- public partial class NotesForm : ThemableWindow
- {
- public NotesForm(Dictionary<Guid, string> employees = null)
- {
- InitializeComponent();
- EmployeeID = Guid.Empty;
- if (employees != null)
- {
- Task.Visibility = Visibility.Visible;
- TaskEmployee.Visibility = Visibility.Visible;
- TaskEmployee.ItemsSource = employees;
- }
- }
- public string Caption
- {
- get => (string)Heading.Content;
- set => Heading.Content = value;
- }
- public string Text
- {
- get => Editor.Text;
- set => Editor.Text = value;
- }
- public bool OKEnabled
- {
- get => OK.IsEnabled;
- set => OK.IsEnabled = value;
- }
- public bool CancelEnabled
- {
- get => Cancel.IsEnabled;
- set => Cancel.IsEnabled = value;
- }
- public Guid EmployeeID { get; private set; }
- private void OK_Click(object sender, RoutedEventArgs e)
- {
- if (Task.Visibility == Visibility.Visible && TaskEmployee.SelectedItem != null)
- {
- var emp = (KeyValuePair<Guid, string>)TaskEmployee.SelectedItem;
- EmployeeID = emp.Key;
- }
- DialogResult = true;
- Close();
- }
- private void Cancel_Click(object sender, RoutedEventArgs e)
- {
- DialogResult = false;
- Close();
- }
- private void Window_Closing(object sender, CancelEventArgs e)
- {
- if (CancelEnabled == false && DialogResult != true)
- e.Cancel = true;
- }
- }
- }
|