本文整理汇总了C#中Canguro.GetMany方法的典型用法代码示例。如果您正苦于以下问题:C# Canguro.GetMany方法的具体用法?C# Canguro.GetMany怎么用?C# Canguro.GetMany使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Canguro
的用法示例。
在下文中一共展示了Canguro.GetMany方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Run
//public override void Run(Canguro.Controller.CommandServices services)
//{
// List<Item> selection = GetSelection(services);
// if (selection.Count == 0)
// return;
// Stream stream = new MemoryStream();
// try
// {
// BinaryFormatter bformatter = new BinaryFormatter();
// Magnet magnet = services.GetPoint("selectPivot");
// bformatter.Serialize(stream, magnet.SnapPosition);
// bformatter.Serialize(stream, selection.Count);
// foreach (Item item in selection)
// {
// bformatter.Serialize(stream, item);
// item.IsSelected = true;
// }
// Clipboard.SetData("Canguro", stream);
// }
// finally
// {
// stream.Close();
// }
//}
/// <summary>
/// Executes the command.
/// Gets the selection and a pivot point, and adds them to the Clipboard with the key "Canguro"
/// </summary>
/// <param name="services">CommandServices object to interact with the system</param>
public override void Run(Canguro.Controller.CommandServices services)
{
Dictionary<uint, Joint> joints = new Dictionary<uint, Joint>();
List<LineElement> lines = new List<LineElement>();
List<AreaElement> areas = new List<AreaElement>();
bool haveSelection = false;
haveSelection = services.GetSelection(joints, lines, areas);
if (!haveSelection)
{
services.GetMany(Culture.Get("selectItems"));
haveSelection = services.GetSelection(joints, lines, areas);
}
if (haveSelection)
{
Magnet magnet = services.GetPoint(Culture.Get("selectPivot"));
if (magnet != null)
{
Microsoft.DirectX.Vector3 pivot = magnet.SnapPosition;
Clipboard.Clear();
object[] objs = new object[] { joints, lines, areas, pivot };
//// Test Serialization
//System.IO.MemoryStream s = new MemoryStream();
//new System.Runtime.Serialization.Formatters.Binary.BinaryFormatter().Serialize(s, objs);
Clipboard.SetData("Canguro", objs);
}
}
foreach (Item item in joints.Values)
if (item != null)
item.IsSelected = true;
foreach (Item item in lines)
if (item != null)
item.IsSelected = true;
foreach (Item item in areas)
if (item != null)
item.IsSelected = true;
}