コード例 #1
0
        private void DoFetch(bool showToastIfNoResult = false)
        {
            if (IsLocked)
            {
                return;
            }

            lock (this)
            {
                try
                {
                    var fetcher     = new GitFetcher();
                    var fetchResult = fetcher.Fetch();
                    if (fetchResult.AnyChanges)
                    {
                        var message = "Changes fetched in:";

                        message += String.Format
                                       ("{0}{0}{1}",
                                       Environment.NewLine,
                                       String.Join(Environment.NewLine, fetchResult.RelevantBranches));

                        var fetchInfo = new FetchInformation(message);
                        MainNotifyIcon.ShowCustomBalloon(fetchInfo, PopupAnimation.Fade, 10 * 60 * 1000);
                    }
                    else if (showToastIfNoResult)
                    {
                        var fetchInfo = new FetchInformation("No changes fetched");
                        MainNotifyIcon.ShowCustomBalloon(fetchInfo, PopupAnimation.Fade, 60 * 1000);
                    }
                }
                catch
                {
                    SystemSounds.Exclamation.Play();
                    MainNotifyIcon.ShowBalloonTip("Git Notifier", "An error has occured", BalloonIcon.Error);
                }
            }
        }
コード例 #2
0
        private void DoFetch(bool showToastIfNoResult = false)
        {
            if (IsLocked)
            {
                return;
            }

            lock (this)
            {
                try
                {
                    var fetcher = new GitFetcher();
                    var fetchResult = fetcher.Fetch();
                    if (fetchResult.AnyChanges)
                    {
                        var message = "Changes fetched in:";

                        message += String.Format
                            ("{0}{0}{1}",
                            Environment.NewLine,
                            String.Join(Environment.NewLine, fetchResult.RelevantBranches));

                        var fetchInfo = new FetchInformation(message);
                        MainNotifyIcon.ShowCustomBalloon(fetchInfo, PopupAnimation.Fade, 10 * 60 * 1000);
                    }
                    else if (showToastIfNoResult)
                    {
                        var fetchInfo = new FetchInformation("No changes fetched");
                        MainNotifyIcon.ShowCustomBalloon(fetchInfo, PopupAnimation.Fade, 60 * 1000);
                    }
                }
                catch
                {
                    SystemSounds.Exclamation.Play();
                    MainNotifyIcon.ShowBalloonTip("Git Notifier", "An error has occured", BalloonIcon.Error);
                }
            }
        }