我的MVVMCross应用程序中有一个奇怪的错误.
考虑以下情况:
<Switch
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:focusable="false"
android:clickable="false"
android:layout_alignParentRight="true"
android:id="@+id/activatedSwitch"
local:MvxBind="Checked IsActive" />
Run Code Online (Sandbox Code Playgroud)
目标版本:14级
链接:仅限Sdk程序集
Android手机版本为4.1.2.
当我在调试模式下运行应用程序时,一切正常.
但是当我在Release中运行它时,对Checked属性的绑定失败,并出现以下错误:
E/MvxBind(11670):12,70未找到视图类型 - 切换
我实现了一个带有图像的简单按钮:
<Button Command="{Binding ButtonCommand, ElementName=ImageButtonControl}">
<StackPanel Orientation="Horizontal">
<Image Source="{Binding ButtonImage, ElementName=ImageButtonControl}"/>
<TextBlock Text="{Binding ButtonText, ElementName=ImageButtonControl}" Margin="2,0,0,0"/>
</StackPanel>
</Button>
Run Code Online (Sandbox Code Playgroud)
如您所见,我公开了一个ButtonCommand属性,以便能够将ICommand附加到此UserControl:
public partial class ImageButton : UserControl
{
/// <summary>
/// The dependency property that gets or sets the source of the image to render.
/// </summary>
public static DependencyProperty ImageSourceProperty =
DependencyProperty.Register("ButtonImage", typeof(ImageSource), typeof(ImageButton));
public static DependencyProperty TextProperty =
DependencyProperty.Register("ButtonText", typeof(string), typeof(ImageButton));
public static DependencyProperty ButtonCommandProperty =
DependencyProperty.Register("ButtonCommand", typeof(ICommand), typeof(ImageButton));
public ImageButton()
{
this.DataContext = this;
InitializeComponent();
}
/// <summary>
/// …Run Code Online (Sandbox Code Playgroud) 在我的SOA架构中,我有几个WCF服务.
我的所有服务都需要访问数据库.
我应该创建一个专门负责所有数据库访问的WCF服务吗?
或者,如果我的每个服务都有自己的数据库访问权限,这样可以吗?
在一个版本中,我只在一个服务中实例化了一个实体层,而所有其他服务都依赖于此服务.
在另一个实体中,实体层在我的每个服务中都是重复的.
第一个版本的主要缺点是引起的耦合.
另一个版本的缺点是层重复,可能是SOA不好的做法?
那么,Stack Overflow的优秀人物是怎么回事?
假设我有一个PetManager和一个Cat:
class PetManager
{
PetManager(IBusinessLayer businessLayer, IWashingService washingService);
IBusinessLayer BusinessLayer;
IWashingService WashingService;
}
class Cat
{
Cat(PetManager manager, string name, int levelOfStupidity);
}
Run Code Online (Sandbox Code Playgroud)
现在让我们说,我的猫需要洗衣服,要从我的宠物经理那里得到抚养费,它是如此地难道吗?
class Cat
{
Cat(PetManager manager, string name, int levelOfStupidity)
{
this.manager = manager;
this.name = name;
this.levelOfStupidity = levelOfStupidity;
}
IWashingService WashingService
{
get { return this.manager.WashingService; }
}
}
Run Code Online (Sandbox Code Playgroud)
我强烈怀疑是的,这可能是...
我对以下结果感到困惑:
PRINT 3.1415926535897931 /180
Run Code Online (Sandbox Code Playgroud)
控制台结果= 0.01745329251994329500
DECLARE @whatTheHell float(53)
SET @whatTheHell = 3.1415926535897931/180
PRINT @whatTheHell
Run Code Online (Sandbox Code Playgroud)
控制台结果= 0.0174533
我不明白,因为提到这个:
http://msdn.microsoft.com/en-us/library/ms131092.aspx
Sql Server Float应该等同于c#double.但是当我在c#中计算时:
double hellYeah = 3.1415926535897931 /180;
Run Code Online (Sandbox Code Playgroud)
我得到0.017453292519943295 ......
有没有办法在iOS中使用MVVMCross 实现方法绑定?我无法在vids或教程中看到这样的绑定示例......
ImageNavigationViewModel:
public void NavigateLeft()
{
if (!this.HasLeftSisters.Value)
{
return;
}
this.currentNodeIndex--;
this.Update();
}
Run Code Online (Sandbox Code Playgroud)
ImageNavigationView:
private UIButton navigateLeftButton;
...
var set = this.CreateBindingSet<ImageNavigationView, ImageNavigationViewModel>();
set.Bind(this.navigateLeftButton).To(vm => vm.NavigateLeft);
Run Code Online (Sandbox Code Playgroud)
我有一个编译时错误,因为它期望一个对象(ICommand).
我也试过这个:
set.Bind(this.navigateLeftButton).To("NavigateLeft");
Run Code Online (Sandbox Code Playgroud)
并且有运行时错误:无法为绑定TouchUpInside为NavigateLeft创建目标绑定.
我最终在我的视图模型中添加了一个ICommand,这有点令人失望,因为我在Android中找到"方法绑定".