}
}
+ protected override void OnFileActivated(FileActivatedEventArgs e)
+ {
+ base.OnFileActivated(e);
+ Frame rootFrame = Window.Current.Content as Frame;
+
+ if (rootFrame == null)
+ {
+ rootFrame = new Frame();
+ rootFrame.NavigationFailed += OnNavigationFailed;
+ Window.Current.Content = rootFrame;
+ }
+ rootFrame.Navigate(typeof(MainPage), e);
+ Window.Current.Activate();
+ }
+
/// <summary>
/// 特定のページへの移動が失敗したときに呼び出されます
/// </summary>
using Windows.Graphics.Printing;
using Windows.Graphics.Printing.OptionDetails;
using FooEditEngine.UWP;
+using Windows.UI.Xaml.Navigation;
+using Windows.ApplicationModel.Activation;
+using System.Linq;
+using Windows.Storage.AccessCache;
// 空白ページのアイテム テンプレートについては、http://go.microsoft.com/fwlink/?LinkId=402352&clcid=0x409 を参照してください
currentView.Hiding += currentView_Hiding;
}
+ protected override async void OnNavigatedTo(NavigationEventArgs e)
+ {
+ var fileargs = e.Parameter as FileActivatedEventArgs;
+ if (fileargs != null)
+ {
+ var filepaths = from file in fileargs.Files
+ select file.Path;
+
+ //MRUに追加しないと後で開けない
+ foreach (var file in fileargs.Files)
+ {
+ StorageApplicationPermissions.MostRecentlyUsedList.Add(file, "mrufile");
+ this.vm.AddDocument();
+ await LoadFile(this.vm.CurrentDocument, file as IStorageFile);
+ }
+
+ }
+ else if(this.vm.DocumentList.Count == 0)
+ {
+ this.vm.Initalize();
+ }
+ }
+
void currentView_Hiding(InputPane sender, InputPaneVisibilityEventArgs args)
{
this.Margin = new Thickness(0);
var filepicker = new FileOpenPicker();
filepicker.FileTypeFilter.Add(".txt");
var file = await filepicker.PickSingleFileAsync();
- if(file != null)
+ await LoadFile(this.vm.CurrentDocument, file);
+ }
+
+ private async Task LoadFile(FooEditEngine.Document doc,IStorageFile file)
+ {
+ if (file != null)
{
using (var ws = await file.OpenAsync(FileAccessMode.Read))
using (var fs = new StreamReader(ws.AsStream()))
{
- await this.vm.CurrentDocument.LoadAsync(fs, null);
+ await doc.LoadAsync(fs, null);
}
- this.vm.CurrentDocument.RequestRedraw();
+ doc.RequestRedraw();
}
}
public MainViewModel()
{
- var complete_collection = new CompleteCollection<ICompleteItem>();
- CompleteHelper.AddComleteWord(complete_collection, "int");
- CompleteHelper.AddComleteWord(complete_collection, "float");
- CompleteHelper.AddComleteWord(complete_collection, "double");
- CompleteHelper.AddComleteWord(complete_collection, "char");
- CompleteHelper.AddComleteWord(complete_collection, "byte");
- CompleteHelper.AddComleteWord(complete_collection, "var");
- CompleteHelper.AddComleteWord(complete_collection, "short");
-
- var doc = new Document() { Title = "test1" };
- doc.AutoComplete = new AutoCompleteBox(doc);
- doc.AutoComplete.Items = complete_collection;
- doc.AutoComplete.Enabled = true;
- this._list.Add(doc);
-
- doc = new Document() { Title = "test2" };
- this._list.Add(doc);
-
- this.CurrentDocument = this._list[0];
}
public ObservableCollection<Document> DocumentList
public event PropertyChangedEventHandler PropertyChanged;
+ public void Initalize()
+ {
+ var complete_collection = new CompleteCollection<ICompleteItem>();
+ CompleteHelper.AddComleteWord(complete_collection, "int");
+ CompleteHelper.AddComleteWord(complete_collection, "float");
+ CompleteHelper.AddComleteWord(complete_collection, "double");
+ CompleteHelper.AddComleteWord(complete_collection, "char");
+ CompleteHelper.AddComleteWord(complete_collection, "byte");
+ CompleteHelper.AddComleteWord(complete_collection, "var");
+ CompleteHelper.AddComleteWord(complete_collection, "short");
+
+ var doc = new Document() { Title = "test1" };
+ doc.AutoComplete = new AutoCompleteBox(doc);
+ doc.AutoComplete.Items = complete_collection;
+ doc.AutoComplete.Enabled = true;
+ this._list.Add(doc);
+
+ doc = new Document() { Title = "test2" };
+ this._list.Add(doc);
+
+ this.CurrentDocument = this._list[0];
+ }
+
public void AddDocument()
{
var doc = new Document() { Title = "test" + this._list.Count };
<?xml version="1.0" encoding="utf-8"?>
-
-<Package
- xmlns="http://schemas.microsoft.com/appx/manifest/foundation/windows10"
- xmlns:mp="http://schemas.microsoft.com/appx/2014/phone/manifest"
- xmlns:uap="http://schemas.microsoft.com/appx/manifest/uap/windows10"
- IgnorableNamespaces="uap mp">
-
- <Identity
- Name="59431542-1ecc-401d-a949-43ef08810b38"
- Publisher="CN=matin"
- Version="1.0.0.0" />
-
- <mp:PhoneIdentity PhoneProductId="59431542-1ecc-401d-a949-43ef08810b38" PhonePublisherId="00000000-0000-0000-0000-000000000000"/>
-
+<Package xmlns="http://schemas.microsoft.com/appx/manifest/foundation/windows10" xmlns:mp="http://schemas.microsoft.com/appx/2014/phone/manifest" xmlns:uap="http://schemas.microsoft.com/appx/manifest/uap/windows10" IgnorableNamespaces="uap mp">
+ <Identity Name="59431542-1ecc-401d-a949-43ef08810b38" Publisher="CN=matin" Version="1.0.0.0" />
+ <mp:PhoneIdentity PhoneProductId="59431542-1ecc-401d-a949-43ef08810b38" PhonePublisherId="00000000-0000-0000-0000-000000000000" />
<Properties>
<DisplayName>Test</DisplayName>
<PublisherDisplayName>matin</PublisherDisplayName>
<Logo>Assets\StoreLogo.png</Logo>
</Properties>
-
<Dependencies>
<TargetDeviceFamily Name="Windows.Universal" MinVersion="10.0.0.0" MaxVersionTested="10.0.0.0" />
</Dependencies>
-
<Resources>
- <Resource Language="x-generate"/>
+ <Resource Language="x-generate" />
</Resources>
-
<Applications>
- <Application Id="App"
- Executable="$targetnametoken$.exe"
- EntryPoint="Test.App">
- <uap:VisualElements
- DisplayName="Test"
- Square150x150Logo="Assets\Square150x150Logo.png"
- Square44x44Logo="Assets\Square44x44Logo.png"
- Description="Test"
- BackgroundColor="transparent">
- <uap:DefaultTile Wide310x150Logo="Assets\Wide310x150Logo.png"/>
+ <Application Id="App" Executable="$targetnametoken$.exe" EntryPoint="Test.App">
+ <uap:VisualElements DisplayName="Test" Square150x150Logo="Assets\Square150x150Logo.png" Square44x44Logo="Assets\Square44x44Logo.png" Description="Test" BackgroundColor="transparent">
+ <uap:DefaultTile Wide310x150Logo="Assets\Wide310x150Logo.png">
+ </uap:DefaultTile>
<uap:SplashScreen Image="Assets\SplashScreen.png" />
</uap:VisualElements>
+ <Extensions>
+ <uap:Extension Category="windows.fileTypeAssociation">
+ <uap:FileTypeAssociation Name="testfilesupport">
+ <uap:SupportedFileTypes>
+ <uap:FileType>.txt</uap:FileType>
+ </uap:SupportedFileTypes>
+ </uap:FileTypeAssociation>
+ </uap:Extension>
+ </Extensions>
</Application>
</Applications>
-
<Capabilities>
<Capability Name="internetClient" />
</Capabilities>