Пример #1
0
 /// <summary>
 /// This Method is called on activation of a PlugIn. The AutomationML Editor 'publishes' its
 /// current state to the plugIn, that is the Path of the loaded AutomationML Document and
 /// the currently selected AutomationML Object'. Please note, that the objects may be empty
 /// or null.
 /// </summary>
 /// <param name="amlFilePath">   The AML file path, may be empty.</param>
 /// <param name="selectedObject">The selected object, may be null.</param>
 public override void PublishAutomationMLFileAndObject(string amlFilePath, CAEXBasicObject selectedObject)
 {
     // inform the View Model to load the document the View Model belongs to a different UI
     // thread, we need the dispatcher to send the change to the UI
     this.ui.Dispatcher.Invoke(DispatcherPriority.Normal,
                               new ThreadStart(() => { this.viewModel.AmlFilePath = amlFilePath; }));
 }
 /// <summary>
 /// This Method is called on activation of a PlugIn. The AutomationML Editor 'publishes' its
 /// current state to the PlugIn, that is the Path of the loaded AutomationML Document and
 /// the currently selected AutomationML Object'. Please note, that the objects may be empty
 /// or null.
 /// </summary>
 /// <param name="amlFilePath">   The AML file path, may be empty.</param>
 /// <param name="selectedObject">The selected object, may be null.</param>
 public void PublishAutomationMLFileAndObject(string amlFilePath, CAEXBasicObject selectedObject)
 {
     if (selectedObject != null)
     {
         ChangeSelectedObject(selectedObject);
     }
 }
Пример #3
0
 /// <summary>
 /// Changes the selected object. The Host Application will call this method when the PlugIns
 /// <see cref="P:Aml.Editor.Plugin.Contracts.IAMLEditorPlugin.IsReactive" /> Property is set to true and the Current Selection changes in
 /// the AMLEditor Host Application.
 /// </summary>
 /// <param name="selectedObject">The selected CAEX - object.</param>
 public void ChangeSelectedObject(CAEXBasicObject selectedObject)
 {
     if (selectedObject != null)
     {
         this.HelloText.Text = "Hello " + "\"" + ((selectedObject is CAEXObject caex) ? caex.Name : selectedObject.Node.Name.LocalName) + "\"";
     }
 }
Пример #4
0
 public override void ChangeSelectedObject(CAEXBasicObject selectedObject)
 {
     base.ChangeSelectedObject(selectedObject);
     if (selectedObject == null)
     {
         return;
     }
     ShowTreeView(selectedObject);
 }
 /// <summary>
 /// Changes the selected object. The Host Application will call this method when the PlugIns
 /// <see cref="P:Aml.Editor.Plugin.Contracts.IAMLEditorPlugin.IsReactive" /> Property is set to true and the Current Selection changes in
 /// the AMLEditor Host Application.
 /// </summary>
 /// <param name="selectedObject">The selected CAEX - object.</param>
 public void ChangeSelectedObject(CAEXBasicObject selectedObject)
 {
     if (selectedObject is InternalElementType ie)
     {
         if (ie.SystemUnitClass != null)
         {
             PlugInUI.ShowClass(ie.SystemUnitClass);
         }
     }
 }
Пример #6
0
        private void ShowTreeView(CAEXBasicObject caex)
        {
            HashSet <string> amlTreeTemplate = new(
                AMLTreeViewTemplate.CompleteInstanceHierarchyTree.Concat(
                    AMLTreeViewTemplate.CompleteSystemUnitClassLibTree.Concat(
                        AMLTreeViewTemplate.InterfaceClassLibTree.Concat(
                            AMLTreeViewTemplate.ExtendedRoleClassLibTree.Concat(
                                AMLTreeViewTemplate.AttributeTypeLibTree
                                )))));

            AMLTree.TreeViewModel = new AMLTreeViewModel(caex.Node, amlTreeTemplate);
            AMLTree.TreeViewModel.ExpandAllCommand.Execute(AMLTree.TreeViewModel.Root);
        }
