예제 #1
0
 public frmDinDraw(Draw drw, UpdateDraw updater, SelectData selector)
 {
     InitializeComponent();
     this.drw      = drw;
     this.updater  = updater;
     this.selector = selector;
     #region Свойства положения и размера
     udLeft.ValueChanged   -= udLeft_ValueChanged;
     udLeft.Value           = (decimal)(float)drw.Props["Left"];
     udLeft.ValueChanged   += udLeft_ValueChanged;
     udTop.ValueChanged    -= udTop_ValueChanged;
     udTop.Value            = (decimal)(float)drw.Props["Top"];
     udTop.ValueChanged    += udTop_ValueChanged;
     udWidth.ValueChanged  -= udWidth_ValueChanged;
     udWidth.Value          = (decimal)(float)drw.Props["Width"];
     udWidth.ValueChanged  += udWidth_ValueChanged;
     udHeight.ValueChanged -= udHeight_ValueChanged;
     udHeight.Value         = (decimal)(float)drw.Props["Height"];
     udHeight.ValueChanged += udHeight_ValueChanged;
     #endregion
     #region Свойства фона
     DrawPlugin.colorComboFillList(cbBackColor, LastColorIndex);
     DrawPlugin.colorComboSelectInList(cbBackColor, (Color)drw.Props["BackColor"]);
     cbBackPattern.Items.AddRange(DrawUtils.GetAllPatternNames()); // получение всех имён доступных паттернов
     cbBackPattern.SelectedIndex = (int)drw.Props["PatternMode"];
     cbBackPatternColor.Enabled  = (cbBackPattern.SelectedIndex > 1);
     DrawPlugin.colorComboFillList(cbBackPatternColor, LastColorIndex);
     DrawPlugin.colorComboSelectInList(cbBackPatternColor, (Color)drw.Props["PatternColor"]);
     #endregion
     tbTransparent.Value = 255 - (int)drw.Props["BackAlpha"];
     lbTransparent.Text  = ((int)(tbTransparent.Value / 255.0 * 100.0)) + " %";
     DrawPlugin.colorComboFillList(cbStrokeColor, LastColorIndex);
     DrawPlugin.colorComboSelectInList(cbStrokeColor, (Color)drw.Props["StrokeColor"]);
 }
예제 #2
0
 private void miSaveAllDataInFiles_Click(object sender, EventArgs e)
 {
     if (MessageBox.Show(this, "Существующие данные на диске будут заменены! Продолжить?",
                         "Сохранение данных на локальный диск пользователя", MessageBoxButtons.YesNoCancel,
                         MessageBoxIcon.Warning) == DialogResult.Yes)
     {
         Cursor = Cursors.WaitCursor;
         try
         {
             string path = Application.StartupPath + "\\backup\\";
             if (!Directory.Exists(path))
             {
                 Directory.CreateDirectory(path);
             }
             UpdateStatusMessage("Экспорт базы данных...");
             Data.ExportBaseAs(path + "exportbase.ini", UpdateStatusMessage);
             UpdateStatusMessage("Экспорт групп параметров трендов...");
             Data.ExportGroupsAs(path + "exporttrends.ini", ParamGroup.Trend);
             UpdateStatusMessage("Экспорт групп параметров таблиц...");
             Data.ExportGroupsAs(path + "exporttables.ini", ParamGroup.Table);
             UpdateStatusMessage("Экспорт мнемосхем...");
             DrawPlugin.ExportSchemesAs(path + "schemes\\", UpdateStatusMessage);
             UpdateStatusMessage("Экспорт картинок...");
             DrawPlugin.ExportImagesAs(path + "images\\", UpdateStatusMessage);
             UpdateStatusMessage("Экспорт отчётов...");
             DrawPlugin.ExportReportsAs(path + "reports\\", UpdateStatusMessage,
                                        Application.StartupPath + "\\reports.ini");
             UpdateStatusMessage("Готово.");
         }
         finally
         {
             Cursor = Cursors.Default;
         }
     }
 }
예제 #3
0
 public frmBackground(Draw drw, UpdateDraw updater, SelectData selector)
 {
     InitializeComponent();
     this.drw             = drw;
     this.updater         = updater;
     this.selector        = selector;
     cbExpanded.Click    -= rbExpanded_Click;
     cbExpanded.Checked   = (bool)drw.Props["Expanded"];
     cbExpanded.Click    += rbExpanded_Click;
     cbSaveAspect.Click  -= cbSaveAspect_Click;
     cbSaveAspect.Checked = (bool)drw.Props["SaveAspect"];
     cbSaveAspect.Click  += cbSaveAspect_Click;
     cbSaveAspect.Enabled = udLeft.Enabled = udTop.Enabled = udWidth.Enabled =
         udHeight.Enabled = cbExpanded.Checked;
     #region Свойства положения и размера
     udLeft.ValueChanged   -= udLeft_ValueChanged;
     udLeft.Value           = (decimal)(float)drw.Props["Left"];
     udLeft.ValueChanged   += udLeft_ValueChanged;
     udTop.ValueChanged    -= udTop_ValueChanged;
     udTop.Value            = (decimal)(float)drw.Props["Top"];
     udTop.ValueChanged    += udTop_ValueChanged;
     udWidth.ValueChanged  -= udWidth_ValueChanged;
     udWidth.Value          = (decimal)(float)drw.Props["Width"];
     udWidth.ValueChanged  += udWidth_ValueChanged;
     udHeight.ValueChanged -= udHeight_ValueChanged;
     udHeight.Value         = (decimal)(float)drw.Props["Height"];
     udHeight.ValueChanged += udHeight_ValueChanged;
     #endregion
     #region Свойства цвета фона
     DrawPlugin.colorComboFillList(cbBackColor, LastColorIndex);
     DrawPlugin.colorComboSelectInList(cbBackColor, (Color)drw.Props["BackColor"]);
     #endregion
     tbSchemeName.Text = (string)drw.Props["SchemeName"];
     tbDescriptor.Text = (string)drw.Props["Descriptor"];
 }
