.


:




:

































 

 

 

 


WebBrowser

. . .

(launchers)

, :

  1. .
  2. .
  3. Show .

:

BingMapsDirectionsTask

Bing Maps . . .

BingMapsTask

Bing Maps, .

ConnectionSettingsTask

.

EmailComposeTask

e-mail c . e-mail .

MarketplaceDetailTask

Windows Phone Marketplace .

MarketplaceHubTask

Windows Phone Marketplace.

MarketplaceReviewTask

Windows Phone Marketplace

MarketplaceSearchTask

Windows Phone Marketplace .

MediaPlayerLauncher

.

PhoneCallTask

Phone. .

SearchTask

.

ShareLinkTask

.

ShareStatusTask

.

SmsComposeTask

Messaging .

WebBrowserTask

-.


Windows Phone Application, ExploreLaunchers. , , , MainPage.xaml Grid:

<!--ContentPanel - place additional content here-->
<Grid x:Name="ContentPanel" Grid.Row="1"
Margin="12,0,12,0" > </Grid>

XAML , :

<!--ContentPanel - place additional content here-->
<Grid x:Name="ContentPanel" Grid.Row="1" Margin="12,0,12,0" >
<StackPanel Orientation="Horizontal" >
<StackPanel Width="240" >
<Button Name="EMailMe" Width="190" Height="75"
Content="E-mail" Click="EMailMe_Click" />
<Button Name="AppDetails" Width="190" Height="75"
Content="" Click="AppDetails_Click" />
<Button Name="MarketHub" Width="190" Height="75"
Content="" Click="MarketHub_Click" />
<Button Name="MarketSearch" Width="190" Height="75"
Content=" ..." Click="MarketSearch_Click" />
<Button Name="MediaPlayer" Width="190" Height="75"
Content="" Click="MediaPlayer_Click" />
</StackPanel>
<StackPanel Width="240" >
<Button Name="PhoneCall" Width="190" Height="75"
Content="" Click="PhoneCall_Click" />
<Button Name="Search" Width="190" Height="75"
Content="" Click="Search_Click" />
<Button Name="SendSms" Width="190" Height="75"
Content="SMS" Click="SendSms_Click" />
<Button Name="WebBrowse" Width="190" Height="75"
Content="" Click="WebBrowse_Click" />
</StackPanel>
</StackPanel>
</Grid>
</Grid>

using .

using Microsoft.Phone.Tasks;


MainPage :
private void EMailMe_Click(object sender, RoutedEventArgs e)
{

EmailComposeTask compose = new EmailComposeTask();
compose.To = "[email protected]";
compose.Body = " !
! , !";
compose.Show();
}

private void AppDetails_Click
(object sender, RoutedEventArgs e)
{
//MarketplaceDetailTask marketDetails =
new MarketplaceDetailTask();
//marketDetails.ContentType =
MarketplaceContentType.Applications;
//marketDetails.ContentIdentifier =
" ";
//marketDetails.Show();
}

private void MarketHub_Click
(object sender, RoutedEventArgs e)
{
MarketplaceHubTask marketHub =
new MarketplaceHubTask();
marketHub.ContentType =
MarketplaceContentType.Applications;
marketHub.Show();
}

private void MarketSearch_Click
(object sender, RoutedEventArgs e)
{
MarketplaceSearchTask marketSearch =
new MarketplaceSearchTask();
marketSearch.ContentType =
MarketplaceContentType.Applications;
marketSearch.SearchTerms = "GPSInfo";
marketSearch.Show();
}
private void
MediaPlayer_Click(object sender, RoutedEventArgs e)
{
//MediaPlayerLauncher player = new MediaPlayerLauncher();
//player.Controls = MediaPlaybackControls.Stop;
//player.Media =
" URI ";
//player.Show();
}

private void PhoneCall_Click(object sender, RoutedEventArgs e)
{
PhoneCallTask call = new PhoneCallTask();
call.DisplayName = " ";
call.PhoneNumber = "+7 555 555 5555";
call.Show();
}

private void Search_Click(object sender, RoutedEventArgs e)
{
SearchTask search = new SearchTask();
search.SearchQuery = "rush4apps";
search.Show();
}

