コード例 #1
0
        public void AddDataItem()
        {
            MemoryDataSource dataSource = new MemoryDataSource();

            // Item 1
            DataItem dataItem1 = new DataItem();
            dataItem1.Id = "dummyId";

            dataItem1.Key = "mk";
            dataItem1.Title = "mailTitle";
            dataItem1.Value = "this is the value of the mail item";
            dataItem1.Comments = "the comments for the mail is added here";

            dataItem1.Labels = "mail;dummy";
            dataItem1.AccessCounter = 2;

            bool bSucc = dataSource.AddDataItem(dataItem1);

            Assert.AreEqual(true, bSucc);

            dataItem1.Key = "newKey";

            // Verify the data isn't changed.
            Assert.AreEqual("mk", dataSource.GetDataItems()[0].Key);
        }
コード例 #2
0
        public void AddDeleteDataItem()
        {
            MemoryDataSource dataSource = new MemoryDataSource();

            // Item 1
            DataItem dataItem1 = new DataItem();
            dataItem1.Id = "dummyId";

            dataItem1.Key = "mk";
            dataItem1.Title = "mailTitle";
            dataItem1.Value = "this is the value of the mail item";
            dataItem1.Comments = "the comments for the mail is added here";

            dataItem1.Labels = "mail;dummy";
            dataItem1.AccessCounter = 2;

            dataSource.AddDataItem(dataItem1);

            Assert.AreEqual(1, dataSource.GetDataItems().Count);

            // Item 2
            DataItem dataItem2 = new DataItem();
            dataItem2.Id = "dummyId";

            dataItem2.Key = "mk";
            dataItem2.Title = "mailTitle";
            dataItem2.Value = "this is the value of the mail item";
            dataItem2.Comments = "the comments for the mail is added here";

            dataItem2.Labels = "mail;dummy";
            dataItem2.AccessCounter = 2;

            dataSource.AddDataItem(dataItem2);

            Assert.AreEqual(2, dataSource.GetDataItems().Count);

            bool bSucc = dataSource.DeleteDataItem(dataSource.GetDataItems()[0].Id);

            Assert.AreEqual(true, bSucc);
            Assert.AreEqual(1, dataSource.GetDataItems().Count);
        }
コード例 #3
0
        public void Search()
        {
            SimpleSearchEngine simpleSearchEngin = new SimpleSearchEngine();
            DataSourceManager dsManager = new DataSourceManager();
            MemoryDataSource dataSource = new MemoryDataSource();
            dsManager.AddDataSource(dataSource);

            // Item 1
            {
                DataItem dataItem = new DataItem();
                dataItem.Id = "dummyId";

                dataItem.Key = "mk";
                dataItem.Title = "mailTitle";
                dataItem.Value = "this is the value of the mail item";
                dataItem.Comments = "the comments for the mail is added here";

                dataItem.Labels = "mail;dummy";
                dataItem.AccessCounter = 2;

                dataSource.AddDataItem(dataItem);
            }
        }
コード例 #4
0
ファイル: Form1.cs プロジェクト: JeffreyZksun/pcassist
        public Form1()
        {
            InitializeComponent();

            mSearchEngine = new SimpleSearchEngine();
            mDsManager = new DataSourceManager();
            mDataSource = new MemoryDataSource();
            mDsManager.AddDataSource(mDataSource);

            mExtToolMgr = new ExternalToolManager();

            bool bSucc = mExtToolMgr.Load("S:\\Build Tools\\pc\\_ExternalTools.xml");

            if(bSucc)
            {
                List<ExternalTool> extTools = mExtToolMgr.GetAllExternalTools();
                for (int i =0; i < extTools.Count; i++)
                {
                    ExternalTool et = extTools[i];
                    TitleList.Items.Add(et.GetTitle());

                    DataItem dataItem = new DataItem();
                    dataItem.Id = i.ToString();

                    dataItem.Key = et.GetTitle();
                    dataItem.Title = et.GetTitle();
                    dataItem.Value = et.GetCommand() + " " + et.GetParameter();
                    dataItem.Comments = i.ToString(); // save the indes in the comments

                    dataItem.Labels = "";
                    dataItem.AccessCounter = 0;

                    mDataSource.AddDataItem(dataItem);
                }
            }
        }