예제 #4
0
        private void cbColor_SelectionChangeCommitted(object sender, EventArgs e)
        {
            Color    color = DrawPlugin.colorComboSelectionChangeCommitted(sender);
            ComboBox cbox  = (ComboBox)sender;

            if (cbox.Equals(cbColor))
            {
                drw.Props["Color"] = color;
            }
            else if (cbox.Equals(cbColor0))
            {
                drw.Props["Color0"] = color;
            }
            else if (cbox.Equals(cbColor1))
            {
                drw.Props["Color1"] = color;
            }
            else
            {
                return;
            }
            if (updater != null)
            {
                updater(drw, UpdateKind.UpdateAfter);
            }
        }
예제 #5
0
 public frmDinValve(Draw drw, UpdateDraw updater, SelectData selector)
 {
     InitializeComponent();
     this.drw      = drw;
     this.updater  = updater;
     this.selector = selector;
     #region Свойства положения и размера
     udLeft.ValueChanged   -= udLeft_ValueChanged;
     udLeft.Value           = (decimal)(float)drw.Props["Left"];
     udLeft.ValueChanged   += udLeft_ValueChanged;
     udTop.ValueChanged    -= udTop_ValueChanged;
     udTop.Value            = (decimal)(float)drw.Props["Top"];
     udTop.ValueChanged    += udTop_ValueChanged;
     udWidth.ValueChanged  -= udWidth_ValueChanged;
     udWidth.Value          = (decimal)(float)drw.Props["Width"];
     udWidth.ValueChanged  += udWidth_ValueChanged;
     udHeight.ValueChanged -= udHeight_ValueChanged;
     udHeight.Value         = (decimal)(float)drw.Props["Height"];
     udHeight.ValueChanged += udHeight_ValueChanged;
     #endregion
     tbPtName.Text = (string)drw.Props["PtName"];
     //updateSelector();
     kindComboFillList(cbSpinValve, LastSpinIndex);
     kindComboSelectInList(cbSpinValve, (int)drw.Props["SpinValve"]);
     #region Свойства цвета линии
     DrawPlugin.colorComboFillList(cbForeColor, LastColorIndex);
     DrawPlugin.colorComboSelectInList(cbForeColor, (Color)drw.Props["ForeColor0"]);
     #endregion
     #region Свойства цвета заполнения
     DrawPlugin.colorComboFillList(cbBackColor, LastColorIndex);
     DrawPlugin.colorComboSelectInList(cbBackColor, (Color)drw.Props["BackColor0"]);
     #endregion
 }
예제 #6
0
        private void cbBackColor_SelectionChangeCommitted(object sender, EventArgs e)
        {
            Color    color = DrawPlugin.colorComboSelectionChangeCommitted(sender);
            ComboBox cbox  = (ComboBox)sender;

            if (cbox.Equals(cbBackColor))
            {
                drw.Props["BackColor"] = color;
            }
            else if (cbox.Equals(cbBackPatternColor))
            {
                drw.Props["PatternColor"] = color;
            }
            else if (cbox.Equals(cbBackPatternColor))
            {
                drw.Props["StrokeColor"] = color;
            }
            else
            {
                return;
            }
            cbBackPattern.Invalidate();
            if (updater != null)
            {
                updater(drw, UpdateKind.UpdateAfter);
            }
        }
예제 #7
0
 public frmDinLine(Draw drw, UpdateDraw updater, SelectData selector)
 {
     InitializeComponent();
     this.drw      = drw;
     this.updater  = updater;
     this.selector = selector;
     #region Свойства положения и размера
     udLeft.ValueChanged   -= udLeft_ValueChanged;
     udLeft.Value           = (decimal)(float)drw.Props["Left"];
     udLeft.ValueChanged   += udLeft_ValueChanged;
     udTop.ValueChanged    -= udTop_ValueChanged;
     udTop.Value            = (decimal)(float)drw.Props["Top"];
     udTop.ValueChanged    += udTop_ValueChanged;
     udWidth.ValueChanged  -= udWidth_ValueChanged;
     udWidth.Value          = (decimal)(float)drw.Props["Width"];
     udWidth.ValueChanged  += udWidth_ValueChanged;
     udHeight.ValueChanged -= udHeight_ValueChanged;
     udHeight.Value         = (decimal)(float)drw.Props["Height"];
     udHeight.ValueChanged += udHeight_ValueChanged;
     #endregion
     tbPtName.Text = (string)drw.Props["PtName"];
     updateSelector();
     kindComboFillList(cbLineKind, LastKindIndex);
     kindComboSelectInList(cbLineKind, (int)drw.Props["LineKind"]);
     #region Свойства цвета линии
     DrawPlugin.colorComboFillList(cbColor, LastColorIndex);
     DrawPlugin.colorComboSelectInList(cbColor, (Color)drw.Props["Color"]);
     #endregion
     #region Свойства стиля линии
     styleComboFillList(cbLineStyle, LastStyleIndex);
     styleComboSelectInList(cbLineStyle, (int)drw.Props["LineStyle"]);
     #endregion
     udLineWidth.Value = (decimal)(float)drw.Props["LineWidth"];
     #region Свойства цвета линии 0
     DrawPlugin.colorComboFillList(cbColor0, LastColorIndex);
     DrawPlugin.colorComboSelectInList(cbColor0, (Color)drw.Props["Color0"]);
     #endregion
     #region Свойства стиля линии 0
     styleComboFillList(cbLineStyle0, LastStyleIndex);
     styleComboSelectInList(cbLineStyle0, (int)drw.Props["LineStyle0"]);
     #endregion
     udLineWidth0.Value = (decimal)(float)drw.Props["LineWidth0"];
     #region Свойства цвета линии 1
     DrawPlugin.colorComboFillList(cbColor1, LastColorIndex);
     DrawPlugin.colorComboSelectInList(cbColor1, (Color)drw.Props["Color1"]);
     #endregion
     #region Свойства стиля линии 1
     styleComboFillList(cbLineStyle1, LastStyleIndex);
     styleComboSelectInList(cbLineStyle1, (int)drw.Props["LineStyle1"]);
     #endregion
     udLineWidth1.Value = (decimal)(float)drw.Props["LineWidth1"];
 }
