Beispiel #1
0
        private void FrmMain_Load(object sender, EventArgs e)
        {
            // локализация приложения
            if (!Localization.UseRussian)
            {
                string langDir = AppData.ExeDir + "Lang\\";
                string errMsg;

                if (Localization.LoadDictionaries(langDir, "ScadaData", out errMsg))
                {
                    CommonPhrases.Init();
                }
                else
                {
                    ScadaUtils.ShowError(errMsg);
                }

                if (Localization.LoadDictionaries(langDir, "ScadaAdmin", out errMsg))
                {
                    Localization.TranslateForm(this, "ScadaAdmin.FrmMain", null, contextExpolorer, contextInCnls);
                    AppPhrases.Init();
                    winControl.MessageText     = AppPhrases.SelectTable;
                    winControl.SaveReqCaption  = AppPhrases.SaveReqCaption;
                    winControl.SaveReqQuestion = AppPhrases.SaveReqQuestion;
                    winControl.SaveReqYes      = AppPhrases.SaveReqYes;
                    winControl.SaveReqNo       = AppPhrases.SaveReqNo;
                    winControl.SaveReqCancel   = AppPhrases.SaveReqCancel;
                }
                else
                {
                    ScadaUtils.ShowError(errMsg);
                }
            }

            // инициализация дерева проводника
            InitTreeView();

            // установка начального состояния разрешений элементов
            SetItemsEnabledOnConnect();
            SetItemsEnabledOnWindowAction();

            // загрузка состояния формы
            settings = new Settings();
            settings.LoadFormState();
            if (settings.FormSt.IsEmpty)
            {
                WindowState = FormWindowState.Maximized;
            }
            else
            {
                Left          = settings.FormSt.Left;
                Top           = settings.FormSt.Top;
                Width         = settings.FormSt.Width;
                Height        = settings.FormSt.Height;
                WindowState   = settings.FormSt.Maximized ? FormWindowState.Maximized : FormWindowState.Normal;
                pnlLeft.Width = settings.FormSt.ExplorerWidth;
            }
        }
Beispiel #2
0
        private void FrmMain_Load(object sender, EventArgs e)
        {
            // application localization
            if (Localization.LoadDictionaries(AppData.AppDirs.LangDir, "ScadaData", out string errMsg))
            {
                CommonPhrases.Init();
            }
            else
            {
                ScadaUiUtils.ShowError(errMsg);
            }

            if (Localization.LoadDictionaries(AppData.AppDirs.LangDir, "ScadaAdmin", out errMsg))
            {
                Translator.TranslateForm(this, "ScadaAdmin.FrmMain", null, contextExpolorer, contextInCnls);
                AppPhrases.Init();
                winControl.MessageText     = AppPhrases.SelectTable;
                winControl.SaveReqCaption  = AppPhrases.SaveReqCaption;
                winControl.SaveReqQuestion = AppPhrases.SaveReqQuestion;
                winControl.SaveReqYes      = AppPhrases.SaveReqYes;
                winControl.SaveReqNo       = AppPhrases.SaveReqNo;
                winControl.SaveReqCancel   = AppPhrases.SaveReqCancel;
            }
            else
            {
                ScadaUiUtils.ShowError(errMsg);
            }

            // conductor tree initialization
            InitTreeView();

            // setting the initial state of element permissions
            SetItemsEnabledOnConnect();
            SetItemsEnabledOnWindowAction();

            // form state loading
            settings.LoadFormState();
            if (settings.FormSt.IsEmpty)
            {
                WindowState = FormWindowState.Maximized;
            }
            else
            {
                Left          = settings.FormSt.Left;
                Top           = settings.FormSt.Top;
                Width         = settings.FormSt.Width;
                Height        = settings.FormSt.Height;
                WindowState   = settings.FormSt.Maximized ? FormWindowState.Maximized : FormWindowState.Normal;
                pnlLeft.Width = settings.FormSt.ExplorerWidth;
            }
        }