Пример #7
0
        /// <summary>
        /// This Method is called on activation of a PlugIn. The AutomationML Editor 'publishes' its
        /// current state to the PlugIn, that is the Path of the loaded AutomationML Document and
        /// the currently selected AutomationML Object'. Please note, that the objects may be empty
        /// or null.
        /// </summary>
        /// <param name="amlFilePath">   The AML file path, may be empty.</param>
        /// <param name="selectedObject">The selected object, may be null.</param>
        public void PublishAutomationMLFileAndObject(string amlFilePath, CAEXBasicObject selectedObject)
        {
            if (!string.IsNullOrEmpty(amlFilePath))
            {
                this.HelloText.Text = "Hello " + System.IO.Path.GetFileName(amlFilePath);
            }
            else
            {
                this.HelloText.Text = "Nobody to say hello to!";
            }

            if (selectedObject != null)
            {
                ChangeSelectedObject(selectedObject);
            }
        }
        /// <summary>
        /// Executes the command.
        /// </summary>
        /// <returns><c>true</c> if execute has an effect, which is reversable by <see cref="UnExecute" />, <c>false</c> otherwise.</returns>
        public bool Execute()
        {
            if (_nextNode == null)
            {
                var parent = CAEXBasicObject.CreateCAEXWrapper(_Target.CAEXNode);
                var child = CAEXBasicObject.CreateCAEXWrapper(_node);
                if (!parent.Insert_TypeBaseElement(child, false))
                {
                    return false;
                }
            }
            else
            {
                _Target.CAEXNode.InsertBefore(_node, _nextNode);
            }

            _Target.RefreshNodeInformation(true);
            return true;
        }
Пример #9
0
        /// <summary>
        ///    creates CAEX object out of an XML node
        /// </summary>
        /// <param name="node">XML node</param>
        /// <returns>CAEXBasicObject</returns>
        public static CAEXBasicObject CreateCAEXWrapper(this XmlNode node)
        {
            if (!CAEXTypeDict.Instance.ContainsKey(node.Name))
            {
                throw new ArgumentException("Don't know how to wrap XML node of type " + CAEXTypeDict.Instance[node.Name], "node");
            }
            Type t           = CAEXTypeDict.Instance[node.Name];
            var  constructor = t.GetConstructor(new[] { typeof(XmlNode) });

            if (constructor == null)
            {
                throw new ArgumentException(t.FullName + " doesn't have a constructor with a single argument of type XmlNode");
            }
            if (node == null)
            {
                throw new ArgumentNullException("node");
            }
            CAEXBasicObject result = (CAEXBasicObject)constructor.Invoke(new object[] { node });

            return(result);
        }
Пример #10
0
 /// <summary>
 /// This Method is called on activation of a PlugIn. The AutomationML Editor 'publishes' its
 /// current state to the PlugIn, that is the Path of the loaded AutomationML Document and
 /// the currently selected AutomationML Object'. Please note, that the objects may be empty
 /// or null.
 /// </summary>
 /// <param name="amlFilePath">   The AML file path, may be empty.</param>
 /// <param name="selectedObject">The selected object, may be null.</param>
 public void PublishAutomationMLFileAndObject(string amlFilePath, CAEXBasicObject selectedObject)
 {
 }
Пример #11
0
 public override void PublishAutomationMLFileAndObject(string amlFilePath, CAEXBasicObject selectedObject)
 {
     _last = null;
 }
Пример #12
0
 public override void ChangeSelectedObject(CAEXBasicObject selectedObject)
 {
 }
Пример #13
0
 /// <summary>
 /// Changes the selected object. The Host Application will call this method when the PlugIn
 /// <see cref="IsReactive"/> is set to true and the Current Selection changes in the Host Application.
 /// </summary>
 /// <param name="selectedObject">The selected object.</param>
 public override void ChangeSelectedObject(CAEXBasicObject selectedObject)
 {
     // the plugIn is neither reactive not read only. Nothing has to be done here
     ;
 }
 public override void ChangeSelectedObject(CAEXBasicObject selectedObject)
 {
     base.ChangeSelectedObject(selectedObject);
     EditorCommands.SelectedObject = selectedObject;
 }
Пример #15
0
 public void ChangeSelectedObject(CAEXBasicObject selectedObject)
 {
     ;
 }