* added new sample

* added assets

* deleted old project

* updated screenshot
This commit is contained in:
Mykyta Bondarenko 2018-12-07 06:25:53 +02:00 коммит произвёл Craig Dunn
Родитель 04120c79a4
Коммит 2e9220aba8
53 изменённых файлов: 846 добавлений и 453 удалений

Просмотреть файл

@ -1,25 +1,21 @@
using Foundation;
using Foundation;
using UIKit;
namespace FileSystem
{
/// <summary>
/// Sizes the window according to the screen, for iPad as well as iPhone support
/// </summary>
[Register ("AppDelegate")]
public class AppDelegate : UIApplicationDelegate
{
UIWindow window;
public override bool FinishedLaunching (UIApplication app, NSDictionary options)
{
var viewController = new FileSystemViewController();
// The UIApplicationDelegate for the application. This class is responsible for launching the
// User Interface of the application, as well as listening (and optionally responding) to application events from iOS.
[Register("AppDelegate")]
public class AppDelegate : UIApplicationDelegate
{
public override UIWindow Window { get; set; }
window = new UIWindow (UIScreen.MainScreen.Bounds);
window.BackgroundColor = UIColor.White;
window.Bounds = UIScreen.MainScreen.Bounds;
window.RootViewController = viewController;
window.MakeKeyAndVisible ();
return true;
}
}
}
public override bool FinishedLaunching(UIApplication application, NSDictionary launchOptions)
{
// Override point for customization after application launch.
// If not required for your application you can safely delete this method
return true;
}
}
}

Просмотреть файл

@ -0,0 +1,244 @@
{
"images": [
{
"size": "20x20",
"scale": "2x",
"idiom": "iphone"
},
{
"size": "20x20",
"scale": "3x",
"idiom": "iphone"
},
{
"filename": "icon-spotlight-29@2x.png",
"size": "29x29",
"scale": "2x",
"idiom": "iphone"
},
{
"filename": "icon-spotlight-29@3x.png",
"size": "29x29",
"scale": "3x",
"idiom": "iphone"
},
{
"filename": "icon-spotlight-40@2x.png",
"size": "40x40",
"scale": "2x",
"idiom": "iphone"
},
{
"filename": "icon-spotlight-40@3x.png",
"size": "40x40",
"scale": "3x",
"idiom": "iphone"
},
{
"filename": "icon-app-60@2x.png",
"size": "60x60",
"scale": "2x",
"idiom": "iphone"
},
{
"filename": "Icon-app-60@3x.png",
"size": "60x60",
"scale": "3x",
"idiom": "iphone"
},
{
"size": "20x20",
"scale": "1x",
"idiom": "ipad"
},
{
"size": "20x20",
"scale": "2x",
"idiom": "ipad"
},
{
"filename": "icon-spotlight-29.png",
"size": "29x29",
"scale": "1x",
"idiom": "ipad"
},
{
"filename": "icon-spotlight-29@2x.png",
"size": "29x29",
"scale": "2x",
"idiom": "ipad"
},
{
"size": "40x40",
"scale": "1x",
"idiom": "ipad"
},
{
"filename": "icon-spotlight-40@2x.png",
"size": "40x40",
"scale": "2x",
"idiom": "ipad"
},
{
"filename": "Icon-app-83.5@2x.png",
"size": "83.5x83.5",
"scale": "2x",
"idiom": "ipad"
},
{
"filename": "icon-app-76.png",
"size": "76x76",
"scale": "1x",
"idiom": "ipad"
},
{
"filename": "icon-app-76@2x.png",
"size": "76x76",
"scale": "2x",
"idiom": "ipad"
},
{
"filename": "app-store-logo.png",
"size": "1024x1024",
"scale": "1x",
"idiom": "ios-marketing"
},
{
"size": "60x60",
"scale": "2x",
"idiom": "car"
},
{
"size": "60x60",
"scale": "3x",
"idiom": "car"
},
{
"role": "notificationCenter",
"size": "24x24",
"subtype": "38mm",
"scale": "2x",
"idiom": "watch"
},
{
"role": "notificationCenter",
"size": "27.5x27.5",
"subtype": "42mm",
"scale": "2x",
"idiom": "watch"
},
{
"role": "companionSettings",
"size": "29x29",
"scale": "2x",
"idiom": "watch"
},
{
"role": "companionSettings",
"size": "29x29",
"scale": "3x",
"idiom": "watch"
},
{
"role": "appLauncher",
"size": "40x40",
"subtype": "38mm",
"scale": "2x",
"idiom": "watch"
},
{
"role": "appLauncher",
"size": "44x44",
"subtype": "40mm",
"scale": "2x",
"idiom": "watch"
},
{
"role": "appLauncher",
"size": "50x50",
"subtype": "44mm",
"scale": "2x",
"idiom": "watch"
},
{
"role": "quickLook",
"size": "86x86",
"subtype": "38mm",
"scale": "2x",
"idiom": "watch"
},
{
"role": "quickLook",
"size": "98x98",
"subtype": "42mm",
"scale": "2x",
"idiom": "watch"
},
{
"role": "quickLook",
"size": "108x108",
"subtype": "44mm",
"scale": "2x",
"idiom": "watch"
},
{
"size": "1024x1024",
"scale": "1x",
"idiom": "watch-marketing"
},
{
"size": "16x16",
"scale": "1x",
"idiom": "mac"
},
{
"size": "16x16",
"scale": "2x",
"idiom": "mac"
},
{
"size": "32x32",
"scale": "1x",
"idiom": "mac"
},
{
"size": "32x32",
"scale": "2x",
"idiom": "mac"
},
{
"size": "128x128",
"scale": "1x",
"idiom": "mac"
},
{
"size": "128x128",
"scale": "2x",
"idiom": "mac"
},
{
"size": "256x256",
"scale": "1x",
"idiom": "mac"
},
{
"size": "256x256",
"scale": "2x",
"idiom": "mac"
},
{
"size": "512x512",
"scale": "1x",
"idiom": "mac"
},
{
"size": "512x512",
"scale": "2x",
"idiom": "mac"
}
],
"info": {
"version": 1,
"author": "xcode"
}
}

Двоичный файл не отображается.

После

Ширина:  |  Высота:  |  Размер: 5.0 KiB

Двоичный файл не отображается.

После

Ширина:  |  Высота:  |  Размер: 8.6 KiB

Двоичный файл не отображается.

После

Ширина:  |  Высота:  |  Размер: 22 KiB

