/// <summary>
		/// Initializes a new instance of the <see cref="MainWindowViewModel"/> class.
		/// </summary>
		public MainWindowViewModel(IMacroService macroService, IUIVisualizerService uiVisualizerService, IMessageService messageService)
		{
			Argument.IsNotNull(() => macroService);
			Argument.IsNotNull(() => uiVisualizerService);
			Argument.IsNotNull(() => messageService);

			//_familyService = familyService;
			this.macroService = macroService;
			this.uiVisualizerService = uiVisualizerService;
			this.messageService = messageService;
			
			InputTest = new Command(OnInputTestExecute);
			MacroSave = new Command(OnSaveMacroExecute);
			MacroAdd = new Command(OnMacroAddExecute);
			MacroRecord = new Command(OnMacroRecordExecute);
			MacroEdit = new Command(OnMacroEditExecute, OnEditMacroCanExecute);
			MacroAdd = new Command(OnMacroAddExecute);
			MacroCopy = new Command(OnMacroCopyExecute);
			MacroDelete = new Command(OnMacroDeleteExecute);
			MacroRun = new Command(OnMacroRunExecute);
			MacroLoad = new Command(OnMacroLoadExecute);
			OpenSettings = new Command(OnOpenSettingsExecute);
			// TODO: Move code above to constructor
			
			Util.Initialize();
			//AddFamily = new Command(OnAddFamilyExecute);
			//EditFamily = new Command(OnEditFamilyExecute, OnEditFamilyCanExecute);
			//RemoveFamily = new Command(OnRemoveFamilyExecute, OnRemoveFamilyCanExecute);
			
		}
Beispiel #2
0
 private bool registerMacro(String macro, String name, IScriptCompiler scriptCompiler, IMacroService macroService, XmlScriptExecutor executor)
 {
     ScriptedMacro scriptedMacro = new ScriptedMacro(executor);
     scriptedMacro.Name = name;
     scriptedMacro.Script = scriptCompiler.Compile(macro, name);
     return macroService.registerMacro(new XnaScrapId(name), scriptedMacro);
 }
		/// <summary>
		/// Initializes a new instance of the <see cref="SettingsWindowViewModel"/> class.
		/// </summary>
		public SettingsWindowViewModel(IMacroService macroService)
		{
			InitializeSkins();
			this.macroService = macroService;
			this.Settings = macroService.Settings;
			CurrentSkin = this.Settings.CurrentSkin;
		}
 void MacroServiceSaved(IMacroService sender, Core.Events.SaveEventArgs<IMacro> e)
 {
     foreach (var entity in e.SavedEntities)
     {
         DistributedCache.Instance.RefreshMacroCache(entity);
     }
 }
 void MacroServiceDeleted(IMacroService sender, Core.Events.DeleteEventArgs<IMacro> e)
 {
     foreach (var entity in e.DeletedEntities)
     {
         DistributedCache.Instance.RemoveMacroCache(entity);
     }
 }
 public OverridingPackagingService(PackagingService realPackagingService, IMacroService macroService)
 {
     this.realPackagingService = realPackagingService;
     this.macroService = macroService;
 }
Beispiel #7
0
 public MacroMapper(IEntityService entityService,
                    IMacroService macroService)
     : base(entityService)
 {
     this.macroService = macroService;
 }
        /// <summary>
        /// Used internally for creating an InstallationSummary (used in new PackagingService) representation of this InstalledPackage object.
        /// </summary>
        /// <param name="contentTypeService"></param>
        /// <param name="dataTypeService"></param>
        /// <param name="fileService"></param>
        /// <param name="localizationService"></param>
        /// <param name="macroService"></param>
        /// <returns></returns>
        internal InstallationSummary GetInstallationSummary(IContentTypeService contentTypeService, IDataTypeService dataTypeService, IFileService fileService, ILocalizationService localizationService, IMacroService macroService)
        {
            var macros          = TryGetIntegerIds(Data.Macros).Select(macroService.GetById).ToList();
            var templates       = TryGetIntegerIds(Data.Templates).Select(fileService.GetTemplate).ToList();
            var contentTypes    = TryGetIntegerIds(Data.Documenttypes).Select(contentTypeService.Get).ToList(); // fixme - media types?
            var dataTypes       = TryGetIntegerIds(Data.DataTypes).Select(dataTypeService.GetDataType).ToList();
            var dictionaryItems = TryGetIntegerIds(Data.DictionaryItems).Select(localizationService.GetDictionaryItemById).ToList();
            var languages       = TryGetIntegerIds(Data.Languages).Select(localizationService.GetLanguageById).ToList();

            for (var i = 0; i < Data.Files.Count; i++)
            {
                var filePath = Data.Files[i];
                Data.Files[i] = filePath.GetRelativePath();
            }

            return(new InstallationSummary
            {
                ContentTypesInstalled = contentTypes,
                DataTypesInstalled = dataTypes,
                DictionaryItemsInstalled = dictionaryItems,
                FilesInstalled = Data.Files,
                LanguagesInstalled = languages,
                MacrosInstalled = macros,
                MetaData = GetMetaData(),
                TemplatesInstalled = templates,
            });
        }
Beispiel #9
0
        /// <summary>
        /// Constructor
        /// </summary>
        /// <param name="contentService"></param>
        /// <param name="contentTypeService"></param>
        /// <param name="dataTypeService"></param>
        /// <param name="fileService"></param>
        /// <param name="macroService"></param>
        /// <param name="languageService"></param>
        /// <param name="serializer"></param>
        /// <param name="logger"></param>
        /// <param name="packageRepositoryFileName">
        /// The file name for storing the package definitions (i.e. "createdPackages.config")
        /// </param>
        /// <param name="tempFolderPath"></param>
        /// <param name="packagesFolderPath"></param>
        /// <param name="mediaFolderPath"></param>
        public PackagesRepository(IContentService contentService, IContentTypeService contentTypeService,
                                  IDataTypeService dataTypeService, IFileService fileService, IMacroService macroService,
                                  ILocalizationService languageService,
                                  IEntityXmlSerializer serializer, ILogger logger,
                                  string packageRepositoryFileName,
                                  string tempFolderPath = null, string packagesFolderPath = null, string mediaFolderPath = null)
        {
            if (string.IsNullOrWhiteSpace(packageRepositoryFileName))
            {
                throw new ArgumentException("Value cannot be null or whitespace.", nameof(packageRepositoryFileName));
            }
            _contentService            = contentService;
            _contentTypeService        = contentTypeService;
            _dataTypeService           = dataTypeService;
            _fileService               = fileService;
            _macroService              = macroService;
            _languageService           = languageService;
            _serializer                = serializer;
            _logger                    = logger;
            _packageRepositoryFileName = packageRepositoryFileName;

            _tempFolderPath     = tempFolderPath ?? SystemDirectories.TempData.EnsureEndsWith('/') + "PackageFiles";
            _packagesFolderPath = packagesFolderPath ?? SystemDirectories.Packages;
            _mediaFolderPath    = mediaFolderPath ?? SystemDirectories.Media + "/created-packages";

            _parser = new PackageDefinitionXmlParser(logger);
        }
 public HtmlMacroParameterParser(IMacroService macroService, ILogger <HtmlMacroParameterParser> logger, ParameterEditorCollection parameterEditors)
 {
     _macroService     = macroService;
     _logger           = logger;
     _parameterEditors = parameterEditors;
 }