Ejemplo n.º 1
0
        void Delete()
        {
            PopupAlertModel model = new()
            {
                Title           = "USUWANIE",
                ContentAsString = "<p>Czy na pewno chcesz usunąć?</br> Uwaga, tej operacji nie można cofnąć!</p>",
                Buttons         = new List <PopupButton>
                {
                    new PopupButton
                    {
                        Content = "Tak",
                        OnClick = (sender, args) => DeleteUser(currentEmployee)
                    },

                    new PopupButton
                    {
                        Content = "Nie"
                    }
                }
            };

            PopupService.AddPopupModelToStack(model);
        }

        void DeleteUser(EmployeeModel employee)
        {
            EmployeeService.DeleteEmployee(employee.ID.ToString());
        }

        void MenuOnAppearingHandler(MenuAppearingEventArgs e)
        {
            currentEmployee = e.Data as EmployeeModel;
            if (currentEmployee is null)
            {
                e.PreventShow = true;
            }
        }
    }
Ejemplo n.º 2
0
        void Delete()
        {
            PopupAlertModel model = new()
            {
                Title           = "USUWANIE",
                ContentAsString = "<p>Czy na pewno chcesz usunąć?</br> Uwaga, tej operacji nie można cofnąć!</p>",
                Buttons         = new List <PopupButton>
                {
                    new PopupButton
                    {
                        Content = "Tak",
                        OnClick = (sender, args) => DeleteTask(currentTask)
                    },

                    new PopupButton
                    {
                        Content = "Nie"
                    }
                }
            };

            PopupService.AddPopupModelToStack(model);
        }

        void DeleteTask(TaskModel task)
        {
            TaskService.Delete(task.ID);
        }

        void MenuOnAppearingHandler(MenuAppearingEventArgs e)
        {
            if (e.Data is TaskWithTaskRole taskModel)
            {
                currentTask = taskModel.Task;
                if (currentTask is null)
                {
                    e.PreventShow = true;
                }
                isForUser = true;
            }
            else if (e.Data is TaskModel)
            {
                currentTask = e.Data as TaskModel;
                if (currentTask is null)
                {
                    e.PreventShow = true;
                }
                isForUser = false;
            }
            else if (e.Data is EmployeeWithTaskRole)
            {
                currentEmployee = e.Data as EmployeeWithTaskRole;
                if (currentEmployee is null)
                {
                    e.PreventShow = true;
                }
            }
            else
            {
                e.PreventShow = true;
            }
        }
    }