/// ------------------------------------------------------------------------------------ /// <summary> /// Adds an entry to the languageProjectsList if it is not there already. /// </summary> /// ------------------------------------------------------------------------------------ private void AddProject(string projectFile) { if (InvokeRequired) { BeginInvoke((Action <string>)AddProject, projectFile); return; } if (IsDisposed) { return; } var languageProjectInfo = new LanguageProjectInfo(projectFile); // Show file extensions for duplicate projects. LanguageProjectInfo existingItem = m_lstLanguageProjects.Items. Cast <LanguageProjectInfo>(). Where(item => item.ToString() == languageProjectInfo.ToString()). FirstOrDefault(); if (existingItem != null) { m_lstLanguageProjects.Items.Remove(existingItem); existingItem.ShowExtenstion = true; m_lstLanguageProjects.Items.Add(existingItem); languageProjectInfo.ShowExtenstion = true; } m_lstLanguageProjects.Items.Add(languageProjectInfo); }
private void btnOk_Click(Object sender, EventArgs e) { if (radioRestore.Checked) { textBoxProjectName.Text = textBoxProjectName.Text.Trim(); if (!DoRestore()) return; } else { m_selectedItem = (LanguageProjectInfo) listBox.SelectedItem; if (!m_fdoCacheCache.Contains(m_selectedItem.ToString()) && ProjectLockingService.IsProjectLocked(m_selectedItem.FullName)) { MessageBox.Show(this, Strings.ksProjectOpen, Strings.ksErrorCaption, MessageBoxButtons.OK, MessageBoxIcon.Error); return; } } DialogResult = DialogResult.OK; Close(); }
private void btnOk_Click(Object sender, EventArgs e) { if (radioRestore.Checked) { textBoxProjectName.Text = textBoxProjectName.Text.Trim(); if (!DoRestore()) { return; } } else { m_selectedItem = (LanguageProjectInfo)listBox.SelectedItem; if (!m_fdoCacheCache.Contains(m_selectedItem.ToString()) && ProjectLockingService.IsProjectLocked(m_selectedItem.FullName)) { MessageBox.Show(this, Strings.ksProjectOpen, Strings.ksErrorCaption, MessageBoxButtons.OK, MessageBoxIcon.Error); return; } } DialogResult = DialogResult.OK; Close(); }
/// ------------------------------------------------------------------------------------ /// <summary> /// Adds an entry to the languageProjectsList if it is not there already. /// </summary> /// ------------------------------------------------------------------------------------ private void AddProject(string projectFile) { if (InvokeRequired) { BeginInvoke((Action<string>)AddProject, projectFile); return; } if (IsDisposed) return; var languageProjectInfo = new LanguageProjectInfo(projectFile); // Show file extensions for duplicate projects. LanguageProjectInfo existingItem = listBox.Items.Cast<LanguageProjectInfo>().FirstOrDefault(item => item.ToString() == languageProjectInfo.ToString()); if (existingItem != null) { listBox.Items.Remove(existingItem); existingItem.ShowExtenstion = true; listBox.Items.Add(existingItem); languageProjectInfo.ShowExtenstion = true; } listBox.Items.Add(languageProjectInfo); }