本文整理汇总了C#中Setup.Initialize方法的典型用法代码示例。如果您正苦于以下问题:C# Setup.Initialize方法的具体用法?C# Setup.Initialize怎么用?C# Setup.Initialize使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Setup
的用法示例。
在下文中一共展示了Setup.Initialize方法的13个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: OnLaunched
/// <summary>
/// Invoked when the application is launched normally by the end user. Other entry points
/// will be used when the application is launched to open a specific file, to display
/// search results, and so forth.
/// </summary>
/// <param name="args">Details about the launch request and process.</param>
protected override void OnLaunched(LaunchActivatedEventArgs args)
{
// Do not repeat app initialization when already running, just ensure that
// the window is active
if (args.PreviousExecutionState == ApplicationExecutionState.Running)
{
Window.Current.Activate();
return;
}
if (args.PreviousExecutionState == ApplicationExecutionState.Terminated)
{
//TODO: Load state from previously suspended application
}
// Create a Frame to act navigation context and navigate to the first page
var rootFrame = new Frame();
if (!rootFrame.Navigate(typeof(MainPage)))
{
throw new Exception("Failed to create initial page");
}
var setup = new Setup(rootFrame);
setup.Initialize();
var start = this.GetService<IMvxStartNavigation>();
start.Start();
// Place the frame in the current Window and ensure that it is active
Window.Current.Content = rootFrame;
Window.Current.Activate();
}
示例2: DismissedEventHandler
// Include code to be executed when the system has transitioned from the splash screen to the extended splash screen (application's first view).
void DismissedEventHandler(SplashScreen sender, object e)
{
// Navigate away from the app's extended splash screen after completing setup operations here...
if (!Dismissed)
{
Dismissed = true;
var task = Dispatcher.RunAsync(CoreDispatcherPriority.Normal, async () =>
{
Window.Current.Content = new AppShell { Language = ApplicationLanguages.Languages[0] };
ApplicationLanguages.PrimaryLanguageOverride = GlobalizationPreferences.Languages[0];
var shell = (AppShell) Window.Current.Content;
// When the navigation stack isn't restored, navigate to the first page
// suppressing the initial entrance animation.
var setup = new Setup(shell.MyAppFrame);
setup.Initialize();
var start = Mvx.Resolve<IMvxAppStart>();
start.Start();
shell.ViewModel = Mvx.Resolve<MenuViewModel>();
//If Jump Lists are supported, adds them
if (ApiInformation.IsTypePresent("Windows.UI.StartScreen.JumpList"))
{
await SetJumplist();
}
await CallRateReminder();
});
}
}
示例3: App
/// <summary>
/// Constructor for the Application object.
/// </summary>
public App()
{
// Global handler for uncaught exceptions.
UnhandledException += Application_UnhandledException;
// Standard Silverlight initialization
InitializeComponent();
// Phone-specific initialization
InitializePhoneApplication();
// Show graphics profiling information while debugging.
if (System.Diagnostics.Debugger.IsAttached)
{
// Display the current frame rate counters.
Application.Current.Host.Settings.EnableFrameRateCounter = true;
// Show the areas of the app that are being redrawn in each frame.
//Application.Current.Host.Settings.EnableRedrawRegions = true;
// Enable non-production analysis visualization mode,
// which shows areas of a page that are handed off to GPU with a colored overlay.
//Application.Current.Host.Settings.EnableCacheVisualization = true;
// Disable the application idle detection by setting the UserIdleDetectionMode property of the
// application's PhoneApplicationService object to Disabled.
// Caution:- Use this under debug mode only. Application that disables user idle detection will continue to run
// and consume battery power when the user is not using the phone.
PhoneApplicationService.Current.UserIdleDetectionMode = IdleDetectionMode.Disabled;
}
var setup = new Setup(RootFrame);
setup.Initialize();
}
示例4: FinishedLaunching
public override bool FinishedLaunching(UIApplication app, NSDictionary options) {
SetupNotifications();
//We MUST wrap our setup in this block to wire up
// Mono's SIGSEGV and SIGBUS signals
HockeyApp.Setup.EnableCustomCrashReporting(() =>
{
//Get the shared instance
var manager = BITHockeyManager.SharedHockeyManager;
BITHockeyManager.SharedHockeyManager.DebugLogEnabled = true;
//Configure it to use our APP_ID
manager.Configure(AppSettings.HockeyAppiOSAppID);
//Start the manager
manager.StartManager();
//Authenticate (there are other authentication options)
//manager.Authenticator will be null if HockeyAppiOSAppID was not set
if (manager.Authenticator != null)
{
manager.Authenticator.AuthenticateInstallation();
//Rethrow any unhandled .NET exceptions as native iOS
// exceptions so the stack traces appear nicely in HockeyApp
TaskScheduler.UnobservedTaskException += (sender, e) =>
HockeyApp.Setup.ThrowExceptionAsNative(e.Exception);
AppDomain.CurrentDomain.UnhandledException += (sender, e) =>
HockeyApp.Setup.ThrowExceptionAsNative(e.ExceptionObject);
}
});
Forms.Init();
_window = new UIWindow(UIScreen.MainScreen.Bounds);
Akavache.BlobCache.ApplicationName = "MyHealth";
var setup = new Setup(this, _window);
setup.Initialize();
var startup = Mvx.Resolve<IMvxAppStart>();
startup.Start();
_window.MakeKeyAndVisible();
var shouldPerformAdditionalDelegateHandling = true;
// Get possible shortcut item
if (options != null)
{
LaunchedShortcutItem = options[UIApplication.LaunchOptionsShortcutItemKey] as UIApplicationShortcutItem;
shouldPerformAdditionalDelegateHandling = (LaunchedShortcutItem == null);
}
return shouldPerformAdditionalDelegateHandling;
}
示例5: DoSetup
/// <summary>
/// Does the setup.
/// </summary>
private void DoSetup()
{
var presenter = new MvxSimpleWpfViewPresenter(MainWindow);
var setup = new Setup(Dispatcher, presenter);
setup.Initialize();
var start = Mvx.Resolve<IMvxAppStart>();
start.Start();
_setupComplete = true;
}
示例6: FinishedLaunching
public override bool FinishedLaunching(UIApplication app, NSDictionary options)
{
_window = new UIWindow(UIScreen.MainScreen.Bounds);
var setup = new Setup(this, _window);
setup.Initialize();
var startup = Mvx.Resolve<IMvxAppStart>();
startup.Start();
_window.MakeKeyAndVisible();
return true;
}
示例7: OnLaunched
/// <summary>
/// Invoked when the application is launched normally by the end user. Other entry points
/// will be used such as when the application is launched to open a specific file.
/// </summary>
/// <param name="e">Details about the launch request and process.</param>
protected override void OnLaunched(LaunchActivatedEventArgs e)
{
#if DEBUG
if (System.Diagnostics.Debugger.IsAttached)
{
this.DebugSettings.EnableFrameRateCounter = true;
}
#endif
Frame rootFrame = Window.Current.Content as Frame;
// Do not repeat app initialization when the Window already has content,
// just ensure that the window is active
if (rootFrame == null)
{
// Create a Frame to act as the navigation context and navigate to the first page
rootFrame = new Frame();
rootFrame.NavigationFailed += OnNavigationFailed;
if (e.PreviousExecutionState == ApplicationExecutionState.Terminated)
{
//TODO: Load state from previously suspended application
}
var setup = new Setup(rootFrame);
setup.Initialize();
// Place the frame in the current Window
Window.Current.Content = rootFrame;
var start = Cirrious.CrossCore.Mvx.Resolve<Cirrious.MvvmCross.ViewModels.IMvxAppStart>();
start.Start();
// Place the frame in the current Window
Window.Current.Content = rootFrame;
}
if (rootFrame.Content == null)
{
// When the navigation stack isn't restored navigate to the first page,
// configuring the new page by passing required information as a navigation
// parameter
rootFrame.Navigate(typeof(MainPage), e.Arguments);
}
// Ensure the current window is active
Window.Current.Activate();
}
示例8: FinishedLaunching
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
Window = new UIWindow(UIScreen.MainScreen.Bounds);
var presenter = new MvxIosViewPresenter(this, Window);
var setup = new Setup (this, presenter);
setup.Initialize ();
var startup = Mvx.Resolve<IMvxAppStart> ();
startup.Start ();
Window.MakeKeyAndVisible ();
return true;
}
示例9: App
/// <summary>
/// Constructor for the Application object.
/// </summary>
public App()
{
// Global handler for uncaught exceptions.
UnhandledException += Application_UnhandledException;
// Standard XAML initialization
InitializeComponent();
// Phone-specific initialization
InitializePhoneApplication();
// Language display initialization
InitializeLanguage();
// Show graphics profiling information while debugging.
if (Debugger.IsAttached)
{
// Display the current frame rate counters.
Application.Current.Host.Settings.EnableFrameRateCounter = true;
// Show the areas of the app that are being redrawn in each frame.
//Application.Current.Host.Settings.EnableRedrawRegions = true;
// Enable non-production analysis visualization mode,
// which shows areas of a page that are handed off to GPU with a colored overlay.
//Application.Current.Host.Settings.EnableCacheVisualization = true;
// Prevent the screen from turning off while under the debugger by disabling
// the application's idle detection.
// Caution:- Use this under debug mode only. Application that disables user idle detection will continue to run
// and consume battery power when the user is not using the phone.
PhoneApplicationService.Current.UserIdleDetectionMode = IdleDetectionMode.Disabled;
}
DispatcherHelper.Initialize();
//MVVMCross Setup
var setup = new Setup(RootFrame);
setup.Initialize();
}
示例10: OnLaunched
/// <summary>
/// Invoked when the application is launched normally by the end user. Other entry points
/// will be used when the application is launched to open a specific file, to display
/// search results, and so forth.
/// </summary>
/// <param name="args">Details about the launch request and process.</param>
protected override void OnLaunched(LaunchActivatedEventArgs args)
{
DispatcherHelper.Initialize();
ServiceLocator.MessageService = new MessageService();
ServiceLocator.LiveTileNotifyService = new LiveTileNotifyService();
ServiceLocator.NavigationService = new NavigationService();
ServiceLocator.AzureMobileService = new AzureMobileService();
ServiceLocator.ResourceFileService = new ResourceFileService();
//Using MVVM Cross Container
var iocProvider = MvxSimpleIoCContainer.Initialise();
Mvx.RegisterSingleton<IMvxFileStore>(new MvxWindowsStoreBlockingFileStore());
Frame rootFrame = Window.Current.Content as Frame;
// Do not repeat app initialization when the Window already has content,
// just ensure that the window is active
if (rootFrame == null)
{
// Create a Frame to act as the navigation context and navigate to the first page
rootFrame = new Frame();
if (args.PreviousExecutionState == ApplicationExecutionState.Terminated)
{
//TODO: Load state from previously suspended application
}
// Place the frame in the current Window
Window.Current.Content = rootFrame;
}
//if (rootFrame.Content == null)
//{
// // When the navigation stack isn't restored navigate to the first page,
// // configuring the new page by passing required information as a navigation
// // parameter
// if (!rootFrame.Navigate(typeof(ItemsShowcaseView), args.Arguments))
// {
// throw new Exception("Failed to create initial page");
// }
//}
//MVVMCross setup
var setup = new Setup(rootFrame);
setup.Initialize();
//MVVMCross setup
var start = Mvx.Resolve<IMvxAppStart>();
start.Start();
// Ensure the current window is active
Window.Current.Activate();
}
示例11: OnLaunched
/// <summary>
/// Invoked when the application is launched normally by the end user. Other entry points
/// will be used when the application is launched to open a specific file, to display
/// search results, and so forth.
/// </summary>
/// <param name="e">Details about the launch request and process.</param>
protected override void OnLaunched(LaunchActivatedEventArgs e)
{
DispatcherHelper.Initialize();
ServiceLocator.MessageService = new MessageService();
ServiceLocator.LiveTileNotifyService = new LiveTileNotifyService();
ServiceLocator.AzureMobileService = new AzureMobileService();
ServiceLocator.ResourceFileService = new ResourceFileService();
//Using MVVM Cross Container
var iocProvider = MvxSimpleIoCContainer.Initialize();
#if WINDOWS_APP
Mvx.RegisterSingleton<IMvxFileStore>(new MvxWindowsStoreBlockingFileStore());
#endif
#if WINDOWS_PHONE_APP
Mvx.RegisterSingleton<IMvxFileStore>(new MvxWindowsCommonBlockingFileStore());
#endif
//Oauth Init
OAuthUtility.ComputeHash = (key, buffer) =>
{
var crypt = Windows.Security.Cryptography.Core.MacAlgorithmProvider.OpenAlgorithm("HMAC_SHA1");
var keyBuffer = Windows.Security.Cryptography.CryptographicBuffer.CreateFromByteArray(key);
var cryptKey = crypt.CreateKey(keyBuffer);
var dataBuffer = Windows.Security.Cryptography.CryptographicBuffer.CreateFromByteArray(buffer);
var signBuffer = Windows.Security.Cryptography.Core.CryptographicEngine.Sign(cryptKey, dataBuffer);
byte[] value;
Windows.Security.Cryptography.CryptographicBuffer.CopyToByteArray(signBuffer, out value);
return value;
};
#if DEBUG
if (System.Diagnostics.Debugger.IsAttached)
{
//this.DebugSettings.EnableFrameRateCounter = true;
}
#endif
Frame rootFrame = Window.Current.Content as Frame;
// Do not repeat app initialization when the Window already has content,
// just ensure that the window is active
if (rootFrame == null)
{
// Create a Frame to act as the navigation context and navigate to the first page
rootFrame = new Frame();
// TODO: change this value to a cache size that is appropriate for your application
rootFrame.CacheSize = 1;
if (e.PreviousExecutionState == ApplicationExecutionState.Terminated)
{
// TODO: Load state from previously suspended application
}
// Place the frame in the current Window
Window.Current.Content = rootFrame;
}
// if (rootFrame.Content == null)
// {
//#if WINDOWS_PHONE_APP
// // Removes the turnstile navigation for startup.
// if (rootFrame.ContentTransitions != null)
// {
// this.transitions = new TransitionCollection();
// foreach (var c in rootFrame.ContentTransitions)
// {
// this.transitions.Add(c);
// }
// }
// rootFrame.ContentTransitions = null;
// rootFrame.Navigated += this.RootFrame_FirstNavigated;
//#endif
// // When the navigation stack isn't restored navigate to the first page,
// // configuring the new page by passing required information as a navigation
// // parameter
// if (!rootFrame.Navigate(typeof(MainPage), e.Arguments))
// {
// throw new Exception("Failed to create initial page");
// }
// }
if (!AppState.Windows81PhoneAppInitialized)
{
Mvx.RegisterSingleton<IMvxSuspensionManager>(new MvxSuspensionManager());
//MVVMCross setup
//.........这里部分代码省略.........
示例12: OnLaunched
/// <summary>
/// Invoked when the application is launched normally by the end user. Other entry points
/// will be used when the application is launched to open a specific file, to display
/// search results, and so forth.
/// </summary>
/// <param name="args">Details about the launch request and process.</param>
protected override void OnLaunched(LaunchActivatedEventArgs args)
{
DispatcherHelper.Initialize();
ServiceLocator.MessageService = new MessageService();
ServiceLocator.LiveTileNotifyService = new LiveTileNotifyService();
ServiceLocator.NavigationService = new NavigationService();
ServiceLocator.AzureMobileService = new AzureMobileService();
ServiceLocator.ResourceFileService = new ResourceFileService();
//Using MVVM Cross Container
var iocProvider = MvxSimpleIoCContainer.Initialize();
Mvx.RegisterSingleton<IMvxFileStore>(new MvxWindowsStoreBlockingFileStore());
//Oauth Init
OAuthUtility.ComputeHash = (key, buffer) =>
{
var crypt = Windows.Security.Cryptography.Core.MacAlgorithmProvider.OpenAlgorithm("HMAC_SHA1");
var keyBuffer = Windows.Security.Cryptography.CryptographicBuffer.CreateFromByteArray(key);
var cryptKey = crypt.CreateKey(keyBuffer);
var dataBuffer = Windows.Security.Cryptography.CryptographicBuffer.CreateFromByteArray(buffer);
var signBuffer = Windows.Security.Cryptography.Core.CryptographicEngine.Sign(cryptKey, dataBuffer);
byte[] value;
Windows.Security.Cryptography.CryptographicBuffer.CopyToByteArray(signBuffer, out value);
return value;
};
Frame rootFrame = Window.Current.Content as Frame;
// Do not repeat app initialization when the Window already has content,
// just ensure that the window is active
if (rootFrame == null)
{
// Create a Frame to act as the navigation context and navigate to the first page
rootFrame = new Frame();
if (args.PreviousExecutionState == ApplicationExecutionState.Terminated)
{
//TODO: Load state from previously suspended application
}
// Place the frame in the current Window
Window.Current.Content = rootFrame;
}
//if (rootFrame.Content == null)
//{
// // When the navigation stack isn't restored navigate to the first page,
// // configuring the new page by passing required information as a navigation
// // parameter
// if (!rootFrame.Navigate(typeof(ItemsShowcaseView), args.Arguments))
// {
// throw new Exception("Failed to create initial page");
// }
//}
//MVVMCross setup
var setup = new Setup(rootFrame);
setup.Initialize();
//MVVMCross setup
var start = Mvx.Resolve<IMvxAppStart>();
start.Start();
// Ensure the current window is active
Window.Current.Activate();
}
示例13: OnLaunched
/// <summary>
/// Invoked when the application is launched normally by the end user. Other entry points
/// will be used such as when the application is launched to open a specific file.
/// </summary>
/// <param name="e">Details about the launch request and process.</param>
protected override void OnLaunched(LaunchActivatedEventArgs e)
{
#if DEBUG
if (System.Diagnostics.Debugger.IsAttached)
{
this.DebugSettings.EnableFrameRateCounter = true;
}
#endif
XamlControls.Frame rootFrame = Window.Current.Content as XamlControls.Frame;
// Do not repeat app initialization when the Window already has content,
// just ensure that the window is active
if (rootFrame == null)
{
// Create a Frame to act as the navigation context and navigate to the first page
rootFrame = new XamlControls.Frame();
// Set the default language
rootFrame.Language = Windows.Globalization.ApplicationLanguages.Languages[0];
rootFrame.NavigationFailed += OnNavigationFailed;
//rootFrame.Navigated += OnRootFrameNavigated;
var setup = new Setup(rootFrame, e);
setup.Initialize();
if (e.PreviousExecutionState == ApplicationExecutionState.Terminated)
{
//TODO: Load state from previously suspended application
}
// Place the frame in the current Window
Window.Current.Content = rootFrame;
}
if (rootFrame.Content == null)
{
// When the navigation stack isn't restored navigate to the first page,
// configuring the new page by passing required information as a navigation
// parameter
rootFrame.Navigate(typeof(MainPage), e.Arguments);
}
// Ensure the current window is active
Window.Current.Activate();
}