C#Visio Addon - 通过当前选择进行迭代

时间:2015-11-30 08:41:21

标签: c# visio

我有以下代码:

        var currentSelection = activeWindow.Selection;

        if (currentSelection != null)
        {
            int numberOfShapes = currentSelection.Count;

            for( int i = 1; i <= numberOfShapes; i++)
            {

                currentSelection.Select(? ,Visio.VisSelectArgs.visSelect);
            }  
        }

正如您所看到的,我正在迭代Visio中的形状选择。我在选择方法中使用SheetObject参数很困难。我想动态地实现它,所以我遍历所有形状(无论名称) - 最好的方法是什么?

1 个答案:

答案 0 :(得分:0)

迭代当前选择就像Selection集合上的Dim shp As Shape For Each shp In ActiveWindow.Selection MsgBox shp.Name Next 一样简单,例如:

class checkCondition<T> implements Callable<T>{
 @Override
public T call() {
//Do Stuff and return result
return result;
}
public class TaskRunner<T> {
private final ExecutorService executor = Executors.newSingleThreadExecutor();
public Future<T> runTask(checkCondiiton task, int times, long sleep){

while(times > 0){
future = executor.submit(task);
Thread.sleep(sleep);
times--;
}
return future;
}
}

}