예제 #1
0
        private void launchEditUserListDialog()
        {
            string host = getHostName();

            if (host == String.Empty)
            {
                return;
            }

            IEnumerable <Tuple <string, bool> > users = ConfigurationHelper.GetUsersForHost(host, Program.Settings);

            Debug.Assert(users != null);

            RawDataAccessor rawDataAccessor = new RawDataAccessor(_gitLabInstance);

            using (EditOrderedListViewForm form = new EditOrderedListViewForm("Edit Users",
                                                                              "Add username", "Type a name of GitLab user, teams allowed",
                                                                              users, new EditUsersListViewCallback(rawDataAccessor), false))
            {
                if (form.ShowDialog() != DialogResult.OK)
                {
                    return;
                }

                if (!Enumerable.SequenceEqual(users, form.Items))
                {
                    ConfigurationHelper.SetUsersForHost(host, form.Items, Program.Settings);
                    updateUsersListView();

                    if (!ConfigurationHelper.IsProjectBasedWorkflowSelected(Program.Settings))
                    {
                        Trace.TraceInformation("[MainForm] Reconnecting after user list change");
                        reconnect();
                    }
                }
            }
        }
예제 #2
0
        private void launchEditProjectListDialog()
        {
            string host = getHostName();

            if (host == String.Empty)
            {
                return;
            }

            IEnumerable <Tuple <string, bool> > projects = ConfigurationHelper.GetProjectsForHost(host, Program.Settings);

            Debug.Assert(projects != null);

            RawDataAccessor rawDataAccessor = new RawDataAccessor(_gitLabInstance);

            using (EditOrderedListViewForm form = new EditOrderedListViewForm("Edit Projects",
                                                                              "Add project", "Type project name in group/project format",
                                                                              projects, new EditProjectsListViewCallback(rawDataAccessor), true))
            {
                if (form.ShowDialog() != DialogResult.OK)
                {
                    return;
                }

                if (!Enumerable.SequenceEqual(projects, form.Items))
                {
                    ConfigurationHelper.SetProjectsForHost(host, form.Items, Program.Settings);
                    updateProjectsListView();

                    if (ConfigurationHelper.IsProjectBasedWorkflowSelected(Program.Settings))
                    {
                        Trace.TraceInformation("[MainForm] Reconnecting after project list change");
                        reconnect();
                    }
                }
            }
        }