private void SendSms_Click(object sender, RoutedEventArgs e)
{
SmsComposeTask sms = new SmsComposeTask();
sms.Body = "Windows Phone 7 - !";
sms.Show();
}

private void WebBrowse_Click(object sender, RoutedEventArgs e)
{
WebBrowserTask web = new WebBrowserTask();
web.Uri = new Uri("http://msdn.com/ru-ru/");
web.Show();
}

. . , .

(F5), , .

.

(choosers)

, :

  1. .
  2. Completed.
  3. .
  4. Show .
  5. Completed.

:

AddressChooserTask

Contacts. , , .

CameraCaptureTask

Camera. , .

EmailAddressChooserTask

Contacts. , e-mail , .

GameInviteTask

.

PhoneNumberChooserTask

Contacts. , , .

PhotoChooserTask

PhotoChooser. , .

SaveContactTask

 

SaveEmailAddressTask

Contacts. , e-mail .

SavePhoneNumberTask

Contacts. , .

SaveRingtoneTask

.


Windows Phone Application, ExploreChoosers. , , , MainPage.xaml Grid:

<!--ContentPanel - place additional content here-->
<Grid x:Name="ContentPanel" Grid.Row="1"
Margin="12,0,12,0" > </Grid>

XAML , :

<!--ContentPanel - place additional content here-->
<Grid x:Name="ContentPanel" Grid.Row="1"
Margin="12,0,12,0" >
<StackPanel>
<Button Width="190" Height="75" Name="Camera"
Content="" Click="Camera_Click" />
<Button Width="190" Height="75" Name="Email"
Content="EMail" Click="Email_Click" />
<Button Width="190" Height="75"
Name="Phone"
Content="" Click="Phone_Click" />
<Button Width="190" Height="75"
Name="ChoosePhoto"
Content="" Click="ChoosePhoto_Click" />
<Button Width="190" Height="75"
Name="SaveEMail"
Content=". EMail"
Click="SaveEMail_Click" />
<Button Width="190" Height="75"
Name="SavePhone"
Content=". ."
Click="SavePhone_Click" />
</StackPanel>
</Grid>

using .

using Microsoft.Phone.Tasks;

MainPage :

private void Camera_Click(object sender, RoutedEventArgs e)

{

CameraCaptureTask camera =

new CameraCaptureTask();

camera.Completed +=

new EventHandler<PhotoResult>(camera_Completed);

camera.Show();

}

 

void camera_Completed

(object sender, PhotoResult e)

{

if (e.TaskResult == TaskResult.OK)

MessageBox.Show(" :" +

e.OriginalFileName);

}

 

private void Email_Click

(object sender, RoutedEventArgs e)

{

EmailAddressChooserTask email =

new EmailAddressChooserTask();

email.Completed += new EventHandler<

EmailResult>(email_Completed);

email.Show();

}

 

void email_Completed(object sender, EmailResult e)

{

if (e.TaskResult == TaskResult.OK)

MessageBox.Show(e.Email);

}

 

private void Phone_Click

(object sender, RoutedEventArgs e)

{

PhoneNumberChooserTask phone =

new PhoneNumberChooserTask();

phone.Completed += new EventHandler<

PhoneNumberResult>(phone_Completed);

phone.Show();

}

 

void phone_Completed(object sender,

PhoneNumberResult e)

{

if (e.TaskResult == TaskResult.OK)

MessageBox.Show(e.PhoneNumber);

}

 

private void ChoosePhoto_Click

(object sender, RoutedEventArgs e)

{

PhotoChooserTask photo =

new PhotoChooserTask();

photo.Completed += new EventHandler<

PhotoResult>(photo_Completed);

photo.Show();

}

 

void photo_Completed(object sender, PhotoResult e)

{

if (e.TaskResult == TaskResult.OK)

MessageBox.Show(e.OriginalFileName);

}

 

private void SaveEMail_Click

(object sender, RoutedEventArgs e)

{

SaveEmailAddressTask saveEmail =

new SaveEmailAddressTask();

saveEmail.Completed += new EventHandler<

TaskEventArgs>(saveEmail_Completed);

saveEmail.Email = "[email protected]";

saveEmail.Show();

}

 

