Ejemplo n.º 1
0
        private void RaiseLanguageRemoveInteractionRequest(GeneralLanguage selectedItem)
        {
            var confirmation = new ConditionalConfirmation
            {
                Title   = "Remove confirmation".Localize(null, LocalizationScope.DefaultCategory),
                Content = string.Format("Are you sure you want to remove Language '{0}'?".Localize(), selectedItem.LanguageCode)
            };

            LanguageCommonConfirmRequest.Raise(confirmation,
                                               (x) =>
            {
                if (x.Confirmed)
                {
                    if (AddedItems.Contains(selectedItem))
                    {
                        AddedItems.Remove(selectedItem);
                    }
                    else
                    {
                        if (UpdatedItems.Contains(selectedItem))
                        {
                            UpdatedItems.Remove(selectedItem);
                        }
                        RemovedItems.Add(selectedItem);
                    }
                    InnerItems.Remove(selectedItem);
                }
            });
        }
Ejemplo n.º 2
0
        public static GeneralLanguage GeneralLanguage(Models.ISO639_2_Lang entity)
        {
            var model = new GeneralLanguage();

            model.ID          = entity.ID;
            model.Code        = entity.ISO_639_1;
            model.Description = entity.EnglishName;
            return(model);
        }
Ejemplo n.º 3
0
        public static GeneralLanguage GeneralLanguage(Models.CommonLanguage entity)
        {
            var model = new GeneralLanguage();

            model.ID          = entity.ID;
            model.Code        = entity.Code;
            model.Description = entity.Description;
            return(model);
        }
Ejemplo n.º 4
0
        private void RaiseLanguageAddInteractionRequest()
        {
            var item = new GeneralLanguage();

            if (RaiseLanguageEditInteractionRequest(item, "Create Language".Localize()))
            {
                AddedItems.Add(item);
                InnerItems.Add(item);
            }
        }
        public GeneralLanguageViewModel(GeneralLanguage language)
        {
            Language = language.Name;

            _quickInfoStates = new ObservableCollection <string>(QuickInfoStateService.SupportedStateByNames.Keys);
            _editorStates    = new ObservableCollection <string>(EditorStateService.SupportedStateByNames.Keys);

            _selectedQuickInfoState = QuickInfoStateService.SupportedState[language.QuickInfoState];
            _selectedEditorState    = EditorStateService.SupportedState[language.EditorState];

            QuickInfoStates = _quickInfoStates.GetDefaultListView();
            EditorStates    = _editorStates.GetDefaultListView();
        }
Ejemplo n.º 6
0
        private void RaiseLanguageEditInteractionRequest(GeneralLanguage originalItem)
        {
            var item = new GeneralLanguage(originalItem);

            if (RaiseLanguageEditInteractionRequest(item, "Edit Language".Localize()))
            {
                // copy all values to original:
                OnUIThread(() => originalItem.InjectFrom <CloneInjection>(item));
                if (!UpdatedItems.Contains(originalItem))
                {
                    UpdatedItems.Add(originalItem);
                }
            }
        }
Ejemplo n.º 7
0
        public GeneralLanguageViewModel(IAppConfigRepository appConfigRepository, GeneralLanguage item,
                                        IEnumerable <object> selectedLanguages)
        {
            _selectedLanguages = selectedLanguages.Select(x => new GeneralLanguage(x)).Where(x => x.LanguageCode != item.LanguageCode).ToList();
            _innerItem         = item;

            LanguageSetting = appConfigRepository.Settings.Where(s => s.Name.Contains("Lang"))
                              .Expand(s => s.SettingValues)
                              .FirstOrDefault();

            if (LanguageSetting != null)
            {
                var view = CollectionViewSource.GetDefaultView(LanguageSetting.SettingValues);
                view.Filter = FilterItems;
                view.Refresh();
            }

            InnerItem.PropertyChanged += InnerItem_PropertyChanged;
        }
Ejemplo n.º 8
0
        private bool RaiseLanguageEditInteractionRequest(GeneralLanguage item, string title)
        {
            var result = false;

            var parameters = new[]
            {
                new KeyValuePair <string, object>("item", item),
                new KeyValuePair <string, object>("selectedLanguages", InnerItems)
            };
            var itemVM = _vmFactory.GetViewModelInstance(parameters);

            var confirmation = new ConditionalConfirmation {
                Title = title, Content = itemVM
            };

            LanguageConfirmRequest.Raise(confirmation, x =>
            {
                result = x.Confirmed;
            });

            return(result);
        }