C# Windows 8 Metro样式项目(Inkstrope.Add错误)

C# Windows 8 Metro样式项目(Inkstrope.Add错误),c#,microsoft-metro,C#,Microsoft Metro,Windows8地铁风格项目 删除一些笔划后,我尝试使用InkManager.AddStroke()方法添加删除的笔划,以提供撤消和重做功能 将引发异常 调用COM组件时返回错误HRESULT E_FAIL。“ 可能是重复的问题。 public void OnDrawUndo(object sender, RoutedEventArgs e) { try { BackupInkStrokeCollection.Push(Cu

Windows8地铁风格项目

删除一些笔划后,我尝试使用
InkManager.AddStroke()
方法添加删除的笔划,以提供撤消和重做功能

将引发异常

调用COM组件时返回错误HRESULT E_FAIL。“

可能是重复的问题。
    public void OnDrawUndo(object sender, RoutedEventArgs e)
    {
        try
        {
            BackupInkStrokeCollection.Push(CurrentInkStrokeCollection.Pop());
            renderer.Clear();
            renderer.AddInk(CurrentInkStrokeCollection);

            //inkManager.GetStrokes()[inkManager.GetStrokes().Count - 1].Selected = true;

            InkStroke SelectedStroke = inkManager.GetStrokes()[inkManager.GetStrokes().Count - 1];
            SelectedStroke.Selected = true;
            var MyInkManager = new InkManager();
            MyInkManager.AddStroke(SelectedStroke.Clone());
            MyInkManagers.Add(MyInkManager);
            inkManager.DeleteSelected();
        }
        catch (Exception ee)
        {
            if (ee.Message == "Stack empty.")
                return;
            else
                new Windows.UI.Popups.MessageDialog(ee.ToString()).ShowAsync();
        }
    }