File access sample

This sample shows how to create, read, write, copy and delete a file, how to retrieve file properties, and how to track a file or folder so that your app can access it again. This sample uses Windows.Storage and Windows.Storage.AccessCache API.

 
 
 
 
 
(32)
99.379 veces
Agregar a favoritos
09/04/2013
E-mail del.icio.us Digg Facebook Reddit Barrapunto Twitter Windows Live Favorites Windows Live Spaces

Explorador de soluciones,

C++
C#
JavaScript
VB.NET
<!--
//*********************************************************
//
// Copyright (c) Microsoft. All rights reserved.
// THIS CODE IS PROVIDED *AS IS* WITHOUT WARRANTY OF
// ANY KIND, EITHER EXPRESS OR IMPLIED, INCLUDING ANY
// IMPLIED WARRANTIES OF FITNESS FOR A PARTICULAR
// PURPOSE, MERCHANTABILITY, OR NON-INFRINGEMENT.
//
//*********************************************************
-->
<common:LayoutAwarePage
    x:Class="FileAccess.Scenario2"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:local="using:FileAccess"
    xmlns:common="using:SDKTemplate.Common"
    xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
    xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
    mc:Ignorable="d">

    <Grid x:Name="LayoutRoot" Background="White">
        <Grid.RowDefinitions>
            <RowDefinition Height="Auto"/>
            <RowDefinition Height="*"/>
        </Grid.RowDefinitions>

        <Grid x:Name="Input" Grid.Row="0">
            <Grid.RowDefinitions>
                <RowDefinition Height="Auto"/>
                <RowDefinition Height="Auto"/>
            </Grid.RowDefinitions>
            <Grid.ColumnDefinitions>
                <ColumnDefinition Width="*"/>
            </Grid.ColumnDefinitions>

            <TextBlock Grid.Row="0" Style="{StaticResource BasicTextStyle}" TextWrapping="Wrap" HorizontalAlignment="Left">
                To write some text to 'sample.dat', type something in the textbox below and click 'Write'.
                To read the contents of 'sample.dat', click 'Read'.
            </TextBlock>

            <StackPanel Grid.Row="1" Orientation="Vertical">
                <TextBox x:Name="InputTextBox" IsReadOnly="false" HorizontalAlignment="Stretch" VerticalAlignment="Top" Height="100" TextWrapping="Wrap" AcceptsReturn="True"/>
                <StackPanel Orientation="Horizontal" Margin="10,10,10,10">
                    <Button x:Name="WriteTextButton" Content="Write" Margin="0,0,10,0"/>
                    <Button x:Name="ReadTextButton" Content="Read" Margin="0,0,10,0"/>
                </StackPanel>
            </StackPanel>
        </Grid>

        <Grid x:Name="Output" HorizontalAlignment="Left" VerticalAlignment="Top" Grid.Row="1">
            <TextBlock x:Name="OutputTextBlock" Style="{StaticResource BasicTextStyle}" TextWrapping="Wrap"/>
        </Grid>

        <!-- Add Storyboards to the visual states below as necessary for supporting the various layouts -->
        <VisualStateManager.VisualStateGroups>
            <VisualStateGroup>
                <VisualState x:Name="FullScreenLandscape"/>
                <VisualState x:Name="Filled"/>
                <VisualState x:Name="FullScreenPortrait"/>
                <VisualState x:Name="Snapped"/>
            </VisualStateGroup>
        </VisualStateManager.VisualStateGroups>

    </Grid>
</common:LayoutAwarePage>