void saveEmail_Completed

(object sender, TaskEventArgs e)

{

if (e.TaskResult == TaskResult.OK)

MessageBox.Show("EMail !");

}

 

private void SavePhone_Click

(object sender, RoutedEventArgs e)

{

SavePhoneNumberTask savePhone =

new SavePhoneNumberTask();

savePhone.Completed += new EventHandler<

TaskEventArgs>(savePhone_Completed);

savePhone.PhoneNumber = "+7 495 555 5555";

savePhone.Show();

}

 

void savePhone_Completed

(object sender, TaskEventArgs e)

{

if (e.TaskResult == TaskResult.OK)

MessageBox.Show(" !");

}

Completed .

(F5), , .

.

Map

Map, Windows Phone Application, ExploreMapControl.

, , , :

Toolbox, , Map

, Microsoft.Phone.Controls.Map:

MainPage.xaml , XAML .

Map my:

<my:Map Height="50" HorizontalAlignment="Left"

Margin="201,198,0,0"

Name="map1" VerticalAlignment="Top" Width="100" />

XAML , :

xmlns:my="clr-namespace:Microsoft.Phone.Controls.Maps;
assembly=Microsoft.Phone.Controls.Maps"

my map, :

xmlns:map="clr-namespace:Microsoft.Phone.Controls.Maps;assembly=
Microsoft.Phone.Controls.Maps"

<map:Map Height="50" HorizontalAlignment="Left"
Margin="201,198,0,0" Name="map1"
VerticalAlignment="Top" Width="100" />

XAML Map Properites , MyMap:

 

(F5) , .

, , ? Bing . Bing Maps: http://www.bingmapsportal.com/

, CredentialsProvider , .

: / , :

<!--ContentPanel - place additional content here-->
<Grid x:Name="ContentPanel" Grid.Row="1"
Margin="12,0,12,0" >
<map:Map Name="MyMap" >
<Button Name="ZoomIn" Content="+"
HorizontalAlignment="Center" VerticalAlignment="Bottom"
Height="60" Width="60"
Margin="-100,0,0,-5" Click="ZoomIn_Click"
FontWeight="Bold"
Padding="0,-9,0,0" />

<Button Name="ZoomOut" Content="-" HorizontalAlignment="Center"
VerticalAlignment="Bottom" Height="60" Width="60"
Margin="100,0,0,-5"
Click="ZoomOut_Click"
FontWeight="Bold" Padding="0,-9,0,0" />

<Button Name="LayoutChange" Content="L" HorizontalAlignment="Center"
VerticalAlignment="Bottom" Height="60" Width="60"
Margin="0,0,0,-5"
FontWeight="Bold"
Padding="0,-9,0,0" Click="LayoutChange_Click" />

</map:Map>
</Grid>

:

private void ZoomIn_Click
(object sender, RoutedEventArgs e)
{
MyMap.ZoomLevel += 1;
}

private void ZoomOut_Click
(object sender, RoutedEventArgs e)
{
MyMap.ZoomLevel -= 1;
}

private void LayoutChange_Click(
object sender, RoutedEventArgs e)
{
if (MyMap.Mode is RoadMode)
{
MyMap.Mode = new AerialMode(true);
}
else
{
MyMap.Mode = new RoadMode();
}

}

using :

using Microsoft.Phone.Controls.Maps;

(F5) , , .

Metro- Application Bar, . , Application Bar XAML Metro.

WebBrowser

Map, Windows Phone Application, ExploreWebControl.

, , , :

Toolbox, , WebBrowser

, :

MainPage.xaml , XAML .

<phone:WebBrowser HorizontalAlignment="Left"

Margin="174,169,0,0"

Name="webBrowser1" VerticalAlignment="Top" />

phone, :

xmlns:phone="clr-namespace:Microsoft.Phone.

Controls;assembly=Microsoft.Phone"

XAML :

<phone:PhoneApplicationPage
x:Class="ExploreWebControl.
MainPage"
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"
mc:Ignorable="d" d:DesignWidth="480"
d:DesignHeight="768"
FontFamily="{StaticResource
PhoneFontFamilyNormal}"
FontSize="{StaticResource
PhoneFontSizeNormal}"
Foreground="{StaticResource
PhoneForegroundBrush}"
SupportedOrientations="Portrait"
Orientation="Portrait"
shell:SystemTray.IsVisible="True" >

