Namespaces

Variants
Actions

Please note that as of October 24, 2014, the Nokia Developer Wiki will no longer be accepting user contributions, including new entries, edits and comments, as we begin transitioning to our new home, in the Windows Phone Development Wiki. We plan to move over the majority of the existing entries over the next few weeks. Thanks for all your past and future contributions.

Revision as of 06:03, 12 September 2013 by croozeus (Talk | contribs)

(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)

Coding4Fun - using the AboutPrompt control (Arabic)

From Wiki
Jump to: navigation, search
WP Metro Icon UI.png
WP Metro Icon Tools.png
SignpostIcon XAML 40.png
WP Metro Icon WP8.png
SignpostIcon WP7 70px.png
Article Metadata
Code Example
Source file: About Page Sample
Tested with
Devices(s): Nokia Lumia
Compatibility
Platform(s): Windows Phone 7.5 and later
Windows Phone 8
Windows Phone 7.5
Article
Keywords: Coding4Fun Toolkit, About Page
Translated:
By bintk
Last edited: croozeus (12 Sep 2013)

المقدمة

The Coding4Fun Toolkit provides AboutPrompt, a basic "About" implementation.

  • - يوفر هذا المثال الحد الأدني من المعلومات :
  • اسم التطبيق
  • رقم الإصدار التطبيق
  • حقوق الطبع والنشر
  • ملخص / نظرة عامة عن التطبيق
  • الموقع، و الدعم و سياسة الخصوصية

Tip.pngTip: نصيحة : للحصول علي صفحات معلومات التطبيق "حول التطبيق" إحترافية او بمزايا أعلي يمكنك الدخول إلي هذا الموضوع و تطبيق المثال الموجود بداخلة Advanced About Page for Windows Phone apps.

التنفيذ

نحن بحاجه في البداية لإنشاء المشروع , نستطيع بدء مشروع مستقل عن المشروع الرئيسي لأنة و بشكل عام هذة الميزة مستقلة عن الهدف , بعد ذلك نحن بحاجه لتثبيت حزمة Coding4Fun Nuget package:

Coding4Fun installPackage.png


الان نضيف عنصر التحكم الجديد إلى التطبيق:


  private void BtnAboutClick(object sender, EventArgs e)
{
var aboutprompt = new AboutPrompt ();
aboutprompt.Show();
}

بعد ذلك، قم بتشغيل التطبيق , يمكننا أن نرى انه لدينا اسم والنسخة التطبيق لميزة "حول التطبيق "، ولكن يمكن الحصول على مزيد من التفاصيل.

لإضافة المزيد من المعلومات يمكننا إنشاء عنصر تحكم مع معلومات إضافية، وفي نهاية يحتاج فقط إلى أن تضيفها إلى Body. هيا لنفعل ذلك !


AboutControl.xaml

<UserControl x:Class="NokiaDev.AboutPageSample.Controls.AboutControl"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
mc:Ignorable="d"
FontFamily="{StaticResource PhoneFontFamilyNormal}"
FontSize="{StaticResource PhoneFontSizeNormal}"
Foreground="{StaticResource PhoneForegroundBrush}"
d:DesignHeight="480" d:DesignWidth="480">
 
<Grid x:Name="LayoutRoot" Background="{StaticResource PhoneChromeBrush}">
<StackPanel Margin="0,-12,0,24">
<TextBlock Style="{StaticResource PhoneTextLargeStyle}" Text="by saramgsilva" />
 
<TextBlock Style="{StaticResource PhoneTextNormalStyle}"
FontSize="{StaticResource PhoneFontSizeMedium}"
Margin="12,12,0,0" FontWeight="Bold"
Text="Copyright (c) 2013 Nokia Developer Wiki." />
 
<TextBlock Style="{StaticResource PhoneTextNormalStyle}"
Margin="12,24,0,0" FontSize="{StaticResource PhoneFontSizeSmall}"
TextWrapping="Wrap">
This application show an 'About page' sample for Windows Phone applications.
<LineBreak/>See more about it, please see the following reference:
</TextBlock>
<HyperlinkButton NavigateUri="http://www.developer.nokia.com/Community/Wiki/About_page_for_Windows_Phone_applications"
Foreground="{StaticResource PhoneAccentBrush}"
TargetName="_new" FontSize="{StaticResource PhoneFontSizeSmall}"
HorizontalAlignment="Left"
Content="About page for Windows Phone applications" />
 
<TextBlock Style="{StaticResource PhoneTextNormalStyle}"
Margin="12,24,0,12" FontWeight="Bold"
Text="More informations:"
FontSize="{StaticResource PhoneFontSizeMedium}" />
 
<HyperlinkButton NavigateUri="http://www.developer.nokia.com/"
Foreground="{StaticResource PhoneAccentBrush}"
TargetName="_new"
HorizontalAlignment="Left"
Content="Website" />
 
