Пример #1
0
        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();
        }
Пример #2
0
        private void txtSearchProjects_KeyUp(object sender, KeyEventArgs e)
        {
            if (e.Key == Key.Down)
            {
                ProjectListBox.Focus();
                return;
            }
            var viewModel = (SelectTaskViewModel)DataContext;

            viewModel.ProjectSearchString = TxtSearchProjects.Text;
        }
Пример #3
0
 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;
         }
     }
 }
Пример #4
0
        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++;
            }
        }