Exemple #1
0
        private void _InitClient()
        {
            _client = IrbisConnectionUtility.GetClientFromConfig();
            _logBox.Output.WriteLine
            (
                "Подключились к серверу {0}, база {1}",
                _client.Host,
                _client.Database
            );

            string   mhr  = CM.AppSettings["mhr"];
            MenuFile menu = _client.ReadMenu(mhr);

            MenuEntry[] entries = menu.SortEntries(MenuSort.ByCode);
            _fondBox.Items.AddRange(entries);

            string coll = CM.AppSettings["coll"];

            menu    = _client.ReadMenu(coll);
            entries = menu.SortEntries(MenuSort.ByCode);
            _collectionBox.Items.AddRange(entries);
        }
Exemple #2
0
        private void _firstTimer_Tick
        (
            object sender,
            EventArgs e
        )
        {
            _firstTimer.Enabled = false;

            _browser.Navigate("about:blank");
            while (_browser.IsBusy)
            {
                Application.DoEvents();
            }
            _browser.Navigate("about:blank");
            while (_browser.IsBusy)
            {
                Application.DoEvents();
            }

            using (IrbisConnection connection = GetConnection())
            {
                FileSpecification specification
                    = new FileSpecification
                      (
                          IrbisPath.MasterFile,
                          connection.Database,
                          "ste.mnu"
                      );
                MenuFile menu = MenuFile.ReadFromServer
                                (
                    connection,
                    specification
                                );
                MenuEntry[] entries
                    = menu.SortEntries(MenuSort.ByCode);

                if (entries.Length == 0)
                {
                    throw new Exception("Empty entries list");
                }

                _statusBox.Items.AddRange(entries);
                _statusBox.SelectedIndex = 0;
            }

            _numberBox.Focus();
        }
        private void _CompareMenu
        (
            MenuFile first,
            MenuFile second
        )
        {
            Assert.AreEqual(first.FileName, second.FileName);

            MenuEntry[] firstEntries
                = first.SortEntries(MenuSort.None);
            MenuEntry[] secondEntries
                = second.SortEntries(MenuSort.None);

            Assert.AreEqual(firstEntries.Length, secondEntries.Length);
            for (int i = 0; i < firstEntries.Length; i++)
            {
                MenuEntry entry1 = firstEntries[i];
                MenuEntry entry2 = secondEntries[i];

                Assert.AreEqual(entry1.Code, entry2.Code);
                Assert.AreEqual(entry1.Comment, entry2.Comment);
            }
        }