コード例 #1
0
ファイル: NewTaskPage.cs プロジェクト: RichardvMeelis/MAPapp
        private async void AddTask(object sender, EventArgs e)
        {
            addTask.IsEnabled = false;
            int projectID;

            //De nieuwe taak toevoegen aan project in de database
            try
            {
                projectID = saved.projectid;
                ContactDataBase.addTaskToProject(ContactDataBase.currentUserName, ContactDataBase.currentToken, nameEntry.Text, descriptionEntry.Text, project.projectid, int.Parse(rroeValueEntry.Text), int.Parse(jobSizeEntry.Text), int.Parse(userBusinessValueEntry.Text), int.Parse(timeCriticalityEntry.Text), int.Parse(uncertaintyEntry.Text));
                List <Project> projects = (List <Project>)ContactDataBase.GetProjects(ContactDataBase.currentUserName, ContactDataBase.currentToken);
                foreach (Project project in projects)
                {
                    if (project.projectid == projectID)
                    {
                        project.Tasks = (List <Task>)ContactDataBase.GetTasks(ContactDataBase.currentUserName, ContactDataBase.currentToken, project.projectid);
                        Sprint      s     = (Sprint)ContactDataBase.GetSprint(ContactDataBase.currentUserName, ContactDataBase.currentToken, project.projectid);
                        List <Task> tasks = new List <Task>();
                        foreach (Task t in project.Tasks)
                        {
                            if (s != null && t.sprintid == s.sprintid)
                            {
                                tasks.Add(t);
                            }
                        }
                        if (s != null)
                        {
                            s.Sprinttasks         = tasks;
                            project.CurrentSprint = s;
                        }
                        await Navigation.PushAsync(new TabbedPage()
                        {
                            Children = { new ProjectInfoPage(project), new SprintPage(project.CurrentSprint, project.Tasks, project), new NewSprintPage(project), new burndown(project) }, Title = project.projectname
                        });
                    }
                }
                // Het verwijderen van de oude pages in de stack
                for (int counter = 1; counter <= 2; counter++)
                {
                    Navigation.RemovePage(Navigation.NavigationStack[2]);
                }
                addTask.IsEnabled = true;
            }
            //Opvangen error
            catch
            {
                await DisplayAlert(Globals.taakallerttitel, Globals.taakallertmessage, "ok");

                addTask.IsEnabled = true;
            }
        }
コード例 #2
0
ファイル: TaskInfoPage.cs プロジェクト: RichardvMeelis/MAPapp
        //Refresh de pagina
        private async void refreshPage()
        {
            int projectID = t.projectid;

            try
            {
                List <Project> projects = (List <Project>)ContactDataBase.GetProjects(ContactDataBase.currentUserName, ContactDataBase.currentToken);
                foreach (Project project in projects)
                {
                    if (project.projectid == projectID)
                    {
                        project.Tasks = (List <Task>)ContactDataBase.GetTasks(ContactDataBase.currentUserName, ContactDataBase.currentToken, project.projectid);
                        Sprint      s     = (Sprint)ContactDataBase.GetSprint(ContactDataBase.currentUserName, ContactDataBase.currentToken, project.projectid);
                        List <Task> tasks = new List <Task>();
                        foreach (Task t in project.Tasks)
                        {
                            if (s != null && t.sprintid == s.sprintid)
                            {
                                tasks.Add(t);
                            }
                        }
                        if (s != null)
                        {
                            s.Sprinttasks         = tasks;
                            project.CurrentSprint = s;
                        }
                        await Navigation.PushAsync(new TabbedPage()
                        {
                            Children = { new ProjectInfoPage(project), new SprintPage(project.CurrentSprint, project.Tasks, project), new NewSprintPage(project), new burndown(project) }, Title = project.projectname
                        });
                    }
                }


                // Het verwijderen van de oude pages in de stack
                for (int counter = 1; counter <= 2; counter++)
                {
                    Navigation.RemovePage(Navigation.NavigationStack[2]);
                }
            }
            catch
            {
                //error opvangen
                await DisplayAlert(Globals.taakallerttitel, Globals.taakallertmessage, "ok");
            }
        }
