Beispiel #1
0
        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();
            }
        }
Beispiel #2
0
        void UpdateAndRestartTimer(PIMPMyRepoSettings settings)
        {
            Debug.Assert(pullTimer != null);

            pullTimer.Stop();
            pullTimer.Interval = settings.pullInterval * 60 * 1000;
            pullTimer.Start();
        }
Beispiel #3
0
        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
        }
Beispiel #4
0
        void TestRepos()
        {
            PIMPMyRepoSettings settings = PIMPMyRepoSettings.Load();

            if (settings.repoCount == 0)
            {
                ManageRepos(null, null);
            }
            pullTimer.Start();
        }
Beispiel #5
0
        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);
        }
Beispiel #6
0
        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();
        }
Beispiel #7
0
        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();
        }
Beispiel #8
0
        void UpdateTrayStatus()
        {
            PIMPMyRepoSettings settings = PIMPMyRepoSettings.Load();

            trayIcon.Text = String.Format("Pull into {0} repos, every {1} minutes ", settings.repoCount.ToString(), settings.pullInterval);
        }