小编Mik*_*ike的帖子

Android使用Intent将事件添加到日历,获取EventID

我正在尝试通过日历意图添加事件.但是,我无法弄清楚如何获取刚刚添加的事件的事件ID.

        Intent intent = new Intent(Intent.ACTION_EDIT);
        intent.setType("vnd.android.cursor.item/event");
        intent.putExtra("beginTime", sdate.getTime());
        intent.putExtra("endTime", edate.getTime());
        intent.putExtra("allDay", true);
        intent.putExtra("rrule", "FREQ=YEARLY");
        intent.putExtra("title", "A Test Event from android app");
        intent.putExtra("description", "Description here");
        intent.putExtra("eventLocation", "location here here here");
Run Code Online (Sandbox Code Playgroud)

我在其他资源上广泛阅读,似乎无法找到答案.我尝试了startActivityForResult,但似乎无法让它工作.我尝试的其他方法似乎无法在活动结束前检查它.

在将事件添加到日历后,是否还有其他方法可以获取事件ID?我需要使用intent方法.

android calendar android-intent

6
推荐指数
1
解决办法
6076
查看次数

HTML5 Boilerplate和jQuery

我想知道为什么来自http://html5boilerplate.com/的样板在web内容之后声明了jQuery?这有充分的理由吗?

这是代码的片段......

  <!-- Add your site or application content here -->
    <p>Hello world! This is HTML5 Boilerplate.</p>
    <script src="//ajax.googleapis.com/ajax/libs/jquery/1.9.0/jquery.min.js"></script>
    <script>window.jQuery || document.write('<script src="js/vendor/jquery-1.9.0.min.js"><\/script>')</script>
    <script src="js/plugins.js"></script>
    <script src="js/main.js"></script>
Run Code Online (Sandbox Code Playgroud)

PS window.jQuery ||部分做什么?

jquery html5

4
推荐指数
1
解决办法
3664
查看次数

MVVM - 数据模板创建一个新视图

我有两个 DataTemplates 根据当前的 ViewModel 进行切换。但是,每当我切换 ViewModel 时,它似乎都会调用相应的 View 构造函数并调用构造函数中的 InitializeComponent() 调用,这意味着每当我切换 DataTemplate 时,它​​都会生成一个绑定到相应 DataTemplate 的新视图。我不确定为什么会发生这种情况,但是有没有办法在切换 ViewModel 时防止创建新视图?

下面是位于我的 MainView 的 DataTemplates。

<Window.Resources>
    <DataTemplate DataType="{x:Type viewModels:FirstPanelViewModel}">
        <views:FirstPanelView />
    </DataTemplate>
    <DataTemplate DataType="{x:Type viewModels:SecondPanelViewModel}">
        <views:SecondPanelView />
    </DataTemplate>
</Window.Resources>
Run Code Online (Sandbox Code Playgroud)

模板显示在 ContentControl 中。

<ContentControl Grid.Row="1" Content="{Binding CurrentViewModel}" />    
Run Code Online (Sandbox Code Playgroud)

这是我的 SecondPanelView,它与我的 FirstPanelView 相同,非常简单。

public partial class FirstPanelView
{
    public FirstPanelView()
    {
        InitializeComponent();
    }
}
public partial class SecondPanelView
{
    public SecondPanelView()
    {
        InitializeComponent();
    }
}
Run Code Online (Sandbox Code Playgroud)

我的 Ioc 确保我只生成 SecondPanelView 的一个实例

container.Register<IFirstPanelViewModel, FirstPanelViewModel>(new PerContainerLifetime())
container.Register<ISecondPanelViewModel, …
Run Code Online (Sandbox Code Playgroud)

c# wpf mvvm

4
推荐指数
1
解决办法
1959
查看次数

Angular ui-select 框禁用自动向上

我有一个根据屏幕大小自动改变方向的盒子。它这样做的方式是向指令添加一个“方向向上”类。无论如何我可以禁用这种行为吗?

编辑:

下面的答案非常简洁,请注意,您需要 angular-ui-select >= 0.13.0 才能使下面的答案起作用。

angularjs angular-ui

3
推荐指数
1
解决办法
1722
查看次数

在覆盖WPF中创建透明孔

我试图在WPF中复制下面的效果.我有一个网格控件,其中边框背景颜色为#000000,不透明度为0.7,内容呈现方式如此......

<Grid>
    <Border Background="#000000" Opacity="0.7" />
    <ContentPresenter ... />
</Grid>
Run Code Online (Sandbox Code Playgroud)

我为我的控制内容设置了一个椭圆以试图获得效果,但我已经从那里到达了一个路障.

<Control:SomeControl>
    <Ellipse Fill="Transparent" />
</Control:SomeControl>
Run Code Online (Sandbox Code Playgroud)

任何帮助表示赞赏.

在此输入图像描述

.net wpf wpf-controls

2
推荐指数
1
解决办法
1162
查看次数