Esempio n. 1
0
 private void CloseDocument(AMLEditorCommandExecutedEventArgs cmd)
 {
     if (MainViewModel.Instance.CloseCommand.CanExecute(cmd.Document))
     {
         MainViewModel.Instance.CloseCommand.Execute(cmd.Document);
     }
 }
Esempio n. 2
0
 internal void ExpandByID(AMLEditorCommandExecutedEventArgs cmd)
 {
     if (cmd.CommandArgument is string path && !string.IsNullOrEmpty(path))
     {
         var caexObject = MainViewModel.Instance.ActiveDocument.Document.FindByID(path);
         if (caexObject != null)
         {
             MainViewModel.Instance.ActiveDocument.Expand(caexObject);
         }
     }
 }
        private void AMLApplication_CommandExecuted(object sender, AMLEditorCommandExecutedEventArgs e)
        {
            switch (e.Command)
            {
            case AMLEditorCommandType.OpenDocument:

                //AMLEditor.AMLApplication.SelectObjectById("7f5e6211-0fd8-473a-821b-efcadf07061b");
                AMLEditor.AMLApplication.SelectObjectById("a429a490-c4c0-4835-bd03-e6f3f66ed4e0");
                AMLEditor.AMLApplication.ExpandObjectByPath("RobotLib");
                break;
            }
        }
Esempio n. 4
0
        private void OpenDocument(AMLEditorCommandExecutedEventArgs args)
        {
            if (AMLEditor.AMLApplication.CancelExecution(
                    new AMLEditorCommandExecutingEventArgs(args.Command, args.CommandArgument, args.Document)))
            {
                return;
            }

            var filePath = args.CommandArgument.ToString();

            if (string.IsNullOrEmpty(filePath) || !File.Exists(filePath))
            {
                return;
            }

            MainViewModel.Instance.OpenDocument(filePath);
            args.Document = new AMLDocument(filePath);
        }
Esempio n. 5
0
        private async Task ExecuteEditorCommandAsync(AMLEditorCommandExecutedEventArgs ed)
        {
            switch (ed.Command)
            {
            case AMLEditorCommandType.OpenDocument:
                await MainViewModel.Instance.View?.Dispatcher.BeginInvoke(new Action(() => OpenDocument(ed)));

                break;

            case AMLEditorCommandType.CloseDocument:
                await MainViewModel.Instance.View?.Dispatcher.BeginInvoke(new Action(() => CloseDocument(ed)));

                break;


            case AMLEditorCommandType.SelectByPath:
                await MainViewModel.Instance.View?.Dispatcher.BeginInvoke(new Action(() => SelectByPath(ed)));

                break;


            case AMLEditorCommandType.SelectByID:
                await MainViewModel.Instance.View?.Dispatcher.BeginInvoke(new Action(() => SelectByID(ed)));

                break;


            case AMLEditorCommandType.ExpandByPath:
                await MainViewModel.Instance.View?.Dispatcher.BeginInvoke(new Action(() => ExpandByPath(ed)));

                break;


            case AMLEditorCommandType.ExpandByID:
                await MainViewModel.Instance.View?.Dispatcher.BeginInvoke(new Action(() => ExpandByID(ed)));

                break;

            default:
                break;
            }
            AMLEditor.AMLApplication.EndExecution(ed);
        }