Двоичный файл не отображается.

После

Ширина:  |  Высота:  |  Размер: 3.3 KiB

Двоичный файл не отображается.

После

Ширина:  |  Высота:  |  Размер: 2.0 KiB

Двоичный файл не отображается.

После

Ширина:  |  Высота:  |  Размер: 4.3 KiB

Двоичный файл не отображается.

После

Ширина:  |  Высота:  |  Размер: 900 B

Двоичный файл не отображается.

После

Ширина:  |  Высота:  |  Размер: 1.8 KiB

Двоичный файл не отображается.

После

Ширина:  |  Высота:  |  Размер: 2.5 KiB

Двоичный файл не отображается.

После

Ширина:  |  Высота:  |  Размер: 2.2 KiB

Двоичный файл не отображается.

После

Ширина:  |  Высота:  |  Размер: 3.3 KiB

Просмотреть файл

@ -0,0 +1,6 @@
{
"info" : {
"version" : 1,
"author" : "xcode"
}
}

Просмотреть файл

@ -1,28 +0,0 @@
using System;
using System.Collections.Generic;
using Foundation;
namespace FileSystem
{
// We use the Preserve attribute to ensure that all the properties of the object
// are preserve even when the linker is ran on the assembly. The reasoning
// for this pattern is to ensure that libraries, such as Newsoft.Json, that use
// reflection can find properties that could be removed by the linker.
[Preserve]
public class Account
{
#region Computed Properties
public string Email { get; set; }
public bool Active { get; set; }
public DateTime CreatedDate { get; set; }
public List<string> Roles { get; set; }
#endregion
#region Constructors
public Account() {
}
#endregion
}
}

Просмотреть файл

@ -0,0 +1,113 @@
using Newtonsoft.Json;
using System;
using System.Collections.Generic;
using System.IO;
using System.Text;
using System.Xml.Serialization;
namespace FileSystem
{
/// <summary>
/// This class contains the code shown in the article "Working with the File System"
/// </summary>
public static class DataManager
{
public static string ReadText()
{
var text = File.ReadAllText("TestData/ReadMe.txt");
Console.WriteLine(text);
return text;
}
public static string ReadDirectories()
{
var result = new StringBuilder();
var directories = Directory.EnumerateDirectories("./");
foreach (var directory in directories)
{
result.AppendLine(directory);
Console.WriteLine(directory);
}
return result.ToString();
}
public static string ReadAll()
{
var result = new StringBuilder();
var fileOrDirectory = Directory.EnumerateFileSystemEntries("./");
foreach (var entry in fileOrDirectory)
{
result.AppendLine(entry);
Console.WriteLine(entry);
}
return result.ToString();
}
public static string ReadXml()
{
var result = string.Empty;
using (TextReader reader = new StreamReader("TestData/Test.xml"))
{
var serializer = new XmlSerializer(typeof(TestXml));
var xml = serializer.Deserialize(reader) as TestXml;
result = "XML was deserialized." + Environment.NewLine
+ "-----------------" + Environment.NewLine + Environment.NewLine
+ "Title: " + xml.Title + Environment.NewLine
+ "Description: " + xml.Description;
}
return result;
}
public static string WriteFile()
{
var documents = Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments);
var filename = Path.Combine(documents, "Write.txt");
File.WriteAllText(filename, "Write this text into a file!");
return "Text was written to a file." + Environment.NewLine
+ "-----------------" + Environment.NewLine
+ File.ReadAllText(filename);
}
public static string WriteJson()
{
// Create a new record
var account = new Account()
{
Email = "monkey@xamarin.com",
Active = true,
CreatedDate = new DateTime(2015, 5, 27, 0, 0, 0, DateTimeKind.Utc),
Roles = new List<string> { "User", "Admin" }
};
// Serialize object
var json = JsonConvert.SerializeObject(account, Formatting.Indented);
// Save to file
var documents = Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments);
var filename = Path.Combine(documents, "account.json");
File.WriteAllText(filename, json);
return json;
}
public static string CreateDirectory()
{
var documents = Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments);
var directoryName = Path.Combine(documents, "NewDirectory");
Directory.CreateDirectory(directoryName);
return "A directory was created." + Environment.NewLine
+ "-----------------" + Environment.NewLine
+ directoryName;
}
}
}

Просмотреть файл

@ -0,0 +1,6 @@
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
</dict>
</plist>

Просмотреть файл

