protected void InitGrid() { dataGridViewPanorama.Rows.Clear(); foreach (StoryData aSD in _stories) { TimeSpan ts = DateTime.Now - aSD.StageTimeStamp; string strTimeInState = ""; if (ts.Days > 0) { strTimeInState += String.Format("{0} days, ", ts.Days); } if (ts.Hours > 0) { strTimeInState += String.Format("{0} hours, ", ts.Hours); } strTimeInState += String.Format("{0} minutes", ts.Minutes); StoryStageLogic.StateTransition st = StoryStageLogic.stateTransitions[aSD.ProjStage.ProjectStage]; object[] aObs = new object[] { aSD.Name, aSD.CraftingInfo.StoryPurpose, TeamMemberData.GetMemberTypeAsDisplayString(aSD.ProjStage.MemberTypeWithEditToken), st.StageDisplayString, strTimeInState }; int nRowIndex = dataGridViewPanorama.Rows.Add(aObs); DataGridViewRow aRow = dataGridViewPanorama.Rows[nRowIndex]; aRow.Tag = st; aRow.Height = _fontForDev.Height + 4; } }
private void buttonAddNewMember_Click(object sender, EventArgs e) { // unselect any member and set the target tab (see // tabControlProjectMetaData_Selected for what happens) listBoxTeamMembers.SelectedIndex = -1; EditMemberForm dlg = new EditMemberForm(null); if (dlg.ShowDialog() == DialogResult.OK) { if (listBoxTeamMembers.Items.Contains(dlg.MemberName)) { MessageBox.Show(String.Format("Oops... you already have a member with the name, '{0}'. If you meant to edit that member, then select the name in the listbox and click the 'Edit Member' button", dlg.MemberName)); return; } Modified = true; TeamMemberData theNewMemberData; if (m_mapNewMembersThisSession.TryGetValue(dlg.MemberName, out theNewMemberData)) { // I don't see how this could happen... this must have been from back when // you could edit and add in a similar way. Now *Add* means *add a new one* // and they can't exist in this map... System.Diagnostics.Debug.Assert(false); // must just be editing the already added member... System.Diagnostics.Debug.Assert(listBoxTeamMembers.Items.Contains(dlg.MemberName)); theNewMemberData.MemberType = dlg.MemberType; theNewMemberData.Email = dlg.Email; theNewMemberData.AltPhone = dlg.AltPhone; theNewMemberData.Phone = dlg.Phone; theNewMemberData.BioData = dlg.BioData; theNewMemberData.SkypeID = dlg.SkypeID; theNewMemberData.TeamViewerID = dlg.TeamViewerID; // update the role listbox int nIndex = listBoxTeamMembers.Items.IndexOf(dlg.MemberName); listBoxMemberRoles.Items[nIndex] = TeamMemberData.GetMemberTypeAsDisplayString(theNewMemberData.MemberType); } else { // add this new user to the proj file theNewMemberData = new TeamMemberData(dlg.MemberName, dlg.MemberType, String.Format("mem-{0}", Guid.NewGuid()), dlg.Email, dlg.SkypeID, dlg.TeamViewerID, dlg.Phone, dlg.AltPhone, dlg.BioData); _dataTeamMembers.Add(dlg.MemberName, theNewMemberData); m_mapNewMembersThisSession.Add(dlg.MemberName, theNewMemberData); listBoxTeamMembers.Items.Add(dlg.MemberName); listBoxMemberRoles.Items.Add(TeamMemberData.GetMemberTypeAsDisplayString(theNewMemberData.MemberType)); listBoxTeamMembers.SelectedItem = dlg.MemberName; } } }
private void buttonEditMember_Click(object sender, EventArgs e) { // this button should only be enabled if a team member is selected System.Diagnostics.Debug.Assert(listBoxTeamMembers.SelectedIndex != -1); int nIndex = listBoxTeamMembers.SelectedIndex; m_strSelectedMember = (string)listBoxTeamMembers.SelectedItem; System.Diagnostics.Debug.Assert(_dataTeamMembers.ContainsKey(m_strSelectedMember)); TeamMemberData theMemberData = _dataTeamMembers[m_strSelectedMember]; EditMemberForm dlg = new EditMemberForm(theMemberData); if (dlg.ShowDialog() != DialogResult.OK) { return; } Modified = true; // if the name of the edited item has been changed and the new name is already // in use, then don't change the name if ((dlg.MemberName != m_strSelectedMember) && _dataTeamMembers.ContainsKey(dlg.MemberName)) { MessageBox.Show(String.Format("Oops... you already have a member with the name, '{0}'. If you meant to edit that member, then select the name in the listbox and click the 'Edit Member' button.", dlg.MemberName)); } else { theMemberData.Name = dlg.MemberName; } theMemberData.MemberType = dlg.MemberType; theMemberData.Email = dlg.Email; theMemberData.AltPhone = dlg.AltPhone; theMemberData.Phone = dlg.Phone; theMemberData.BioData = dlg.BioData; theMemberData.SkypeID = dlg.SkypeID; theMemberData.TeamViewerID = dlg.TeamViewerID; // update the role listbox listBoxMemberRoles.Items[nIndex] = TeamMemberData.GetMemberTypeAsDisplayString(theMemberData.MemberType); if (theMemberData.Name != m_strSelectedMember) { _dataTeamMembers.Remove(m_strSelectedMember); m_strSelectedMember = theMemberData.Name; _dataTeamMembers.Add(m_strSelectedMember, theMemberData); } listBoxTeamMembers.Items[nIndex] = theMemberData.Name; // keep a hang on it so we don't try to, for example, give it a new guid if (!m_mapNewMembersThisSession.ContainsKey(dlg.MemberName)) { m_mapNewMembersThisSession.Add(dlg.MemberName, theMemberData); } }
// if the coach tries to add a note in the consultant's pane, that should fail. // (but it's okay for a project facilitator to add one if they have a question // for the consultant) public bool CheckAddNotePrivilege(StoryEditor theSE, TeamMemberData.UserTypes eLoggedOnMember) { if (!HasAddNotePrivilege(eLoggedOnMember)) { theSE.SetStatusBar("Error: " + String.Format("You must be logged in as a '{0}' or a '{1}' to add a note here", TeamMemberData.GetMemberTypeAsDisplayString(MentorType), TeamMemberData.GetMemberTypeAsDisplayString(MenteeType))); return(false); } return(true); }
public bool IsChangeOfStateAllowed(TeamMemberData loggedOnMember) { bool bRet = ((loggedOnMember.MemberType == TeamMemberData.UserTypes.eJustLooking) || (loggedOnMember.MemberType == MemberTypeWithEditToken)); if (!bRet) { MessageBox.Show( String.Format(Properties.Resources.IDS_WhichUserEdits, TeamMemberData.GetMemberTypeAsDisplayString(MemberTypeWithEditToken)), Properties.Resources.IDS_Caption); } return(bRet); }
public TeamMemberForm(TeamMembersData dataTeamMembers, string strOKLabel) { _dataTeamMembers = dataTeamMembers; InitializeComponent(); foreach (TeamMemberData aMember in _dataTeamMembers.Values) { listBoxTeamMembers.Items.Add(aMember.Name); listBoxMemberRoles.Items.Add(TeamMemberData.GetMemberTypeAsDisplayString(aMember.MemberType)); } if ((listBoxTeamMembers.Items.Count > 0) && !String.IsNullOrEmpty(Properties.Settings.Default.LastMemberLogin)) { listBoxTeamMembers.SelectedItem = Properties.Settings.Default.LastMemberLogin; } /* * // initialize the keyboard combo list * foreach (KeyboardController.KeyboardDescriptor keyboard in * KeyboardController.GetAvailableKeyboards(KeyboardController.Engines.All)) * { * comboBoxKeyboardVernacular.Items.Add(keyboard.Name); * comboBoxKeyboardNationalBT.Items.Add(keyboard.Name); * } * * // initialize the vernacular language controls * if (_projSettings.Vernacular.HasData) * { * textBoxVernacular.Text = ((String.IsNullOrEmpty(_projSettings.Vernacular.LangName)) ? _projSettings.ProjectName : _projSettings.Vernacular.LangName); * textBoxVernacularEthCode.Text = _projSettings.Vernacular.LangCode; * * // select the configured keyboard in the combo box (this is made complicated by the fact * // that members may have overridden the default keyboard for their own system) * // First check if the logged in member (which is approximated by being the 'last member') * // has an override for the keyboard * if ((_tmdLastMember != null) * && !String.IsNullOrEmpty(_tmdLastMember.OverrideVernacularKeyboard) * && comboBoxKeyboardVernacular.Items.Contains(_tmdLastMember.OverrideVernacularKeyboard)) * { * comboBoxKeyboardVernacular.SelectedItem = _tmdLastMember.OverrideVernacularKeyboard; * } * else if (!String.IsNullOrEmpty(_projSettings.Vernacular.DefaultKeyboard) * && comboBoxKeyboardVernacular.Items.Contains(_projSettings.Vernacular.DefaultKeyboard)) * { * comboBoxKeyboardVernacular.SelectedItem = _projSettings.Vernacular.DefaultKeyboard; * } * checkBoxVernacularRTL.Checked = _projSettings.Vernacular.IsRTL; * checkBoxVernacular.Checked = true; * } * else * checkBoxVernacular.Checked = false; * * // even if there's no Vern, these should still be set (in case they check the box for Vern) * textBoxVernSentFullStop.Font = _projSettings.Vernacular.LangFont; * textBoxVernSentFullStop.ForeColor = _projSettings.Vernacular.FontColor; * textBoxVernSentFullStop.Text = _projSettings.Vernacular.FullStop; * toolTip.SetToolTip(buttonVernacularFont, String.Format(CstrDefaultFontTooltipVernacular, * Environment.NewLine, _projSettings.Vernacular.LangFont, * _projSettings.Vernacular.FontColor, * _projSettings.Vernacular.IsRTL)); * * // if there is a national language configured, then initialize those as well. * if (_projSettings.NationalBT.HasData) * { * textBoxNationalBTLanguage.Text = _projSettings.NationalBT.LangName; * textBoxNationalBTEthCode.Text = _projSettings.NationalBT.LangCode; * * // select the configured keyboard in the combo box (this is made complicated by the fact * // that members may have overridden the default keyboard for their own system) * // First check if the logged in member (which is approximated by being the 'last member') * // has an override for the keyboard * if ((_tmdLastMember != null) * && !String.IsNullOrEmpty(_tmdLastMember.OverrideNationalBTKeyboard) * && comboBoxKeyboardNationalBT.Items.Contains(_tmdLastMember.OverrideNationalBTKeyboard)) * { * comboBoxKeyboardNationalBT.SelectedItem = _tmdLastMember.OverrideNationalBTKeyboard; * } * else if (!String.IsNullOrEmpty(_projSettings.NationalBT.DefaultKeyboard) * && comboBoxKeyboardNationalBT.Items.Contains(_projSettings.NationalBT.DefaultKeyboard)) * { * comboBoxKeyboardNationalBT.SelectedItem = _projSettings.NationalBT.DefaultKeyboard; * } * * checkBoxNationalRTL.Checked = _projSettings.NationalBT.IsRTL; * checkBoxNationalLangBT.Checked = true; * } * else * checkBoxNationalLangBT.Checked = false; * * // even if there's no National language BT, these should still be set (in case they check the box for National language BT) * textBoxNationalBTSentFullStop.Font = _projSettings.NationalBT.LangFont; * textBoxNationalBTSentFullStop.ForeColor = _projSettings.NationalBT.FontColor; * textBoxNationalBTSentFullStop.Text = _projSettings.NationalBT.FullStop; * toolTip.SetToolTip(buttonNationalBTFont, String.Format(CstrDefaultFontTooltipNationalBT, * Environment.NewLine, _projSettings.NationalBT.LangFont, * _projSettings.NationalBT.FontColor, * _projSettings.NationalBT.IsRTL)); * * // even if there's no English BT, these should still be set (in case they check the box for English BT) * toolTip.SetToolTip(buttonInternationalBTFont, String.Format(CstrDefaultFontTooltipInternationalBT, * Environment.NewLine, _projSettings.InternationalBT.LangFont, * _projSettings.InternationalBT.FontColor, * _projSettings.InternationalBT.IsRTL)); * * * textBoxProjectName.Text = _projSettings.ProjectName; */ if (!String.IsNullOrEmpty(strOKLabel)) { buttonOK.Text = strOKLabel; } /* * // if the user hasn't configured the language information, send them there first * if (!_projSettings.IsConfigured) * tabControlProjectMetaData.SelectedTab = tabPageLanguageInfo; * * if (_projSettings.Vernacular.HasData && !String.IsNullOrEmpty(textBoxVernacular.Text) && String.IsNullOrEmpty(textBoxVernacularEthCode.Text)) * ProposeEthnologueCode(textBoxVernacular.Text, textBoxVernacularEthCode); */ }