예제 #8
0
 public frmDinJump(Draw drw, UpdateDraw updater, SelectData selector)
 {
     InitializeComponent();
     this.drw      = drw;
     this.updater  = updater;
     this.selector = selector;
     #region Свойства положения и размера
     udLeft.ValueChanged   -= udLeft_ValueChanged;
     udLeft.Value           = (decimal)(float)drw.Props["Left"];
     udLeft.ValueChanged   += udLeft_ValueChanged;
     udTop.ValueChanged    -= udTop_ValueChanged;
     udTop.Value            = (decimal)(float)drw.Props["Top"];
     udTop.ValueChanged    += udTop_ValueChanged;
     udWidth.ValueChanged  -= udWidth_ValueChanged;
     udWidth.Value          = (decimal)(float)drw.Props["Width"];
     udWidth.ValueChanged  += udWidth_ValueChanged;
     udHeight.ValueChanged -= udHeight_ValueChanged;
     udHeight.Value         = (decimal)(float)drw.Props["Height"];
     udHeight.ValueChanged += udHeight_ValueChanged;
     #endregion
     cbFramed.Checked = (bool)drw.Props["Framed"];
     cbSolid.Checked  = (bool)drw.Props["Solid"];
     #region Свойства шрифта
     DrawPlugin.fontComboFillList(cbFontName);
     cbFontName.Text          = (string)drw.Props["FontName"];
     udFontSize.ValueChanged -= udFontSize_ValueChanged;
     udFontSize.Value         = (decimal)(float)drw.Props["FontSize"];
     udFontSize.ValueChanged += udFontSize_ValueChanged;
     cbBold.Checked           = (bool)drw.Props["FontBold"];
     cbItalic.Checked         = (bool)drw.Props["FontItalic"];
     cbUnderline.Checked      = (bool)drw.Props["FontUnderline"];
     cbStrikeout.Checked      = (bool)drw.Props["FontStrikeOut"];
     DrawPlugin.colorComboFillList(cbFontColor, LastColorIndex);
     DrawPlugin.colorComboSelectInList(cbFontColor, (Color)drw.Props["FontColor"]);
     #endregion
     #region Свойства цвета фона
     DrawPlugin.colorComboFillList(cbColor, LastColorIndex);
     DrawPlugin.colorComboSelectInList(cbColor, (Color)drw.Props["Color"]);
     cbColor.Enabled = cbSolid.Checked;
     #endregion
     tbScreenName.TextChanged -= tbScreenName_TextChanged;
     tbScreenName.Text         = (string)drw.Props["ScreenName"];
     tbScreenName.TextChanged += tbScreenName_TextChanged;
     cbKeyLevel.SelectedIndex  = (int)drw.Props["KeyLevel"];
     tbText.TextChanged       -= tbText_TextChanged;
     tbText.Text         = (string)drw.Props["Text"];
     tbText.TextChanged += tbText_TextChanged;
 }
예제 #9
0
 private void tbValveState_Scroll(object sender, EventArgs e)
 {
     string[] states = new string[8]
     {
         "ХОД", "ЗАКРЫТО", "ОТКРЫТО", "ОШИБКА", "ХОД (АВАРИЯ)",
         "ЗАКРЫТО (АВАРИЯ)", "ОТКРЫТО (АВАРИЯ)", "ОШИБКА (АВАРИЯ)"
     };
     lbValveState.Text = states[tbValveState.Value];
     DrawPlugin.colorComboSelectInList(cbBackColor, (Color)drw.Props["BackColor" + tbValveState.Value]);
     DrawPlugin.colorComboSelectInList(cbForeColor, (Color)drw.Props["ForeColor" + tbValveState.Value]);
     drw.Props["PV"] = (int)tbValveState.Value;
     cbSpinValve.Invalidate();
     if (updater != null)
     {
         updater(drw, UpdateKind.UpdateAfter);
     }
 }
예제 #10
0
 private void miRestoreServerDataFromFiles_Click(object sender, EventArgs e)
 {
     if (MessageBox.Show(this, "Существующие данные сервера будут заменены! Продолжить?",
                         "Восстановление данных с локального диска на сервер", MessageBoxButtons.YesNoCancel,
                         MessageBoxIcon.Warning) == DialogResult.Yes)
     {
         Cursor = Cursors.WaitCursor;
         try
         {
             string path     = Application.StartupPath + "\\backup\\";
             string filename = path + "exportbase.ini";
             if (File.Exists(filename))
             {
                 UpdateStatusMessage("Импорт базы данных...");
                 IDictionary <string, IPointPlugin> plugins =
                     PointPlugin.LoadPlugins(Application.StartupPath);
                 Data.ImportBaseFrom(plugins, filename, UpdateStatusMessage);
             }
             filename = path + "exporttrends.ini";
             if (File.Exists(filename))
             {
                 UpdateStatusMessage("Импорт групп параметров трендов...");
                 Data.ImportGroupsFrom(filename, ParamGroup.Trend);
             }
             filename = path + "exporttables.ini";
             if (File.Exists(filename))
             {
                 UpdateStatusMessage("Импорт групп параметров таблиц...");
                 Data.ImportGroupsFrom(filename, ParamGroup.Table);
             }
             UpdateStatusMessage("Импорт динамических элементов мнемосхем...");
             DrawPlugin.ImportSchemesFrom(path + "schemes\\", UpdateStatusMessage);
             UpdateStatusMessage("Импорт файлов картинок...");
             DrawPlugin.ImportImagesFrom(path + "images\\", UpdateStatusMessage);
             UpdateStatusMessage("Импорт файлов отчётов...");
             DrawPlugin.ImportReportsFrom(path + "reports\\", UpdateStatusMessage);
             UpdateStatusMessage("Готово.");
         }
         finally
         {
             Cursor = Cursors.Default;
         }
     }
 }