@ -1,125 +1,136 @@
<?xml version="1.0" encoding="utf-8"?>
<Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">iPhoneSimulator</Platform>
<ProductVersion>8.0.30703</ProductVersion>
<SchemaVersion>2.0</SchemaVersion>
<ProjectGuid>{367D4ECC-D04A-41FB-A784-4D10F30666C8}</ProjectGuid>
<ProjectTypeGuids>{FEACFBD2-3405-455C-9665-78FE426C6842};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
<OutputType>Exe</OutputType>
<RootNamespace>FileSystem</RootNamespace>
<AssemblyName>FileSystem</AssemblyName>
<TargetFrameworkIdentifier>Xamarin.iOS</TargetFrameworkIdentifier>
<TargetFrameworkVersion>v1.0</TargetFrameworkVersion>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|iPhoneSimulator' ">
<DebugSymbols>True</DebugSymbols>
<DebugType>full</DebugType>
<Optimize>False</Optimize>
<OutputPath>bin\iPhoneSimulator\Debug</OutputPath>
<DefineConstants>DEBUG</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
<MtouchDebug>True</MtouchDebug>
<ConsolePause>False</ConsolePause>
<MtouchArch>x86_64</MtouchArch>
<MtouchI18n></MtouchI18n>
<MtouchUseRefCounting>true</MtouchUseRefCounting>
<MtouchHttpClientHandler>NSUrlSessionHandler</MtouchHttpClientHandler>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|iPhoneSimulator' ">
<DebugType>none</DebugType>
<Optimize>False</Optimize>
<OutputPath>bin\iPhoneSimulator\Release</OutputPath>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
<MtouchLink>None</MtouchLink>
<ConsolePause>False</ConsolePause>
<MtouchArch>x86_64</MtouchArch>
<MtouchI18n></MtouchI18n>
<MtouchHttpClientHandler>NSUrlSessionHandler</MtouchHttpClientHandler>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|iPhone' ">
<DebugSymbols>True</DebugSymbols>
<DebugType>full</DebugType>
<Optimize>False</Optimize>
<OutputPath>bin\iPhone\Debug</OutputPath>
<DefineConstants>DEBUG</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
<MtouchDebug>True</MtouchDebug>
<CodesignKey>iPhone Developer</CodesignKey>
<ConsolePause>False</ConsolePause>
<MtouchArch>ARM64</MtouchArch>
<MtouchHttpClientHandler>NSUrlSessionHandler</MtouchHttpClientHandler>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|iPhone' ">
<DebugType>none</DebugType>
<Optimize>False</Optimize>
<OutputPath>bin\iPhone\Release</OutputPath>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
<ConsolePause>False</ConsolePause>
<CodesignKey>iPhone Developer</CodesignKey>
<MtouchArch>ARM64</MtouchArch>
<MtouchHttpClientHandler>NSUrlSessionHandler</MtouchHttpClientHandler>
</PropertyGroup>
<ItemGroup>
<Reference Include="System" />
<Reference Include="System.Xml" />
<Reference Include="System.Core" />
<Reference Include="Xamarin.iOS" />
<Reference Include="Newtonsoft.Json">
<HintPath>..\packages\Newtonsoft.Json.7.0.1\lib\portable-net40+sl5+wp80+win8+wpa81\Newtonsoft.Json.dll</HintPath>
</Reference>
</ItemGroup>
<ItemGroup>
<Compile Include="Main.cs" />
<Compile Include="AppDelegate.cs" />
<Compile Include="FileSystemViewController.cs" />
<Compile Include="SampleCode.cs" />
<Compile Include="TestData\TestXml.cs" />
<Compile Include="Classes\Account.cs" />
</ItemGroup>
<ItemGroup>
<Folder Include="TestData\" />
<Folder Include="Resources\" />
<Folder Include="Classes\" />
</ItemGroup>
<ItemGroup>
<Content Include="TestData\ReadMe.txt" />
<Content Include="TestData\Test.xml" />
</ItemGroup>
<ItemGroup>
<None Include="Info.plist" />
<None Include="packages.config" />
</ItemGroup>
<ItemGroup>
<BundleResource Include="Resources\icon-72.png" />
<BundleResource Include="Resources\icon-29.png" />
<BundleResource Include="Resources\icon-50.png" />
<BundleResource Include="Resources\icon-58.png" />
<BundleResource Include="Resources\icon-100.png" />
<BundleResource Include="Resources\iTunesArtwork%402x.png" />
<BundleResource Include="Resources\Default-568h%402x.png" />
<BundleResource Include="Resources\Default-Landscape%402x~ipad.png" />
<BundleResource Include="Resources\Default-Landscape~ipad.png" />
<BundleResource Include="Resources\Default-Portrait%402x~ipad.png" />
<BundleResource Include="Resources\Default-Portrait~ipad.png" />
<BundleResource Include="Resources\Default.png" />
<BundleResource Include="Resources\Default%402x.png" />
<BundleResource Include="Resources\icon-57.png" />
<BundleResource Include="Resources\icon-114.png" />
<BundleResource Include="Resources\icon-144.png" />
<BundleResource Include="Resources\Icon-60%402x.png" />
<BundleResource Include="Resources\Icon-76.png" />
<BundleResource Include="Resources\Icon-76%402x.png" />
<BundleResource Include="Resources\Icon-Small-40.png" />
<BundleResource Include="Resources\Icon-Small-40%402x.png" />
</ItemGroup>
<ItemGroup>
<ITunesArtwork Include="Resources\iTunesArtwork.png" />
</ItemGroup>
<Import Project="$(MSBuildExtensionsPath)\Xamarin\iOS\Xamarin.iOS.CSharp.targets" />
<?xml version="1.0" encoding="utf-8"?>
<Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">iPhoneSimulator</Platform>
<ProductVersion>8.0.30703</ProductVersion>
<SchemaVersion>2.0</SchemaVersion>
<ProjectGuid>{7652DDB4-2A98-4533-8B7A-A662DACF04EB}</ProjectGuid>
<ProjectTypeGuids>{FEACFBD2-3405-455C-9665-78FE426C6842};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
<OutputType>Exe</OutputType>
<RootNamespace>FileSystem</RootNamespace>
<AssemblyName>FileSystem</AssemblyName>
<IPhoneResourcePrefix>Resources</IPhoneResourcePrefix>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|iPhoneSimulator' ">
<DebugSymbols>true</DebugSymbols>
<DebugType>full</DebugType>
<Optimize>false</Optimize>
<OutputPath>bin\iPhoneSimulator\Debug</OutputPath>
<DefineConstants>DEBUG;ENABLE_TEST_CLOUD;</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
<CodesignKey>iPhone Developer</CodesignKey>
<MtouchDebug>true</MtouchDebug>
<MtouchNoSymbolStrip>true</MtouchNoSymbolStrip>
<MtouchFastDev>true</MtouchFastDev>
<IOSDebuggerPort>45354</IOSDebuggerPort>
<MtouchLink>None</MtouchLink>
<MtouchArch>x86_64</MtouchArch>
<MtouchHttpClientHandler>NSUrlSessionHandler</MtouchHttpClientHandler>
<DeviceSpecificBuild>false</DeviceSpecificBuild>
<MtouchVerbosity></MtouchVerbosity>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|iPhone' ">
<DebugType>pdbonly</DebugType>
<Optimize>true</Optimize>
<OutputPath>bin\iPhone\Release</OutputPath>
<DefineConstants></DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
<CodesignKey>iPhone Developer</CodesignKey>
<MtouchUseLlvm>true</MtouchUseLlvm>
<MtouchFloat32>true</MtouchFloat32>
<CodesignEntitlements>Entitlements.plist</CodesignEntitlements>
<MtouchLink>SdkOnly</MtouchLink>
<MtouchArch>ARM64</MtouchArch>
<MtouchHttpClientHandler>NSUrlSessionHandler</MtouchHttpClientHandler>
<MtouchVerbosity></MtouchVerbosity>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|iPhoneSimulator' ">
<DebugType>pdbonly</DebugType>
<Optimize>true</Optimize>
<OutputPath>bin\iPhoneSimulator\Release</OutputPath>
<DefineConstants></DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
<CodesignKey>iPhone Developer</CodesignKey>
<MtouchNoSymbolStrip>true</MtouchNoSymbolStrip>
<MtouchLink>None</MtouchLink>
<MtouchArch>x86_64</MtouchArch>
<MtouchHttpClientHandler>NSUrlSessionHandler</MtouchHttpClientHandler>
<MtouchVerbosity></MtouchVerbosity>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|iPhone' ">
<DebugSymbols>true</DebugSymbols>
<DebugType>full</DebugType>
<Optimize>false</Optimize>
<OutputPath>bin\iPhone\Debug</OutputPath>
<DefineConstants>DEBUG;ENABLE_TEST_CLOUD;</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
<CodesignKey>iPhone Developer</CodesignKey>
<DeviceSpecificBuild>true</DeviceSpecificBuild>
<MtouchDebug>true</MtouchDebug>
<MtouchNoSymbolStrip>true</MtouchNoSymbolStrip>
<MtouchFastDev>true</MtouchFastDev>
<MtouchFloat32>true</MtouchFloat32>
<CodesignEntitlements>Entitlements.plist</CodesignEntitlements>
<IOSDebuggerPort>65459</IOSDebuggerPort>
<MtouchLink>SdkOnly</MtouchLink>
<MtouchArch>ARM64</MtouchArch>
<MtouchHttpClientHandler>NSUrlSessionHandler</MtouchHttpClientHandler>
<MtouchVerbosity></MtouchVerbosity>
</PropertyGroup>
<ItemGroup>
<Reference Include="System" />
<Reference Include="System.Xml" />
<Reference Include="System.Core" />
<Reference Include="Xamarin.iOS" />
<Reference Include="Newtonsoft.Json">
<HintPath>..\packages\Newtonsoft.Json.11.0.2\lib\netstandard2.0\Newtonsoft.Json.dll</HintPath>
</Reference>
</ItemGroup>
<ItemGroup>
<ImageAsset Include="Assets.xcassets\AppIcon.appiconset\Contents.json" />
<ImageAsset Include="Assets.xcassets\Contents.json" />
<ImageAsset Include="Assets.xcassets\AppIcon.appiconset\app-store-logo.png" />
<ImageAsset Include="Assets.xcassets\AppIcon.appiconset\icon-app-60%402x.png" />
<ImageAsset Include="Assets.xcassets\AppIcon.appiconset\Icon-app-60%403x.png" />
<ImageAsset Include="Assets.xcassets\AppIcon.appiconset\Icon-app-83.5%402x.png" />
<ImageAsset Include="Assets.xcassets\AppIcon.appiconset\icon-app-76%402x.png" />
<ImageAsset Include="Assets.xcassets\AppIcon.appiconset\icon-app-76.png" />
<ImageAsset Include="Assets.xcassets\AppIcon.appiconset\icon-spotlight-29.png" />
<ImageAsset Include="Assets.xcassets\AppIcon.appiconset\icon-spotlight-29%402x.png" />
<ImageAsset Include="Assets.xcassets\AppIcon.appiconset\icon-spotlight-29%403x.png" />
<ImageAsset Include="Assets.xcassets\AppIcon.appiconset\icon-spotlight-40%403x.png" />
<ImageAsset Include="Assets.xcassets\AppIcon.appiconset\icon-spotlight-40%402x.png" />
</ItemGroup>
<ItemGroup>
<Folder Include="TestData\" />
</ItemGroup>
<ItemGroup>
<InterfaceDefinition Include="LaunchScreen.storyboard" />
<InterfaceDefinition Include="Main.storyboard" />
</ItemGroup>
<ItemGroup>
<None Include="Info.plist" />
<None Include="Entitlements.plist" />
<None Include="packages.config" />
</ItemGroup>
<ItemGroup>
<Compile Include="Main.cs" />
<Compile Include="AppDelegate.cs" />
<Compile Include="ViewController.cs" />
<Compile Include="ViewController.designer.cs">
<DependentUpon>ViewController.cs</DependentUpon>
</Compile>
<Compile Include="DataManager.cs" />
<Compile Include="Models.cs" />
</ItemGroup>
<ItemGroup>
<Content Include="TestData\ReadMe.txt" />
<Content Include="TestData\Test.xml" />
</ItemGroup>
<Import Project="$(MSBuildExtensionsPath)\Xamarin\iOS\Xamarin.iOS.CSharp.targets" />
</Project>

