uwp 基础知识
(TitleId,DiaplayName,args,LogoUri,size);
Obj.VisualElements.ShowNameOnSquare150x150Logo = true;
if (await Obj.RequestCreateAsync())
{
await new MessageDialog("OK").ShowAsync();
}
}

删除,修改磁贴

private async void Button_Click_1(object sender, RoutedEventArgs e)
{
//磁贴的唯一标识
string TitleId = "My_Title";
var Title = new SecondaryTile(TitleId); Title.VisualElements.ShowNameOnSquare150x150Logo = false;
await Title.RequestDeleteAsync(); }

磁贴通知

var toast = ToastNotificationManager.GetTemplateContent(ToastTemplateType.ToastText01);
var textNodes = toast.GetElementsByTagName("text");
textNodes[0].InnerText = "呵呵呵";
textNodes[1].InnerText = "你是猴子请来的救兵吗?";
textNodes[2].InnerText = "呵呵呵";
var Message = new TileNotification(toast);
TileUpdateManager.CreateTileUpdaterForSecondaryTile("My_Title").Update(Message);

HttpClient
string url = "http://www.baidu.com";
HttpClient client = new HttpClient();
string responce = await client.GetStringAsync(url);
Weather天气实战
利用GPS获取手机坐标(经纬度)
var geo = new Geolocator();
var P = await geo.GetGeopositionAsync();
var Po = P.Coordinate.Point.Position;
百度地图API获取位置信息

string AppId = "XTTNdkZYIFCIqKVW1vfYUID3eWOgizwC";
string Type = "json"; string Url = "http://api.map.baidu.com/geocoder/v2/?ak=" + AppId + "&location=" + Po.Latitude + "," + Po.Longitude + "&output=" + Type + ""; HttpClient client = new HttpClient();
var json = await client.GetStringAsync(Url); JsonObject jsonRes = JsonObject.Parse(json);
var City = jsonRes.GetNamedObject("result").GetNamedObject("addressComponent").GetNamedString("city");

百度天气接口 获取天气信息
string WeaApi = "http://api.map.baidu.com/telematics/v3/weather?location=" + City + "&output=json&ak=" + AppId;
var WeatherJson = await client.GetStringAsync(WeaApi);
Info i= JsonConvert.DeserializeObject<Info>(WeatherJson);
this.DataContext = i;
天气信息 Info Class

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks; namespace Weather
{
public class Info
{
public int error { get; set; }
public string status { get; set; }
public string date { get; set; }
public List<result> results { get; set; } } public class result
{
public string currentCity { get; set; }
public string pm25 { get; set; } public IList<indexitem> index { get; set; }
public IList<weather_data_item> weather_data { get; set; }
} public struct weather_data_item
{
public string date { get; set; }
public string dayPictureUrl { get; set; }
public string nightPictureUrl { get; set; }
public string weather { get; set; }
public string wind { get; set; }
public string temperature { get; set; } } public struct indexitem
{ public string title { get; set; }
public string zs { get; set; }
public string tipt { get; set; }
public string des { get; set; }
}
}

前台Xmal代码绑定

<Page
x:Class="Weather.MainPage"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:local="using:Weather"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
mc:Ignorable="d"
Background="{ThemeResource ApplicationPageBackgroundThemeBrush}"> <Grid>
<Grid.Background>
<ImageBrush ImageSource="ms-appx:///Assets/zhuo.jpeg"/>
</Grid.Background>
<ProgressRing x:Name="gif"></ProgressRing>
<Hub Header="Weather">
<HubSection>
<DataTemplate>
<StackPanel>
<TextBlock Text="{Binding results[0].currentCity}" FontSize="60"></TextBlock>
<TextBlock Text="{Binding results[0].pm25}" FontSize="30"></TextBlock>
</StackPanel>
</DataTemplate>
</HubSection>
<HubSection>
<DataTemplate>
<ListView ItemsSource="{Binding results[0].weather_data}">
<ListView.ItemTemplate>
<DataTemplate> <Border Width="360" BorderThickness="2" BorderBrush="Green">
<StackPanel>
<TextBlock Text="{Binding date}" FontSize="25"></TextBlock>
<TextBlock Text="{Binding weather}" FontSize="30"></TextBlock>
<StackPanel Orientation="Horizontal">
<Image Source="{Binding dayPictureUrl}" Stretch="Uniform" Width="60" Height="60"></Image>
</StackPanel>
<TextBlock Text="{Binding wind}" FontSize="25"></TextBlock>
<TextBlock Text="{Binding temperature}" FontSize="30"></TextBlock> </StackPanel>
</Border> </DataTemplate>
</ListView.ItemTemplate>
</ListView>
</DataTemplate>
</HubSection>
<HubSection>
<DataTemplate>
<ListView ItemsSource="{Binding results[0].index}">
<ListView.ItemTemplate>
<DataTemplate>
<Border>
<StackPanel>
<TextBlock Text="{Binding tipt}" FontSize="25" Foreground="#FF2996AE"></TextBlock>
<TextBlock Text="{Binding zs}" FontSize="30" Foreground="Green"></TextBlock>
<TextBlock Text="{Binding des}" FontSize="20" TextWrapping="Wrap"></TextBlock>
</StackPanel>
</Border>
</DataTemplate>
</ListView.ItemTemplate>
</ListView>
</DataTemplate>
</HubSection>
</Hub>
</Grid>
</Page>

