public void NavigateTo(string uri, params InvokeParam[] arguments) { InvokeParameters invokeParameters = new InvokeParameters(); foreach (var param in arguments) { invokeParameters.Set(param); } DefinitionFile def = uri != null?ContentLoader.Current.Load <DefinitionFile>(uri) : null; Navigation.NavigateTo(def, invokeParameters); }
internal void NavigateTo(DefinitionFile def, InvokeParameters parameters) { if (def == null) { AddPage(null); return; } Type controllerType = def["PageController"] as Type; UiController controller = Controller; bool attachController = false; if (controllerType != null) { var newController = Activator.CreateInstance(controllerType) as UiController; if (newController != null) { newController.Parent = Controller; controller = newController; attachController = true; } } IDefinitionClass obj = (IDefinitionClass)Activator.CreateInstance(def.Class); if (!(obj is UiPage)) { throw new Exception("Error while navigating to page. The given file doesn't define UiPage."); } if (controller is UiNavigationController) { (controller as UiNavigationController).InitPage(parameters); } if (attachController) { (obj as UiView).Controller = controller; } if (!obj.Init(controller, Binding, def)) { throw new Exception("Error while navigating to page."); } AddPage(obj as UiPage); _history.Add(new Tuple <DefinitionFile, InvokeParameters>(def, parameters)); }
public virtual void InitPage(InvokeParameters parameters) { }
public IAsyncResult BeginInvoke(Delegate method, Object[] args) { lock( this.invokeEventQueue ) { InvokeParameters iParm = new InvokeParameters(); InvokeAsyncResult ar = new InvokeAsyncResult(); if( args != null ) { ar.AsyncState = args[args.Length - 1]; } iParm.method = method; iParm.args = args; iParm.wr = ar; if(toolkitWindow == null) { CreateControlInner(); } this.invokeEventQueue.Enqueue( iParm ); toolkitWindow.SendBeginInvoke(IntPtr.Zero); return ar; } }