<HyperlinkButton NavigateUri="http://www.developer.nokia.com/"
Foreground="{StaticResource PhoneAccentBrush}"
TargetName="_new"
HorizontalAlignment="Left"
Content="Support" />
 
<HyperlinkButton NavigateUri="http://www.developer.nokia.com/"
Foreground="{StaticResource PhoneAccentBrush}"
TargetName="_new"
HorizontalAlignment="Left"
Content="Privacy Policy" />
 
</StackPanel>
</Grid>
</UserControl>


HomePage.xaml

The HomePage.xaml is:

<phone:PhoneApplicationPage
x:Class="NokiaDev.AboutPageSample.Views.HomePage"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:phone="clr-namespace:Microsoft.Phone.Controls;assembly=Microsoft.Phone"
xmlns:shell="clr-namespace:Microsoft.Phone.Shell;assembly=Microsoft.Phone"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
FontFamily="{StaticResource PhoneFontFamilyNormal}"
FontSize="{StaticResource PhoneFontSizeNormal}"
Foreground="{StaticResource PhoneForegroundBrush}"
SupportedOrientations="Portrait" Orientation="Portrait"
mc:Ignorable="d"
shell:SystemTray.IsVisible="True">
 
<!--LayoutRoot is the root grid where all page content is placed-->
<Grid x:Name="LayoutRoot" Background="Transparent">
<Grid.RowDefinitions>
<RowDefinition Height="Auto"/>
<RowDefinition Height="*"/>
</Grid.RowDefinitions>
 
<!--TitlePanel contains the name of the application and page title-->
<StackPanel Grid.Row="0" Margin="12,17,0,28">
<TextBlock Text="Nokia Developer Wiki Samples" Style="{StaticResource PhoneTextNormalStyle}"/>
<TextBlock Text="Article" Margin="9,-7,0,0" Style="{StaticResource PhoneTextTitle1Style}"/>
<TextBlock Text="About page for Windows Phone applications"
FontSize="{StaticResource PhoneFontSizeSmall}"
Foreground="{StaticResource PhoneAccentBrush}"
Margin="9,-7,0,0" Style="{StaticResource PhoneTextTitle1Style}"/>
 
</StackPanel>
 
<!--ContentPanel - place additional content here-->
<Grid x:Name="ContentPanel" Grid.Row="1" Margin="12,0,12,0">
<phone:WebBrowser Source="http://www.developer.nokia.com/Community/Wiki/About_page_for_Windows_Phone_applications" />
</Grid>
</Grid>
 
<phone:PhoneApplicationPage.ApplicationBar>
<shell:ApplicationBar IsVisible="True" IsMenuEnabled="True">
<shell:ApplicationBarIconButton IconUri="/Images/appbar.about.png" Text="About" x:Name="btnAbout" Click="BtnAboutClick"/>
<shell:ApplicationBar.MenuItems>
<shell:ApplicationBarMenuItem x:Name="AboutMenuItem" Text="About" Click="BtnAboutClick"/>
</shell:ApplicationBar.MenuItems>
</shell:ApplicationBar>
</phone:PhoneApplicationPage.ApplicationBar>
</phone:PhoneApplicationPage>


HomePage.xaml.cs

في الكود السابق نوف نحدد ردة الفعل "السلوك" عندما نضغط علي خيار معلومات التطبيق "حول التطبيق".

namespace NokiaDev.AboutPageSample.Views
{
using System;
 
using Coding4Fun.Toolkit.Controls;
 
using NokiaDev.AboutPageSample.Controls;
 
/// <summary>
/// The home page.
/// </summary>
public partial class HomePage
{
/// <summary>
/// Initializes a new instance of the <see cref="HomePage"/> class.
/// </summary>
public HomePage()
{
InitializeComponent();
}
 
/// <summary>
/// The button about click.
/// </summary>
/// <param name="sender">
/// The sender.
/// </param>
/// <param name="e">
/// The e.
/// </param>
private void BtnAboutClick(object sender, EventArgs e)
{
var aboutprompt = new AboutPrompt { Body = new AboutControl() };
aboutprompt.Show();
}
}
}

Note.pngNote: في هذه الحالة نحن لم تستخدم MVVM pattern

وهذه هي النتيجة النهائية في الصورة أدناه :

About for Windows Phone application using Coding4Fun control


مراجع

http://coding4fun.codeplex.com/

http://channel9.msdn.com/coding4fun

Coding4Fun Blog

This page was last modified on 12 September 2013, at 06:03.
197 page views in the last 30 days.

Was this page helpful?

Your feedback about this content is important. Let us know what you think.

 

Thank you!

We appreciate your feedback.

×