public static GetMainPage ( ) : System.Windows.Controls.Page | ||
리턴 | System.Windows.Controls.Page |
protected override void OnCreate(Bundle bundle) { base.OnCreate(bundle); Xamarin.Forms.Forms.Init(this, bundle); SetPage(App.GetMainPage()); }
// // This method is invoked when the application has loaded and is ready to run. In this // method you should instantiate the window, load the UI into it and then make the window // visible. // // You have 17 seconds to return from this method, or iOS will terminate your application. // public override bool FinishedLaunching(UIApplication app, NSDictionary options) { Forms.Init(); // create a new window instance based on the screen size window = new UIWindow(UIScreen.MainScreen.Bounds); // If you have defined a view, add it here: // window.RootViewController = navigationController; window.RootViewController = App.GetMainPage().CreateViewController(); // make the window visible window.MakeKeyAndVisible(); return(true); }
// // This method is invoked when the application has loaded and is ready to run. In this // method you should instantiate the window, load the UI into it and then make the window // visible. // // You have 17 seconds to return from this method, or iOS will terminate your application. // public override bool FinishedLaunching(UIApplication app, NSDictionary options) { Forms.Init(); // create a new window instance based on the screen size window = new UIWindow(UIScreen.MainScreen.Bounds); window.TintColor = UIColor.Black; UINavigationBar.Appearance.SetTitleTextAttributes(new UITextAttributes { TextColor = UIColor.Black }); UINavigationBar.Appearance.BarTintColor = UIColor.Black; UIBarButtonItem.Appearance.TintColor = UIColor.Black; UIBarButtonItem.Appearance.SetTitleTextAttributes(new UITextAttributes { TextColor = UIColor.Black }, UIControlState.Normal); var sqliteFilename = "TodoSQLite.db3"; string documentsPath = Environment.GetFolderPath(Environment.SpecialFolder.Personal); // Documents folder string libraryPath = Path.Combine(documentsPath, "..", "Library"); // Library folder var path = Path.Combine(libraryPath, sqliteFilename); // This is where we copy in the prepopulated database Console.WriteLine(path); if (!File.Exists(path)) { File.Copy(sqliteFilename, path); } var plat = new SQLite.Net.Platform.XamarinIOS.SQLitePlatformIOS(); var conn = new SQLite.Net.SQLiteConnection(plat, path); // Set the database connection string App.SetDatabaseConnection(conn); App.SetTextToSpeech(new Speech()); // If you have defined a view, add it here: // window.RootViewController = navigationController; window.RootViewController = App.GetMainPage().CreateViewController(); // make the window visible window.MakeKeyAndVisible(); return(true); }
protected override void OnCreate(Bundle bundle) { base.OnCreate(bundle); Xamarin.Forms.Forms.Init(this, bundle); #if DEBUG // http://forums.xamarin.com/discussion/21148/calabash-and-xamarin-forms-what-am-i-missing Xamarin.Forms.Forms.ViewInitialized += (object sender, Xamarin.Forms.ViewInitializedEventArgs e) => { if (!string.IsNullOrWhiteSpace(e.View.StyleId)) { Console.WriteLine("Style:" + e.View.StyleId); e.NativeView.ContentDescription = e.View.StyleId; } }; #endif SetPage(App.GetMainPage()); }
// // This method is invoked when the application has loaded and is ready to run. In this // method you should instantiate the window, load the UI into it and then make the window // visible. // // You have 17 seconds to return from this method, or iOS will terminate your application. // public override bool FinishedLaunching(UIApplication app, NSDictionary options) { Forms.Init(); #region Localization debug info foreach (var s in NSLocale.PreferredLanguages) { Console.WriteLine("pref:" + s); } var iosLocaleAuto = NSLocale.AutoUpdatingCurrentLocale.LocaleIdentifier; var iosLanguageAuto = NSLocale.AutoUpdatingCurrentLocale.LanguageCode; Console.WriteLine("nslocaleid:" + iosLocaleAuto); Console.WriteLine("nslanguage:" + iosLanguageAuto); var iosLocale = NSLocale.CurrentLocale.LocaleIdentifier; var iosLanguage = NSLocale.CurrentLocale.LanguageCode; var netLocale = iosLocale.Replace("_", "-"); var netLanguage = iosLanguage.Replace("_", "-"); Console.WriteLine("ios:" + iosLanguage + " " + iosLocale); Console.WriteLine("net:" + netLanguage + " " + netLocale); //Thread.CurrentThread.CurrentCulture = new System.Globalization.CultureInfo("de-AT"); Console.WriteLine("culture:" + Thread.CurrentThread.CurrentCulture); Console.WriteLine("uiculture:" + Thread.CurrentThread.CurrentUICulture); #endregion // create a new window instance based on the screen size window = new UIWindow(UIScreen.MainScreen.Bounds); // If you have defined a view, add it here: // window.RootViewController = navigationController; window.RootViewController = App.GetMainPage().CreateViewController(); // make the window visible window.MakeKeyAndVisible(); return(true); }
public LoginPage() { Title = "Todo"; NavigationPage.SetHasNavigationBar(this, true); var loginButton = new Button { Text = "LogIn" }; loginButton.Clicked += (sender, e) => { App.Database.Login().ContinueWith( t => { if (t.Result) { Xamarin.Forms.Device.BeginInvokeOnMainThread(() => Navigation.PushModalAsync(App.GetMainPage())); } } ); }; Content = new StackLayout { VerticalOptions = LayoutOptions.StartAndExpand, Padding = new Thickness(20), Children = { loginButton } }; }