Просмотреть файл

@ -1,93 +0,0 @@
using System;
using CoreGraphics;
using System.Linq;
using UIKit;
using Foundation;
namespace FileSystem
{
/// <summary>
/// View containing Buttons and TextView to show off the samples
/// </summary>
public class FileSystemViewController : UIViewController
{
UIButton btnFiles, btnDirectories, btnXml, btnAll, btnWrite, btnDirectory;
UITextView txtView;
bool writeJson = true;
public override void ViewDidLoad ()
{
base.ViewDidLoad ();
// Create the buttons and TextView to run the sample code
btnFiles = UIButton.FromType(UIButtonType.RoundedRect);
btnFiles.Frame = new CGRect(10,10,145,50);
btnFiles.SetTitle("Open 'ReadMe.txt'", UIControlState.Normal);
btnDirectories = UIButton.FromType(UIButtonType.RoundedRect);
btnDirectories.Frame = new CGRect(10,70,145,50);
btnDirectories.SetTitle("List Directories", UIControlState.Normal);
btnXml = UIButton.FromType(UIButtonType.RoundedRect);
btnXml.Frame = new CGRect(165,10,145,50);
btnXml.SetTitle("Open 'Test.xml'", UIControlState.Normal);
btnAll = UIButton.FromType(UIButtonType.RoundedRect);
btnAll.Frame = new CGRect(165,70,145,50);
btnAll.SetTitle("List All", UIControlState.Normal);
btnWrite = UIButton.FromType(UIButtonType.RoundedRect);
btnWrite.Frame = new CGRect(10,130,145,50);
btnWrite.SetTitle("Write File", UIControlState.Normal);
btnDirectory = UIButton.FromType(UIButtonType.RoundedRect);
btnDirectory.Frame = new CGRect(165,130,145,50);
btnDirectory.SetTitle("Create Directory", UIControlState.Normal);
txtView = new UITextView(new CGRect(10, 190, 300, 250));
txtView.Editable = false;
txtView.ScrollEnabled = true;
// Wire up the buttons to the SamplCode class methods
btnFiles.TouchUpInside += (sender, e) => {
SampleCode.ReadText(txtView);
};
btnDirectories.TouchUpInside += (sender, e) => {
SampleCode.ReadDirectories(txtView);
};
btnAll.TouchUpInside += (sender, e) => {
SampleCode.ReadAll(txtView);
};
btnXml.TouchUpInside += (sender, e) => {
SampleCode.ReadXml(txtView);
};
btnWrite.TouchUpInside += (sender, e) => {
if (writeJson ) {
SampleCode.WriteJson(txtView);
} else {
SampleCode.WriteFile(txtView);
}
};
btnDirectory.TouchUpInside += (sender, e) => {
SampleCode.CreateDirectory(txtView);
};
// Add the controls to the view
this.Add(btnFiles);
this.Add(btnDirectories);
this.Add(btnXml);
this.Add(btnAll);
this.Add(btnWrite);
this.Add(btnDirectory);
this.Add(txtView);
// Write out this special folder, just for curiousity's sake
Console.WriteLine("MyDocuments:"+Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments));
}
}
}