コード例 #3
0
        //Voeg gebruiker toe aan project
        private async void B_Clicked(object sender, EventArgs e)
        {
            b.IsEnabled = false;
            string userName  = ContactDataBase.currentUserName;
            string token     = ContactDataBase.currentToken;
            int    projectID = ding.projectid;

            //Controleer JOIN_PROJECT_SUCCESS
            if ((string)ContactDataBase.JoinProject(userName, token, projectID) == "JOIN_PROJECT_SUCCESS")
            {
                //Popup success
                await DisplayAlert(Globals.joinpassname, Globals.joinpass, Globals.okknop);

                Project f            = ding;
                var     tokenSource2 = new CancellationTokenSource();
                await System.Threading.Tasks.Task.Run(() =>
                {
                    Boolean hasAccess = true;
                    Sprint s          = null;
                    //Krijg taken en sprints van database
                    try
                    {
                        f.Tasks = (List <Task>)ContactDataBase.GetTasks(ContactDataBase.currentUserName, ContactDataBase.currentToken, f.projectid);
                        s       = (Sprint)ContactDataBase.GetSprint(ContactDataBase.currentUserName, ContactDataBase.currentToken, f.projectid);
                    }
                    catch { hasAccess = false; }

                    try
                    {
                        //Voeg taken en sprints toe
                        List <Task> tasks = new List <Task>();
                        foreach (Task t in f.Tasks)
                        {
                            if (s != null && t.sprintid == s.sprintid)
                            {
                                tasks.Add(t);
                            }
                        }
                        if (s != null)
                        {
                            s.Sprinttasks   = tasks;
                            f.CurrentSprint = s;
                        }
                    }
                    catch { }
                    //Laat normale pagina of join pagina zien (afhankelijk van hasAccess)
                    Device.BeginInvokeOnMainThread(() =>
                    {
                        if (hasAccess)
                        {
                            Navigation.PushAsync(new TabbedPage()
                            {
                                Children = { new ProjectInfoPage(f), new SprintPage(f.CurrentSprint, f.Tasks, f), new NewSprintPage(f), new burndown(f) }, Title = f.projectname
                            });
                        }
                        else
                        {
                            Navigation.PushAsync(new TabbedPage()
                            {
                                Children = { new JoinProjectPage(f), }, Title = f.projectname, BackgroundColor = GeneralSettings.mainColor
                            });
                        }
                    });
                }, tokenSource2.Token);

                tokenSource2.Cancel();
            }
            //error JOIN_PROJECT niet gelukt
            else
            {
                await DisplayAlert(Globals.error, Globals.joinfail, Globals.okknop);

                b.IsEnabled = true;
            }
            Navigation.RemovePage(Navigation.NavigationStack[Navigation.NavigationStack.Count - 2]);
        }
コード例 #4
0
        public AddTaskToSprintPage(Sprint givenSprint, List <Task> projectTasks, Project project)
        {
            this.f           = project;
            sprint           = givenSprint;
            addTask.Clicked += AddTaskClicked;
            BackgroundColor  = GeneralSettings.backgroundColor;
            List <Task> tasks = new List <Task>();

            foreach (Task t in projectTasks)
            {
                //Als een taak nog niet af is en nog geen sprint heeft kan hij worden toegevoegd
                if (t.sprintid == 0 && t.timecompleted == null)
                {
                    tasks.Add(t);
                }
            }
            //Listview met alle taken die aan de sprint kunnen worden toegevoegd
            table = new ListView
            {
                VerticalOptions = LayoutOptions.FillAndExpand,
                ItemsSource     = tasks,
                HasUnevenRows   = true,

                ItemTemplate = new DataTemplate(() =>
                {
                    // Creëer de labels met bindings

                    Label nameLabel = new Label();
                    nameLabel.SetBinding(Label.TextProperty, "taskname");
                    nameLabel.FontSize  = 20;
                    nameLabel.TextColor = GeneralSettings.textColor;

                    Label jobSizeLabel = new Label();
                    jobSizeLabel.SetBinding(Label.TextProperty,
                                            new Binding("JSPoints", BindingMode.OneWay,
                                                        null, null, "Job Size: {0:d}"));
                    jobSizeLabel.TextColor = GeneralSettings.textColor;

                    Label importancePointsLabel = new Label();
                    importancePointsLabel.SetBinding(Label.TextProperty,
                                                     new Binding("UBVPoints", BindingMode.OneWay,
                                                                 null, null, "User- business value: {0:d}"));
                    importancePointsLabel.TextColor = GeneralSettings.textColor;


                    //Maak viewcell met stacklayout
                    return(new ViewCell
                    {
                        View = new StackLayout
                        {
                            Margin = GeneralSettings.pageMargin,
                            Padding = new Thickness(0, 2),
                            Orientation = StackOrientation.Horizontal,
                            Children =
                            {
                                new StackLayout
                                {
                                    VerticalOptions = LayoutOptions.FillAndExpand,
                                    Spacing = 0,
                                    Children =
                                    {
                                        nameLabel,
                                        jobSizeLabel,importancePointsLabel,
                                    }
                                }
                            }
                        }
                    });
                })
            };

            addTask.IsEnabled = false;
            table.ItemTapped += Table_ItemTapped;
            Content           = new StackLayout {
                Children = { table, addTask }
            };
        }
