Ejemplo n.º 1
0
        private void SetLanguage([NotNull] object sender, [NotNull] SelectionChangedEventArgs e)
        {
            Debug.ArgumentNotNull(sender, nameof(sender));
            Debug.ArgumentNotNull(e, nameof(e));

            if (IsLoading)
            {
                return;
            }

            var listBoxItem = Languages.SelectedItem as ListBoxItem;

            if (listBoxItem == null)
            {
                return;
            }

            var language = listBoxItem.Tag as string;

            if (string.IsNullOrEmpty(language))
            {
                return;
            }

            var contentModel = ContentEditor.ContentModel;

            if (contentModel.IsEmpty)
            {
                return;
            }

            if (contentModel.IsMultiple)
            {
                return;
            }

            LanguageManager.CurrentLanguage = new Language(language);

            var list = new List <ItemVersionUri>
            {
                new ItemVersionUri(contentModel.FirstItem.Uri.ItemUri, new Language(language), Version.Latest)
            };

            ContentEditor.LoadItems(list, new LoadItemsOptions(true));
        }
Ejemplo n.º 2
0
        private void SetVersion([NotNull] object sender, [NotNull] SelectionChangedEventArgs e)
        {
            Debug.ArgumentNotNull(sender, nameof(sender));
            Debug.ArgumentNotNull(e, nameof(e));

            if (IsLoading)
            {
                return;
            }

            var listBoxItem = Versions.SelectedItem as ListBoxItem;

            if (listBoxItem == null)
            {
                return;
            }

            var contentModel = ContentEditor.ContentModel;

            if (contentModel.IsEmpty)
            {
                return;
            }

            if (contentModel.IsMultiple)
            {
                return;
            }

            var version = (int)listBoxItem.Tag;

            var list = new List <ItemVersionUri>
            {
                new ItemVersionUri(contentModel.FirstItem.Uri.ItemUri, LanguageManager.CurrentLanguage, new Version(version))
            };

            ContentEditor.LoadItems(list, new LoadItemsOptions(true));
        }