void ManageRepos(object sender, EventArgs e) { if (!managementDialogOpen) { managementDialogOpen = true; PIMPMyRepoSettings settings = PIMPMyRepoSettings.Load(); RepoManagement repoPathDialog = new RepoManagement(settings); repoPathDialog.Disposed += RepoPathDialog_Disposed; var result = repoPathDialog.ShowDialog(); settings.ResetSettings(); var pullInterval = repoPathDialog.GetPullInterval(); if (pullInterval != settings.pullInterval) { settings.pullInterval = pullInterval; UpdateAndRestartTimer(settings); } var paths = repoPathDialog.GetListBoxItems(); foreach (string path in paths) { settings.repoPaths.Add(path); settings.repoCount++; } settings.Save(); repoPathDialog.Dispose(); UpdateTrayStatus(); } }
void UpdateAndRestartTimer(PIMPMyRepoSettings settings) { Debug.Assert(pullTimer != null); pullTimer.Stop(); pullTimer.Interval = settings.pullInterval * 60 * 1000; pullTimer.Start(); }
public void InitTimer() { PIMPMyRepoSettings settings = PIMPMyRepoSettings.Load(); pullTimer = new System.Windows.Forms.Timer(); pullTimer.Tick += new EventHandler(PullLoop); pullTimer.Interval = settings.pullInterval * 60 * 1000; // in miliseconds }
void TestRepos() { PIMPMyRepoSettings settings = PIMPMyRepoSettings.Load(); if (settings.repoCount == 0) { ManageRepos(null, null); } pullTimer.Start(); }
void ShowTrayNotification() { PIMPMyRepoSettings settings = PIMPMyRepoSettings.Load(); trayIcon.BalloonTipIcon = System.Windows.Forms.ToolTipIcon.Info; trayIcon.BalloonTipTitle = "Pulling into repos"; trayIcon.BalloonTipText = String.Format("Nr of repos being pulled into: {0}", settings.repoCount.ToString()); // Display for 5 seconds. trayIcon.ShowBalloonTip(5000); }
public RepoManagement(PIMPMyRepoSettings settings) { InitializeComponent(); // set our icon Icon = Resources.AppIcon; // Disallow resize MaximizeBox = false; MinimizeBox = false; // Field validation errorProvider = new ErrorProvider(this); // Init from stored settings RepoListListbox.Items.AddRange(settings.repoPaths.ToArray()); PullIntervalTextBox.Text = settings.pullInterval.ToString(); }
void PullLoop(object sender, EventArgs e) { UpdateTrayStatus(); PIMPMyRepoSettings settings = PIMPMyRepoSettings.Load(); if (notificatinThread != null) { notificatinThread.Join(); } WaitForHGWorkbenchToLoseFocus(); pullTimer.Stop(); notificatinThread = new Thread(ShowTrayNotification); notificatinThread.Start(); foreach (var repo in settings.repoPaths) { mercurialService.pull(repo); } pullTimer.Start(); }
void UpdateTrayStatus() { PIMPMyRepoSettings settings = PIMPMyRepoSettings.Load(); trayIcon.Text = String.Format("Pull into {0} repos, every {1} minutes ", settings.repoCount.ToString(), settings.pullInterval); }