XAML WebBrowser Properites , MyBrowser, XAML Source, , HTML . MSDN:

 

(F5) , .

: Go, URL .

XAML :

<!--ContentPanel - place additional content here-->
<Grid x:Name="ContentPanel"
Grid.Row="1" Margin="12,0,12,0" >
<StackPanel>
<StackPanel Orientation="Horizontal" >
<TextBox Name="Url" InputScope="URL" Width="380" />
<Button Name="Go" Width="82"
Content="Go" Click="Go_Click" />
</StackPanel>

<phone:WebBrowser Name="MyBrowser"
Source="http://msdn.com/ru-ru/" Height="530" />
</StackPanel>
</Grid>

:

private void Go_Click(object sender, RoutedEventArgs e)
{
try
{
Uri url = new Uri(Url.Text);
MyBrowser.Navigate(url);
}
catch (Exception ex)
{
MessageBox.Show(ex.Message);
}
}

(F5) , , URL.

.

ExploreMapControl .

Microsoft.Devices.Sensors. Solution Explorer Refernce , Add Reference Microsoft.Devices.Sensors. , using :

using Microsoft.Devices.Sensors;

.

, . , .

:

private Accelerometer myAccel;

, :

myAccel = new Accelerometer();

myAccel.CurrentValueChanged += new EventHandler&gt;(myAccel_CurrentValueChanged);

myAccel.Start();

Vector3 Microsoft.Xna.Framework. Microsoft.Xna.Framework, Microsoft.Devices.Sensors, using :

using Microsoft.Xna.Framework;

, , , ( ) . :

private Vector3 currentValues;

:
void myAccel_CurrentValueChanged
(object sender, SensorReadingEventArgs<
AccelerometerReading> e)
{
if (myAccel.IsDataValid)
{
float deltaZ = (currentValues -
e.SensorReading.Acceleration).Z;
float Z = e.SensorReading.Acceleration.Z;

currentValues = e.SensorReading.Acceleration;

if (Z < 0 && deltaZ > 0)
{
//
}
if (Z > 0 && deltaZ < 0)
{
//
}
}

}

. . Dispatcher:

Dispatcher.BeginInvoke

:

private void HandleZoomIn()

{

MyMap.ZoomLevel += 1;

}

 

private void HandleZoomOut()

{

MyMap.ZoomLevel -= 1;

}

Dispatcher:

Dispatcher.BeginInvoke(() =&gt; HandleZoomIn());

Dispatcher.BeginInvoke(() =&gt; HandleZoomOut());

:

private Accelerometer myAccel;

private Vector3 currentValues;

 

// Constructor

public MainPage()

{

InitializeComponent();

 

myAccel = new Accelerometer();

myAccel.CurrentValueChanged +=

new EventHandler<SensorReadingEventArgs<

AccelerometerReading>>

(myAccel_CurrentValueChanged);

 

myAccel.Start();

currentValues = myAccel.CurrentValue.Acceleration;

}

 

void myAccel_CurrentValueChanged(object sender,

SensorReadingEventArgs<AccelerometerReading> e)

{

if (myAccel.IsDataValid)

{

float deltaZ = (currentValues - e.SensorReading.Acceleration).Z;

float Z = e.SensorReading.Acceleration.Z;

 

currentValues = e.SensorReading.Acceleration;

 

if (Z < 0 && deltaZ > 0)

{

Dispatcher.BeginInvoke(() => HandleZoomIn());

}

if (Z > 0 && deltaZ < 0)

{

Dispatcher.BeginInvoke(() => HandleZoomOut());

}

}

 

}

 

private void HandleZoomIn()

{

MyMap.ZoomLevel += 1;

}

 

private void HandleZoomOut()

{

MyMap.ZoomLevel -= 1;

}

 

private void ZoomIn_Click

(object sender, RoutedEventArgs e)

{

MyMap.ZoomLevel += 1;

}

 

private void ZoomOut_Click

(object sender, RoutedEventArgs e)

