Likes

Windows App Lab@Home 8

Ryan, a Windows Store app developer, needs to create a recipe app for desserts. The app is expected to display the images of the various desserts whose recipes are available, as shown in the following figure.

Ryan, a Windows Store app developer, needs to create a recipe app for desserts. The app is
expected to display the images of the various desserts whose recipes are available, as shown in
the following figure.

The Various Dessert Recipes
Whenever a user clicks on the image of a dessert, the page containing the recipe for the same is
displayed, as shown in the following figure.
The Page Containing the Recipe
In addition, every recipe page allows the user to go back to the main page of the app.
To enhance the appearance of the app, Ryan has applied styles to the previous buttons in the
app. In addition, to make the app more appealing, he wants to add animation to the pages of the
app. However, after applying the animation, when he tries to deploy the app, an exception is
thrown.

Help Ryan identify the reason of exception and provide a solution for the same.

Solution






Genelia has developed a reader app, which allows users to read a book and to move from one page to another. The home page of the app is shown in the following figure.

Genelia has developed a reader app, which allows users to read a book and to move from one
page to another. The home page of the app is shown in the following figure.


The Home Page of the App
The content page of the app is shown in the following figure.
The Content Page of the App
To enhance the look and feel of the next and previous buttons, Genelia has applied styles to the
next and previous buttons. However, after applying the desired styles, when she tries to deploy the
app, an exception is thrown. Help Genelia identify the reason of exception and provide a solution
for the same.


Solution;








Ryan, an app developer, has developed an app that can be used to take notes. This app allows the users to view, create, edit, and delete notes. Each note contains a title and a description. To provide the preceding functionalities, the following pages are added in the app:

Ryan, an app developer, has developed an app that can be used to take notes. This app allows
the users to view, create, edit, and delete notes. Each note contains a title and a description. To
provide the preceding functionalities, the following pages are added in the app:
Notes: Displays the titles of the existing notes, if already added. When a user selects the title of
a note on this page, the details of the note are displayed on a new page. However, if no notes
have been added yet, the Notes page displays the message, Notes not available. In addition,
this page contains a control in the app bar to add a new note.
Add Note: Displays controls to specify the title and description of a note. In addition, it contains
controls in the app bar to save a note or cancel the action of adding a note.
Edit Note: Displays the controls containing the details of the selected note. In addition, it
contains controls in the app bar to save the edited note or cancel the action of editing a note.
Note Details: Displays the title and description of the selected note along with the controls to
delete and edit the current note. In addition, it contains a control in the app bar to navigate to the
home page.
Now, Ryan has been assigned the task to enhance the UI of the app by implementing the
following functionalities:
Display the entrance animation effect when the pages of the app are displayed.
In the Notes page, a popup menu needs to be added. This menu should be displayed when the
user right-clicks an item in the list box that displays the list of notes. The popup menu contains
the commands that allow the user to edit or delete the selected note.
The buttons in the App bar of the app need to be styled with the respective App bar button styles,
such as EditAppBarButtonStyle, DeleteAppBarButtonStyle, and HomeAppBarButtonStyle.
Display a message dialog for confirming a delete operation before deleting a note.
Help Ryan to enhance the app by adding the preceding functionalities.

Solution;






John has developed a Windows Store app for viewing images. The following figure shows the UI of the app. The UI of the App The app has the following functionalities: The users are able to select an image from the Image List section.

John has developed a Windows Store app for viewing images. The following figure shows the UI
of the app.
The UI of the App

The app has the following functionalities:
The users are able to select an image from the Image List section.
Once the user selects the image from the Image List section, the preview of the selected image
is displayed in the Image Preview section.
The preview of the selected image uniformly fits in the defined area.
Now, John has been assigned the task to add the fadein and fadeout animation effects for the
preview of the image. This implies that whenever the user selects an image in Image List, the
currently-displayed image fades out and the selected image fades-in into the UI.
Help John add the preceding functionality to the app.


Solution;

XAML code:

<Page
    x:Class="Exercise01.MainPage"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:local="using:Exercise01"
    xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
    xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
    mc:Ignorable="d">
    <Viewbox>
        <Grid Background="{StaticResource ApplicationPageBackgroundThemeBrush}" HorizontalAlignment="Center" VerticalAlignment="Center">
        <Button Content="Image List" HorizontalAlignment="Left" Margin="10,10,0,0" BorderThickness="0" FontSize="24" Background="Blue" VerticalAlignment="Top" Width="315"/>
        <ListBox x:Name="lstboxPictureList" HorizontalAlignment="Left" Height="697" Margin="10,61,0,0" VerticalAlignment="Top" Width="315" SelectionChanged="lstboxPictureList_SelectionChanged"/>
        <Button Content="Image Preview"  HorizontalAlignment="Left" Margin="346,10,0,0" BorderThickness="0" FontSize="24" Background="Blue" VerticalAlignment="Top" Width="1010"/>
        <Button IsEnabled="False" HorizontalAlignment="Left" Height="697" Margin="346,61,0,0" VerticalAlignment="Top" Width="1010">
         
        <Image x:Name="imgPreview" Source="Assets/1.jpg" Stretch="Uniform">
       <Image.Resources>
       <Storyboard x:Name="fadeInImage" Storyboard.TargetName="imgPeview">
       <FadInThemeAnimation></FadInThemeAnimation>
       </Storyboard>
       <Storyboard x:Name="fadeInImage" Storyboard.TargetName="imgPeview">
       <FadeOutThemeAnimation></FadeOutThemeAnimation>
       </Storyboard>
       </Image.Resources>
        </Image>
        </Button>
    </Grid>
    </Viewbox>

</Page>
========================================================================

CS code:

using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Threading.Tasks;
using Windows.Foundation;
using Windows.Foundation.Collections;
using Windows.UI.Xaml;
using Windows.UI.Xaml.Controls;
using Windows.UI.Xaml.Controls.Primitives;
using Windows.UI.Xaml.Data;
using Windows.UI.Xaml.Input;
using Windows.UI.Xaml.Media;
using Windows.UI.Xaml.Media.Imaging;
using Windows.UI.Xaml.Navigation;
using System;
// The Blank Page item template is documented at http://go.microsoft.com/fwlink/?LinkId=234238

namespace Exercise01
{
    /// <summary>
    /// An empty page that can be used on its own or navigated to within a Frame.
    /// </summary>
    public sealed partial class MainPage : Page
    {
        public MainPage()
        {
            this.InitializeComponent();
        }

        public void loadPictureList()
        {
            for (int i = 1; i < 9; i++)
            {
                lstboxPictureList.Items.Add(i + ".jpg");
            }
            lstboxPictureList.SelectedIndex = 0;
        }
      
        /// <summary>
        /// Invoked when this page is about to be displayed in a Frame.
        /// </summary>
        /// <param name="e">Event data that describes how this page was reached.  The Parameter
        /// property is typically used to configure the page.</param>
        protected override void OnNavigatedTo(NavigationEventArgs e)
        {
            loadPictureList();
        }

        private void lstboxPictureList_SelectionChanged(object sender, SelectionChangedEventArgs e)
        {


            fadeOutImage.Begin();
        }
        private void fadeOutImage_Completed(object sender, object e)
        {
           imgPreview.Source = new BitmapImage(new uri("ms-appx:///Assets/"+ istboxPictureList.SelectedValue));
           fadeInImage.Begin();
        }
    }
}

No comments: