-
Notifications
You must be signed in to change notification settings - Fork 14
Expand file tree
/
Copy pathApp.xaml.cs
More file actions
29 lines (26 loc) · 864 Bytes
/
App.xaml.cs
File metadata and controls
29 lines (26 loc) · 864 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
namespace GridDatafromSQLite;
public partial class App : Application {
public string targetFile = Path.Combine(FileSystem.CacheDirectory,"contacts.db");
public App(){
InitializeComponent();
InitCache();
}
protected override Window CreateWindow(IActivationState activationState) {
return new Window(new MainPage());
}
private void InitCache() {
if (!File.Exists(targetFile)) {
#if IOS
File.Copy("database/contacts.db", targetFile);
#else
var file = File.Create(targetFile);
var task = FileSystem.Current.OpenAppPackageFileAsync("Resources/database/contacts.db");
task.Wait();
var fileStream = task.Result;
fileStream.CopyTo(file);
fileStream.Close();
file.Close();
#endif
}
}
}