码迷,mamicode.com
首页 > Windows程序 > 详细

win10 uwp 装机必备应用 含源代码

时间:2015-12-03 23:25:22      阅读:608      评论:0      收藏:0      [点我收藏+]

标签:

zhxilin大神说http://www.cnblogs.com/zhxilin/p/4819372.html这文章说到了使用await Windows.System.Launcher.LaunchUriAsync(new Uri(uri));
打开应用商店

我想到了装机必备的一个软件

大概界面
技术分享

求轻喷

我设计了MainPage.xaml拥有两个Frame
单例model

https://www.microsoft.com/zh-cn/store/top-free/apps/pc得到软件图片
技术分享
Button可以设置Content为Grid

                        <Button.Content>
                                <Grid>
                                    <Grid.RowDefinitions>
                                        <RowDefinition Height="auto"/>
                                        <RowDefinition Height="auto"/>
                                    </Grid.RowDefinitions>
                                    <Image Source="ms-appx:///Assets/QQ.png" Grid.Row="0" ScrollViewer.VerticalScrollBarVisibility="Disabled" />
                                    <TextBlock Text="搜狐视频" Grid.Row="1" HorizontalAlignment="Center" />
                                </Grid>
                            </Button.Content>
                        </Button>

button设置大小和图片一样,就可以把图片填到button作为按钮

右击获得应用软件QQ的ProductId,
ProductId是点击链接最后的
技术分享
9wzdncrfj1ps

使用

            string uri = "ms-windows-store://pdp/?ProductId=9wzdncrfj1ps";
            await Windows.System.Launcher.LaunchUriAsync(new Uri(uri));

在按钮写<Button Click="QQ_Click" Width="50" Height="50" Margin="10,10,10,10" Padding="0"/>

就可以点击跳转应用商店

技术分享

在页面跳转到QQ页面chatcommunicationframe.Navigate(typeof(chatcommunication));

因为

            string uri = "ms-windows-store://pdp/?ProductId=9wzdncrfj1ps";
            await Windows.System.Launcher.LaunchUriAsync(new Uri(uri));

在每次打开应用都使用,放在model

        public async void windowsapp(string ProductId)
        {
            string uri = $"ms-windows-store://pdp/?ProductId={ProductId}";
            await Windows.System.Launcher.LaunchUriAsync(new Uri(uri));
        }

可以使用

        private void souhu_Click(object sender , RoutedEventArgs e)
        {            
            string ProductId = "9wzdncrfhvq0";
            _model.windowsapp(ProductId);
        }

view:
chatcommunication.xaml
movie.xaml
model.cs

MainPage.xaml

<Page
    x:Class="classifyapp.MainPage"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:local="using:classifyapp"
    xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
    xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
    mc:Ignorable="d">

    <Grid Background="{ThemeResource ApplicationPageBackgroundThemeBrush}">
        <Grid.RowDefinitions>
            <RowDefinition Height="auto"/>
            <RowDefinition Height="auto"/>
        </Grid.RowDefinitions>
        <Frame Name="chatcommunicationframe" Grid.Row="0" Margin="10,10,10,10"/>
        <Frame Name="movieframe" Grid.Row="1" Margin="10,10,10,10"/>

    </Grid>
</Page>

chatcommunication.xaml:

<Page
    x:Class="classifyapp.view.chatcommunication"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:local="using:classifyapp"
    xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
    xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
    mc:Ignorable="d">

    <Grid Background="{ThemeResource ApplicationPageBackgroundThemeBrush}">
        <Border>
            <Border.Background>
                <LinearGradientBrush EndPoint="0.5,1" StartPoint="0.5,0">
                    <GradientStop Color="#FF6369EB" Offset="0"/>
                    <GradientStop Color="#FFFAFBFF" Offset="1"/>
                </LinearGradientBrush>
            </Border.Background>
            <Grid>
            <Grid.RowDefinitions>
                <RowDefinition Height="auto"/>
                <RowDefinition />
            </Grid.RowDefinitions>
            <TextBlock Text="聊天" Grid.Row="0" Margin="10,10,10,10"/>
            <Grid Grid.Row="1">
                <GridView >
                    <Button Click="QQ_Click" Width="50" Height="50" Margin="10,10,10,10" Padding="0">
                        <Button.Content>
                            <Image Source="ms-appx:///Assets/QQ.png" ScrollViewer.VerticalScrollBarVisibility="Disabled" />
                        </Button.Content>
                    </Button>

                </GridView>
            </Grid>
        </Grid>
        </Border>
    </Grid>
</Page>

movie.xaml

