Example #1
0
        private void FrmAddressBook_Load(object sender, EventArgs e)
        {
            // локализация библиотеки
            string errMsg;

            if (!Localization.UseRussian)
            {
                if (Localization.LoadDictionaries(appDirs.LangDir, "AddressBook", out errMsg))
                {
                    Translator.TranslateForm(this, "Scada.Comm.Devices.AB.FrmAddressBook");
                    AbPhrases.Init();
                    rootNode.Text = AbPhrases.AddressBookNode;
                }
                else
                {
                    ScadaUiUtils.ShowError(errMsg);
                }
            }

            // загрузка адресной книги
            string fileName = appDirs.ConfigDir + AddressBook.DefFileName;

            if (File.Exists(fileName) && !addressBook.Load(fileName, out errMsg))
            {
                ScadaUiUtils.ShowError(errMsg);
            }
            Modified = false;

            // вывод дерева адресной книги
            BuildTree();

            // установка доступности кнопок
            SetButtonsEnabled();
        }
Example #2
0
        /// <summary>
        /// Download address book from file
        /// </summary>
        public static bool LoadAddressBook(string configDir, Log.WriteLineDelegate writeToLog,
                                           out AddressBook addressBook)
        {
            addressBook = new AddressBook();

            string fileName = configDir + AddressBook.DefFileName;

            if (File.Exists(fileName))
            {
                writeToLog(Localization.UseRussian ? "Загрузка адресной книги" : "Loading address book");
                string errMsg;

                if (addressBook.Load(fileName, out errMsg))
                {
                    return(true);
                }
                else
                {
                    writeToLog(errMsg);
                    return(false);
                }
            }
            else
            {
                writeToLog(Localization.UseRussian ? "Адресная книга отсутствует" : "Address book is missing");
                return(false);
            }
        }
Example #3
0
        private void FrmAddressBook_Load(object sender, EventArgs e)
        {
            // library localization
            string errMsg;

            if (!Localization.UseRussian)
            {
                if (Localization.LoadDictionaries(appDirs.LangDir, "AddressBook", out errMsg))
                {
                    Translator.TranslateForm(this, "Scada.Comm.Devices.AB.FrmAddressBook");
                    AbPhrases.Init();
                    rootNode.Text = AbPhrases.AddressBookNode;
                }
                else
                {
                    ScadaUiUtils.ShowError(errMsg);
                }
            }

            // loading address book
            string fileName = appDirs.ConfigDir + AddressBook.DefFileName;

            if (File.Exists(fileName) && !addressBook.Load(fileName, out errMsg))
            {
                ScadaUiUtils.ShowError(errMsg);
            }
            Modified = false;

            // output address book tree
            BuildTree();

            // setting the availability of buttons
            SetButtonsEnabled();
        }