Просмотреть файл

@ -1,51 +1,41 @@
<?xml version="1.0" encoding="utf-8"?>
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>CFBundleIconFiles</key>
<array>
<string>Resources/icon-57.png</string>
<string>Resources/icon-114.png</string>
<string>Resources/icon-72.png</string>
<string>Resources/icon-144.png</string>
<string>Resources/icon-29.png</string>
<string>Resources/icon-58.png</string>
<string>Resources/icon-50.png</string>
<string>Resources/icon-100.png</string>
<string>Icon-60@2x</string>
<string>Icon-76</string>
<string>Icon-76@2x</string>
<string>Icon-Small-40</string>
<string>Icon-Small-40@2x</string>
</array>
<key>CFBundleDisplayName</key>
<string>FileSystem</string>
<key>CFBundleName</key>
<string>File System</string>
<key>CFBundleIdentifier</key>
<string>com.xamarin.samples.filesystem</string>
<string>com.xamarin.file-system</string>
<key>CFBundleShortVersionString</key>
<string>1.0</string>
<key>CFBundleVersion</key>
<string>1.0</string>
<key>LSRequiresIPhoneOS</key>
<true/>
<key>MinimumOSVersion</key>
<string>9.0</string>
<key>UIDeviceFamily</key>
<array>
<integer>1</integer>
<integer>2</integer>
</array>
<key>UIFileSharingEnabled</key>
<true />
<true/>
<key>UILaunchStoryboardName</key>
<string>LaunchScreen</string>
<key>UIMainStoryboardFile</key>
<string>Main</string>
<key>UIRequiredDeviceCapabilities</key>
<array>
<string>armv7</string>
</array>
<key>UISupportedInterfaceOrientations</key>
<array>
<string>UIInterfaceOrientationPortrait</string>
<string>UIInterfaceOrientationPortraitUpsideDown</string>
<string>UIInterfaceOrientationLandscapeLeft</string>
<string>UIInterfaceOrientationLandscapeRight</string>
</array>
<key>MinimumOSVersion</key>
<string>9.0</string>
<key>UISupportedInterfaceOrientations~ipad</key>
<array>
<string>UIInterfaceOrientationPortrait</string>
<string>UIInterfaceOrientationPortraitUpsideDown</string>
<string>UIInterfaceOrientationLandscapeLeft</string>
<string>UIInterfaceOrientationLandscapeRight</string>
</array>
<key>XSAppIconAssets</key>
<string>Assets.xcassets/AppIcon.appiconset</string>
</dict>
</plist>

Просмотреть файл

@ -0,0 +1,41 @@
<?xml version="1.0" encoding="UTF-8"?>
<document type="com.apple.InterfaceBuilder3.CocoaTouch.Storyboard.XIB" version="3.0" toolsVersion="14460.31" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" launchScreen="YES" useTraitCollections="YES" useSafeAreas="YES" colorMatched="YES" initialViewController="01J-lp-oVM">
<device id="retina4_7" orientation="portrait">
<adaptation id="fullscreen"/>
</device>
<dependencies>
<deployment identifier="iOS"/>
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="14460.20"/>
<capability name="Safe area layout guides" minToolsVersion="9.0"/>
<capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/>
</dependencies>
<scenes>
<!--View Controller-->
<scene sceneID="EHf-IW-A2E">
<objects>
<viewController id="01J-lp-oVM" sceneMemberID="viewController">
<view key="view" contentMode="scaleToFill" id="Ze5-6b-2t3">
<rect key="frame" x="0.0" y="0.0" width="375" height="667"/>
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
<subviews>
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="Xamarin" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="GQa-Eu-V9z">
<rect key="frame" x="117" y="319" width="142" height="48"/>
<fontDescription key="fontDescription" type="system" pointSize="40"/>
<color key="textColor" white="1" alpha="1" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
<nil key="highlightedColor"/>
</label>
</subviews>
<color key="backgroundColor" white="0.0" alpha="1" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
<constraints>
<constraint firstItem="GQa-Eu-V9z" firstAttribute="centerY" secondItem="fKj-eb-QrB" secondAttribute="centerY" id="GnQ-Ov-WZ3"/>
<constraint firstItem="GQa-Eu-V9z" firstAttribute="centerX" secondItem="fKj-eb-QrB" secondAttribute="centerX" id="eVa-7s-Ixu"/>
</constraints>
<viewLayoutGuide key="safeArea" id="fKj-eb-QrB"/>
</view>
</viewController>
<placeholder placeholderIdentifier="IBFirstResponder" id="iYj-Kq-Ea1" userLabel="First Responder" sceneMemberID="firstResponder"/>
</objects>
<point key="canvasLocation" x="53" y="375"/>
</scene>
</scenes>
</document>

Просмотреть файл

@ -1,19 +1,15 @@
using System;
using System.Collections.Generic;
using System.Linq;
using Foundation;
using UIKit;
using UIKit;
namespace FileSystem
{
/// <summary>Kick everything off</summary>
public class Application
{
static void Main (string[] args)
{
UIApplication.Main (args, null, "AppDelegate");
}
}
}
public class Application
{
// This is the main entry point of the application.
static void Main(string[] args)
{
// if you want to use a different Application Delegate class from "AppDelegate"
// you can specify it here.
UIApplication.Main(args, null, "AppDelegate");
}
}
}

Просмотреть файл

