仍然熟悉MonoTouch的限制.是否有可与MonoTouch一起使用的IoC/DI库.像理想的Ninject?
dependency-injection ioc-container inversion-of-control xamarin.ios
我正在寻找的是一种方法来获取当前正在运行powershell脚本的当前驱动器号.
我知道我可以使用当前路径,Get-Location但有没有办法提取驱动器号而不进行某种子串操作?
所以我是iOS开发的新手,我正在尽我所能去学习"最好"的做事方式.(是的,我知道这是一个相对的术语)
我来自一个C#和Java世界,我们通过IOC容器注入依赖项,使用存储库模式抽象数据访问,使用域服务和对象来封装业务数据和行为等等.这些都是我的事情.还没有在iOS开发中看到.(也许我在寻找错误的地方)
我意识到Objective-C是C的超集和动态/松散类型的语言,当涉及到良好的设计实践时,它可能会改变游戏.任何人都可以指点我的一些书籍/博客/其他方面的指示,这将有助于我从一个强类型,有管理的环境到这个新世界的精神飞跃,同时保持我的设计柔顺和遵守SOLID原则?
编辑 - 我想在这里说清楚. 我不是在问如何学习Cocoa框架以及Objective-C作为一种语言的来龙去脉.我发现了很多资源.我希望将其提升到一个新的水平,开始进行TDD并确保我正在构建的项目易于扩展和维护.
我已经搜索了互联网,发现了很多关于如何使用列表选择器更改列表视图颜色的帖子.但它似乎对我不起作用.所以我的问题是我做错了什么?
当我使用下面的文件时,我得到一个列表,其中所有项目背景最初是蓝色的.(我期待白色)
当我上下移动焦点时,文本只会变为深灰色,而项目背景仍为蓝色.(这是我希望单行为蓝色,其余为白色)
当我点击一行时,我点击的行的背景变为黑色,而所有其他行变为绿色.(我希望我点击的行变为绿色,其余为白色)
这是我的主要布局文件:
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
>
<ListView
android:id="@android:id/list"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:listSelector="@drawable/item_selector"
/>
<TextView
android:id="@android:id/empty"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/empty"
/>
</LinearLayout>
Run Code Online (Sandbox Code Playgroud)
这是我的列表项文件:
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:orientation="horizontal"
android:padding="10sp">
<CheckBox
android:id="@+id/checkbox"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:focusable="false"
/>
<TextView
android:id="@+id/title"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:ellipsize="end"
android:singleLine="true"
android:textStyle="bold"
android:padding="7dip"
android:textSize="18sp"
android:layout_toRightOf="@id/checkbox"
/>
</RelativeLayout>
Run Code Online (Sandbox Code Playgroud)
这是我的颜色文件:
<?xml version="1.0" encoding="utf-8"?>
<resources>
<color name="red">#ff00</color>
<color name="green">#f0f0</color>
<color name="blue">#f00f</color>
<color name="white">#ffff</color>
</resources>
Run Code Online (Sandbox Code Playgroud)
这是我的选择器文件:
<?xml version="1.0" encoding="utf-8"?>
<selector xmlns:android="http://schemas.android.com/apk/res/android">
<item
android:state_pressed="true"
android:drawable="@color/green" />
<item …Run Code Online (Sandbox Code Playgroud) 我想保护我的appSettings中的一个键/值对,但不使用像我之前使用ProtectSection方法那样的其他东西,如下所示.
var configurationSection = config.GetSection("appSettings");
configurationSection.SectionInformation.ProtectSection("DataProtectionConfigurationProvider");
Run Code Online (Sandbox Code Playgroud)
理想情况下,我想做类似以下的事情:
var configurationElement = config.GetSection("appSettings").GetElement("Protected");
configurationElement.ElementInformation.ProtectElement("DataProtectionConfigurationProvider");
Run Code Online (Sandbox Code Playgroud)
以下是我将要操作的示例appSettings:
<configuration>
<appSettings>
<add key="Unprotected" value="ChangeMeFreely" />
<add key="Protected" value="########"/>
</appSettings>
</configuration>
Run Code Online (Sandbox Code Playgroud)
我一直在寻找,但还没有办法做到这一点.这可能吗?
.net ×1
android ×1
app-config ×1
c# ×1
ios ×1
listview ×1
objective-c ×1
powershell ×1
xamarin.ios ×1