<Page
    x:Class="classifyapp.view.movie"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:local="using:classifyapp"
    xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
    xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
    mc:Ignorable="d">

    <Grid Background="{ThemeResource ApplicationPageBackgroundThemeBrush}">
        <Border>
            <Border.Background>
                <LinearGradientBrush EndPoint="0.5,1" StartPoint="0.5,0">
                    <GradientStop Color="#FF6369EB" Offset="0"/>
                    <GradientStop Color="#FFFAFBFF" Offset="1"/>
                </LinearGradientBrush>
            </Border.Background>
            <Grid>
                <Grid.RowDefinitions>
                    <RowDefinition Height="auto"/>
                    <RowDefinition />
                </Grid.RowDefinitions>
                <TextBlock Text="视频" Grid.Row="0" Margin="10,10,10,10"/>
                <Grid Grid.Row="1">
                    <GridView >
                        <Button Click="souhu_Click" Width="50" Height="50" Margin="10,10,10,10" Padding="0" >
                            <Button.Content>
                                <Grid>
                                    <Grid.RowDefinitions>
                                        <RowDefinition Height="auto"/>
                                        <RowDefinition Height="auto"/>
                                    </Grid.RowDefinitions>
                                    <Image Source="ms-appx:///Assets/搜狐.png" Grid.Row="0" ScrollViewer.VerticalScrollBarVisibility="Disabled" />
                                    <TextBlock Text="搜狐视频" Grid.Row="1" HorizontalAlignment="Center" />
                                </Grid>
                            </Button.Content>
                        </Button>

                        <Button Click="blibli_Click" Width="50" Height="50" Margin="10,10,10,10" Padding="0">
                            <Button.Content>
                                <Grid>
                                    <Grid.RowDefinitions>
                                        <RowDefinition Height="auto"/>
                                        <RowDefinition Height="auto"/>
                                    </Grid.RowDefinitions>
                                    <Image Source="ms-appx:///Assets/blibli.png" ScrollViewer.VerticalScrollBarVisibility="Disabled" />
                                    <TextBlock Text="搜狐视频" Grid.Row="1" HorizontalAlignment="Center" />
                                </Grid>
                            </Button.Content>
                        </Button>

                        <Button Click="manguo_Click" Width="50" Height="50" Margin="10,10,10,10" Padding="0">
                            <Button.Content>
                                <Grid>
                                    <Grid.RowDefinitions>
                                        <RowDefinition Height="auto"/>
                                        <RowDefinition Height="auto"/>
                                    </Grid.RowDefinitions>
                                    <Image Source="ms-appx:///Assets/芒果.png" Width="50" ScrollViewer.VerticalScrollBarVisibility="Disabled" />
                                    <TextBlock Text="芒果TV" Grid.Row="1" HorizontalAlignment="Center" />
                                </Grid>
                            </Button.Content>
                        </Button>

                        <Button Click="youku_Click" Width="50" Height="50" Margin="10,10,10,10" Padding="0">
                            <Button.Content>
                                <Grid>
                                    <Grid.RowDefinitions>
                                        <RowDefinition Height="auto"/>
                                        <RowDefinition Height="auto"/>
                                    </Grid.RowDefinitions>
                                    <Image Source="ms-appx:///Assets/优酷.png" Width="50" ScrollViewer.VerticalScrollBarVisibility="Disabled" />
                                    <TextBlock Text="优酷TV" Grid.Row="1" HorizontalAlignment="Center" />
                                </Grid>
                            </Button.Content>
                        </Button>

                        <Button Click="baofengyingyin_Click" Width="50" Height="50" Margin="10,10,10,10" Padding="0">
                            <Button.Content>
                                <Grid>
                                    <Grid.RowDefinitions>
                                        <RowDefinition Height="auto"/>
                                        <RowDefinition Height="auto"/>
                                    </Grid.RowDefinitions>
                                    <Image Source="ms-appx:///Assets/暴风影音.png" Width="50" ScrollViewer.VerticalScrollBarVisibility="Disabled" />
                                    <TextBlock Text="暴风影音" Grid.Row="1" HorizontalAlignment="Center" />
                                </Grid>
                            </Button.Content>
                        </Button>
                    </GridView>
                </Grid>
            </Grid>
        </Border>
    </Grid>

</Page>

没有使用比较多的东西,简单单例,按钮,frame,GridView,没有使用bind,动画
margin可以使用”10”,我都是使用”10,10,10,10”,虽然好多写法可以简单,让代码变少,也不会容易出错,但是没有那么多,只是做一个看到的想到的好的东西,虽然这个应该发布是不会的,但是也有一些想不开的也许就发出来,有人想要。不过这样只是在博客可以这样说,实际的软件这样开发,根本做不到,因为没有那么多人都知道我的想法,知道了也不会开发出来,除了技术还有的是做出来是他想的。
也没有那些跳转出来的,好看的,我设计看起来没有一点好,本来想做一个好看的天蓝,最后成了上面的那个

技术分享

需要的技术很少
做出来可以是一个装机必备,不知有谁想到这么简单技术做出的,可以卖软件,不知道有谁要,挂个价格100

代码:https://code.csdn.net/lindexi_gd/lindexi_gd/tree/master/classifyapp

参考:https://msdn.microsoft.com/en-us/library/windows/apps/mt228343.aspx

win10 uwp 装机必备应用 含源代码

标签:

原文地址:http://blog.csdn.net/lindexi_gd/article/details/50166161

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!