Пример #1
0
        public void GitInvalidPath()
        {
            string path           = @"D:\04_SideProjects";
            string gitFetchResult = string.Empty;
            string gitStatus      = string.Empty;

            gitFetchResult = GitExtensions.ProcessGitRepo(ref gitStatus, path);
            string expectedResult = "";

            Assert.That(expectedResult, Is.EqualTo(15));
        }
Пример #2
0
        private void GitTrayNotification(object source, ElapsedEventArgs e)
        {
            TrayTimer.Stop();

            for (int index = 0; index < gitTrayDataSet.GitTrayTable.Rows.Count; index++)
            {
                if (IsTableRefreshed == true)
                {
                    IsTableRefreshed = false; //Reset the flag
                    _statusHolder.Clear();    //Remove all entries
                    break;                    // break the loop
                }

                if (_trayStatus == GitTrayStatusType.Stopped || _trayStatus == GitTrayStatusType.Sleep)
                {
                    break; // break the loop
                }

                GitTrayDataSet.GitTrayTableRow currRow = (GitTrayDataSet.GitTrayTableRow)gitTrayDataSet.GitTrayTable.Rows[index];

                string gitFetchResult = string.Empty;
                string gitStatus      = string.Empty;
                string gerritResult   = string.Empty;

                currRow.Activity = "Running"; /* Start Processing the row */

                #region Setup Threads
                Thread gitThread = new Thread(() => gitFetchResult = GitExtensions.ProcessGitRepo(ref gitStatus, currRow.Path))
                {
                    IsBackground = true
                };
                #endregion

                gitThread.Start();

                #region Git Status
                gitThread.Join();
                currRow.Git_Status = gitStatus;
                if (!string.IsNullOrEmpty(gitFetchResult) && IsTableRefreshed == false)
                {
                    bool isPresent = false;
                    if (_statusHolder.ContainsKey(currRow.Path))
                    {
                        if (gitFetchResult.Equals(_statusHolder[currRow.Path][0]))
                        {
                            isPresent = true;
                        }
                        else
                        {
                            _statusHolder[currRow.Path][0] = gitFetchResult;
                        }
                    }

                    if (isPresent == false && gitFetchResult.Contains("fatal:"))
                    {
                        //GitTray.ShowBalloonTip(1000, "Error", gitFetchResult, ToolTipIcon.Error);
                    }
                    else if (isPresent == false)
                    {
                        GitTray.ShowBalloonTip(1000, "New Software Available!", gitFetchResult, ToolTipIcon.Info);
                    }
                    else
                    {
                        //skip
                    }
                }
                #endregion

                currRow.Activity = "Sleeping"; /* Processing completed */

                if (!_statusHolder.ContainsKey(currRow.Path))
                {
                    _statusHolder.Add(currRow.Path, new List <string> {
                        gitFetchResult, gerritResult
                    });
                }
            }

            if (_trayStatus == GitTrayStatusType.Running)
            {
                //Restart the timer if user has not requested to stop/halt
                TrayTimer.Start();
            }
            else
            {
                _trayStatus = GitTrayStatusType.Sleep;
            }
        }