public bool OpenScreen(string screenName, String controllerName , Dictionary<string, object> parameters = null , bool isBackCommand = false , bool isRefresh = false) { try { ActionHandler.Busy = true; ActionHandlerEx.Busy = true; _baseActivity.ClearNavigationEvents(); DateTime startLoading = DateTime.Now; ValueStack = new ValueStack.ValueStack(BitBrowserApp.Current.ExceptionHandler); ValueStack.Push("common", _commonData); ValueStack.Push("context", this); ValueStack.Push("dao", DAL.DAO); ValueStack.Push("activity", _baseActivity); foreach (var variable in GlobalVariables) ValueStack.Push(variable.Key, variable.Value); if (parameters != null) foreach (KeyValuePair<String, object> item in parameters) ValueStack.Push(item.Key, item.Value); var controller = ControllerFactory.CreateInstance().CreateController<Controllers.ScreenController>(controllerName); ValueStack.Push("controller", controller); screenName = controller.GetView(screenName); var scr = (Screen)ScreenFactory.CreateInstance().CreateScreen<AndroidStyleSheet>(screenName, ValueStack, controller); var currentScreen = new ScreenData(screenName, controllerName, scr); FlipScreen(scr.View, isBackCommand, isRefresh); if (Settings.DevelopModeEnabled) { string message = string.Format("{0}\n{1}" , screenName , (DateTime.Now - startLoading).ToString("ss\\.ff")); Toast.MakeText(_baseActivity, message, ToastLength.Short).Show(); } ThreadPool.QueueUserWorkItem(Finish, CurrentScreen); CurrentScreen = currentScreen; return true; } catch (Exception e) { HandleException(e); return false; } }
public bool OpenScreen (String screenName , string controllerName, Dictionary<String , object> parameters = null , bool isBackCommand = false , bool isRefresh = false) { try { Busy = true; _back = null; _forward = null; ValueStack = new ValueStack.ValueStack (_exceptionHandler); ValueStack.Push ("common", _commonData); ValueStack.Push ("context", this); ValueStack.Push ("dao", DAL.DAO); foreach (var variable in GlobalVariables) ValueStack.Push (variable.Key, variable.Value); if (parameters != null) { foreach (KeyValuePair<String, object> item in parameters) { ValueStack.Push (item.Key, item.Value); } } Controllers.ScreenController newController = ControllerFactory.CreateInstance ().CreateController<Controllers.ScreenController> (controllerName); ValueStack.Push ("controller", newController); screenName = newController.GetView (screenName); TabOrderManager.Create (this); Screen scr = (Screen)Factory.ScreenFactory.CreateInstance ().CreateScreen<IOSStyleSheet> (screenName, ValueStack, newController); if (CurrentScreen != null) ((IDisposable)CurrentScreen.Screen).Dispose (); CurrentScreen = new ScreenData (screenName, controllerName, scr); ScreenController viewController = new ScreenController (scr.View); if (!isRefresh) { _controller.SetViewControllers (new UIViewController[] { _controller.TopViewController }, false); if (!isBackCommand) { _controller.PushViewController (viewController, true); } else { _controller.SetViewControllers (new UIViewController[] { viewController, _controller.TopViewController }, false); _controller.PopViewControllerAnimated (true); } } else { _controller.PopViewControllerAnimated (false); _controller.PushViewController (viewController, false); } } catch (Exception ex) { HandleException (ex); } finally { ActionHandler.Busy = false; ActionHandlerEx.Busy = false; Busy = false; } return true; }