public MainWindow() { InitializeComponent(); Thread.Sleep(5000); Process[] procs = Process.GetProcesses(); var s = new List <string>(); foreach (Process p in procs) { if (!String.IsNullOrWhiteSpace(p.MainWindowTitle)) { s.Add(p.MainWindowTitle); } } using (var textReader = new StreamReader("tm.xml")) { var deserializer = new XmlSerializer(typeof(TimeManagement)); TimeManagement = (TimeManagement)deserializer.Deserialize(textReader); } var bindProjectsListBox = new Binding { Source = TimeManagement, Path = new PropertyPath("Projects"), Mode = BindingMode.TwoWay }; ProjectListBox.SetBinding(ItemsControl.ItemsSourceProperty, bindProjectsListBox); _worker.DoWork += worker_DoWork; _worker.RunWorkerAsync(); }
private void txtSearchProjects_KeyUp(object sender, KeyEventArgs e) { if (e.Key == Key.Down) { ProjectListBox.Focus(); return; } var viewModel = (SelectTaskViewModel)DataContext; viewModel.ProjectSearchString = TxtSearchProjects.Text; }
private void CheckProjectsByEmployee(string employeeOib) { foreach (var project in RelationProjectEmployeeRepo.GetProjectsByEmployee(employeeOib)) { for (var i = 0; i < ProjectListBox.Items.Count; i++) { if (ProjectListBox.Items[i].ToString().GetProjectName() != project.ToString().GetProjectName()) { continue; } ProjectListBox.SetItemChecked(i, true); break; } } }
private void EditEmployeeForm_Load() { FirstNametextbox.Text = ToViewEmployee.FirstName; LastNametextbox.Text = ToViewEmployee.LastName; OibTextbox.Text = ToViewEmployee.Oib; birthTimePicker.Text = ToViewEmployee.DateOfBirth.ToString(); JobComboBox.Text = ToViewEmployee.Position.ToString(); HoursTextbox.Text = DataBaseRelations.GetHours(ToViewEmployee.Oib).ToString(); var index = 0; foreach (var project in DataBaseProjects.ListProjects) { ProjectListBox.Items.Add(project.Name); if (DataBaseRelations.GetRelation(project.Name, ToViewEmployee.Oib) != null) { ProjectListBox.SetItemChecked(index, true); } index++; } }