示例#1
0
		//
		// 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)
		{
			// Appearance
			UITableView.Appearance.BackgroundColor = Styles.RTDarkerBlue;
			UITableView.Appearance.SeparatorInset = UIEdgeInsets.Zero;
			UITabBar.Appearance.BarTintColor = Styles.RTDarkerBlue;

			// create a new window instance based on the screen size
			window = new UIWindow(UIScreen.MainScreen.Bounds);

			var cs = new ConcurrencyService();
			_cs = cs;

			var logSource = new LogHub();
			_loggerFactory = new LoggerFactory(logSource);

#if DEBUG
			UIApplication.CheckForIllegalCrossThreadCalls = true;
			var logViewController = new LogViewController(cs, logSource);
#endif

			_reactiveTrader = new Adaptive.ReactiveTrader.Client.Domain.ReactiveTrader();
			_startUpViewController = new StartUpView(Initalize);
			Initalize();


			_notificationHandler = new NotificationGenerator(_reactiveTrader, cs);
			_notificationHandler.Initialise();

			var tradesViewController = new TradesViewController(_reactiveTrader, cs);
			var pricesViewController = new PriceTilesViewController(_reactiveTrader, cs);
			var statusViewController = new StatusViewController(_reactiveTrader, cs, _notificationHandler.NotificationsEnabled);

			tabBarController = new UITabBarController();
			tabBarController.ViewControllers = new UIViewController[] {
				pricesViewController,
				tradesViewController,
				statusViewController
				#if DEBUG
				, logViewController
				#endif
			};

			tabBarController.ModalTransitionStyle = UIModalTransitionStyle.CrossDissolve;

			window.RootViewController = _startUpViewController;
			window.MakeKeyAndVisible();

			new WormholeSender(_reactiveTrader);

			return true;
		}
示例#2
0
		//
		// 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)
		{
			// Appearance
			UITableView.Appearance.BackgroundColor = Styles.RTDarkerBlue;
			UITableView.Appearance.SeparatorInset = UIEdgeInsets.Zero;

			UITabBar.Appearance.BarTintColor = Styles.RTDarkerBlue;


			// Black opaque status bar (which we request via Info.plist) not supported in iOS 7?
			// Xamarin 5.0.1 toolset out of date?

			UIApplication.SharedApplication.SetStatusBarStyle (UIStatusBarStyle.LightContent, false);
			UIApplication.SharedApplication.SetStatusBarHidden (false, true);

			// create a new window instance based on the screen size
			window = new UIWindow (UIScreen.MainScreen.Bounds);

			var cs = new ConcurrencyService ();
			var logSource = new LogHub ();
			var logging = new LoggerFactory (logSource);

			#if DEBUG
			UIApplication.CheckForIllegalCrossThreadCalls = true;
			var logViewController = new LogViewController(cs, logSource);
			#endif

			_reactiveTrader = new Adaptive.ReactiveTrader.Client.Domain.ReactiveTrader ();

			_reactiveTrader.Initialize (UserModel.Instance.TraderId, new [] { "https://reactivetrader.azurewebsites.net/signalr" }, logging);
			//		_reactiveTrader.Initialize (UserModel.Instance.Id, new [] { "http://192.168.1.197:8080/signalr" }, logging);

			var tradesViewController = new TradesViewController (_reactiveTrader, cs);
			var pricesViewController = new PriceTilesViewController (_reactiveTrader, cs);
			var statusViewController = new StatusViewController (_reactiveTrader, cs);

			tabBarController = new UITabBarController ();

			tabBarController.ViewControllers = new UIViewController [] {
				pricesViewController,
				tradesViewController,
				statusViewController
				#if DEBUG
				, logViewController
				#endif
			};

			var startUpViewController = new StartUpView ();

			startUpViewController.DisplayMessages (true, "Connecting..");
			_reactiveTrader.ConnectionStatusStream
				.Where (ci => ci.ConnectionStatus == ConnectionStatus.Connected)
				.Timeout (TimeSpan.FromSeconds (15))
				.ObserveOn (cs.Dispatcher)
				.Subscribe (_ => startUpViewController.PresentViewController (tabBarController, false, null),
				ex => startUpViewController.DisplayMessages (false, "Disconnected", "Unable to connect. Please restart the app."));

			window.RootViewController = startUpViewController;

			// make the window visible
			window.MakeKeyAndVisible ();

			return true;
		}