@ -0,0 +1,106 @@
<?xml version="1.0" encoding="UTF-8"?>
<document type="com.apple.InterfaceBuilder3.CocoaTouch.Storyboard.XIB" version="3.0" toolsVersion="14460.31" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" useSafeAreas="YES" colorMatched="YES" initialViewController="BYZ-38-t0r">
<device id="retina4_7" orientation="portrait">
<adaptation id="fullscreen"/>
</device>
<dependencies>
<deployment identifier="iOS"/>
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="14460.20"/>
<capability name="Safe area layout guides" minToolsVersion="9.0"/>
<capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/>
</dependencies>
<scenes>
<!--View Controller-->
<scene sceneID="tne-QT-ifu">
<objects>
<viewController id="BYZ-38-t0r" customClass="ViewController" sceneMemberID="viewController">
<view key="view" contentMode="scaleToFill" id="8bC-Xf-vdC">
<rect key="frame" x="0.0" y="0.0" width="375" height="667"/>
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
<subviews>
<button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" buttonType="roundedRect" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="v2X-WM-LXP">
<rect key="frame" x="22.5" y="36" width="141" height="33"/>
<fontDescription key="fontDescription" type="system" pointSize="17"/>
<state key="normal" title="Open 'ReadMe.txt'"/>
<connections>
<action selector="OpenReadMe:" destination="BYZ-38-t0r" eventType="touchUpInside" id="223"/>
</connections>
</button>
<button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" buttonType="roundedRect" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="XOT-h9-XIw">
<rect key="frame" x="35.5" y="85" width="115" height="33"/>
<fontDescription key="fontDescription" type="system" pointSize="17"/>
<state key="normal" title="List Directories"/>
<connections>
<action selector="ListDirectories:" destination="BYZ-38-t0r" eventType="touchUpInside" id="225"/>
</connections>
</button>
<button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" buttonType="roundedRect" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="6dW-gt-zEm">
<rect key="frame" x="248" y="85" width="51" height="33"/>
<fontDescription key="fontDescription" type="system" pointSize="17"/>
<state key="normal" title="List All"/>
<connections>
<action selector="ListAll:" destination="BYZ-38-t0r" eventType="touchUpInside" id="226"/>
</connections>
</button>
<button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" buttonType="roundedRect" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="XcE-vF-Usq">
<rect key="frame" x="211.5" y="36" width="124" height="33"/>
<fontDescription key="fontDescription" type="system" pointSize="17"/>
<state key="normal" title="Open &quot;Test.xml&quot;"/>
<connections>
<action selector="OpenTestFile:" destination="BYZ-38-t0r" eventType="touchUpInside" id="224"/>
</connections>
</button>
<button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" buttonType="roundedRect" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="LAF-ay-OZE">
<rect key="frame" x="57" y="134" width="72" height="33"/>
<fontDescription key="fontDescription" type="system" pointSize="17"/>
<state key="normal" title="Write File"/>
<connections>
<action selector="WriteFile:" destination="BYZ-38-t0r" eventType="touchUpInside" id="227"/>
</connections>
</button>
<button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" buttonType="roundedRect" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="PqG-9v-ZEl">
<rect key="frame" x="210.5" y="134" width="126" height="33"/>
<fontDescription key="fontDescription" type="system" pointSize="17"/>
<state key="normal" title="Create Directory"/>
<connections>
<action selector="CreateDirectory:" destination="BYZ-38-t0r" eventType="touchUpInside" id="228"/>
</connections>
</button>
<textView clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="scaleToFill" editable="NO" textAlignment="natural" translatesAutoresizingMaskIntoConstraints="NO" id="dE8-Xc-9if">
<rect key="frame" x="16" y="183" width="343" height="464"/>
<color key="backgroundColor" white="1" alpha="1" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
<fontDescription key="fontDescription" type="system" pointSize="15"/>
<textInputTraits key="textInputTraits" autocapitalizationType="sentences"/>
</textView>
</subviews>
<color key="backgroundColor" red="1" green="1" blue="1" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
<constraints>
<constraint firstItem="LAF-ay-OZE" firstAttribute="top" secondItem="XOT-h9-XIw" secondAttribute="bottom" constant="16" id="1DK-Me-hbZ"/>
<constraint firstItem="dE8-Xc-9if" firstAttribute="leading" secondItem="dL8-wU-OE1" secondAttribute="leading" constant="16" id="672-ir-gkG"/>
<constraint firstItem="v2X-WM-LXP" firstAttribute="trailing" secondItem="dL8-wU-OE1" secondAttribute="centerX" constant="-24" id="Tzd-Cl-tZM"/>
<constraint firstItem="XcE-vF-Usq" firstAttribute="top" secondItem="dL8-wU-OE1" secondAttribute="top" constant="16" id="VfL-SH-IBk"/>
<constraint firstItem="dE8-Xc-9if" firstAttribute="top" secondItem="LAF-ay-OZE" secondAttribute="bottom" constant="16" id="Xzh-rI-Ys2"/>
<constraint firstItem="v2X-WM-LXP" firstAttribute="top" secondItem="dL8-wU-OE1" secondAttribute="top" constant="16" id="Zfb-Rr-izB"/>
<constraint firstItem="PqG-9v-ZEl" firstAttribute="top" secondItem="6dW-gt-zEm" secondAttribute="bottom" constant="16" id="fGP-dg-7Zj"/>
<constraint firstItem="XOT-h9-XIw" firstAttribute="top" secondItem="v2X-WM-LXP" secondAttribute="bottom" constant="16" id="fWv-KS-IbO"/>
<constraint firstItem="dL8-wU-OE1" firstAttribute="bottom" secondItem="dE8-Xc-9if" secondAttribute="bottom" constant="20" id="ffa-rF-WVk"/>
<constraint firstItem="XcE-vF-Usq" firstAttribute="leading" secondItem="dL8-wU-OE1" secondAttribute="centerX" constant="24" id="gsi-Oj-auX"/>
<constraint firstItem="XOT-h9-XIw" firstAttribute="centerX" secondItem="v2X-WM-LXP" secondAttribute="centerX" id="nxq-nv-f4J"/>
<constraint firstItem="6dW-gt-zEm" firstAttribute="centerX" secondItem="XcE-vF-Usq" secondAttribute="centerX" id="rQW-b3-cnd"/>
<constraint firstItem="dL8-wU-OE1" firstAttribute="trailing" secondItem="dE8-Xc-9if" secondAttribute="trailing" constant="16" id="s0Y-yh-hs9"/>
<constraint firstItem="6dW-gt-zEm" firstAttribute="top" secondItem="XcE-vF-Usq" secondAttribute="bottom" constant="16" id="s3n-te-epn"/>
<constraint firstItem="PqG-9v-ZEl" firstAttribute="centerX" secondItem="6dW-gt-zEm" secondAttribute="centerX" id="sZc-B9-tv4"/>
<constraint firstItem="LAF-ay-OZE" firstAttribute="centerX" secondItem="XOT-h9-XIw" secondAttribute="centerX" id="wA1-d0-bXm"/>
</constraints>
<viewLayoutGuide key="safeArea" id="dL8-wU-OE1"/>
</view>
<connections>
<outlet property="textView" destination="dE8-Xc-9if" id="name-outlet-dE8-Xc-9if"/>
</connections>
</viewController>
<placeholder placeholderIdentifier="IBFirstResponder" id="dkx-z0-nzr" sceneMemberID="firstResponder"/>
</objects>
<point key="canvasLocation" x="-0.80000000000000004" y="-0.44977509999999998"/>
</scene>
</scenes>
</document>

