Exemple #1
0
        public void Test()
        {
            SearchHistory sh = new SearchHistory(3);

            sh.QueryStrings.Add("");
            sh.QueryStrings.Add("");
            sh.QueryStrings.Add("");
            Assert.AreEqual("", sh.QueryStrings[0]);
            Assert.AreEqual("", sh.QueryStrings[1]);
            Assert.AreEqual("", sh.QueryStrings[2]);
            sh.Save();
            sh.Load();
            Assert.AreEqual(0, sh.QueryStrings.Count);
            sh.PushSearch("assaf");
            Assert.AreEqual("assaf", sh.QueryStrings[0]);
            Assert.AreEqual(1, sh.QueryStrings.Count);
            sh.PushSearch("lavie");
            Assert.AreEqual("lavie", sh.QueryStrings[0]);
            Assert.AreEqual("assaf", sh.QueryStrings[1]);
            Assert.AreEqual(2, sh.QueryStrings.Count);
            sh.PushSearch("again");
            Assert.AreEqual("again", sh.QueryStrings[0]);
            Assert.AreEqual("lavie", sh.QueryStrings[1]);
            Assert.AreEqual("assaf", sh.QueryStrings[2]);
            Assert.AreEqual(3, sh.QueryStrings.Count);
            sh.PushSearch("again");
            Assert.AreEqual("again", sh.QueryStrings[0]);
            Assert.AreEqual("lavie", sh.QueryStrings[1]);
            Assert.AreEqual("assaf", sh.QueryStrings[2]);
            sh.PushSearch("assaf");
            Assert.AreEqual("assaf", sh.QueryStrings[0]);
            Assert.AreEqual("again", sh.QueryStrings[1]);
            Assert.AreEqual("lavie", sh.QueryStrings[2]);
            sh.PushSearch("again");
            Assert.AreEqual("again", sh.QueryStrings[0]);
            Assert.AreEqual("assaf", sh.QueryStrings[1]);
            Assert.AreEqual("lavie", sh.QueryStrings[2]);
            sh.Save();
            SearchHistory sh2 = new SearchHistory(4);

            sh2.Load();
            Assert.AreEqual("again", sh.QueryStrings[0]);
            Assert.AreEqual("assaf", sh.QueryStrings[1]);
            Assert.AreEqual("lavie", sh.QueryStrings[2]);
            Assert.AreEqual(3, sh.QueryStrings.Count);
            sh2.Save();
            SearchHistory sh3 = new SearchHistory(2);

            sh3.Load();
            Assert.AreEqual("again", sh.QueryStrings[0]);
            Assert.AreEqual("assaf", sh.QueryStrings[1]);
        }
Exemple #2
0
        private void ShowFilterDialog()
        {
            var f = new FilterDialog(_history)
            {
                fb                = _fb,
                dad               = this,
                UserSearch        = _narrowSearch,
                BaseSearch        = _baseSearch,
                IncludeNoEstimate = _includeNoEstimate,
                IgnoreBaseSearch  = _ignoreBaseSearch
            };

            if (f.ShowDialog() != DialogResult.OK)
            {
                return;
            }
            _narrowSearch      = f.UserSearch;
            _ignoreBaseSearch  = f.IgnoreBaseSearch;
            _includeNoEstimate = f.IncludeNoEstimate;
            if (f.Cases != null)
            {
                updateCaseDropdown(f.Cases);
            }
            else
            {
                updateCases();
            }
            _history.Save();
        }