Ejemplo n.º 1
0
        /// <summary>
        /// Создание нового объекта
        /// </summary>
        public LabelViewModel(uint id, string name, DataProvider dataProvider)
        {
            if (string.IsNullOrEmpty(name))
            {
                return;
            }

            Properties     = new ObjectBaseProperties(id, name, dataProvider.CommonSettings.AppMode, dataProvider.ObjectsRepository);
            TextProperties = new ObjectTextProperties(dataProvider.VariablesRepository);
        }
Ejemplo n.º 2
0
 /// <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;
 }
Ejemplo n.º 3
0
 /// <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;
 }
Ejemplo n.º 4
0
        /// <summary>
        /// Восстановление объекта из xml
        /// </summary>
        public LabelViewModel(LabelObject storedObj, DataProvider dataProvider)
        {
            if (storedObj == null || dataProvider?.CommonSettings == null)
            {
                return;
            }

            Properties = new ObjectBaseProperties(storedObj.Id, storedObj.Name, dataProvider.CommonSettings.AppMode, dataProvider.ObjectsRepository);
            Properties.FontSettings.Update(storedObj.FontSettings);
            TextProperties = new ObjectTextProperties(dataProvider.VariablesRepository)
            {
                Text = storedObj.Text
            };
        }
Ejemplo n.º 5
0
        /// <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;
        }
Ejemplo n.º 6
0
        /// <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);
            }
        }
Ejemplo n.º 7
0
        /// <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);
            }
        }
Ejemplo n.º 8
0
        /// <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);
            }
        }