/// <summary>
 /// Создание нового объекта
 /// </summary>
 public CheckBoxViewModel(uint id, string name,
                          IVariableWrapper variable,
                          DataProvider dataProvider)
 {
     _objectsRepository = dataProvider.ObjectsRepository;
     Properties         = new ObjectBaseProperties(id, name, dataProvider.CommonSettings.AppMode, _objectsRepository);
     TextProperties     = new ObjectTextProperties(dataProvider.VariablesRepository);
     ActionProperties   = new ObjectActionProperties(variable, dataProvider.VariablesRepository, _objectsRepository);
     ActionProperties.Variable.ValueChanged += OnValueChanged;
     IsChecked = ((BoolVariableWrapper)ActionProperties.Variable).IsSet;
 }
 /// <summary>
 /// Создание нового объекта
 /// </summary>
 public DatePickerViewModel(uint id, string name,
                            IVariableWrapper variable,
                            DataProvider dataProvider)
 {
     Properties       = new ObjectBaseProperties(id, name, dataProvider.CommonSettings.AppMode, dataProvider.ObjectsRepository);
     TextProperties   = new ObjectTextProperties(dataProvider.VariablesRepository);
     ActionProperties = new ObjectActionProperties(variable, dataProvider.VariablesRepository, dataProvider.ObjectsRepository);
     ActionProperties.Variable.ValueChanged += OnValueChanged;
     Date       = ((DateVariableWrapper)ActionProperties.Variable).Value;
     IsRequired = false;
 }
 /// <summary>
 /// Добавление нового объекта
 /// </summary>
 public TextBoxViewModel(uint id, string name,
                         IVariableWrapper variable,
                         DataProvider dataProvider)
 {
     _objectsRepository = dataProvider.ObjectsRepository;
     Properties         = new ObjectBaseProperties(id, name, dataProvider.CommonSettings.AppMode, dataProvider.ObjectsRepository);
     ActionProperties   = new ObjectActionProperties(variable, dataProvider.VariablesRepository, dataProvider.ObjectsRepository);
     ActionProperties.Variable.ValueChanged += OnValueChanged;
     Text        = ActionProperties.Variable.StringValue;
     IsMultiline = false;
     IsRequired  = false;
 }
        /// <summary>
        /// Создание нового объекта
        /// </summary>
        public TimePickerViewModel(uint id, string name,
                                   IVariableWrapper variable,
                                   DataProvider dataProvider)
        {
            Properties       = new ObjectBaseProperties(id, name, dataProvider.CommonSettings.AppMode, dataProvider.ObjectsRepository);
            TextProperties   = new ObjectTextProperties(dataProvider.VariablesRepository);
            ActionProperties = new ObjectActionProperties(variable, dataProvider.VariablesRepository, dataProvider.ObjectsRepository);
            ActionProperties.Variable.ValueChanged += OnValueChanged;

            var timeWrapper = (TimeVariableWrapper)ActionProperties.Variable;

            Time = timeWrapper.Value;
            UpdateBindingTime();
            UseSeconds = timeWrapper.UseSeconds;
            IsRequired = false;
        }
        /// <summary>
        /// Восстановление объекта из xml
        /// </summary>
        public DatePickerViewModel(DateBoxObject storedObj, DataProvider dataProvider)
        {
            _objectsRepository = dataProvider.ObjectsRepository;
            var variablesRepository = dataProvider.VariablesRepository;

            Properties = new ObjectBaseProperties(storedObj.Id, storedObj.Name, dataProvider.CommonSettings.AppMode, dataProvider.ObjectsRepository);
            Properties.FontSettings.Update(storedObj.FontSettings);
            TextProperties = new ObjectTextProperties(variablesRepository);
            IsRequired     = storedObj.IsRequired;

            var variable = variablesRepository.Find(storedObj.VariableName);

            if (variable != null)
            {
                variable.IsAssigned = true;
                ActionProperties    = new ObjectActionProperties(variable, variablesRepository, dataProvider.ObjectsRepository);
                ActionProperties.Variable.ValueChanged += OnValueChanged;
                Date = ((DateVariableWrapper)ActionProperties.Variable).Value;
                ActionProperties.UpdateActions(storedObj.Actions);
            }
        }
        /// <summary>
        /// Восстановление объекта из xml
        /// </summary>
        public TextBoxViewModel(TextBoxObject storedObj, DataProvider dataProvider)
        {
            _objectsRepository = dataProvider.ObjectsRepository;
            var variablesRepository = dataProvider.VariablesRepository;

            Properties = new ObjectBaseProperties(storedObj.Id, storedObj.Name, dataProvider.CommonSettings.AppMode, dataProvider.ObjectsRepository);
            Properties.FontSettings.Update(storedObj.FontSettings);
            IsRequired  = storedObj.IsRequired;
            IsMultiline = storedObj.IsMultiLine;

            var variable = variablesRepository.Find(storedObj.VariableName);

            if (variable != null)
            {
                variable.IsAssigned = true;
                ActionProperties    = new ObjectActionProperties(variable, variablesRepository, dataProvider.ObjectsRepository);
                ActionProperties.Variable.ValueChanged += OnValueChanged;
                Text = ActionProperties.Variable.StringValue;
                ActionProperties.UpdateActions(storedObj.Actions);
            }
        }
        /// <summary>
        /// Восстановление объекта из xml
        /// </summary>
        public CheckBoxViewModel(CheckBoxObject storedObj, DataProvider dataProvider)
        {
            _objectsRepository = dataProvider.ObjectsRepository;
            var variablesRepository = dataProvider.VariablesRepository;

            Properties = new ObjectBaseProperties(storedObj.Id, storedObj.Name, dataProvider.CommonSettings.AppMode, _objectsRepository);
            Properties.FontSettings.Update(storedObj.FontSettings);
            TextProperties = new ObjectTextProperties(variablesRepository)
            {
                Text = storedObj.Text
            };

            var variable = variablesRepository.Find(storedObj.VariableName);

            if (variable != null)
            {
                variable.IsAssigned = true;
                ActionProperties    = new ObjectActionProperties(variable, variablesRepository, _objectsRepository);
                ActionProperties.Variable.ValueChanged += OnValueChanged;
                IsChecked = ((BoolVariableWrapper)ActionProperties.Variable).IsSet;
                ActionProperties.UpdateActions(storedObj.Actions);
            }
        }
        /// <summary>
        /// Восстановление объекта из xml
        /// </summary>
        public TimePickerViewModel(TimePickerObject storedObj, DataProvider dataProvider)
        {
            _objectsRepository = dataProvider.ObjectsRepository;
            var variablesRepository = dataProvider.VariablesRepository;

            Properties = new ObjectBaseProperties(storedObj.Id, storedObj.Name, dataProvider.CommonSettings.AppMode, dataProvider.ObjectsRepository);
            Properties.FontSettings.Update(storedObj.FontSettings);
            TextProperties = new ObjectTextProperties(variablesRepository);
            IsRequired     = storedObj.IsRequired;

            var variable = variablesRepository.Find(storedObj.VariableName);

            if (variable != null)
            {
                var timeWrapper = (TimeVariableWrapper)ActionProperties.Variable;
                timeWrapper.IsAssigned = true;
                ActionProperties       = new ObjectActionProperties(timeWrapper, variablesRepository, dataProvider.ObjectsRepository);
                ActionProperties.Variable.ValueChanged += OnValueChanged;
                Time = timeWrapper.Value;
                UpdateBindingTime();
                UseSeconds = timeWrapper.UseSeconds;
                ActionProperties.UpdateActions(storedObj.Actions);
            }
        }