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

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

            CommandCacheItems.DataSource = GitCommandCache.CachedCommands().ToList();
        }
        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());
        }
Esempio 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);
        }
 public void TestAddCannotCache()
 {
     GitCommandCache.Add(null, null, null);
     Assert.IsFalse(GitCommandCache.CachedCommands().Any());
 }