예제 #11
0
 public frmDinKontur(Draw drw, UpdateDraw updater, SelectData selector)
 {
     InitializeComponent();
     this.drw      = drw;
     this.updater  = updater;
     this.selector = selector;
     #region Свойства для панели
     EnableFontGroup(true);
     #endregion
     #region Свойства положения и размера
     udLeft.ValueChanged   -= udLeft_ValueChanged;
     udLeft.Value           = (decimal)(float)drw.Props["Left"];
     udLeft.ValueChanged   += udLeft_ValueChanged;
     udTop.ValueChanged    -= udTop_ValueChanged;
     udTop.Value            = (decimal)(float)drw.Props["Top"];
     udTop.ValueChanged    += udTop_ValueChanged;
     udWidth.ValueChanged  -= udWidth_ValueChanged;
     udWidth.Value          = (decimal)(float)drw.Props["Width"];
     udWidth.ValueChanged  += udWidth_ValueChanged;
     udHeight.ValueChanged -= udHeight_ValueChanged;
     udHeight.Value         = (decimal)(float)drw.Props["Height"];
     udHeight.ValueChanged += udHeight_ValueChanged;
     #endregion
     #region Свойства шрифта
     DrawPlugin.fontComboFillList(cbFontName);
     cbFontName.Text          = (string)drw.Props["FontName"];
     udFontSize.ValueChanged -= udFontSize_ValueChanged;
     udFontSize.Value         = (decimal)(float)drw.Props["FontSize"];
     udFontSize.ValueChanged += udFontSize_ValueChanged;
     cbBold.Checked           = (bool)drw.Props["FontBold"];
     cbItalic.Checked         = (bool)drw.Props["FontItalic"];
     cbUnderline.Checked      = (bool)drw.Props["FontUnderline"];
     cbStrikeout.Checked      = (bool)drw.Props["FontStrikeOut"];
     DrawPlugin.colorComboFillList(cbFontColor, LastColorIndex);
     DrawPlugin.colorComboSelectInList(cbFontColor, (Color)drw.Props["FontColor"]);
     #endregion
     #region Свойства цвета фона
     DrawPlugin.colorComboFillList(cbColor, LastColorIndex);
     DrawPlugin.colorComboSelectInList(cbColor, (Color)drw.Props["Color"]);
     #endregion
     tbPtName.Text = (string)drw.Props["PtName"];
 }
예제 #12
0
 public frmDinNet(Draw drw, UpdateDraw updater, SelectData selector)
 {
     InitializeComponent();
     this.drw      = drw;
     this.updater  = updater;
     this.selector = selector;
     #region Свойства положения и размера
     udLeft.ValueChanged   -= udLeft_ValueChanged;
     udLeft.Value           = (decimal)(float)drw.Props["Left"];
     udLeft.ValueChanged   += udLeft_ValueChanged;
     udTop.ValueChanged    -= udTop_ValueChanged;
     udTop.Value            = (decimal)(float)drw.Props["Top"];
     udTop.ValueChanged    += udTop_ValueChanged;
     udWidth.ValueChanged  -= udWidth_ValueChanged;
     udWidth.Value          = (decimal)(float)drw.Props["Width"];
     udWidth.ValueChanged  += udWidth_ValueChanged;
     udHeight.ValueChanged -= udHeight_ValueChanged;
     udHeight.Value         = (decimal)(float)drw.Props["Height"];
     udHeight.ValueChanged += udHeight_ValueChanged;
     #endregion
     #region Свойства шрифта
     DrawPlugin.fontComboFillList(cbFontName);
     cbFontName.Text          = (string)drw.Props["FontName"];
     udFontSize.ValueChanged -= udFontSize_ValueChanged;
     udFontSize.Value         = (decimal)(float)drw.Props["FontSize"];
     udFontSize.ValueChanged += udFontSize_ValueChanged;
     cbBold.Checked           = (bool)drw.Props["FontBold"];
     cbItalic.Checked         = (bool)drw.Props["FontItalic"];
     cbUnderline.Checked      = (bool)drw.Props["FontUnderline"];
     cbStrikeout.Checked      = (bool)drw.Props["FontStrikeOut"];
     DrawPlugin.colorComboFillList(cbFontColor, LastColorIndex);
     DrawPlugin.colorComboSelectInList(cbFontColor, (Color)drw.Props["FontColor"]);
     #endregion
     cbShowPersents.Checked = (bool)drw.Props["ShowPersents"];
     cbHideText.Checked     = (bool)drw.Props["HideText"];
     udScaleHigh.Value      = (decimal)(float)drw.Props["ScaleHigh"];
     udScaleLow.Value       = (decimal)(float)drw.Props["ScaleLow"];
 }
예제 #13
0
        private void cbColor_SelectionChangeCommitted(object sender, EventArgs e)
        {
            Color    color = DrawPlugin.colorComboSelectionChangeCommitted(sender);
            ComboBox cbox  = (ComboBox)sender;

            if (cbox.Equals(cbBackColor))
            {
                drw.Props["BackColor" + tbValveState.Value] = color;
            }
            else if (cbox.Equals(cbForeColor))
            {
                drw.Props["ForeColor" + tbValveState.Value] = color;
            }
            else
            {
                return;
            }
            cbSpinValve.Invalidate();
            if (updater != null)
            {
                updater(drw, UpdateKind.UpdateAfter);
            }
        }
