private void Save(object sender, EventArgs e)
        {
            if (!view.Validate())
            {
                MessageBoxUtilities.ShowWarning(Resources.ViewNotValidated);
                DialogResult = DialogResult.None;
                return;
            }

            try
            {
                for (var i = 0; i < view.RowCount && i < Points.Count; ++i)
                {
                    var point = Points[i];
                    var row   = view.Rows[i];
                    point.Input.Number = row.GetValue <int>(NumberColumn);
                    point.AutoManual   = row.GetValue <AutoManual>(AutoManualColumn);
                    //point.Value = TViewUtilities.GetVariableValue(row, ValueColumn, UnitsColumn, RangeColumn, CustomUnits);
                }
            }
            catch (Exception exception)
            {
                MessageBoxUtilities.ShowException(exception);
                DialogResult = DialogResult.None;
                return;
            }

            DialogResult = DialogResult.OK;
            Close();
        }
Example #2
0
        private void Save(object sender, EventArgs e)
        {
            if (!view.Validate())
            {
                MessageBoxUtilities.ShowWarning(Resources.ViewNotValidated);
                DialogResult = DialogResult.None;
                return;
            }

            try
            {
                for (var i = 0; i < view.RowCount && i < Points.Count; ++i)
                {
                    var point = Points[i];
                    var row   = view.Rows[i];
                    point.Description = row.GetValue <string>(DescriptionColumn);
                    point.Control     = row.GetValue <OffOn>(StatusColumn);
                    point.NormalCom   = row.GetValue <NormalCom>(RunStatusColumn);
                    point.AutoManual  = row.GetValue <AutoManual>(AutoManualColumn);
                    point.Length      = row.GetValue <int>(SizeColumn);
                    point.Label       = row.GetValue <string>(LabelColumn);
                }
            }
            catch (Exception exception)
            {
                MessageBoxUtilities.ShowException(exception);
                DialogResult = DialogResult.None;
                return;
            }

            DialogResult = DialogResult.OK;
            Close();
        }
Example #3
0
        private bool CheckIsOpened()
        {
            if (!IsOpened)
            {
                MessageBoxUtilities.ShowWarning(Resources.FileIsNotOpen);
                return(false);
            }

            return(true);
        }
        private void Save(object sender, EventArgs e)
        {
            if (!IsValidated)
            {
                MessageBoxUtilities.ShowWarning(Resources.SelectUnitsFormNotValid);
                DialogResult = DialogResult.None;
                return;
            }

            DialogResult = DialogResult.OK;
            Close();
        }