コード例 #5
0
        public SprintPage(Sprint s, List <Task> projectTasks, Project project)
        {
            Title       = Globals.nieuwesprintpaginatitel;
            givenTasks  = projectTasks;
            givenSprint = s;
            this.f      = project;
            List <Task> tasks = new List <Task>();

            Title           = Globals.paginasprint;
            BackgroundColor = GeneralSettings.backgroundColor;
            //Pagina icon
            Icon = "Calender.png";
            //Controleren of er taken zijn in de sprint
            if (s != null && s.Sprinttasks != null)
            {
                tasks = s.Sprinttasks;
                tasks = Sort.SortTasks(tasks);
            }
            table = new ListView
            {
                VerticalOptions = LayoutOptions.FillAndExpand,
                ItemsSource     = tasks,
                HasUnevenRows   = true,

                ItemTemplate = new DataTemplate(() =>
                {
                    // Create views with bindings for displaying each property.
                    Label nameLabel = new Label();
                    nameLabel.SetBinding(Label.TextProperty, "taskname");
                    nameLabel.FontSize  = 20;
                    nameLabel.TextColor = GeneralSettings.textColor;
                    //Label met binding voor Job Size
                    Label CompanyLabel = new Label();
                    CompanyLabel.SetBinding(Label.TextProperty,
                                            new Binding("JSPoints", BindingMode.OneWay,
                                                        null, null, "Job Size: {0:d}"));
                    CompanyLabel.TextColor = GeneralSettings.textColor;
                    //Label met binding voor UBV
                    Label importancePointsLabel = new Label();
                    importancePointsLabel.SetBinding(Label.TextProperty,
                                                     new Binding("UBVPoints", BindingMode.OneWay,
                                                                 null, null, "User- business value: {0:d}"));
                    importancePointsLabel.TextColor = GeneralSettings.textColor;

                    // Return ViewCell.
                    return(new ViewCell
                    {
                        View = new StackLayout
                        {
                            Margin = GeneralSettings.pageMargin,
                            Padding = new Thickness(0, 2),
                            Orientation = StackOrientation.Horizontal,
                            Children =
                            {
                                //boxView,

                                new StackLayout
                                {
                                    VerticalOptions = LayoutOptions.FillAndExpand,
                                    Spacing = 0,
                                    Children =
                                    {
                                        nameLabel,
                                        //birthdayLabel,
                                        CompanyLabel,importancePointsLabel,
                                    }
                                }
                            }
                        }
                    });
                })
            };
            //Nieuwe button voor taak toevoegen
            Button b = new Button()
            {
                BackgroundColor = GeneralSettings.mainColor, TextColor = GeneralSettings.btextColor
            };

            b.Text     = Globals.knoptaaktoevoegen;
            b.Clicked += B_Clicked;

            Label sprintName, sprintStartDate, sprintDuration, sprintTimeRemaining;

            //Content aanmaken
            if (s != null)
            {
                sprintName = new Label {
                    Text = "Name: " + s.sprintname, TextColor = GeneralSettings.textColor
                };
                sprintDuration = new Label {
                    Text = "Sprint duration: " + s.duration, TextColor = GeneralSettings.textColor
                };
                sprintStartDate = new Label {
                    Text = "Start date: " + s.sprint_start_date.ToString("dd/MM/yyyy"), TextColor = GeneralSettings.textColor
                };
                sprintTimeRemaining = new Label {
                    Text = "Time Remaining: " + TimeRemaining(s.sprint_start_date, s.duration) + " Dagen", TextColor = GeneralSettings.textColor
                };
            }
            else
            {
                sprintName = new Label {
                    Text = "No Sprint available", TextColor = GeneralSettings.warningColor
                };
                sprintDuration = new Label {
                    Text = " ", TextColor = GeneralSettings.textColor
                };
                sprintStartDate = new Label {
                    Text = "", TextColor = GeneralSettings.textColor
                };
                sprintTimeRemaining = new Label {
                    Text = "", TextColor = GeneralSettings.textColor
                };
            }
            //Content toevoegen aan stacklayout
            Content = new StackLayout
            {
                VerticalOptions = LayoutOptions.FillAndExpand,
                Children        =
                {
                    sprintName,
                    sprintStartDate,
                    sprintDuration,
                    sprintTimeRemaining,
                    table, b
                }
            };
            table.ItemTapped += Table_ItemTapped;
        }