public MainWindow() { InitializeComponent(); //горячие клавиши AppSettingsReader reader = new AppSettingsReader(); KeyGestureConverter gestureConverter = new KeyGestureConverter(); try { string tmp = (string)reader.GetValue("Save", typeof(string)); KeyGesture saveKeyGesture = (KeyGesture)gestureConverter.ConvertFromString(tmp); KeyBinding saveKeyBinding = new KeyBinding(new RelayCommand(o => { FileManager.Save(empList, depList); }, o => true), saveKeyGesture); InputBindings.Add(saveKeyBinding); } catch { } try { string tmp = (string)reader.GetValue("Load", typeof(string)); gestureConverter = new KeyGestureConverter(); KeyGesture loadKeyGesture = (KeyGesture)gestureConverter.ConvertFromString(tmp); KeyBinding loadKeyBinding = new KeyBinding(new RelayCommand(o => { FileManager.Load(empList, depList); }, o => true), loadKeyGesture); InputBindings.Add(loadKeyBinding); } catch { } try { string tmp = (string)reader.GetValue("Plugins", typeof(string)); gestureConverter = new KeyGestureConverter(); KeyGesture pluginsKeyGesture = (KeyGesture)gestureConverter.ConvertFromString(tmp); KeyBinding pluginsKeyBinding = new KeyBinding(new RelayCommand(o => { PluginMenu window = new PluginMenu(pluginList); window.Show(); }, o => true), pluginsKeyGesture); InputBindings.Add(pluginsKeyBinding); } catch { } try { string tmp = (string)reader.GetValue("Esc", typeof(string)); gestureConverter = new KeyGestureConverter(); KeyGesture escKeyGesture = (KeyGesture)gestureConverter.ConvertFromString(tmp); KeyBinding escKeyBinding = new KeyBinding(new RelayCommand(o => { MinHeight = 0; var animation = new DoubleAnimation(); animation.From = Height; animation.To = MinHeight; animation.Duration = TimeSpan.FromSeconds(0.5); animation.Completed += animation_Completed; this.BeginAnimation(HeightProperty, animation); }, o => true), escKeyGesture); InputBindings.Add(escKeyBinding); } catch { } //загрузка иконок try { var bitmapSource = Imaging.CreateBitmapSourceFromHBitmap(EMResource.FileIcon.GetHbitmap(), IntPtr.Zero, Int32Rect.Empty, BitmapSizeOptions.FromEmptyOptions()); fileImg.Source = bitmapSource; } catch { } try { var bitmapSource = Imaging.CreateBitmapSourceFromHBitmap(EMResource.PluginIcon.GetHbitmap(), IntPtr.Zero, Int32Rect.Empty, BitmapSizeOptions.FromEmptyOptions()); pluginImg.Source = bitmapSource; } catch { } //список плагинов try { foreach (string file in Directory.GetFiles(Directory.GetCurrentDirectory() + (string)reader.GetValue("pluginPath", typeof(string)))) { string assemblyName = file.Remove(0, file.LastIndexOf(@"\") + 1); assemblyName = assemblyName.Remove(assemblyName.Length - 4, 4); if (assemblyName != "EmployeeManager.SDK") { Plugin tmp = new Plugin(); tmp.Name = assemblyName; pluginList.Add(tmp); } } } catch { } }
public DepartmentWindow(Window _window, MainWindow _mainWindow, EmployeeList _empList, DepartmentList _depList) { InitializeComponent(); //горячие клавиши AppSettingsReader reader = new AppSettingsReader(); KeyGestureConverter gestureConverter = new KeyGestureConverter(); try { string tmp = (string)reader.GetValue("Save", typeof(string)); KeyGesture saveKeyGesture = (KeyGesture)gestureConverter.ConvertFromString(tmp); KeyBinding saveKeyBinding = new KeyBinding(new RelayCommand(o => { FileManager.Save(empList, depList); }, o => true), saveKeyGesture); InputBindings.Add(saveKeyBinding); } catch { } try { string tmp = (string)reader.GetValue("Load", typeof(string)); gestureConverter = new KeyGestureConverter(); KeyGesture loadKeyGesture = (KeyGesture)gestureConverter.ConvertFromString(tmp); KeyBinding loadKeyBinding = new KeyBinding(new RelayCommand(o => { FileManager.Load(empList, depList); }, o => true), loadKeyGesture); InputBindings.Add(loadKeyBinding); } catch { } try { string tmp = (string)reader.GetValue("Plugins", typeof(string)); gestureConverter = new KeyGestureConverter(); KeyGesture pluginsKeyGesture = (KeyGesture)gestureConverter.ConvertFromString(tmp); KeyBinding pluginsKeyBinding = new KeyBinding(new RelayCommand(o => { PluginMenu window = new PluginMenu(mainWindow.pluginList); window.Show(); }, o => true), pluginsKeyGesture); InputBindings.Add(pluginsKeyBinding); } catch { } try { string tmp = (string)reader.GetValue("Esc", typeof(string)); gestureConverter = new KeyGestureConverter(); KeyGesture escKeyGesture = (KeyGesture)gestureConverter.ConvertFromString(tmp); KeyBinding escKeyBinding = new KeyBinding(new RelayCommand(o => { MinHeight = 0; var animation = new DoubleAnimation(); animation.From = Height; animation.To = MinHeight; animation.Duration = TimeSpan.FromSeconds(0.5); animation.Completed += Window_Closed; this.BeginAnimation(HeightProperty, animation); }, o => true), escKeyGesture); InputBindings.Add(escKeyBinding); } catch { } empList = _empList; depList = _depList; window = _window; mainWindow = _mainWindow; List <int> year = new List <int>(); int currentDate = DateTime.Today.Year; for (int i = 0; currentDate >= 1982; i++) { year.Add(currentDate); currentDate--; } depYear.ItemsSource = year; depBoss.ItemsSource = empList.empManager; foreach (Department item in depList.depManager) { departmentList.Items.Add(item); } }
private void MenuItem_Click_2(object sender, RoutedEventArgs e) { PluginMenu window = new PluginMenu(pluginList); window.Show(); }
public EmployeeWindow(Window _window, MainWindow _mainWindow, EmployeeList _empList, DepartmentList _depList) { InitializeComponent(); //горячие клавиши AppSettingsReader reader = new AppSettingsReader(); KeyGestureConverter gestureConverter = new KeyGestureConverter(); try { string tmp = (string)reader.GetValue("Save", typeof(string)); KeyGesture saveKeyGesture = (KeyGesture)gestureConverter.ConvertFromString(tmp); KeyBinding saveKeyBinding = new KeyBinding(new RelayCommand(o => { FileManager.Save(empList, depList); }, o => true), saveKeyGesture); InputBindings.Add(saveKeyBinding); } catch { } try { string tmp = (string)reader.GetValue("Load", typeof(string)); gestureConverter = new KeyGestureConverter(); KeyGesture loadKeyGesture = (KeyGesture)gestureConverter.ConvertFromString(tmp); KeyBinding loadKeyBinding = new KeyBinding(new RelayCommand(o => { FileManager.Load(empList, depList); }, o => true), loadKeyGesture); InputBindings.Add(loadKeyBinding); } catch { } try { string tmp = (string)reader.GetValue("Plugins", typeof(string)); gestureConverter = new KeyGestureConverter(); KeyGesture pluginsKeyGesture = (KeyGesture)gestureConverter.ConvertFromString(tmp); KeyBinding pluginsKeyBinding = new KeyBinding(new RelayCommand(o => { PluginMenu window = new PluginMenu(mainWindow.pluginList); window.Show(); }, o => true), pluginsKeyGesture); InputBindings.Add(pluginsKeyBinding); } catch { } try { string tmp = (string)reader.GetValue("Esc", typeof(string)); gestureConverter = new KeyGestureConverter(); KeyGesture escKeyGesture = (KeyGesture)gestureConverter.ConvertFromString(tmp); KeyBinding escKeyBinding = new KeyBinding(new RelayCommand(o => { MinHeight = 0; var animation = new DoubleAnimation(); animation.From = Height; animation.To = MinHeight; animation.Duration = TimeSpan.FromSeconds(0.5); animation.Completed += Window_Closed; this.BeginAnimation(HeightProperty, animation); }, o => true), escKeyGesture); InputBindings.Add(escKeyBinding); } catch { } empList = _empList; depList = _depList; window = _window; mainWindow = _mainWindow; int[] day = new int[] { 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31 }; string[] month = new string[] { "Январь", "Февраль", "Март", "Апрель", "Май", "Июнь", "Июль", "Август", "Сентябрь", "Октябрь", "Ноябрь", "Декабрь" }; List <int> year = new List <int>(); int currentDate = DateTime.Today.Year; for (int i = 0; currentDate >= 1982; i++) { year.Add(currentDate); currentDate--; } employmentDay.ItemsSource = day; employmentMonth.ItemsSource = month; employmentYear.ItemsSource = year; dismissalDay.ItemsSource = day; dismissalMonth.ItemsSource = month; dismissalYear.ItemsSource = year; empDepartment.ItemsSource = depList.depManager; empBoss.ItemsSource = empList.empManager; empSubWorkers.ItemsSource = empList.empManager; foreach (Employee item in empList.empManager) { employeeList.Items.Add(item); } }