public string Execute(params object[] param) { string result; if (CurrentTemplate == null) { throw new Exception("No Template Loaded!"); } else { CurrentTemplate.Execute(param); result = CurrentTemplate.Buffer.ToString(); CurrentTemplate.Buffer.Clear(); } return(result); }
private void RegisterCommands() { AnchorableCloseCommand = new RelayCommand( () => { /* Ignore */ }, () => false); ExecuteCommand = new RelayCommand( p => CurrentTemplate.Execute(), p => CurrentTemplate != null ); CloseCommand = new RelayCommand( p => Close(CurrentTemplate), p => HasCurrentTemplate ); FontSizeCommand = new RelayCommand(ChangeFontSize); ManageReferencesCommand = new RelayCommand(() => { var loadedReferences = CurrentTemplate.AssemblyReferences; CurrentTemplate.AssemblyReferences = GetReferencesThunk(loadedReferences); }); NewCommand = new RelayCommand(() => AddNewTemplateEditor()); OpenCommand = new RelayCommand(p => { string filename = p as string; if (string.IsNullOrWhiteSpace(filename)) { if (Locator == null) { filename = GetOpenFilenameThunk(); } else { filename = Locator.Locate(); } } if (string.IsNullOrWhiteSpace(filename)) { return; } AddNewTemplateEditor(filename); }); SaveCommand = new RelayCommand( p => Save(CurrentTemplate), p => HasCurrentTemplate ); SaveAsCommand = new RelayCommand( p => SaveAs(CurrentTemplate), p => HasCurrentTemplate && CurrentTemplate.CanSaveAsNewFilename ); SwitchThemeCommand = new RelayCommand( p => SwitchTheme((Theme)p), p => true ); }