예제 #14
0
 public frmDinText(Draw drw, UpdateDraw updater, SelectData selector)
 {
     InitializeComponent();
     this.drw      = drw;
     this.updater  = updater;
     this.selector = selector;
     #region Свойства положения и размера
     udLeft.ValueChanged   -= udLeft_ValueChanged;
     udLeft.Value           = (decimal)(float)drw.Props["Left"];
     udLeft.ValueChanged   += udLeft_ValueChanged;
     udTop.ValueChanged    -= udTop_ValueChanged;
     udTop.Value            = (decimal)(float)drw.Props["Top"];
     udTop.ValueChanged    += udTop_ValueChanged;
     udWidth.ValueChanged  -= udWidth_ValueChanged;
     udWidth.Value          = (decimal)(float)drw.Props["Width"];
     udWidth.ValueChanged  += udWidth_ValueChanged;
     udHeight.ValueChanged -= udHeight_ValueChanged;
     udHeight.Value         = (decimal)(float)drw.Props["Height"];
     udHeight.ValueChanged += udHeight_ValueChanged;
     #endregion
     cbShowPanel.Checked = (bool)drw.Props["ShowPanel"];
     cbSolid.Checked     = (bool)drw.Props["Solid"];
     #region Свойства рамки и ее цвета
     cbFramed.Checked = (bool)drw.Props["Framed"];
     DrawPlugin.colorComboFillList(cbFrameColor, LastColorIndex);
     DrawPlugin.colorComboSelectInList(cbFrameColor, (Color)drw.Props["FrameColor"]);
     cbFrameColor.Enabled = cbFramed.Checked;
     #endregion
     tbPtName.Text = (string)drw.Props["PtName"];
     updateSelector();
     #region Свойства шрифта
     DrawPlugin.fontComboFillList(cbFontName);
     cbFontName.Text          = (string)drw.Props["FontName"];
     udFontSize.ValueChanged -= udFontSize_ValueChanged;
     udFontSize.Value         = (decimal)(float)drw.Props["FontSize"];
     udFontSize.ValueChanged += udFontSize_ValueChanged;
     cbBold.Checked           = (bool)drw.Props["FontBold"];
     cbItalic.Checked         = (bool)drw.Props["FontItalic"];
     cbUnderline.Checked      = (bool)drw.Props["FontUnderline"];
     cbStrikeout.Checked      = (bool)drw.Props["FontStrikeOut"];
     DrawPlugin.colorComboFillList(cbFontColor, LastColorIndex);
     DrawPlugin.colorComboSelectInList(cbFontColor, (Color)drw.Props["FontColor"]);
     #endregion
     #region Свойства цвета фона
     DrawPlugin.colorComboFillList(cbColor, LastColorIndex);
     DrawPlugin.colorComboSelectInList(cbColor, (Color)drw.Props["Color"]);
     #endregion
     tbText.Text = (string)drw.Props["Text"];
     #region Свойства шрифта при "0"
     DrawPlugin.fontComboFillList(cbFontName0);
     cbFontName0.Text     = (string)drw.Props["Font0Name"];
     udFontSize0.Value    = (decimal)(float)drw.Props["Font0Size"];
     cbBold0.Checked      = (bool)drw.Props["Font0Bold"];
     cbItalic0.Checked    = (bool)drw.Props["Font0Italic"];
     cbUnderline0.Checked = (bool)drw.Props["Font0Underline"];
     cbStrikeout0.Checked = (bool)drw.Props["Font0StrikeOut"];
     DrawPlugin.colorComboFillList(cbFontColor0, LastColorIndex);
     DrawPlugin.colorComboSelectInList(cbFontColor0, (Color)drw.Props["Font0Color"]);
     #endregion
     #region Свойства цвета фона при "0"
     DrawPlugin.colorComboFillList(cbColor0, LastColorIndex);
     DrawPlugin.colorComboSelectInList(cbColor0, (Color)drw.Props["Color0"]);
     #endregion
     tbText0.Text = (string)drw.Props["Text0"];
     #region Свойства шрифта при "1"
     DrawPlugin.fontComboFillList(cbFontName1);
     cbFontName1.Text     = (string)drw.Props["Font1Name"];
     udFontSize1.Value    = (decimal)(float)drw.Props["Font1Size"];
     cbBold1.Checked      = (bool)drw.Props["Font1Bold"];
     cbItalic1.Checked    = (bool)drw.Props["Font1Italic"];
     cbUnderline1.Checked = (bool)drw.Props["Font1Underline"];
     cbStrikeout1.Checked = (bool)drw.Props["Font1StrikeOut"];
     DrawPlugin.colorComboFillList(cbFontColor1, LastColorIndex);
     DrawPlugin.colorComboSelectInList(cbFontColor1, (Color)drw.Props["Font1Color"]);
     #endregion
     #region Свойства цвета фона при "1"
     DrawPlugin.colorComboFillList(cbColor1, LastColorIndex);
     DrawPlugin.colorComboSelectInList(cbColor1, (Color)drw.Props["Color1"]);
     #endregion
     tbText1.Text = (string)drw.Props["Text1"];
 }
예제 #15
0
 private void cbFontColor_SelectedIndexChanged(object sender, EventArgs e)
 {
     DrawPlugin.colorComboSelectedIndexChanged(sender, ref LastColorIndex,
                                               cbFontColor_SelectionChangeCommitted);
 }
예제 #16
0
 private void cbFontColor_DrawItem(object sender, DrawItemEventArgs e)
 {
     DrawPlugin.colorComboDrawItem(sender, e);
 }
