Example #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();
        }
Example #2
0
        void ReleaseDesignerOutlets()
        {
            if (DepartmentEmployeesTableView != null)
            {
                DepartmentEmployeesTableView.Dispose();
                DepartmentEmployeesTableView = null;
            }

            if (DepartmentsTableView != null)
            {
                DepartmentsTableView.Dispose();
                DepartmentsTableView = null;
            }

            if (SelectManagerButton != null)
            {
                SelectManagerButton.Dispose();
                SelectManagerButton = null;
            }

            if (Box != null)
            {
                Box.Dispose();
                Box = null;
            }
        }
Example #3
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);
        }
Example #4
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();
 }