天气数据加载时用ProgressRing控制

<ProgressRing x:Name="Pro"></ProgressRing> 加载前 Pro.IsActive=True; 加载完毕 Pro.IsActive=false;




数据绑定

public class User
{
public string Name { get; set; }
public string Phone { get; set; }
public string Address { get; set; }
} protected override void OnNavigatedTo(NavigationEventArgs e)
{
// TODO: 准备此处显示的页面。 // TODO: 如果您的应用程序包含多个页面,请确保
// 通过注册以下事件来处理硬件“后退”按钮:
// Windows.Phone.UI.Input.HardwareButtons.BackPressed 事件。
// 如果使用由某些模板提供的 NavigationHelper,
// 则系统会为您处理该事件。 User U = new User();
U.Name = "张三";
U.Phone = "1888";
U.Address = "东北";
this.DataContext = U;
}

<TextBox Text="{Binding }"></TextBox>
<TextBox Text="{Binding Name}"></TextBox>
<TextBox Text="{Binding Address}"></TextBox>
UWP汉堡包菜单

Xaml:
<Grid Background="{ThemeResource ApplicationPageBackgroundThemeBrush}"> <AppBarButton Click="Button_Click" Height="50" Width="50">
<SymbolIcon Symbol="Bold" HorizontalAlignment="Left" VerticalAlignment="Top"/>
</AppBarButton> <SplitView x:Name="mySplit" DisplayMode="CompactOverlay" CompactPaneLength="0"
OpenPaneLength="200" IsPaneOpen="False" > <SplitView.Pane>
<StackPanel Background="Pink">
<AppBarButton Click="Button_Click" Height="50" Width="50">
<SymbolIcon Symbol="Bold" HorizontalAlignment="Left" VerticalAlignment="Top"/>
</AppBarButton>
<TextBlock FontSize="20">第一项</TextBlock>
<TextBlock FontSize="20">第二项</TextBlock>
<TextBlock FontSize="20">第一项</TextBlock>
<TextBlock FontSize="20">第二项</TextBlock>
<TextBlock FontSize="20">第一项</TextBlock>
<TextBlock FontSize="20">第二项</TextBlock>
</StackPanel>
</SplitView.Pane>
<TextBlock HorizontalAlignment="Center"
VerticalAlignment="Center" FontSize="100">Spring</TextBlock>
</SplitView>
</Grid>
CS:
private void Button_Click(object sender, RoutedEventArgs e)
{
mySplit.IsPaneOpen = !mySplit.IsPaneOpen;
}
uwp 基础知识的更多相关文章
- 背水一战 Windows 10 (75) - 控件(控件基类): FrameworkElement - 基础知识, 相关事件, HorizontalAlignment, VerticalAlignment
[源码下载] 背水一战 Windows 10 (75) - 控件(控件基类): FrameworkElement - 基础知识, 相关事件, HorizontalAlignment, Vertical ...
- 背水一战 Windows 10 (56) - 控件(集合类): ListViewBase - 基础知识, 拖动项
[源码下载] 背水一战 Windows 10 (56) - 控件(集合类): ListViewBase - 基础知识, 拖动项 作者:webabcd 介绍背水一战 Windows 10 之 控件(集合 ...
- C# 基础知识系列- 16 开发工具篇
0. 前言 这是C# 基础知识系列的最后一个内容讲解篇,下一篇是基础知识-实战篇.这一篇主要讲解一下C#程序的结构和主要编程工具. 1. 工具 工欲善其事必先利其器,在实际动手之前我们先来看看想要编写 ...
- .NET面试题系列[1] - .NET框架基础知识(1)
很明显,CLS是CTS的一个子集,而且是最小的子集. - 张子阳 .NET框架基础知识(1) 参考资料: http://www.tracefact.net/CLR-and-Framework/DotN ...
- RabbitMQ基础知识
RabbitMQ基础知识 一.背景 RabbitMQ是一个由erlang开发的AMQP(Advanced Message Queue )的开源实现.AMQP 的出现其实也是应了广大人民群众的需求,虽然 ...
- Java基础知识(壹)
写在前面的话 这篇博客,是很早之前自己的学习Java基础知识的,所记录的内容,仅仅是当时学习的一个总结随笔.现在分享出来,希望能帮助大家,如有不足的,希望大家支出. 后续会继续分享基础知识手记.希望能 ...
- selenium自动化基础知识
什么是自动化测试? 自动化测试分为:功能自动化和性能自动化 功能自动化即使用计算机通过编码的方式来替代手工测试,完成一些重复性比较高的测试,解放测试人员的测试压力.同时,如果系统有不份模块更改后,只要 ...
- [SQL] SQL 基础知识梳理(一)- 数据库与 SQL
SQL 基础知识梳理(一)- 数据库与 SQL [博主]反骨仔 [原文地址]http://www.cnblogs.com/liqingwen/p/5902856.html 目录 What's 数据库 ...
- [SQL] SQL 基础知识梳理(二) - 查询基础
SQL 基础知识梳理(二) - 查询基础 [博主]反骨仔 [原文]http://www.cnblogs.com/liqingwen/p/5904824.html 序 这是<SQL 基础知识梳理( ...
随机推荐
- python 异常获取方法
import sys #第1:print(6/0) #直接运行该命令,出现异常,程序终止 #异常提示: '''Traceback (most recent call last): File " ...
- Java基础00-运算符4
1. 算术运算符 1.1 运算符和表达式 1.2 算数运算符 余数的计算取余数是指整数除法中被除数未被除尽部分,且余数的取值范围为0到除数之间(不包括除数)的整数 ,例如27除以6,商数为4,余数为3 ...
- org.apache.maven.archiver.mavenarchiver.getmanifest怎么解决——原因就是你的maven的配置文件不是最新的
转载:https://www.cnblogs.com/flytop/p/8933728.html原因就是你的maven的配置文件不是最新的 1.help ->Install New Softwa ...
- Redis主从复制那点事
我们在 Redis持久化机制你学会了吗?学习了AOF和RDB,如果Redis宕机,他们分别通过回放日志和重新读入RDB文件的方式恢复数据,从而提高可靠性.我们今天来想这么一个问题,假如我们 ...
- ssm框架下 数据库连接异常 java.sql.SQLException: The server time zone value '???ú±ê×??±??' is unrecognized or represents more
1.错误截图 2.修改操作 我是在框架的中连接的数据库,如果在类中把 &换成& 修改前代码 <property value="com.mysql.jdbc.Dri ...
- Django的ORM如何执行group by 语句
问题描述: 使用Django的ORM建立了如下Model: class Book(models.Model): name = models.CharField(max_length=300) page ...
- c++ 父类 子类 虚表占用内存空间情况
#include <iostream> using namespace std; class C {}; class A:public C { private: long a; long ...
- intouch 开发源程序加密方法
在先前项目中,因为同行竞争被拷贝走了源程序代码,以至于被上司责备,故而亡羊补牢对intouch(10.1老版本进行源代码加密探索)整理方法如下. 1.intouch wondermarker打开源程序 ...
- EF中数据修改时动态更新其他数据
场景 利用.net core开发时,经常会遇到使用EF(Entity Framework),但是今天在开发过程中发现一个值莫名其妙的自己变了,我怀疑是EF的问题. 主要代码如下: 1 // 最近一条告 ...
- JBoss 5.x/6.x 反序列化漏洞(CVE-2017-12149)
检测