예제 #17
0
 public frmDinAnalog(Draw drw, UpdateDraw updater, SelectData selector)
 {
     InitializeComponent();
     this.drw      = drw;
     this.updater  = updater;
     this.selector = selector;
     #region Свойства для панели
     cbShowPanel.Checked = (bool)drw.Props["ShowPanel"];
     cbShowValue.Checked = (bool)drw.Props["ShowValue"];
     cbShowUnit.Checked  = (bool)drw.Props["ShowUnit"];
     cbShowTag.Checked   = (bool)drw.Props["ShowTag"];
     EnableFontGroup(cbShowValue.Checked || cbShowUnit.Checked);
     #endregion
     #region Свойства положения и размера
     udLeft.ValueChanged   -= udLeft_ValueChanged;
     udLeft.Value           = (decimal)(float)drw.Props["Left"];
     udLeft.ValueChanged   += udLeft_ValueChanged;
     udTop.ValueChanged    -= udTop_ValueChanged;
     udTop.Value            = (decimal)(float)drw.Props["Top"];
     udTop.ValueChanged    += udTop_ValueChanged;
     udWidth.ValueChanged  -= udWidth_ValueChanged;
     udWidth.Value          = (decimal)(float)drw.Props["Width"];
     udWidth.ValueChanged  += udWidth_ValueChanged;
     udHeight.ValueChanged -= udHeight_ValueChanged;
     udHeight.Value         = (decimal)(float)drw.Props["Height"];
     udHeight.ValueChanged += udHeight_ValueChanged;
     #endregion
     #region Свойства рамки и ее цвета
     cbFramed.Checked = (bool)drw.Props["Framed"];
     DrawPlugin.colorComboFillList(cbFrameColor, LastColorIndex);
     DrawPlugin.colorComboSelectInList(cbFrameColor, (Color)drw.Props["FrameColor"]);
     cbFrameColor.Enabled = cbFramed.Checked;
     #endregion
     #region Свойства указателя бара (уровня)
     cbBarLevelVisible.Checked = (bool)drw.Props["BarLevelVisible"];
     cbBarLevelInverse.Checked = (bool)drw.Props["BarLevelInverse"];
     rbShowLevel.Checked       = (bool)drw.Props["ShowLevel"];
     rbShowBar.Checked         = (bool)drw.Props["ShowBar"];
     DrawPlugin.colorComboFillList(cbBarLevelColor, LastColorIndex);
     DrawPlugin.colorComboSelectInList(cbBarLevelColor, (Color)drw.Props["BarLevelColor"]);
     cbBarLevelInverse.Enabled = cbBarLevelVisible.Checked;
     rbShowLevel.Enabled       = cbBarLevelVisible.Checked;
     rbShowBar.Enabled         = cbBarLevelVisible.Checked;
     cbBarLevelColor.Enabled   = cbBarLevelVisible.Checked;
     #endregion
     #region Свойства шрифта
     DrawPlugin.fontComboFillList(cbFontName);
     cbFontName.Text          = (string)drw.Props["FontName"];
     udFontSize.ValueChanged -= udFontSize_ValueChanged;
     udFontSize.Value         = (decimal)(float)drw.Props["FontSize"];
     udFontSize.ValueChanged += udFontSize_ValueChanged;
     cbBold.Checked           = (bool)drw.Props["FontBold"];
     cbItalic.Checked         = (bool)drw.Props["FontItalic"];
     cbUnderline.Checked      = (bool)drw.Props["FontUnderline"];
     cbStrikeout.Checked      = (bool)drw.Props["FontStrikeOut"];
     DrawPlugin.colorComboFillList(cbFontColor, LastColorIndex);
     DrawPlugin.colorComboSelectInList(cbFontColor, (Color)drw.Props["FontColor"]);
     #endregion
     #region Свойства цвета фона
     DrawPlugin.colorComboFillList(cbColor, LastColorIndex);
     DrawPlugin.colorComboSelectInList(cbColor, (Color)drw.Props["Color"]);
     #endregion
     tbPtName.Text = (string)drw.Props["PtName"] + "." + (string)drw.Props["PtParam"];
 }
예제 #18
0
    public static List <Draw> LoadScheme(string schemename, string imagepath)
    {
        List <Draw> drawslist = new List <Draw>();

        using (ServerSQL mySQL = new ServerSQL(DatabaseFrom.Database, true))     // чтение
        {
            if (mySQL.Connected)
            {
                List <string> dinlist = Data.GetDinList(schemename, mySQL);
                foreach (string dinname in dinlist)
                {
                    IDictionary <string, string> dinprops =
                        Data.GetDinProps(schemename, dinname, mySQL);
                    if (dinname.Equals("Background") &&
                        dinprops.ContainsKey("Left") &&
                        dinprops.ContainsKey("Top") &&
                        dinprops.ContainsKey("Width") &&
                        dinprops.ContainsKey("Height") &&
                        dinprops.ContainsKey("BackColor") &&
                        dinprops.ContainsKey("Descriptor") &&
                        dinprops.ContainsKey("Expanded") &&
                        dinprops.ContainsKey("SaveAspect")
                        )
                    {
                        Background drw = new Background();
                        drw.Location = new Point(int.Parse(dinprops["Left"]),
                                                 int.Parse(dinprops["Top"]));
                        drw.Width      = int.Parse(dinprops["Width"]);
                        drw.Height     = int.Parse(dinprops["Height"]);
                        drw.BackColor  = Data.ColorFromBase(dinprops["BackColor"]);
                        drw.Descriptor = dinprops["Descriptor"];
                        drw.Expanded   = int.Parse(dinprops["Expanded"]) > 0;
                        drw.SaveAspect = int.Parse(dinprops["SaveAspect"]) > 0;
                        drawslist.Add(drw);
                    }
                    else
                    {
                        if (dinprops.ContainsKey("Plugin") &&
                            dinprops.ContainsKey("Left") &&
                            dinprops.ContainsKey("Top") &&
                            dinprops.ContainsKey("Name"))
                        {
                            string plugname = dinprops["Plugin"];
                            IDictionary <string, IDrawPlugin> plugins =
                                DrawPlugin.LoadPlugins(Application.StartupPath);
                            if (plugins.ContainsKey(plugname))
                            {
                                IDrawPlugin plugin = plugins[plugname];
                                float       x      = float.Parse(dinprops["Left"]);
                                float       y      = float.Parse(dinprops["Top"]);
                                Draw        drw    = new Draw(x, y, plugin);
                                drw.Name = dinprops["Name"];
                                drawslist.Add(drw);
                                foreach (KeyValuePair <string, string> prop in dinprops)
                                {
                                    drw.SetPropValue(prop.Key, prop.Value);
                                }
                                if (drw.Props.ContainsKey("ImagePath"))
                                {
                                    drw.SetPropValue("ImagePath", imagepath);
                                }
                            }
                        }
                    }
                }
            }
        }
        return(drawslist);
    }
