本文整理汇总了C#中IMvxViewModel类的典型用法代码示例。如果您正苦于以下问题:C# IMvxViewModel类的具体用法?C# IMvxViewModel怎么用?C# IMvxViewModel使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
IMvxViewModel类属于命名空间,在下文中一共展示了IMvxViewModel类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Close
public override void Close(IMvxViewModel toClose)
{
var topViewController = _masterNavigationController.TopViewController;
if (topViewController == null)
{
MvxTrace.Trace(MvxTraceLevel.Warning, "Don't know how to close this viewmodel - no topmost");
return;
}
var topView = topViewController as IMvxTouchView;
if (topView == null)
{
MvxTrace.Trace(MvxTraceLevel.Warning,
"Don't know how to close this viewmodel - topmost is not a touchview");
return;
}
var viewModel = topView.ReflectionGetViewModel();
if (viewModel != toClose)
{
MvxTrace.Trace(MvxTraceLevel.Warning,
"Don't know how to close this viewmodel - topmost view does not present this viewmodel");
return;
}
_masterNavigationController.PopViewControllerAnimated(true);
}
示例2: TryLoad
public bool TryLoad(Type viewModelType, IDictionary<string, string> parameters, out IMvxViewModel model)
{
model = null;
var constructor = viewModelType
#if NETFX_CORE
.GetTypeInfo().DeclaredConstructors
#else
.GetConstructors()
#endif
.FirstOrDefault(c => c.GetParameters().All(p=> p.ParameterType == typeof(string)));
if (constructor == null)
return false;
var invokeWith = new List<object>();
foreach (var parameter in constructor.GetParameters())
{
string parameterValue = null;
if (parameters == null ||
!parameters.TryGetValue(parameter.Name, out parameterValue))
{
MvxTrace.Trace("Missing parameter in call to {0} - missing parameter {1} - asssuming null", viewModelType,
parameter.Name);
}
invokeWith.Add(parameterValue);
}
model = Activator.CreateInstance(viewModelType, invokeWith.ToArray()) as IMvxViewModel;
return (model != null);
}
示例3: Close
public virtual void Close(IMvxViewModel toClose)
{
var topViewController = this.MasterNavigationController.TopViewController;
if (topViewController == null)
{
MvxTrace.Warning("Don't know how to close this viewmodel - no topmost");
return;
}
var topView = topViewController as IMvxIosView;
if (topView == null)
{
MvxTrace.Warning(
"Don't know how to close this viewmodel - topmost is not a touchview");
return;
}
var viewModel = topView.ReflectionGetViewModel();
if (viewModel != toClose)
{
MvxTrace.Warning(
"Don't know how to close this viewmodel - topmost view does not present this viewmodel");
return;
}
this.MasterNavigationController.PopViewController(true);
}
示例4: Close
public override void Close(IMvxViewModel toClose)
{
if (_currentModalViewController != null)
{
IMvxTouchView mvxTouchView = _currentModalViewController as IMvxTouchView;
if (mvxTouchView == null)
MvxTrace.Error("Unable to close view - modal is showing but not an IMvxTouchView");
else if (mvxTouchView.ReflectionGetViewModel() != toClose)
{
MvxTrace.Error("Unable to close view - modal is showing but is not the requested viewmodel");
}
else
{
// ISSUE: reference to a compiler-generated method
_currentModalViewController.DismissViewController(true, () => { });
_currentModalViewController = null;
}
return;
}
// We will look across all active navigation stacks to see if we can
// pop our MvxView associated with this MvxViewModel (saves explicitly having to specify)
bool modelClosed = CloseTopView(toClose, CentrePanelUiNavigationController());
if (!modelClosed) modelClosed = CloseTopView(toClose, LeftPanelUiNavigationController());
if (!modelClosed) modelClosed = CloseTopView(toClose, RightPanelUiNavigationController());
if (!modelClosed)
{
MvxTrace.Warning("Don't know how to close this viewmodel - none of topmost views represent this viewmodel");
}
}
示例5: Close
public sealed override void Close(IMvxViewModel viewModel)
{
if (_fragmentHostRegistrationSettings.IsTypeRegisteredAsFragment(viewModel.GetType()))
CloseFragment(viewModel);
else
CloseActivity(viewModel);
}
示例6: Close
public override void Close(IMvxViewModel toClose)
{
var root = _window.RootViewController;
var view = Mvx.Resolve<IMvxTouchViewCreator>().CreateView(toClose) as BaseViewController;
var masterView = MasterNavigationController.TopViewController as MasterPanelView;
if (masterView != null && view != null)
{
switch (view.TypeOfView)
{
case ViewType.MenuView:
base.Close(masterView.ViewModel);
break;
case ViewType.SubMenuView:
masterView.MasterContainer.HideMenu();
break;
case ViewType.DetailView:
base.Close(masterView.ViewModel);
break;
case ViewType.SingleView:
base.Close(toClose);
break;
}
}
else
base.Close(toClose);
}
示例7: CustomDialog
public CustomDialog(Android.Content.Context context, int layout, IMvxViewModel viewModel)
: this(context, Resource.Style.CustomDialog)
{
this.BindingContext = new MvxAndroidBindingContext(context, (context as IMvxLayoutInflaterHolder));
ViewModel = viewModel;
Init(layout);
}
示例8: Close
public override void Close(IMvxViewModel viewModel)
{
if (NavigationProvider == null)
return;
NavigationProvider.Pop();
}
示例9: Close
public virtual void Close(IMvxViewModel toClose)
{
var topInterfaceController = this._interfaceControllers.Last();
if (topInterfaceController == null)
{
MvxTrace.Warning("Don't know how to close this viewmodel - no topmost");
return;
}
var topView = topInterfaceController as IMvxWatchOSView;
if (topView == null)
{
MvxTrace.Warning(
"Don't know how to close this viewmodel - topmost is not a watchOSView");
return;
}
var viewModel = topView.ReflectionGetViewModel();
if (viewModel != toClose)
{
MvxTrace.Warning(
"Don't know how to close this viewmodel - topmost view does not present this viewmodel");
return;
}
topInterfaceController.PopController();
}
示例10: Close
public override void Close(IMvxViewModel toClose)
{
if (_currentModalViewController != null)
{
var touchView = _currentModalViewController as IMvxTouchView;
if (touchView == null)
{
MvxTrace.Error(
"Unable to close view - modal is showing but not an IMvxTouchView");
return;
}
var viewModel = touchView.ReflectionGetViewModel();
if (viewModel != toClose)
{
MvxTrace.Error(
"Unable to close view - modal is showing but is not the requested viewmodel");
return;
}
var nav = _currentModalViewController.ParentViewController as UINavigationController;
if (nav != null)
nav.DismissViewController(true, () => { });
else
_currentModalViewController.DismissViewController(true, () => { });
_currentModalViewController = null;
return;
}
base.Close(toClose);
}
示例11: Close
public override void Close(IMvxViewModel toClose)
{
if (_currentModalViewController != null)
{
var touchView = _currentModalViewController as IMvxTouchView;
if (touchView == null)
{
MvxTrace.Trace(MvxTraceLevel.Error, "Unable to close view - modal is showing but not an IMvxTouchView");
return;
}
var viewModel = touchView.ReflectionGetViewModel();
if (viewModel != toClose)
{
MvxTrace.Trace(MvxTraceLevel.Error, "Unable to close view - modal is showing but is not the requested viewmodel");
return;
}
_currentModalViewController.DismissModalViewControllerAnimated(true);
_currentModalViewController = null;
return;
}
base.Close(toClose);
}
示例12: CreateTabFor
private UIViewController CreateTabFor(string title, string imageName, IMvxViewModel viewModel)
{
Mvx.Trace("CreateTabFor");
var innerView = (UIViewController)this.CreateViewControllerFor(viewModel);
PresentViewController(innerView, false, () => { });
return innerView;
}
示例13: Reload
public virtual IMvxViewModel Reload(IMvxViewModel viewModel,
IMvxBundle parameterValues,
IMvxBundle savedState)
{
RunViewModelLifecycle(viewModel, parameterValues, savedState);
return viewModel;
}
示例14: CreateViewFor
// from Stuart Lodge N+1-25
private UIViewController CreateViewFor(IMvxViewModel viewModel, bool navBarHidden)
{
var controller = new UINavigationController();
var screen = this.CreateViewControllerFor(viewModel) as UIViewController;
controller.PushViewController(screen, false);
controller.NavigationBarHidden = navBarHidden;
return controller;
}
示例15: CreateTabFor
private UIViewController CreateTabFor(string title, string imageName, IMvxViewModel viewModel)
{
var controller = new UINavigationController();
var screen = this.CreateViewControllerFor(viewModel) as UIViewController;
SetTitleAndTabBarItem(screen, title, imageName);
controller.PushViewController(screen, false);
return controller;
}