protected override void OnControllerLoadComplete(IMXView fromView, IMXController controller, MXViewPerspective viewPerspective) { Android.Util.Log.Debug("MXDroidContainer", "OnControllerLoadComplete"); Type viewType = Views.GetViewType(viewPerspective); if (viewType != null) { // stash the model away so we can get it back when the view shows up! ViewModels[controller.ModelType] = controller.GetModel(); LastContext = fromView as Activity ?? ApplicationContext; if (NavigationHandler != null) { // allow first crack at the view creation to the person over-riding NavigationHandler(viewType); } else if (LastContext != null) { // use the last context to instantiate the new view Intent intent = new Intent(LastContext, viewType); intent.AddFlags(ActivityFlags.NewTask); LastContext.StartActivity(intent); } else { Android.Util.Log.Debug("MXDroidContainer", "OnControllerLoadComplete: View not found for " + viewPerspective.ToString()); throw new TypeLoadException("View not found for " + viewPerspective.ToString()); } } else { Android.Util.Log.Debug("MXDroidContainer", "OnControllerLoadComplete: View not found for " + viewPerspective.ToString()); throw new TypeLoadException("View not found for " + viewPerspective.ToString()); } }
public void LoadViewForController(IMXView fromView, IMXController controller, MXViewPerspective viewPerspective) { HideLoading(); if (controller.View == null) { // get the view, create it if it has yet been created controller.View = Views.GetOrCreateView(viewPerspective); if (controller.View == null) { Console.WriteLine("View not found for perspective!" + viewPerspective.ToString()); throw new ArgumentException("View creation failed for perspective!" + viewPerspective.ToString()); } } // asign the view it's model and render the contents of the view controller.View.SetModel(controller.GetModel()); controller.View.Render(); // pull the type from the view ViewNavigationContext navigationContext = MXTouchNavigation.GetViewNavigationContext(controller.View); UIViewController viewController = controller.View as UIViewController; // iFactr binding options if (viewController == null) viewController = RenderLayer(controller.View); //slideoutNavigation.PushToModel(viewController); Menu.TopView = viewController; ShowView(); }
public MXTouchViewGroupItem(IMXView view, String title, String iconFile) { this.ViewType = view.GetType(); this.View = view; this.Title = title; this.Icon = iconFile; }
public MXTouchViewGroupItem(IMXView view, String title, String iconFile) { this.ViewType = view.GetType(); this.View = view; this.Title = title; this.Image = UIImage.FromFile(iconFile); }
protected void StartViewForController(IMXView fromView, IMXController controller, MXShowViewRequest showViewRequest) { var viewPerspective = showViewRequest.ViewPerspective; Type viewType = PhoneContainerInstance.Views.GetViewType(viewPerspective); if (viewType == null) { throw new TypeLoadException("View not found for " + viewPerspective.ToString()); } #warning TODO - make this Uri look up better! Uri viewUri = new Uri("/" + viewType.Name + ".xaml", UriKind.Relative); // get the uri from the MXPhoneView attribute, if present object[] attributes = viewType.GetCustomAttributes(true); for (int i = 0; i < attributes.Length; i++) { if (attributes[i] is MXPhoneViewAttribute) { viewUri = new Uri(((MXPhoneViewAttribute)attributes[i]).Uri, UriKind.Relative); break; } } // stash the model away so we can get it back when the view shows up! _cachedViewModel = showViewRequest.ViewModel; #warning TODO - make this navigation better - pwn the history stack //var page = fromView as PhoneApplicationPage; //((MXPhonePage)fromView).NavigationService.n _rootFrame.Source = viewUri; //_rootFrame.Navigate(viewUri); }
protected override void OnControllerLoadComplete(IMXView fromView, IMXController controller, MXViewPerspective viewPerspective) { Debug.WriteLine("OnControllerLoadComplete"); Type viewType = Views.GetViewType(viewPerspective); if (viewType != null) { // stash the model away so we can get it back when the view shows up! ViewModels[controller.ModelType] = controller.GetModel(); var activity = fromView as Page; if (NavigationHandler != null) { // allow first crack at the view creation to the person over-riding NavigationHandler(viewType); } else if (activity != null) { // start the next view NavigationFrame.NavigationService.Navigate(activity); } else { RenderViewFromPerspective(controller, viewPerspective); NavigationFrame.NavigationService.Navigate(Views.GetView(viewPerspective) as Page); } } else { Debug.WriteLine("OnControllerLoadComplete: View not found for " + viewPerspective.ToString()); throw new TypeLoadException("View not found for " + viewPerspective.ToString()); } }
protected override void OnControllerLoadComplete(IMXView fromView, IMXController controller, MXViewPerspective perspective) { // store of the stack for later NavHistory.Push(new NavDetail(controller.Uri, controller.Parameters)); // render the view MXConsoleContainer.RenderViewFromPerspective(controller, perspective); }
protected override void OnControllerLoadComplete(IMXView fromView, IMXController controller, string perspective, string navigatedUri) { // store of the stack for later NavHistory.Push(new NavDetail(navigatedUri, null)); // render the view RenderViewFromPerspective(controller.ModelType, perspective, controller.GetModel()); }
protected override void OnControllerLoadComplete(IMXView fromView, IMXController controller, MXViewPerspective viewPerspective) { //Console.WriteLine("Controller Load End"); Xamarin.Forms.Device.BeginInvokeOnMainThread(()=>{ LoadViewForController(fromView, controller, viewPerspective); if (ControllerLoadComplete != null) ControllerLoadComplete(controller); }); }
protected override void OnControllerLoadComplete(IMXView fromView, IMXController controller, MXViewPerspective viewPerspective) { Console.WriteLine("Controller Load End"); _appDelegate.InvokeOnMainThread( delegate { LoadViewForController(fromView, controller, viewPerspective); if (ControllerLoadComplete != null) ControllerLoadComplete(controller); }); }
public override void ShowError(IMXView fromView, IMXController controller, Exception exception) { if (fromView != null) { var activity = fromView as Activity; if (activity != null) activity.RunOnUiThread( () => Toast.MakeText(activity, "Error: " + exception.Message, ToastLength.Long).Show()); } base.ShowError(fromView, controller, exception); }
protected static void StartViewForController(IMXView fromView, IMXController controller, MXViewPerspective viewPerspective) { Type viewType = Instance.Views.GetViewType(viewPerspective); if (viewType == null) { Console.WriteLine("View not found for " + viewPerspective.ToString()); throw new TypeLoadException("View not found for " + viewPerspective.ToString()); } Uri viewUri = new Uri("/" + viewType.Name + ".xaml", UriKind.Relative); // get the uri from the MXPhoneView attribute, if present object[] attributes = viewType.GetCustomAttributes(true); for (int i = 0; i < attributes.Length; i++) { if (attributes[i] is MXPhoneViewAttribute) { viewUri = new Uri(((MXPhoneViewAttribute)attributes[i]).Uri, UriKind.Relative); break; } } // stash the model away so we can get it back when the view shows up! ViewModels[controller.ModelType] = controller.GetModel(); var page = fromView as PhoneApplicationPage; if (!(controller.View is PhoneApplicationPage) && controller.View != null && RenderLayer != null) { controller.View.Render(); viewUri = RenderLayer(controller.View); } if (page != null) { // NOTE: assumes XAML file matches type name and no sub directories page.NavigationService.Navigate(viewUri); } else { if (_rootFrame != null) { _rootFrame.Navigate(viewUri); } // failure, called too early or Something Very Bad Happened(tm)... } }
public static void Back(IMXView view) { // exit if we try to go back too far if (!CanGoBack()) { Environment.Exit(0); } else { // pop off the current view NavHistory.Pop(); // prepare to re-push the current view NavDetail backTo = NavHistory.Pop(); // re-display the view Navigate(view, backTo.Path, backTo.Parameters); } }
protected void StartViewForController(IMXView fromView, IMXController controller, string viewPerspective) { Type viewType = Views.GetViewType(controller.ModelType, viewPerspective); if (viewType == null) { Console.WriteLine("View not found for " + viewPerspective); throw new TypeLoadException("View not found for " + viewPerspective); } var viewUri = new Uri("/" + viewType.Name + ".xaml", UriKind.Relative); // get the uri from the MXPhoneView attribute, if present object[] attributes = viewType.GetCustomAttributes(true); foreach (MXPhoneViewAttribute t in attributes.OfType<MXPhoneViewAttribute>()) { viewUri = new Uri((t).Uri, UriKind.Relative); break; } // stash the model away so we can get it back when the view shows up! ViewModels[controller.ModelType] = controller.GetModel(); var page = fromView as PhoneApplicationPage; if (page != null) { // NOTE: assumes XAML file matches type name and no sub directories page.NavigationService.Navigate(viewUri); } else { if (_rootFrame != null) { _rootFrame.Navigate(viewUri); } // failure, called too early or Something Very Bad Happened(tm)... } }
public void LoadViewForController(IMXView fromView, IMXController controller, MXViewPerspective viewPerspective) { hideLoading(); if (controller.View == null) { // get the view, create it if it has yet been created controller.View = Views.GetOrCreateView(viewPerspective); if (controller.View == null) { //Console.WriteLine("View not found for perspective!" + viewPerspective.ToString()); throw new ArgumentException("View creation failed for perspective!" + viewPerspective.ToString()); } } // asign the view it's model and render the contents of the view controller.View.SetModel(controller.GetModel()); controller.View.Render(); // pull the type from the view //ViewNavigationContext navigationContext = MXFormsNavigation.GetViewNavigationContext(controller.View); Page page = controller.View as Page; // iFactr binding options if (page == null) page = RenderLayer(controller.View); ViewNavigationContext navigationContext = MXFormsNavigation.GetViewNavigationContext(controller.View); formsNavigation.PushToModel(page); }
/// <summary> /// Initializes a new instance of the <see cref="iFactr.UI.ViewOutputEventArgs"/> class. /// </summary> /// <param name="controller">The <see cref="IMXController"/> instance that the outputted view belongs to.</param> /// <param name="view">The <see cref="IMXView"/> instance that was outputted.</param> public ViewOutputEventArgs(IMXController controller, IMXView view) { Controller = controller; View = view; }
protected override void OnControllerLoadComplete(IMXView fromView, IMXController controller, string viewPerspective, string navigatedUri) { Deployment.Current.Dispatcher.BeginInvoke(() => StartViewForController(fromView, controller, viewPerspective)); }
/* * void LoadController(IMXView fromView, IMXController controller, Dictionary<string, string> parameters) * { * string perspective = controller.Load(parameters); * * // HACKHACK - the CancelLoad hack from MonoCross team is just horrid so I've added a magic string to it :/ * if (perspective != "Ignore" && !Instance.CancelLoad) // done if failed * { * MXViewPerspective viewPerspective = new MXViewPerspective(controller.ModelType, perspective); * // quick check (viable for ALL platforms) to see if there is some kind of a mapping set up * if (!Instance.Views.ContainsKey(viewPerspective)) * throw new Exception("There is no View mapped for " + viewPerspective.ToString()); * * // if we have a view lying around assign it from the map, more of a curtesy to the derived container that anything * controller.View = Instance.Views.GetView(viewPerspective); * if (controller.View != null) * controller.View.SetModel(controller.GetModel()); * * // give the derived container the ability to do something * // with the fromView if it exists or to create it if it doesn't * Instance.OnControllerLoadComplete(fromView, controller, viewPerspective); * } * // clear CancelLoad, we're done * Instance.CancelLoad = false; * } */ void LoadController(IMXView fromView, IMXController controller, Dictionary <string, string> parameters) { var action = controller.Load(parameters); action.Perform(this, fromView, controller); }
public void PushView(IMXView view) { _views.Add(view); Align(NavigationType.Forward); }
/// <summary> /// Called when a controller is about to be loaded. /// </summary> /// <param name="controller">The controller to be loaded.</param> /// <param name="fromView">The view that initiated the navigation that resulted in the controller being loaded.</param> protected override void OnControllerLoadBegin(IMXController controller, IMXView fromView) { Debug.WriteLine("OnControllerLoadBegin"); }
/* public static IMXController NavigateFromButton(string url, Dictionary<string, string> parameters, UIBarButtonItem button) { //_stashButton = button; return Navigate(url, parameters); } */ void LoadViewForController(IMXView fromView, IMXController controller, MXViewPerspective viewPerspective) { HideLoading(); if (controller.View == null) { // get the view, create it if it has yet been created controller.View = Views.GetOrCreateView(viewPerspective); if (controller.View == null) { Console.WriteLine("View not found for perspective!" + viewPerspective.ToString()); throw new ArgumentException("View creation failed for perspective!" + viewPerspective.ToString()); } } // asign the view it's model and render the contents of the view controller.View.SetModel(controller.GetModel()); controller.View.Render(); // pull the type from the view ViewNavigationContext navigationContext = MXTouchNavigation.GetViewNavigationContext(controller.View); UIViewController viewController = controller.View as UIViewController; if (navigationContext == ViewNavigationContext.Modal) { // treat as a modal/popup view _touchNavigation.PushToModel(viewController); } else if (navigationContext == ViewNavigationContext.InContext) { // it's just an in-context view, just slap it on top of the view that navigated it here! UIViewController parentViewController = fromView as UIViewController; parentViewController.NavigationController.PushViewController(viewController, true); } else { // if the view is one of the views in the group MXTouchViewGroup viewGroup = null; MXTouchViewGroupItem viewGroupItem = null; foreach (MXTouchViewGroup vg in ViewGroups) { viewGroupItem = vg.Items.Find( item => item.ViewType == controller.View.GetType() ); if (viewGroupItem != null) { viewGroup = vg; break; } } if (viewGroup != null) { // activate the group! _touchNavigation.PushToViewGroup(viewGroup, viewGroupItem, controller.View as UIViewController); } else { switch (navigationContext) { case ViewNavigationContext.Detail: _touchNavigation.PushToDetail(viewController); break; case ViewNavigationContext.Master: _touchNavigation.PushToMaster(viewController); break; } } } // handle initial view display if not already handled ShowView(); }
protected override void OnControllerLoadComplete(IMXView fromView, IMXController controller, MXShowViewRequest showViewRequest) { Deployment.Current.Dispatcher.BeginInvoke(() => { StartViewForController(fromView, controller, showViewRequest); }); }
public override void ShowError(IMXView fromView, IMXController controller, Exception exception) { _rootFrame.Dispatcher.BeginInvoke(() => MessageBox.Show("Soz - I haz a prblm - " + exception.Message)); }
/// <summary> /// Displays the specified view in the stack. /// </summary> /// <param name="stack">The stack to display the view.</param> /// <param name="view">The view to be displayed.</param> public static void DisplayView(this IHistoryStack stack, IMXView view) { stack.DisplayView(view, false); }
protected override void OnControllerLoadComplete(IMXView fromView, IMXController controller, MXShowViewRequest showViewRequest) { _viewModelLifeCycleHelper.OnControllerLoadComplete(controller, showViewRequest); base.OnControllerLoadComplete(fromView, controller, showViewRequest); }
public virtual void ShowError(IMXView fromView, IMXController controller, Exception exception) { // default implementation is to just wrap and throw the exception throw exception.MXWrap(); }
public static void Navigate(this IMXView view, string url) { MXContainer.Navigate(view, url); }
/// <summary> /// Executes the rendering logic for the view of the specified <see cref="IMXController"/> instance before painting it on the screen. /// </summary> /// <param name="controller">The controller to output.</param> /// <param name="perspective">The perspective that is mapped to the view that will be rendered.</param> /// <param name="navigatedUri">A <see cref="String"/> that represents the uri used to navigate to the controller.</param> /// <exception cref="ArgumentNullException">Thrown when the <paramref name="controller"/> is <c>null</c>.</exception> /// <exception cref="InvalidOperationException">Thrown when there is no view mapped to the <paramref name="perspective"/>.</exception> public void OutputController(IMXController controller, string perspective, string navigatedUri) { if (controller == null) { throw new ArgumentNullException("controller"); } var ilayer = controller as iLayer; IMXView view = Views.GetView(controller.ModelType, perspective); if (view == null) { if (ilayer != null) { view = ilayer.GetView(); ilayer.View = view; } else { var viewType = Views.GetViewType(controller.ModelType, perspective); if (viewType == null) { object model = controller.GetModel(); if (model != null && Device.Reflector.HasAttribute(model.GetType(), typeof(ViewAttribute), false)) { view = ReflectiveUIBuilder.GenerateView(model); } else { throw new InvalidOperationException("There is no view or view type mapped to the given perspective."); } } else { view = (IMXView)Activator.CreateInstance(viewType); } } } view.SetModel(controller.GetModel()); var entry = view as IHistoryEntry; if (entry != null) { entry.OutputPane = PaneManager.Instance.GetPreferredPaneForView(view); } view.Render(); { var handler = ViewOutputting; if (handler != null) { var args = new ViewOutputCancelEventArgs(controller, view); handler(this, args); if (args.Cancel) { return; } } } var tabs = view as ITabView; if (tabs != null) { PaneManager.Instance.Tabs = tabs; } PaneManager.Instance.NavigatedURIs[view] = navigatedUri; OnOutputView(view); { // Handler scope var handler = ViewOutputted; if (handler != null) { handler(this, new ViewOutputEventArgs(controller, view)); } } StopBlockingUserInput(); }
public static void AddView <Model>(IMXView view, string perspective) { Instance.AddView(new MXViewPerspective(typeof(Model), perspective), view.GetType(), view); }
/// <summary> /// Called when an <see cref="IMXController"/> instance has finished loading. /// </summary> /// <param name="fromView">The view that initiated the navigation to the controller.</param> /// <param name="controller">The controller that has finished loading.</param> /// <param name="perspective">The view perspective that was returned from the controller.</param> /// <param name="navigatedUri">A <see cref="String"/> that represents the uri used to navigate to the controller.</param> protected override void OnControllerLoadComplete(IMXView fromView, IMXController controller, string perspective, string navigatedUri) { if (perspective == null) { TheApp.OnControllerLoadCanceled(fromView, controller, navigatedUri); return; } var layer = controller as iLayer; var parent = layer; while (layer != null) { var tabs = layer as NavigationTabs; if (tabs != null && tabs.TabItems != null && tabs.TabItems.Count == 0) { throw new NotSupportedException("NavigationTabs must have at least 1 Tab."); } if (layer is FormLayer) { layer.Items.AddRange(((FormLayer)layer).Fieldsets); } if (layer.CompositeParent != null) { layer.CompositeParent.Items.AddRange(layer.Items); } // for backwards compatibility if (layer.Items.FirstOrDefault() is iList || layer.Items.FirstOrDefault() is iPanel) { layer.Layout = LayerLayout.EdgetoEdge; } else if (layer.Items.FirstOrDefault() is iMenu || layer.Items.FirstOrDefault() is iBlock) { layer.Layout = LayerLayout.Rounded; } iLayer navLayer; var nextMapping = layer.CompositeLayerLink == null ? null : App.NavigationMap.MatchUrl(layer.CompositeLayerLink.Address); if (nextMapping == null || (navLayer = nextMapping.Controller as iLayer) == null || !LargeFormFactor) { break; } navLayer.CompositeParent = layer.CompositeParent ?? layer; navLayer.Clear(); var parameters = new Dictionary <string, string>(); nextMapping.ExtractParameters(layer.CompositeLayerLink.Address, parameters); navLayer.Load(navigatedUri, parameters); if (navLayer.ActionButtons.Any()) { navLayer.CompositeParent.ActionButtons = navLayer.ActionButtons; } layer = navLayer; } Thread.ExecuteOnMainThread(() => { if (parent == null) { OutputController(controller, perspective, navigatedUri); } else { parent.LoadComplete(); } }); }
/// <summary> /// Called when a controller's view output has been canceled by setting <see cref="MXContainer.CancelLoad"/> or by returning a <c>null</c> perspective. /// </summary> /// <param name="fromView">The view that initiated the navigation to the controller.</param> /// <param name="controller">The canceled controller.</param> /// <param name="navigatedUri">The uri used to navigate to the controller.</param> public virtual void OnControllerLoadCanceled(IMXView fromView, IMXController controller, string navigatedUri) { Device.Log.Debug("{0} canceled load to {1}. This can be handled by overriding OnControllerLoadCanceled in the app.", controller, navigatedUri); }
/// <summary> /// Called when an <see cref="IMXView"/> is ready to be outputted. /// </summary> /// <param name="view">The view to be outputted.</param> protected virtual void OnOutputView(IMXView view) { PaneManager.Instance.DisplayView(view); }
/// <summary> /// Loads the specified layer with the specified parameters. /// </summary> /// <param name="fromView">The <see cref="IMXView"/> instance from which the navigation was initiated.</param> /// <param name="navLayer">The <see cref="iLayer"/> instance to load.</param> /// <param name="navigatedUri">A <see cref="String"/> that represents the uri used to navigate to the layer.</param> /// <param name="parameters">A <see cref="Dictionary<TKey, TValue>"/> representing the parameters to pass to the layer's Load method.</param> internal virtual void LoadLayer(IMXView fromView, iLayer navLayer, string navigatedUri, Dictionary <String, String> parameters) { TryLoadController(this, fromView, navLayer, navigatedUri, parameters); }
protected override void OnControllerLoadComplete(IMXView fromView, IMXController controller, MXViewPerspective viewPerspective) { controller.RenderView(); if (controller.View.GetType().BaseType.GetGenericTypeDefinition() != typeof(MXWebkitView<>) && RenderLayer != null) { HtmlGenericControl control = RenderLayer(controller.View); if (controller.Uri == App.NavigateOnLoad) { MXWebkitView<object>.WriteToResponse(controller.ModelType.ToString(), control.Attributes["title"], control); } else { MXWebkitView<object>.WriteAjaxToResponse(controller.ModelType.ToString(), control.Attributes["title"], control); } } }
/// <summary> /// Raises the load complete event after the Controller has completed loading its Model. The View may be populated, /// and the derived class should check if it exists and do something with it if needed for the platform: either free it, /// pop off the views in a stack above it or whatever makes sense to the platform. /// </summary> /// <param name="fromView"> /// The view that raised the navigation. /// </param> /// <param name='controller'> /// The newly loaded controller. /// </param> /// <param name='perspective'> /// The view perspective returned by the controller load. /// </param> /// <param name="navigatedUri"> /// A <see cref="String"/> that represents the uri used to navigate to the controller. /// </param> protected abstract void OnControllerLoadComplete(IMXView fromView, IMXController controller, string perspective, string navigatedUri);
protected override void OnControllerLoadComplete(IMXView fromView, IMXController controller, MXViewPerspective viewPerspective) { _viewModelLifeCycleHelper.OnControllerLoadComplete(controller); base.OnControllerLoadComplete(fromView, controller, viewPerspective); }
/// <summary> /// Adds the specified view to the view map. /// </summary> /// <param name="perspective">The view's perspective.</param> /// <param name="view">The initialized view value.</param> public static void AddView <TModel>(IMXView view, string perspective) { Instance.AddView(typeof(TModel), view.GetType(), perspective, view); }
/* * public static IMXController NavigateFromButton(string url, Dictionary<string, string> parameters, UIBarButtonItem button) * { * //_stashButton = button; * * return Navigate(url, parameters); * } */ void LoadViewForController(IMXView fromView, IMXController controller, MXViewPerspective viewPerspective) { HideLoading(); if (controller.View == null) { // get the view, create it if it has yet been created controller.View = Views.GetOrCreateView(viewPerspective); if (controller.View == null) { Console.WriteLine("View not found for perspective!" + viewPerspective.ToString()); throw new ArgumentException("View creation failed for perspective!" + viewPerspective.ToString()); } } // asign the view it's model and render the contents of the view controller.View.SetModel(controller.GetModel()); controller.View.Render(); // pull the type from the view ViewNavigationContext navigationContext = MXTouchNavigation.GetViewNavigationContext(controller.View); UIViewController viewController = controller.View as UIViewController; if (navigationContext == ViewNavigationContext.Modal) { // treat as a modal/popup view _touchNavigation.PushToModel(viewController); } else if (navigationContext == ViewNavigationContext.InContext) { // it's just an in-context view, just slap it on top of the view that navigated it here! UIViewController parentViewController = fromView as UIViewController; parentViewController.NavigationController.PushViewController(viewController, true); } else { // if the view is one of the views in the group MXTouchViewGroup viewGroup = null; MXTouchViewGroupItem viewGroupItem = null; foreach (MXTouchViewGroup vg in ViewGroups) { viewGroupItem = vg.Items.Find(item => item.ViewType == controller.View.GetType()); if (viewGroupItem != null) { viewGroup = vg; break; } } if (viewGroup != null) { // activate the group! _touchNavigation.PushToViewGroup(viewGroup, viewGroupItem, controller.View as UIViewController); } else { switch (navigationContext) { case ViewNavigationContext.Detail: _touchNavigation.PushToDetail(viewController); break; case ViewNavigationContext.Master: _touchNavigation.PushToMaster(viewController); break; } } } // handle initial view display if not already handled ShowView(); }
public static void Back(this IMXView view) { MXConsoleContainer.Back(view); }
public override void Perform(IMXContainer container, IMXView fromView, IMXController controller) { container.Redirect(_redirectUrl); }
/// <summary> /// Initiates a navigation to the specified URL. /// </summary> /// <param name="view">The <see cref="IMXView"/> that kicked off the navigation.</param> /// <param name="url">A <see cref="String"/> representing the URL to navigate to.</param> public static void Navigate(IMXView view, string url) { InternalNavigate(view, url, new Dictionary <string, string>()); }
/* public static IMXController NavigateFromButton(string url, Dictionary<string, string> parameters, UIBarButtonItem button) { //_stashButton = button; return Navigate(url, parameters); } */ void LoadViewForController(IMXView fromView, IMXController controller, MXViewPerspective viewPerspective) { HideLoading(); if (controller.View == null) { // get the view, create it if it has yet been created controller.View = Views.GetOrCreateView(viewPerspective); if (controller.View == null) { Console.WriteLine("View not found for perspective!" + viewPerspective.ToString()); throw new ArgumentException("View creation failed for perspective!" + viewPerspective.ToString()); } } // asign the view it's model and render the contents of the view controller.View.SetModel(controller.GetModel()); controller.View.Render(); // pull the type from the view ViewNavigationContext navigationContext = MXTouchNavigation.GetViewNavigationContext(controller.View); UIViewController viewController = controller.View as UIViewController; if (navigationContext == ViewNavigationContext.Modal) { // treat as a modal/popup view _touchNavigation.PushToModel(viewController); } else if (navigationContext == ViewNavigationContext.InContext) { // it's just an in-context view, just slap it on top of the view that navigated it here! UIViewController parentViewController = fromView as UIViewController; parentViewController.NavigationController.PushViewController(viewController, true); } else { UIViewController vc = viewController; if (_touchNavigation.HasTabBar) { _touchNavigation.PushViewInTabBar(vc, false); } else { switch (navigationContext) { case ViewNavigationContext.Detail: _touchNavigation.PushToDetail(vc); break; case ViewNavigationContext.Master: _touchNavigation.PushToMaster(vc); break; case ViewNavigationContext.Modal: _touchNavigation.PushToModel(vc); break; } } } // handle initial view display if not already handled ShowView(); }
/// <summary> /// Initiates a navigation to the specified URL. /// </summary> /// <param name="view">The <see cref="IMXView"/> that kicked off the navigation.</param> /// <param name="url">A <see cref="String"/> representing the URL to navigate to.</param> /// <param name="parameters">A <see cref="Dictionary<TKey,TValue>"/> representing any parameters such as submitted values.</param> public static void Navigate(IMXView view, string url, Dictionary <string, string> parameters) { InternalNavigate(view, url, parameters); }
// Model to View associations public static void AddView <Model>(IMXView view) { Instance.AddView(new MXViewPerspective(typeof(Model), ViewPerspective.Default), view.GetType(), view); }
/// <summary> /// Called when a controller is about to be loaded. /// </summary> /// <param name="controller">The controller to be loaded.</param> /// <param name="fromView">The view that initiated the navigation that resulted in the controller being loaded.</param> protected virtual void OnControllerLoadBegin(IMXController controller, IMXView fromView) { #pragma warning disable 618 OnControllerLoadBegin(controller); #pragma warning restore 618 }
public static void Navigate(this IMXView view, string url, Dictionary <string, string> parameters) { MXContainer.Navigate(view, url, parameters); }
public void Perform(IMXContainer container, IMXView fromView, IMXController controller) { // nothing to do container.ShowError(fromView, controller, _exception); }
// currently this class adds no value whatsoever... but it does make the inheritance tree look nice! // keep this class for now - just in case there is future common functionality here public abstract void Perform(IMXContainer container, IMXView fromView, IMXController controller);
protected override void OnControllerLoadComplete(IMXView fromView, IMXController controller, MXViewPerspective viewPerspective) { controller.RenderView(); }
/// <summary> /// Adds the specified view to the view map. /// </summary> /// <param name="perspective">The view perspective key.</param> /// <param name="view">The initialized view value.</param> public void Add(string perspective, IMXView view) { if (view == null) { throw new ArgumentNullException("view"); } Add(perspective, view.ModelType, new TypeLoader(view)); }
protected override void OnControllerLoadComplete(IMXView fromView, IMXController controller, string viewPerspective, string navigatedUri) { try { RenderViewFromPerspective(controller.ModelType, viewPerspective, controller.GetModel()); } catch (ArgumentException ae) { #if DEBUG System.Diagnostics.Debug.WriteLine("Failed to Render a view"); #endif throw new Exception("Webkit container failed to find a view", ae); } }
/// <summary> /// Adds the specified view to the view map. /// </summary> /// <param name="modelType">The type of the view's model.</param> /// <param name="viewType">The view's type.</param> /// <param name="perspective">The view perspective.</param> /// <param name="view">The initialized view value.</param> protected virtual void AddView(Type modelType, Type viewType, string perspective, IMXView view) { if (view == null) { Views.Add(perspective, modelType, viewType); } else { Views.Add(perspective, view); } }
/// <summary> /// Raises the load complete event after the Controller has completed loading its Model, the View may be populated /// and the derived classs should check if it exists and do something with it if needed for the platform, either free it, /// pop off the views in a stack above it or whatever makes sense to the platform /// </summary> /// <param name='controller'> /// Controller. /// </param> /// <param name='viewPerspective'> /// View perspective. /// </param> protected abstract void OnControllerLoadComplete(IMXView fromView, IMXController controller, MXShowViewRequest showViewRequest);