예제 #19
0
        private void frmMain_Load(object sender, EventArgs e)
        {
            #region Защита от повторного запуска
            Process process = RunningInstance();
            if (process != null)
            {
                Application.Exit(); return;
            }
            #endregion
            this.Width         = 0;
            this.Height        = 1;
            MustWinLogOff      = false;
            AlarmAsked         = true;
            EntityAsked        = String.Empty;
            this.StationNumber = Properties.Settings.Default.Station;
            SplashForm         = new frmAbout();
            SplashForm.Show();
            SplashForm.Refresh();
            LoadUsersList(Application.StartupPath + "\\users.xml");
            IDictionary <string, IPointPlugin> plugins = PointPlugin.LoadPlugins(Application.StartupPath);
            DrawPlugin.LoadPlugins(Application.StartupPath);
            Data.RestoreSQLsettings(Application.StartupPath);
            Settings.CreateDataAndFetchBases();
            #region Создание кэша картинок на диске
            try { DrawPlugin.RestoreImageCatalog(Application.StartupPath + "\\images\\"); }
            catch (Exception ex)
            {
                Data.SendToSystemLog(StationNumber, "Картинки",
                                     "Ошибка: " + ex.Message);
            }
            #endregion
            baseVersion        = Data.LoadBase(plugins);
            timerClock.Enabled = true;
            timerFetch.Enabled = true;
            Data.SendToChangeLog(StationNumber, "Станция RemX", "Старт", String.Empty, "Работа",
                                 "Автономно", "Уровень доступа: " + UserLevel.ToString());
            Data.SendToSystemLog(StationNumber, "Станция RemX", "Рабочая станция загружена");
            ClientID = Data.ClientLogin(ClientID, "S", StationNumber, Properties.Settings.Default.StationName);
            LoadFetchServers();

            //if (ServerSQL.HostIsLocalhost()) startFetchServices();

            bool     winmode  = Properties.Settings.Default.WindowMode;
            Screen[] monitors = Screen.AllScreens;
            panels = new frmPanel[monitors.Length];
            for (int i = 0; i < monitors.Length; i++)
            {
                if (!winmode || winmode && monitors[i].Primary)
                {
                    panels[i] = new frmPanel(this, monitors[i].Primary, monitors[i].WorkingArea);
                    if (winmode)
                    {
                        panels[i].FormBorderStyle    = System.Windows.Forms.FormBorderStyle.Sizable;
                        panels[i].pnlCaption.Visible = false;
                        panels[i].stpStatus.Visible  = false;
                        panels[i].Size = new System.Drawing.Size(
                            Properties.Settings.Default.PanelWidth,
                            Properties.Settings.Default.PanelHeight);
                        panels[i].Location = new System.Drawing.Point(
                            Properties.Settings.Default.PanelLeft,
                            Properties.Settings.Default.PanelTop);
                    }
                    panels[i].Show(this);
                }
            }
            PeriodicalCheck();
        }
예제 #20
0
    public static string ImportSchemeFrom(string filename)
    {
        IDictionary <string, IDrawPlugin> plugins =
            DrawPlugin.LoadPlugins(Application.StartupPath);

        string[]    lines      = System.IO.File.ReadAllLines(filename);
        bool        background = false;
        string      name       = String.Empty;
        Draw        drw        = null;
        Background  bkg        = null;
        List <Draw> drawslist  = new List <Draw>();

        foreach (string line in lines)
        {
            if (!String.IsNullOrWhiteSpace(line))
            {
                if (line.Equals("[Background]"))
                {
                    background = true;
                    bkg        = new Background();
                    drawslist.Add(bkg);
                }
                else if (background)
                {
                    string[] items = line.Split(new char[] { '=' });
                    switch (items[0])
                    {
                    case "Width": bkg.Width = int.Parse(items[1]); break;

                    case "Height": bkg.Height = int.Parse(items[1]); break;

                    case "BackColor":
                        bkg.BackColor = Data.ColorFromBase(items[1]);
                        break;

                    case "SchemeName": bkg.SchemeName = items[1]; break;

                    case "Descriptor": bkg.Descriptor = items[1]; break;
                    }
                }
                else if (drw == null)
                {
                    string[] items = line.Split(new char[] { '=' });
                    string   value = (items.Length == 2) ? items[1] : String.Empty;
                    switch (items[0])
                    {
                    case "Name": name = value; break;

                    case "Plugin":
                        if (plugins.ContainsKey(value))
                        {
                            IDrawPlugin plugin = plugins[value];
                            drw      = new Draw(0, 0, plugin);
                            drw.Name = name;
                            drawslist.Add(drw);
                        }
                        break;
                    }
                }
                else if (drw != null)
                {
                    string[] items = line.Split(new char[] { '=' });
                    drw.SetPropValue(items[0], items[1]);
                }
            }
            else
            {
                drw        = null;
                background = false;
            }
        }
        string SchemeName = bkg.SchemeName;

        using (ServerSQL mySQL = new ServerSQL(DatabaseFrom.Database))     // запись
        {
            if (mySQL.Connected)
            {
                string ukey = Data.GetUniqueKey(20);
                int    step = 0;
                try
                {
                    int npp = 0;
                    foreach (Draw item in drawslist)
                    {
                        saveOneDraw(npp++, ukey, item, mySQL);
                    }
                    step++;
                    Data.EmptyScheme(SchemeName, mySQL);
                    Data.RenameScheme(ukey, SchemeName, mySQL);
                }
                catch
                {
                    switch (step)
                    {
                    case 0:
                        Data.EmptyScheme(ukey, mySQL);
                        break;
                    }
                }
            }
        }
        return(SchemeName);
    }