Просмотреть файл

@ -0,0 +1,30 @@
using Foundation;
using System;
using System.Collections.Generic;
namespace FileSystem
{
[Preserve]
public class TestXml
{
public string Title { get; set; }
public string Description { get; set; }
}
// We use the Preserve attribute to ensure that all the properties of the object
// are preserve even when the linker is ran on the assembly. The reasoning
// for this pattern is to ensure that libraries, such as Newsoft.Json, that use
// reflection can find properties that could be removed by the linker.
[Preserve]
public class Account
{
public string Email { get; set; }
public bool Active { get; set; }
public DateTime CreatedDate { get; set; }
public List<string> Roles { get; set; }
}
}

Двоичный файл не отображается.

До

Ширина:  |  Высота:  |  Размер: 12 KiB

Двоичный файл не отображается.

До

Ширина:  |  Высота:  |  Размер: 24 KiB

Двоичный файл не отображается.

До

Ширина:  |  Высота:  |  Размер: 9.4 KiB

Двоичный файл не отображается.

До

Ширина:  |  Высота:  |  Размер: 25 KiB

Двоичный файл не отображается.

До

Ширина:  |  Высота:  |  Размер: 9.8 KiB

Двоичный файл не отображается.

До

Ширина:  |  Высота:  |  Размер: 5.2 KiB

Двоичный файл не отображается.

До

Ширина:  |  Высота:  |  Размер: 12 KiB

Двоичный файл не отображается.

До

Ширина:  |  Высота:  |  Размер: 15 KiB

Двоичный файл не отображается.

До

Ширина:  |  Высота:  |  Размер: 8.1 KiB

Двоичный файл не отображается.

До

Ширина:  |  Высота:  |  Размер: 20 KiB

Двоичный файл не отображается.

До

Ширина:  |  Высота:  |  Размер: 3.3 KiB

Двоичный файл не отображается.

До

Ширина:  |  Высота:  |  Размер: 8.6 KiB

Двоичный файл не отображается.

До

Ширина:  |  Высота:  |  Размер: 106 KiB

Двоичный файл не отображается.

До

Ширина:  |  Высота:  |  Размер: 273 KiB

Двоичный файл не отображается.

До

Ширина:  |  Высота:  |  Размер: 11 KiB

Двоичный файл не отображается.

До

Ширина:  |  Высота:  |  Размер: 14 KiB

Двоичный файл не отображается.

До

Ширина:  |  Высота:  |  Размер: 18 KiB

Двоичный файл не отображается.

До

Ширина:  |  Высота:  |  Размер: 2.0 KiB

Двоичный файл не отображается.

До

Ширина:  |  Высота:  |  Размер: 4.2 KiB

Двоичный файл не отображается.

До

Ширина:  |  Высота:  |  Размер: 5.1 KiB

Двоичный файл не отображается.

До

Ширина:  |  Высота:  |  Размер: 5.2 KiB

Двоичный файл не отображается.

До

Ширина:  |  Высота:  |  Размер: 6.6 KiB

Просмотреть файл

@ -1,126 +0,0 @@
using System;
using System.IO;
using System.Xml;
using System.Xml.Serialization;
using UIKit;
using System.Collections.Generic;
using Newtonsoft.Json;
namespace FileSystem
{
/// <summary>
/// This class contains the code shown in the article "Working with the File System"
/// </summary>
public class SampleCode
{
public static void ReadText(UITextView display)
{
display.Text = "";
// Sample code from the article
var text = System.IO.File.ReadAllText("TestData/ReadMe.txt");
Console.WriteLine(text);
// Output to app UITextView
display.Text = text;
}
public static void ReadDirectories(UITextView display)
{
display.Text = "";
// Sample code from the article
var directories = Directory.EnumerateDirectories("./");
foreach (var directory in directories) {
Console.WriteLine(directory);
}
// Output to app UITextView
foreach (var directory in directories) {
display.Text += directory + Environment.NewLine;
}
}
public static void ReadAll(UITextView display)
{
display.Text = "";
// Sample code from the article
var fileOrDirectory = Directory.EnumerateFileSystemEntries("./");
foreach (var entry in fileOrDirectory) {
Console.WriteLine(entry);
}
// Output to app UITextView
foreach (var entry in fileOrDirectory) {
display.Text += entry + Environment.NewLine;
}
}
public static void ReadXml(UITextView display)
{
display.Text = "";
// Output to app UITextView
using (TextReader reader = new StreamReader("TestData/Test.xml")) {
XmlSerializer serializer = new XmlSerializer(typeof(TestXml));
var xml = (TestXml)serializer.Deserialize(reader);
display.Text = "XML was deserialized." + Environment.NewLine
+ "-----------------" + Environment.NewLine
+ "Title: " + xml.Title + Environment.NewLine
+ "Description: " + xml.Description;
}
}
public static void WriteFile(UITextView display)
{
// Sample code from the article
var documents =
Environment.GetFolderPath (Environment.SpecialFolder.MyDocuments);
var filename = Path.Combine (documents, "Write.txt");
File.WriteAllText(filename, "Write this text into a file!");
// Output to app UITextView
display.Text = "Text was written to a file." + Environment.NewLine
+ "-----------------" + Environment.NewLine
+ System.IO.File.ReadAllText(filename);
}
public static void WriteJson(UITextView display) {
// Create a new record
var account = new Account(){
Email = "monkey@xamarin.com",
Active = true,
CreatedDate = new DateTime(2015, 5, 27, 0, 0, 0, DateTimeKind.Utc),
Roles = new List<string> {"User", "Admin"}
};
// Serialize object
var json = JsonConvert.SerializeObject(account, Newtonsoft.Json.Formatting.Indented);
// Save to file
var documents = Environment.GetFolderPath (Environment.SpecialFolder.MyDocuments);
var filename = Path.Combine (documents, "account.json");
File.WriteAllText(filename, json);
// Display output
display.Text = json;
}
public static void CreateDirectory(UITextView display)
{
// Sample code from the article
var documents =
Environment.GetFolderPath (Environment.SpecialFolder.MyDocuments);
var directoryname = Path.Combine (documents, "NewDirectory");
Directory.CreateDirectory(directoryname);
// Output to app UITextView
display.Text = "A directory was created." + Environment.NewLine
+ "-----------------" + Environment.NewLine
+ directoryname;
}
}
}