Example #5
0
        private void Save(object sender, EventArgs e)
        {
            if (!view.Validate())
            {
                MessageBoxUtilities.ShowWarning(Resources.ViewNotValidated);
                DialogResult = DialogResult.None;
                return;
            }

            try
            {
                for (var i = 0; i < view.RowCount && i < Points.Count; ++i)
                {
                    var point = Points[i];
                    var row   = view.Rows[i];
                    point.Description = row.GetValue <string>(DescriptionColumn);
                    point.PictureFile = row.GetValue <string>(PictureColumn);
                    point.GraphicMode = row.GetValue <TextGraphic>(ModeColumn);
                    point.Label       = row.GetValue <string>(LabelColumn);
                    point.RefreshTime = row.GetValue <int>(RefreshColumn);

                    string      name     = row.GetValue <string>(PictureColumn);
                    var         building = "Default_Building";
                    string      path     = GetFullPathForPicture(name, building);
                    UpdatePoint up       = new UpdatePoint();
                    if (up.Update_point_image(Prfileid, path, i))
                    {
                        Console.WriteLine("Image Update Success");
                    }
                    else
                    {
                        Console.WriteLine("Error");
                    }
                }
                Prg.Save(PrgPath);
            }
            catch (Exception exception)
            {
                MessageBoxUtilities.ShowException(exception);
                DialogResult = DialogResult.None;
                return;
            }

            DialogResult = DialogResult.OK;
            Close();
        }
        private void Save(object sender, EventArgs e)
        {
            if (!view.Validate())
            {
                MessageBoxUtilities.ShowWarning(Resources.ViewNotValidated);
                DialogResult = DialogResult.None;
                return;
            }

            try
            {
                var i = 0;
                foreach (DataGridViewRow row in view.Rows)
                {
                    if (i >= Points.Count)
                    {
                        break;
                    }

                    var point = Points[i];
                    point.Description      = (string)row.Cells[DescriptionColumn.Name].Value;
                    point.AutoManual       = (AutoManual)row.Cells[AutoManualColumn.Name].Value;
                    point.Control          = (OffOn)row.Cells[OutputColumn.Name].Value;
                    point.Override1Control = (OffOn)row.Cells[State1Column.Name].Value;
                    point.Override2Control = (OffOn)row.Cells[State2Column.Name].Value;
                    point.Label            = (string)row.Cells[LabelColumn.Name].Value;
                    ++i;
                }
            }
            catch (Exception exception)
            {
                MessageBoxUtilities.ShowException(exception);
                DialogResult = DialogResult.None;
                return;
            }

            DialogResult = DialogResult.OK;
            Close();
        }
        private void Save(object sender, EventArgs e)
        {
            if (!analogView.Validate() || !digitalView.Validate())
            {
                MessageBoxUtilities.ShowWarning(Resources.EditCustomUnitsFormNotValid);
                DialogResult = DialogResult.None;
                return;
            }

            try
            {
                for (var i = 0; i < analogView.RowCount && i < CustomUnits.Analog.Count; ++i)
                {
                    var point = CustomUnits.Analog[i];
                    var row   = analogView.Rows[i];
                    point.Name = row.GetValue <string>(NameColumn);
                }
                for (var i = 0; i < digitalView.RowCount && i < CustomUnits.Digital.Count; ++i)
                {
                    var point = CustomUnits.Digital[i];
                    var row   = digitalView.Rows[i];
                    point.DigitalUnitsOff = row.GetValue <string>(OffNameColumn);
                    point.DigitalUnitsOn  = row.GetValue <string>(OnNameColumn);
                    point.Direct          = row.GetValue <bool>(DirectColumn);
                }
            }
            catch (Exception exception)
            {
                MessageBoxUtilities.ShowException(exception);
                DialogResult = DialogResult.None;
                return;
            }

            DialogResult = DialogResult.OK;
            Close();
        }
        private void Save(object sender, EventArgs e)
        {
            if (!view.Validate())
            {
                MessageBoxUtilities.ShowWarning(Resources.ViewNotValidated);
                DialogResult = DialogResult.None;
                return;
            }

            try
            {
                for (var i = 0; i < view.RowCount && i < Points.Count; ++i)
                {
                    var point = Points[i];
                    var row   = view.Rows[i];
                    point.Description    = row.GetValue <string>(DescriptionColumn);
                    point.AutoManual     = row.GetValue <AutoManual>(AutoManualColumn);
                    point.HwSwitchStatus = row.GetValue <SwitchStatus>(HOASwitchColumn);
                    point.LowVoltage     = row.GetValue <int>(LowVColumn);
                    point.HighVoltage    = row.GetValue <int>(HighVColumn);
                    point.PwmPeriod      = row.GetValue <int>(PWMPeriodColumn);
                    point.Control        = row.GetValue <OffOn>(StatusColumn);
                    point.Value          = TViewUtilities.GetVariableValue(row, ValueColumn, UnitColumn, RangeColumn, CustomUnits);
                    point.Label          = row.GetValue <string>(LabelColumn);
                }
            }
            catch (Exception exception)
            {
                MessageBoxUtilities.ShowException(exception);
                DialogResult = DialogResult.None;
                return;
            }

            DialogResult = DialogResult.OK;
            Close();
        }
Example #9
0
        private void Save(object sender, EventArgs e)
        {
            if (!view.Validate())
            {
                MessageBoxUtilities.ShowWarning(Resources.ViewNotValidated);
                DialogResult = DialogResult.None;
                return;
            }

            try
            {
                for (var i = 0; i < view.RowCount && i < Points.Count; ++i)
                {
                    var point = Points[i];
                    var row   = view.Rows[i];
                    point.Description     = row.GetValue <string>(DescriptionColumn);
                    point.AutoManual      = row.GetValue <AutoManual>(AutoManualColumn);
                    point.Value           = TViewUtilities.GetVariableValue(row, ValueColumn, UnitColumn, RangeColumn, CustomUnits);
                    point.CalibrationL    = row.GetValue <double>(CalibrationColumn);
                    point.CalibrationSign = row.GetValue <Sign>(SignColumn);
                    point.Filter          = row.GetValue <int>(FilterColumn);
                    point.Status          = row.GetValue <InputStatus>(StatusColumn);
                    point.Jumper          = row.GetValue <Jumper>(JumperColumn);
                    point.Label           = row.GetValue <string>(LabelColumn);
                }
            }
            catch (Exception exception)
            {
                MessageBoxUtilities.ShowException(exception);
                DialogResult = DialogResult.None;
                return;
            }

            DialogResult = DialogResult.OK;
            Close();
        }