Exemple #1
0
        private void RemoveProject_Load(object sender, EventArgs e)
        {
            CenterToScreen();
            FormSelectProject form = new FormSelectProject();

            form.ShowDialog();
            if (form.DialogResult != DialogResult.OK)
            {
                MessageBox.Show("No project selected.", "Attention");
                Close();
            }
            _SelectedProjectId    = form._SelectedProjectId;
            labelProjectName.Text = form._SelectedProjectName;
            FakePreferenceRepository preferenceRepository = new FakePreferenceRepository();
            string preferredProjectId = preferenceRepository.GetPreference(_CurrentAppUser.UserName,
                                                                           FakePreferenceRepository.PREFERENCE_PROJECT_ID);

            if (_SelectedProjectId.ToString() == preferredProjectId)
            {
                MessageBox.Show("Cannot remove your current session project.", "Attention");
                Close();
            }
        }
Exemple #2
0
        private string selectAProject()
        {
            string            selectedProject = "";
            FormSelectProject form            = new FormSelectProject();

            form.ShowDialog();
            if (form.DialogResult == DialogResult.OK)
            {
                FakePreferenceRepository preferenceRepository = new FakePreferenceRepository();
                preferenceRepository.SetPreference(_CurrentAppUser.UserName,
                                                   FakePreferenceRepository.PREFERENCE_PROJECT_NAME,
                                                   form._SelectedProjectName);
                int selectedProjectId = form._SelectedProjectId;
                preferenceRepository.SetPreference(_CurrentAppUser.UserName,
                                                   FakePreferenceRepository.PREFERENCE_PROJECT_ID,
                                                   selectedProjectId.ToString());
                this.Text         = "Main - " + form._SelectedProjectName;
                selectedProject   = form._SelectedProjectName;
                _CurrentProjectId = selectedProjectId;
            }
            form.Dispose();
            return(selectedProject);
        }