Exemplo n.º 1
0
 public void OnAreaItemClick(object sender, EventArgs e, Area area, StoryboardView view)
 {
     selectedArea = area;
     IoC.Get<IPropertyGrid>().SelectedObject = area;
     // TODO. 加载时间线
     TimelineControl tlc = view.timelineControl;
     //tlc..Clear();
     foreach (TimePoint tp in area.Timeline.TimePointItems)
     {
         foreach (Command cmd in tp.CommandItems)
         {
             // 绘制时间点图形
             Ellipse tpg = DrawCommandGraph(tlc, tp.Tick, 100);
             // 时间点图形添加点击事件
             tpg.MouseRightButtonDown += (s, evt) =>
             {
                 IoC.Get<IPropertyGrid>().SelectedObject = cmd;
             };
         }
     }
 }
Exemplo n.º 2
0
 public void OnAddNewCommand(object sender, EventArgs e, StoryboardView view)
 {
     // 自动关联层次结构
     if (selectedOperation != null)
     {
         selectedDevice = selectedOperation.GetParent();
         if (selectedDevice != null)
             selectedArea = selectedDevice.GetParent();
     }
     if (selectedDevice != null && selectedOperation != null)
     {
         Command cmd = new Command();
         cmd.DeviceId = selectedDevice.Id;
         cmd.OperationName = selectedOperation.Name;
         foreach (ShowMaker.Desktop.Domain.Parameter param in selectedOperation.ParameterItems)
         {
             cmd.PropertyItems.Add(new Property(param.Name, ""));
         }
         // TODO. 获取选择的时间点
         selectedTick = (int)view.timelineControl.Slider.Value;
         Timeline tl = selectedArea.Timeline;
         TimePoint tp = tl.GetItemByKey(selectedTick);
         if (tp == null)
         {
             tp = new TimePoint(selectedTick);
             tp.CommandItems.Add(cmd);
             tl.TimePointItems.Add(tp);
         }
         else
         {
             tp.CommandItems.Add(cmd);
         }
         // 绘制时间点图形
         Ellipse tpg = DrawCommandGraph(view.timelineControl, 100);
         // 时间点图形添加点击事件
         tpg.MouseRightButtonDown += (s, evt) =>
         {
             IoC.Get<IPropertyGrid>().SelectedObject = cmd;
         };
     }
 }