Просмотреть файл

@ -1,13 +0,0 @@
using System;
using Foundation;
namespace FileSystem
{
[Preserve (AllMembers = true)]
public class TestXml
{
public string Title;
public string Description;
}
}

Просмотреть файл

@ -0,0 +1,52 @@
using System;
using UIKit;
namespace FileSystem
{
public partial class ViewController : UIViewController
{
private bool writeJson = true;
protected ViewController(IntPtr handle) : base(handle) { }
partial void OpenReadMe(UIButton sender)
{
textView.Text = DataManager.ReadText();
}
partial void OpenTestFile(UIButton sender)
{
textView.Text = DataManager.ReadXml();
}
partial void ListDirectories(UIButton sender)
{
textView.Text = DataManager.ReadDirectories();
}
partial void ListAll(UIButton sender)
{
textView.Text = DataManager.ReadAll();
}
partial void WriteFile(UIButton sender)
{
var text = string.Empty;
if (writeJson)
{
text = DataManager.WriteJson();
}
else
{
text = DataManager.WriteFile();
}
textView.Text = text;
}
partial void CreateDirectory(UIButton sender)
{
textView.Text = DataManager.CreateDirectory();
}
}
}

52
FileSystemSampleCode/FileSystem/ViewController.designer.cs сгенерированный Normal file
Просмотреть файл

@ -0,0 +1,52 @@
// WARNING
//
// This file has been generated automatically by Visual Studio from the outlets and
// actions declared in your storyboard file.
// Manual changes to this file will not be maintained.
//
using Foundation;
using System;
using System.CodeDom.Compiler;
namespace FileSystem
{
[Register ("ViewController")]
partial class ViewController
{
[Outlet]
[GeneratedCode ("iOS Designer", "1.0")]
UIKit.UITextView textView { get; set; }
[Action ("CreateDirectory:")]
[GeneratedCode ("iOS Designer", "1.0")]
partial void CreateDirectory (UIKit.UIButton sender);
[Action ("ListAll:")]
[GeneratedCode ("iOS Designer", "1.0")]
partial void ListAll (UIKit.UIButton sender);
[Action ("ListDirectories:")]
[GeneratedCode ("iOS Designer", "1.0")]
partial void ListDirectories (UIKit.UIButton sender);
[Action ("OpenReadMe:")]
[GeneratedCode ("iOS Designer", "1.0")]
partial void OpenReadMe (UIKit.UIButton sender);
[Action ("OpenTestFile:")]
[GeneratedCode ("iOS Designer", "1.0")]
partial void OpenTestFile (UIKit.UIButton sender);
[Action ("WriteFile:")]
[GeneratedCode ("iOS Designer", "1.0")]
partial void WriteFile (UIKit.UIButton sender);
void ReleaseDesignerOutlets ()
{
if (textView != null) {
textView.Dispose ();
textView = null;
}
}
}
}

Просмотреть файл

@ -1,4 +1,4 @@
<?xml version="1.0" encoding="utf-8"?>
<packages>
<package id="Newtonsoft.Json" version="7.0.1" targetFramework="xamarinios10" />
<package id="Newtonsoft.Json" version="11.0.2" targetFramework="xamarinios10" />
</packages>

Двоичный файл не отображается.

До

Ширина:  |  Высота:  |  Размер: 54 KiB

После

Ширина:  |  Высота:  |  Размер: 110 KiB

Просмотреть файл

@ -1,7 +1,9 @@

Microsoft Visual Studio Solution File, Format Version 11.00
# Visual Studio 2010
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "FileSystem", "FileSystem\FileSystem.csproj", "{367D4ECC-D04A-41FB-A784-4D10F30666C8}"
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "FileSystem2", "FileSystem2\FileSystem2.csproj", "{367D4ECC-D04A-41FB-A784-4D10F30666C8}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "FileSystem", "FileSystem\FileSystem.csproj", "{7652DDB4-2A98-4533-8B7A-A662DACF04EB}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
@ -19,6 +21,14 @@ Global
{367D4ECC-D04A-41FB-A784-4D10F30666C8}.Release|iPhone.Build.0 = Release|iPhone
{367D4ECC-D04A-41FB-A784-4D10F30666C8}.Release|iPhoneSimulator.ActiveCfg = Release|iPhoneSimulator
{367D4ECC-D04A-41FB-A784-4D10F30666C8}.Release|iPhoneSimulator.Build.0 = Release|iPhoneSimulator
{7652DDB4-2A98-4533-8B7A-A662DACF04EB}.Debug|iPhoneSimulator.ActiveCfg = Debug|iPhoneSimulator
{7652DDB4-2A98-4533-8B7A-A662DACF04EB}.Debug|iPhoneSimulator.Build.0 = Debug|iPhoneSimulator
{7652DDB4-2A98-4533-8B7A-A662DACF04EB}.Release|iPhoneSimulator.ActiveCfg = Release|iPhoneSimulator
{7652DDB4-2A98-4533-8B7A-A662DACF04EB}.Release|iPhoneSimulator.Build.0 = Release|iPhoneSimulator
{7652DDB4-2A98-4533-8B7A-A662DACF04EB}.Debug|iPhone.ActiveCfg = Debug|iPhone
{7652DDB4-2A98-4533-8B7A-A662DACF04EB}.Debug|iPhone.Build.0 = Debug|iPhone
{7652DDB4-2A98-4533-8B7A-A662DACF04EB}.Release|iPhone.ActiveCfg = Release|iPhone
{7652DDB4-2A98-4533-8B7A-A662DACF04EB}.Release|iPhone.Build.0 = Release|iPhone
EndGlobalSection
GlobalSection(MonoDevelopProperties) = preSolution
StartupItem = FileSystem\FileSystem.csproj