private void RaiseRemoveSettingRequest()
        {
            var settingToRemove = SelectedSettingValue;

            if (RemoveConfirmRequest != null)
            {
                var confirmation = new ConditionalConfirmation();
                confirmation.Title   = "Delete confirmation".Localize(null, LocalizationScope.DefaultCategory);
                confirmation.Content = "Remove this setting value?".Localize();

                RemoveConfirmRequest.Raise(confirmation,
                                           (x) =>
                {
                    if (x.Confirmed)
                    {
                        var settingFromInnerItem =
                            InnerItem.SettingValues.SingleOrDefault(
                                s => s.SettingValueId == settingToRemove.SettingValueId);
                        if (settingFromInnerItem != null)
                        {
                            settingFromInnerItem.PropertyChanged -= ViewModel_PropertyChanged;
                            InnerItem.SettingValues.Remove(settingFromInnerItem);
                        }
                    }
                    OnPropertyChanged("IsValid");
                    ItemAddCommand.RaiseCanExecuteChanged();
                });
            }
        }
 protected override void OnViewModelPropertyChangedUI(object sender, PropertyChangedEventArgs e)
 {
     base.OnViewModelPropertyChangedUI(sender, e);
     if (ItemAddCommand != null)
     {
         ItemAddCommand.RaiseCanExecuteChanged();
     }
 }
 protected override void OnViewModelCollectionChangedUI(object sender, System.Collections.Specialized.NotifyCollectionChangedEventArgs e)
 {
     base.OnViewModelCollectionChangedUI(sender, e);
     if (ItemAddCommand != null)
     {
         ItemAddCommand.RaiseCanExecuteChanged();
     }
 }
        private void RaiseAddSettingRequest(OperationType operationType)
        {
            if (CommonConfirmRequest != null)
            {
                var operType = operationType;
                var itemVM   = new AddSettingValueViewModel(ValueType, operationType);
                ConditionalConfirmation confirmation = new ConditionalConfirmation();

                if (operationType == OperationType.Edit)
                {
                    switch (ValueType)
                    {
                    case Infrastructure.Enumerations.ValueType.Boolean:
                        itemVM.BooleanValue = SelectedSettingValue.BooleanValue;
                        break;

                    case Infrastructure.Enumerations.ValueType.DataTime:
                        itemVM.DateTimeValue = SelectedSettingValue.DateTimeValue;
                        break;

                    case Infrastructure.Enumerations.ValueType.Decimal:
                        itemVM.DecimalValue = SelectedSettingValue.DecimalValue;
                        break;

                    case Infrastructure.Enumerations.ValueType.Integer:
                        itemVM.IntegerValue = SelectedSettingValue.IntegerValue;
                        break;

                    case Infrastructure.Enumerations.ValueType.LongText:
                        itemVM.LongTextValue = SelectedSettingValue.LongTextValue;
                        break;

                    case Infrastructure.Enumerations.ValueType.ShortText:
                        itemVM.ShortTextValue = SelectedSettingValue.ShortTextValue;
                        break;
                    }
                    confirmation.Title = "Edit setting value".Localize();
                }
                else
                {
                    confirmation.Title = "Add setting value".Localize();
                }

                confirmation.Content = itemVM;

                CommonConfirmRequest.Raise(confirmation,
                                           (x) =>
                {
                    if (x.Confirmed)
                    {
                        var vm = x.Content as AddSettingValueViewModel;

                        if (operType == OperationType.Add)
                        {
                            SettingValue settingToAdd = new SettingValue();

                            GetValueFromAddEditDialog(vm, ref settingToAdd);

                            this.InnerItem.SettingValues.Add(settingToAdd);
                        }
                        else
                        {
                            SettingValue settingToEdit = SelectedSettingValue;
                            GetValueFromAddEditDialog(vm, ref settingToEdit);
                        }

                        OnPropertyChanged("IsValid");
                        ItemAddCommand.RaiseCanExecuteChanged();
                        OnIsValidChanged();
                    }
                });
            }
        }
 public void RaiseCanExecuteChanged()
 {
     ItemAddCommand.RaiseCanExecuteChanged();
     ItemEditCommand.RaiseCanExecuteChanged();
     ItemDeleteCommand.RaiseCanExecuteChanged();
 }