public void SetComponentAndAction(VDViewComponent srcComponent, VDActionBase targetAction) { // set source component cmbEvent.Items.Clear(); if (srcComponent != null) { txtSource.Text = string.Format("[{1}] {0}", srcComponent.WidgetName, srcComponent.WidgetType.ToString()); if (srcComponent.SupportedEvents != null) { cmbEvent.Items.AddRange(srcComponent.SupportedEvents.ToArray()); if (cmbEvent.Items.Count > 0) cmbEvent.SelectedIndex = 0; } } else { txtSource.Text = string.Empty; } // set target action if (targetAction != null) { txtAction.Text = targetAction.Name; chkServer.Checked = targetAction is VDServerAction; } else { txtAction.Text = string.Empty; chkServer.Checked = false; } }
public void SetComponentAndAction(VDViewComponent srcComponent, VDActionBase targetAction) { // set source component cmbEvent.Items.Clear(); if (srcComponent != null) { txtSource.Text = string.Format("[{1}] {0}", srcComponent.WidgetName, srcComponent.WidgetType.ToString()); if (srcComponent.SupportedEvents != null) { cmbEvent.Items.AddRange(srcComponent.SupportedEvents.ToArray()); if (cmbEvent.Items.Count > 0) { cmbEvent.SelectedIndex = 0; } } } else { txtSource.Text = string.Empty; } // set target action if (targetAction != null) { txtAction.Text = targetAction.Name; chkServer.Checked = targetAction is VDServerAction; } else { txtAction.Text = string.Empty; chkServer.Checked = false; } }
public void ShowActionModel(VDActionBase action) { m_selectedWidget = action; setToolWindowTitle(string.Format("Action Data - {0} [{1} Action]", action.Name, action is VDClientAction ? "Client" : "Server")); if (this.Window != null) { ModelToolWindowForm.ActionDataHandler.Show(action); } }
private NewTargetHandler SetSourceAction(VDActionBase action) { m_lstAction.Items.Clear(); m_cmbJoint.Items.Clear(); if (action is VDClientAction) { m_cmbJoint.Items.Add(DefaultActionJontInfo.Instance); } if (action != null) { m_lstAction.Items.Add(action.ActionInfo); if (action.ActionInfo.Joints != null) { m_cmbJoint.Items.AddRange(action.ActionInfo.Joints.ToArray()); } } m_cmbJoint.SelectedIndex = 0; return(this); }
private static ElementLink ConnectSourceToTarget(ModelElement source, ModelElement target) { if (source is VDEventBase && target is VDActionBase) { VDEventBase evt = source as VDEventBase; VDActionBase act = target as VDActionBase; evt.TargetComponents.Add(act); return(R_Event2Component.GetLink(evt, act)); } else if (source is VDActionJoint && target is VDViewComponent) { VDActionJoint joint = source as VDActionJoint; VDViewComponent tgt = target as VDViewComponent; joint.TargetComponents.Add(tgt); return(R_ActionJoint2Component.GetLink(joint, tgt)); } else if (source is VDViewComponent && target is VDActionBase) { VDViewComponent srcComponent = source as VDViewComponent; VDActionBase targetAction = target as VDActionBase; Component2ActionDialog dlg = new Component2ActionDialog(); dlg.SetComponentAndAction(srcComponent, targetAction); dlg.ShowDialog(); if (dlg.DialogResult == System.Windows.Forms.DialogResult.OK) { IEventInfo evtInfo = dlg.SelectedEvent; VDEventBase newEvent = evtInfo.CreateEvent(srcComponent); newEvent.Widget = srcComponent; newEvent.TargetComponents.Add(targetAction); return(R_Event2Component.GetLink(newEvent, targetAction)); } } else if (source is VDEventBase && target is VDViewComponent) // create new action { VDEventBase sourceEvent = source as VDEventBase; VDViewComponent targetComponent = target as VDViewComponent; Component2ComponentDialog dlg = new Component2ComponentDialog(false); dlg.NewAction.SetSourceEvent(sourceEvent).SetTarget(targetComponent); dlg.ShowDialog(); if (dlg.DialogResult == System.Windows.Forms.DialogResult.OK) { IActionInfo actInfo = dlg.NewAction.SelectedAction; VDActionBase newAct = actInfo.CreateAction(sourceEvent.Partition); VDWidget.GetCommonParent(sourceEvent.Widget, targetComponent).Children.Add(newAct); //sourceEvent.Widget.Parent.Children.Add(newAct); sourceEvent.TargetComponents.Add(newAct); IActionJointInfo jointInfo = dlg.NewAction.SelectedJoint; VDActionJoint newJoint = jointInfo.CreateActionJoint(newAct, targetComponent); newJoint.Widget = newAct; newJoint.TargetComponents.Add(targetComponent); return(R_ActionJoint2Component.GetLink(newJoint, targetComponent)); } } else if (source is VDViewComponent && target is VDViewComponent) // create new action or target { VDViewComponent srcComponent = source as VDViewComponent; VDViewComponent tgtComponent = target as VDViewComponent; Component2ComponentDialog dlg = new Component2ComponentDialog(); dlg.NewAction.SetSource(srcComponent).SetTarget(tgtComponent); dlg.NewTarget.SetSource(srcComponent).SetTarget(tgtComponent); dlg.ShowDialog(); if (dlg.DialogResult == System.Windows.Forms.DialogResult.OK) { if (dlg.IfCreateNewAction) { IEventInfo evtInfo = dlg.NewAction.SelectedEvent; VDEventBase newEvent = evtInfo.CreateEvent(srcComponent); newEvent.Widget = srcComponent; IActionInfo actInfo = dlg.NewAction.SelectedAction; VDActionBase newAct = actInfo.CreateAction(srcComponent.Partition); VDWidget.GetCommonParent(srcComponent, tgtComponent).Children.Add(newAct); //srcComponent.Parent.Children.Add(newAct); newEvent.TargetComponents.Add(newAct); IActionJointInfo jointInfo = dlg.NewAction.SelectedJoint; VDActionJoint newJoint = jointInfo.CreateActionJoint(newAct, tgtComponent); newJoint.Widget = newAct; newJoint.TargetComponents.Add(tgtComponent); return(R_ActionJoint2Component.GetLink(newJoint, tgtComponent)); } else { IActionJointInfo jointInfo = dlg.NewTarget.SelectedJoint; VDActionJoint joint = jointInfo.CreateActionJoint(srcComponent, tgtComponent); joint.Widget = srcComponent; joint.TargetComponents.Add(tgtComponent); return(R_ActionJoint2Component.GetLink(joint, tgtComponent)); } } } return(null); }
private NewTargetHandler SetSourceAction(VDActionBase action) { m_lstAction.Items.Clear(); m_cmbJoint.Items.Clear(); if (action is VDClientAction) { m_cmbJoint.Items.Add(DefaultActionJontInfo.Instance); } if (action != null) { m_lstAction.Items.Add(action.ActionInfo); if (action.ActionInfo.Joints != null) { m_cmbJoint.Items.AddRange(action.ActionInfo.Joints.ToArray()); } } m_cmbJoint.SelectedIndex = 0; return this; }