예제 #21
0
        private void miTuningLink_Click(object sender, EventArgs e)
        {
            using (frmTuning form = new frmTuning())
            {
                form.cbScreenSize.SelectedIndex = Properties.Settings.Default.ScreenSize;
                form.tbHostName.Text            = BaseServer.Settings.Host;
                form.tbPortNumber.Text          = BaseServer.Settings.Port;
                form.tbUserName.Text            = BaseServer.Settings.User;
                form.tbPassword.Text            = BaseServer.Settings.Password;
                form.tbFetchBase.Text           = BaseServer.Settings.Fetchbase;
                form.tbDatabase.Text            = BaseServer.Settings.Database;
                if (form.ShowDialog() == DialogResult.OK)
                {
                    Properties.Settings settings = Properties.Settings.Default;
                    settings.ScreenSize = form.cbScreenSize.SelectedIndex;
                    settings.Save();
                    if (BaseServer.Settings.Host != form.tbHostName.Text ||
                        BaseServer.Settings.Port != form.tbPortNumber.Text ||
                        BaseServer.Settings.User != form.tbUserName.Text ||
                        BaseServer.Settings.Password != form.tbPassword.Text ||
                        BaseServer.Settings.Fetchbase != form.tbFetchBase.Text ||
                        BaseServer.Settings.Database != form.tbDatabase.Text)
                    {
                        BaseServer.Settings.Host      = form.tbHostName.Text;
                        BaseServer.Settings.Port      = form.tbPortNumber.Text;
                        BaseServer.Settings.User      = form.tbUserName.Text;
                        BaseServer.Settings.Password  = form.tbPassword.Text;
                        BaseServer.Settings.Fetchbase = form.tbFetchBase.Text;
                        BaseServer.Settings.Database  = form.tbDatabase.Text;

                        SaveSettings();

                        Data.RestoreSQLsettings(Application.StartupPath);
                        if (Settings.CreateDataAndFetchBases())
                        {
                            try { DrawPlugin.RestoreImageCatalog(Application.StartupPath + "\\images\\"); }
                            catch (Exception ex)
                            {
                                Data.SendToSystemLog(Properties.Settings.Default.Station, "Картинки",
                                                     "Ошибка: " + ex.Message);
                            }
                            try { DrawPlugin.RestoreReportCatalog(Application.StartupPath + "\\reports\\"); }
                            catch (Exception ex)
                            {
                                Data.SendToSystemLog(Properties.Settings.Default.Station, "Отчёты",
                                                     "Ошибка: " + ex.Message);
                            }

                            Data.LoadBase(PointPlugin.LoadPlugins(Application.StartupPath));
                            MessageBox.Show(this, "Подключение к SQL-серверу успешно восстановлено.",
                                            "Настройка связи с SQL-сервером", MessageBoxButtons.OK, MessageBoxIcon.Information);
                        }
                        else
                        {
                            MessageBox.Show(this, "Не удалось восстановить подключение к SQL-серверу.\n" +
                                            Settings.LastError,
                                            "Настройка связи с SQL-сервером", MessageBoxButtons.OK, MessageBoxIcon.Error);
                        }
                    }
                }
            }
        }
예제 #22
0
        public bool LoadScheme(string schemename)
        {
            if (backgroundFetch.IsBusy)
            {
                backgroundFetch.CancelAsync();
            }
            drawBox.Location = new Point(0, 0);
            Size pnlSize = updater.GetPanelSize();

            drawBox.Width  = pnlSize.Width;
            drawBox.Height = pnlSize.Height;
            if (Data.SchemeExists(schemename))
            {
                timerFetch.Enabled = false;
                Cursor             = Cursors.WaitCursor;
                SchemeName         = schemename;
                drawslist          = DrawPlugin.LoadScheme(
                    SchemeName, Application.StartupPath + "\\images\\");
                if (drawslist.Count > 0)
                {
                    Background bkg = (Background)drawslist[0];
                    drawBox.BackColor = bkg.BackColor;
                    this.BackColor    = bkg.BackColor;
                    this.Text         = bkg.Descriptor;
                    if (updater != null)
                    {
                        updater.UpdateCaptionText(this.Text);
                    }
                    this.MaximumSize     = new System.Drawing.Size();
                    this.WindowState     = FormWindowState.Maximized;
                    this.FormBorderStyle = FormBorderStyle.Sizable;
                    this.MaximizeBox     = true;
                }
                foreach (Draw drw in drawslist)
                {
                    if (drw.Props.ContainsKey("Quality"))
                    {
                        drw.Props["Quality"] = "GOOD";
                    }
                    else
                    {
                        drw.Props.Add("Quality", "GOOD");
                    }
                }
                fetchlist.Clear();
                foreach (Draw drw in drawslist)
                {
                    if (drw.Props.ContainsKey("PtName") &&
                        !String.IsNullOrWhiteSpace((string)drw.Props["PtName"]))
                    {
                        string ptname = (string)drw.Props["PtName"];
                        if (fetchlist.ContainsKey(ptname))
                        {
                            fetchlist[ptname].Add(drw);
                        }
                        else
                        {
                            fetchlist.Add(ptname, new List <Draw>()
                            {
                                drw
                            });
                        }
                    }
                }
                LoadFirst();
                FetchBase();
                drawBox.Refresh();
                pnlScroll.VerticalScroll.Value = pnlScroll.HorizontalScroll.Value = 0;
                if (updater != null)
                {
                    updater.UpdateCurrentSchemeName(SchemeName, this.Text);
                }
                timerFetch.Enabled = true;
                Cursor             = Cursors.Default;
                return(true);
            }
            else
            {
                return(false);
            }
        }