private void propertiesToolStripMenuItem_Click(object sender, EventArgs e) { int selectedIndex = listViewFolders.SelectedIndices[0]; ScmRepository folder = folders[selectedIndex]; if (new SettingsProjectForm(folder).ShowDialog(this) == DialogResult.OK) { listViewFolders.Items[selectedIndex].Text = folder.Path; if (folder.Disable) { folder.Status = ScmRepositoryStatus.Unknown; listViewFolders.Items[selectedIndex].Font = new Font(listViewFolders.Font, FontStyle.Strikeout); listViewFolders.Items[selectedIndex].ForeColor = Color.LightGray; listViewFolders.Items[selectedIndex].ImageKey = folder.IconName; } else { listViewFolders.Items[selectedIndex].Font = listViewFolders.Font; listViewFolders.Items[selectedIndex].ForeColor = SystemColors.WindowText; } newNonUpdatedFolders.Clear(); UpdateListViewFolderNames(); Config.SaveSvnFolders(folders); UpdateTray(true); BeginUpdateFolderStatuses(); } }
private void AddFile(string fileName) { string path = Path.GetDirectoryName(fileName); if (!folders.ContainsPath(fileName)) { if (Directory.Exists(path + @"\.svn") || Directory.Exists(path + @"\_svn")) { SvnRepository repo = new SvnRepository(fileName, ScmRepository.PathType.File); folders.Add(repo); listViewFolders.Items.Add(new ListViewItem(fileName, repo.IconName)); UpdateListViewFolderNames(); Config.SaveSvnFolders(folders); UpdateTray(false); BeginUpdateFolderStatuses(); } else { MessageBox.Show("This file is not under SCM", "SCM Notifier", MessageBoxButtons.OK, MessageBoxIcon.Error); } } else { SelectFolder(fileName); } }
private void AddFolder(string path) { if (!folders.ContainsPath(path)) { ScmRepository repo = ScmRepository.create(path); if (repo != null) { folders.Add(repo); listViewFolders.Items.Add(new ListViewItem(path, repo.IconName)); UpdateListViewFolderNames(); Config.SaveSvnFolders(folders); UpdateTray(false); BeginUpdateFolderStatuses(); } else { MessageBox.Show("This folder is not repository", "SCM Notifier", MessageBoxButtons.OK, MessageBoxIcon.Error); } } else { SelectFolder(path); } }
private void listViewFolders_DragDrop(object sender, DragEventArgs e) { // Determine whether dropped object is a file or folder. if (e.Data.GetDataPresent(DataFormats.FileDrop)) { string[] filePath = ((string[])e.Data.GetData(DataFormats.FileDrop)); foreach (string p in filePath) { if (File.Exists(p)) { AddFile(p); } else if (Directory.Exists(p)) { AddFolder(p); } } } else // otherwise assume it is a DragAndDropListView.DragItem { try { DragAndDropListView.DragItemData data = (DragAndDropListView.DragItemData)e.Data.GetData(typeof(DragAndDropListView.DragItemData)); ListViewItem item = (ListViewItem)data.DragItems[0]; folders.Remove((ScmRepository)item.Tag); folders.Insert(item.Index, (ScmRepository)item.Tag); Config.SaveSvnFolders(folders); } catch (Exception ex) { OnThreadException(this, new ThreadExceptionEventArgs(ex)); } } }
private void menuItemDelete_Click(object sender, EventArgs e) { if (listViewFolders.SelectedIndices.Count > 0) { int selectedIndex = listViewFolders.SelectedIndices[0]; string path = folders[listViewFolders.SelectedIndices[0]].Path; if (MessageBox.Show("Are you sure to remove " + path + " from list?", "SCM Notifier", MessageBoxButtons.OKCancel, MessageBoxIcon.Warning) != DialogResult.OK) { return; } folders.RemoveAt(selectedIndex); listViewFolders.Items.RemoveAt(selectedIndex); UpdateListViewFolderNames(); newNonUpdatedFolders.Clear(); Config.SaveSvnFolders(folders); UpdateTray(true); BeginUpdateFolderStatuses(); } }