Ejemplo n.º 1
0
        private void buttonAddBookmark_Click(object sender, RoutedEventArgs e)
        {
            var model = BookmarkerModel.GetDefault();
            var view = new AddBookmarkView();

            var border = new Border
            {
                BorderThickness = new Thickness(1),
                BorderBrush = new SolidColorBrush(Colors.White),
                Width = view.MinWidth,
                Height = view.MinHeight
            };
            border.Child = view;
            var popup = FlyoutUtils.CreateFlyout(this.BottomAppBar, (Button)sender, border);

            view.AddClicked += (_, __) =>
            {
                if (!view.Validate())
                {
                    return;
                }

                model.AddBookmark(view.SelectedCategory.Id, view.CreateBookmark());
                var nowait = model.SaveAsync();
                popup.IsOpen = false;
            };

            popup.IsOpen = true;
        }
Ejemplo n.º 2
0
        private void buttonAddBookmark_Click(object sender, RoutedEventArgs e)
        {
            var model = BookmarkerModel.GetDefault();
            var view  = new AddBookmarkView();

            var border = new Border
            {
                BorderThickness = new Thickness(1),
                BorderBrush     = new SolidColorBrush(Colors.White),
                Width           = view.MinWidth,
                Height          = view.MinHeight
            };

            border.Child = view;
            var popup = FlyoutUtils.CreateFlyout(this.BottomAppBar, (Button)sender, border);

            view.AddClicked += (_, __) =>
            {
                if (!view.Validate())
                {
                    return;
                }

                model.AddBookmark(view.SelectedCategory.Id, view.CreateBookmark());
                var nowait = model.SaveAsync();
                popup.IsOpen = false;
            };

            popup.IsOpen = true;
        }
Ejemplo n.º 3
0
        private void buttonEditBookmark_Click(object sender, RoutedEventArgs e)
        {
            var bookmark = groupedItemsViewSource.View.CurrentItem as Bookmark;

            if (bookmark == null || bookmark.Id == Guid.Empty)
            {
                return;
            }

            var model           = BookmarkerModel.GetDefault();
            var currentCategory = model.GetCategoryByBookmark(bookmark);

            var view = new AddBookmarkView
            {
                Categories       = model.Categories,
                SelectedCategory = currentCategory,
                Title            = bookmark.Title,
                Uri = bookmark.Uri.ToString()
            };

            var border = new Border
            {
                BorderThickness = new Thickness(1),
                BorderBrush     = new SolidColorBrush(Colors.White),
                Width           = view.MinWidth,
                Height          = view.MinHeight
            };

            border.Child = view;
            var popup = FlyoutUtils.CreateFlyout(this.BottomAppBar, (Button)sender, border);

            view.AddClicked += (_, __) =>
            {
                if (!view.Validate())
                {
                    return;
                }

                bookmark.Title = view.Title;
                bookmark.Uri   = new Uri(view.Uri, UriKind.Absolute);
                model.ChangeCategory(view.SelectedCategory, bookmark);
                var nowait = model.SaveAsync();
                popup.IsOpen = false;
            };
            popup.IsOpen = true;
        }
Ejemplo n.º 4
0
        private void buttonEditBookmark_Click(object sender, RoutedEventArgs e)
        {
            var bookmark = groupedItemsViewSource.View.CurrentItem as Bookmark;
            if (bookmark == null || bookmark.Id == Guid.Empty)
            {
                return;
            }

            var model = BookmarkerModel.GetDefault();
            var currentCategory = model.GetCategoryByBookmark(bookmark);

            var view = new AddBookmarkView
            {
                Categories = model.Categories,
                SelectedCategory = currentCategory,
                Title = bookmark.Title,
                Uri = bookmark.Uri.ToString()
            };

            var border = new Border
            {
                BorderThickness = new Thickness(1),
                BorderBrush = new SolidColorBrush(Colors.White),
                Width = view.MinWidth,
                Height = view.MinHeight
            };
            border.Child = view;
            var popup = FlyoutUtils.CreateFlyout(this.BottomAppBar, (Button)sender, border);

            view.AddClicked += (_, __) =>
            {
                if (!view.Validate())
                {
                    return;
                }

                bookmark.Title = view.Title;
                bookmark.Uri = new Uri(view.Uri, UriKind.Absolute);
                model.ChangeCategory(view.SelectedCategory, bookmark);
                var nowait = model.SaveAsync();
                popup.IsOpen = false;
            };
            popup.IsOpen = true;
        }