Exemple #1
0
        void RemoveClicked(NSButton sender)
        {
            Console.WriteLine("DVC Remove clicked");
            if (!StopEditing() || DepartmentsTableView.SelectedRow < 0)
            {
                AppKitFramework.NSBeep();
                return;
            }
            Department dep = DataStore.Departments[(int)DepartmentsTableView.SelectedRow];

            if (currentSelectedDepartment.ID == dep.ID)
            {
                currentSelectedDepartment = null;
            }

            foreach (Employee emp in DataStore.Employees)
            {
                if (emp.Department == dep.ID)
                {
                    emp.DepartmentName = "";
                }
            }

            DataStore.RemoveItem(dep);
            DepartmentsTableView.DeselectAll(this);
            DepartmentEmployeesTableView.DeselectAll(this);
            DepartmentsTableView.ReloadData();
            DepartmentEmployeesTableView.ReloadData();
        }
Exemple #2
0
        void AddClicked(NSButton sender)
        {
            Console.WriteLine("DVC Add clicked");
            Department dep = new Department();

            DataStore.AddItem <Department>(dep);
            dep.SetName("New Department");
            DepartmentsTableView.ReloadData();

            // Start editing new item
            int row = DataStore.Departments.IndexOf(dep);

            DepartmentsTableView.SelectRow(row, false);
            DepartmentsTableView.EditColumn(0, row, null, true);
        }
Exemple #3
0
 public override void ViewWillAppear()
 {
     base.ViewWillAppear();
     IsViewReady = true;
     if (currentSelectedDepartment != null)
     {
         SelectManagerButton.RemoveAllItems();
         foreach (Employee emp in currentSelectedDepartment.Employees)
         {
             SelectManagerButton.Menu.AddItem(emp.FullName, new ObjCRuntime.Selector("managerSelected:"), "");
         }
         SelectManagerButton.SelectItem(currentSelectedDepartment.ManagerName);
     }
     DepartmentsTableView.ReloadData();
     DepartmentEmployeesTableView.ReloadData();
 }