{

MyMap.ZoomLevel -= 1;

}

private void LayoutChange_Click

(object sender, RoutedEventArgs e)

{

if (MyMap.Mode is RoadMode)

{

MyMap.Mode = new AerialMode(true);

}

else

{

MyMap.Mode = new RoadMode();

}

 

}

(F5) , , . , .

, . , Wi-Fi, GPS .

ExploreMapControl .

, using :

using System.Device.Location;

/.

, , .

GeoCoordinateWatcher, .

private GeoCoordinateWatcher myGeoWatcher;

, ( , ..) .

yGeoWatcher = new GeoCoordinateWatcher();
myGeoWatcher.MovementThreshold = 100.0f;

myGeoWatcher.StatusChanged +=
new EventHandler<GeoPositionStatusChangedEventArgs>
(myGeoWatcher_StatusChanged);

myGeoWatcher.PositionChanged +=
new EventHandler<GeoPosition
ChangedEventArgs<GeoCoordinate>>
(myGeoWatcher_PositionChanged);

, .. . , , .

, , , :

myGeoWatcher.TryStart(false, TimeSpan.FromSeconds(60));

Visual Studio StatusChanged PositionChanged, , NotImplemented:

throw new NotImplementedException();

PositionChanged , :

void myGeoWatcher_PositionChanged
(object sender, GeoPositionChangedEventArgs<GeoCoordinate> e)
{
MyMap.Center = e.Position.Location;
}

(F5) , . , , .

, , , , .

, using :

using System.Threading;

:

new Thread(startMyGeoWotcher).Start();

, , startMyGeoWotcher :

void startMyGeoWotcher()
{
myGeoWatcher.TryStart(false,
TimeSpan.FromSeconds(60));
}

TextBlock

<!--ContentPanel - place additional content here-->

<Grid x:Name="ContentPanel" Grid.Row="1"

Margin="12,0,12,0">

<StackPanel>

<TextBlock Name="GeoStatus"

HorizontalAlignment="Center"

VerticalAlignment="Top" Text="Geo Status.." />

<map:Map Name="MyMap" Height="580">

 

<Button Name="ZoomIn" Content="+"

HorizontalAlignment="Center"

VerticalAlignment="Bottom"

Height="60" Width="60" Margin="-100,0,0,-5"

Click="ZoomIn_Click"

FontWeight="Bold" Padding="0,-9,0,0"/>

 

<Button Name="ZoomOut" Content="-"

HorizontalAlignment="Center"

VerticalAlignment="Bottom"

Height="60" Width="60" Margin="100,0,0,-5"

Click="ZoomOut_Click" FontWeight="Bold"

Padding="0,-9,0,0" />

 

<Button Name="LayoutChange"

Content="L"

HorizontalAlignment="Center"

VerticalAlignment="Bottom"

Height="60" Width="60" Margin="0,0,0,-5"

FontWeight="Bold"

Padding="0,-9,0,0"

Click="LayoutChange_Click"/>

 

</map:Map>

</StackPanel>

</Grid>

StatusChanged:

void myGeoWatcher_StatusChanged

(object sender, GeoPositionStatusChangedEventArgs e)

{

switch (e.Status)

{

case GeoPositionStatus.Disabled:

if (myGeoWatcher.Permission ==

GeoPositionPermission.Denied)

{

GeoStatus.Text = " ";

}

else

{

GeoStatus.Text =

" ";

}

break;

case GeoPositionStatus.Initializing:

GeoStatus.Text = " ";

break;

case GeoPositionStatus.NoData:

GeoStatus.Text =

" ";

break;

case GeoPositionStatus.Ready:

GeoStatus.Text =

" ";

break;

}

 

}

, .

Pushpin:

private Pushpin myPushpin;

:

myPushpin = new Pushpin();

, :

myPushpin.Location = e.Position.Location;

if (!MyMap.Children.Contains(myPushpin)) MyMap.Children.Add(myPushpin);

(F5) , . , , ; .

 



<== | ==>
YlY. |
:


: 2017-02-24; !; : 309 |


:

:

.
==> ...

1726 - | 1514 -


© 2015-2024 lektsii.org - -

: 0.305 .