Exemplo n.º 1
0
        private ModView lastModView;          // пользовательский интерфейс последнего выбранного модуля


        /// <summary>
        /// Конструктор
        /// </summary>
        public FrmMain()
        {
            InitializeComponent();

            // установка формата дат и времени элементов управления
            dtpSrezDate.CustomFormat = dtpEvDate1.CustomFormat = dtpEvDate2.CustomFormat =
                Localization.Culture.DateTimeFormat.ShortDatePattern;
            dtpSrezTime.CustomFormat = dtpEvTime.CustomFormat =
                Localization.Culture.DateTimeFormat.LongTimePattern;

            // инициализация полей
            appDirs = new AppDirs();
            errLog = new Log(Log.Formats.Simple);
            errLog.Encoding = Encoding.UTF8;
            mutex = null;
            svcContr = null;
            prevSvcStatus = ServiceControllerStatus.Stopped;

            notifyIcons = new Icon[ilNotify.Images.Count];
            for (int i = 0; i < notifyIcons.Length; i++)
                notifyIcons[i] = Icon.FromHandle(((Bitmap)ilNotify.Images[i]).GetHicon());
            notifyIconIndex = 0;

            stateFileName = "";
            logFileName = "";
            stateFileAge = DateTime.MinValue;
            logFileAge = DateTime.MinValue;

            nodeCommonParams = treeView.Nodes["nodeCommonParams"];
            nodeSaveParams = treeView.Nodes["nodeSaveParams"];
            nodeDirectories = treeView.Nodes["nodeDirectories"];
            nodeFiles = treeView.Nodes["nodeFiles"];
            nodeBase = nodeFiles.Nodes["nodeBase"];
            nodeCurSrez = nodeFiles.Nodes["nodeCurSrez"];
            nodeMinSrez = nodeFiles.Nodes["nodeMinSrez"];
            nodeHrSrez = nodeFiles.Nodes["nodeHrSrez"];
            nodeEvents = nodeFiles.Nodes["nodeEvents"];
            nodeModules = treeView.Nodes["nodeModules"];
            nodeGenerator = treeView.Nodes["nodeGenerator"];
            nodeStats = treeView.Nodes["nodeStats"];
            lastNode = null;

            settings = new Settings();
            commSettings = new CommSettings();
            serverComm = null;
            changing = false;
            modViewDict = new Dictionary<string, ModView>();
            lastModView = null;

            Application.ThreadException += Application_ThreadException;
        }
Exemplo n.º 2
0
        /// <summary>
        /// Установить значения элементов управления в соответствии с настройками
        /// </summary>
        private void SettingsToControls()
        {
            changing = true;

            // общие параметры
            numTcpPort.SetNumericValue(settings.TcpPort);
            chkUseAD.Checked = settings.UseAD;
            txtLdapPath.Text = settings.LdapPath;

            // директории системы
            txtBaseDATDir.Text = settings.BaseDATDir;
            txtItfDir.Text = settings.ItfDir;
            txtArcDir.Text = settings.ArcDir;
            txtArcCopyDir.Text = settings.ArcCopyDir;

            // запись данных
            int ind = Array.IndexOf<int>(WriteCurPerItemVals, settings.WriteCurPer);
            cbWriteCurPer.SelectedIndex = ind >= 0 ? ind : 0;
            ind = Array.IndexOf<int>(InactUnrelTimeItemVals, settings.InactUnrelTime);
            cbInactUnrelTime.SelectedIndex = ind >= 0 ? ind : 0;
            chkWriteCur.Checked = settings.WriteCur;
            chkWriteCurCopy.Checked = settings.WriteCurCopy;

            ind = Array.IndexOf<int>(WriteMinPerItemVals, settings.WriteMinPer);
            cbWriteMinPer.SelectedIndex = ind >= 0 ? ind : 0;
            numStoreMinPer.SetNumericValue(settings.StoreMinPer);
            chkWriteMin.Checked = settings.WriteMin;
            chkWriteMinCopy.Checked = settings.WriteMinCopy;

            cbWriteHrPer.SelectedIndex = settings.WriteHrPer == 1800 /*30 минут*/ ? 0 : 1;
            numStoreHrPer.SetNumericValue(settings.StoreHrPer);
            chkWriteHr.Checked = settings.WriteHr;
            chkWriteHrCopy.Checked = settings.WriteHrCopy;

            numStoreEvPer.SetNumericValue(settings.StoreEvPer);
            chkWriteEv.Checked = settings.WriteEv;
            chkWriteEvCopy.Checked = settings.WriteEvCopy;

            // модули
            lbModDll.Items.Clear();
            lbModDll.Items.AddRange(settings.ModuleFileNames.ToArray());

            if (lbModDll.Items.Count > 0)
            {
                lbModDll.SelectedIndex = 0;
            }
            else
            {
                SetModulesButtonsEnabled();
                lastModView = null;
            }
            
            // статистика
            chkDetailedLog.Checked = settings.DetailedLog;

            changing = false;
        }
Exemplo n.º 3
0
        private void lbModDll_SelectedIndexChanged(object sender, EventArgs e)
        {
            // установка доступности кнопок действий с модулями
            SetModulesButtonsEnabled();

            // вывод описания модуля
            if (lbModDll.SelectedIndex >= 0)
            {
                string fileName = lbModDll.Items[lbModDll.SelectedIndex].ToString();
                string errMsg;
                lastModView = GetModView(fileName, out errMsg);

                if (lastModView == null)
                {
                    txtModDescr.Text = errMsg;
                    btnModProps.Enabled = false;
                }
                else
                {
                    txtModDescr.Text = lastModView.Descr;
                    btnModProps.Enabled = lastModView.CanShowProps;
                }
            }
            else
            {
                txtModDescr.Text = "";
                btnModProps.Enabled = false;
                lastModView = null;
            }
        }