Ejemplo n.º 1
0
 private void RefreshCommandCacheItems()
 {
     if (TabControl.SelectedTab == tabPageCommandCache)
     {
         RefreshListBox(CommandCacheItems, GitCommandCache.CachedCommands());
     }
 }
Ejemplo n.º 2
0
        private void GitLogFormLoad(object sender, EventArgs e)
        {
            RestorePosition("log");

            LogItems.DataSource = Settings.GitLog.Commands();

            CommandCacheItems.DataSource = GitCommandCache.CachedCommands().ToList();
        }
Ejemplo n.º 3
0
        public void TestAdd()
        {
            byte[]   output = new byte[] { 11, 12 };
            byte[]   error  = new byte[] { 13, 14 };
            string[] expectedCachedCommand = { "git command" };

            GitCommandCache.Add("git command", output, error);

            Assert.IsTrue(expectedCachedCommand.SequenceEqual(GitCommandCache.CachedCommands()));
        }
        public void TestClean()
        {
            byte[]   output = { 11, 12 };
            byte[]   error  = { 13, 14 };
            string[] expectedCachedCommand = { "git command" };

            GitCommandCache.Add("git command", output, error);
            Assert.IsTrue(expectedCachedCommand.SequenceEqual(GitCommandCache.CachedCommands()));
            GitCommandCache.CleanCache();
            Assert.IsFalse(GitCommandCache.CachedCommands().Any());
        }
Ejemplo n.º 5
0
        protected void RefreshCommandCacheItems()
        {
            SendOrPostCallback method = o =>
            {
                if (TabControl.SelectedTab == tabPageCommandCache)
                {
                    bool selectLastIndex = CommandCacheItems.Items.Count == 0 || CommandCacheItems.SelectedIndex == CommandCacheItems.Items.Count - 1;
                    CommandCacheItems.DataSource = GitCommandCache.CachedCommands();
                    if (selectLastIndex && CommandCacheItems.Items.Count > 0)
                    {
                        CommandCacheItems.SelectedIndex = CommandCacheItems.Items.Count - 1;
                    }
                }
            };

            syncContext.Post(method, this);
        }
Ejemplo n.º 6
0
 public void TestAddCannotCache()
 {
     GitCommandCache.Add(null, null, null);
     Assert.IsFalse(GitCommandCache.CachedCommands().Any());
 }