public override void RegisterTypes() { base.RegisterTypes(); //add a button to the update settings form to check for new release var customFormFunction = new CustomFormFunction("RELEASECHECK", "Check For Release", (x) => CheckNewForRelease(displayNoUpdate: true), (x) => true); this.AddCustomFormFunction(customFormFunction, typeof(UpdateSettings)); }
/// <summary> /// This function adds the save and load buttons onto the form for an object type which implements IAllowSaveAndLoad /// </summary> private void AddSavedRequestsFormFunctions() { var customFormFunction = new CustomFormFunction("SAVEREQUEST", "Save Details", SaveObject, (re) => { return(true); }); this.AddCustomFormFunction(customFormFunction, typeof(IAllowSaveAndLoad)); customFormFunction = new CustomFormFunction("LOADREQUEST", "Load/Edit Saved Details", LoadObject, AreSavedRequests); this.AddCustomFormFunction(customFormFunction, typeof(IAllowSaveAndLoad)); }
/// <summary> /// This function adds the save and load buttons onto the form for an object type which implements IAllowSaveAndLoad /// </summary> private void AddSavedRequestsFormFunctions() { var customFormFunction = new CustomFormFunction("SAVEREQUEST", "Save Input", SaveObject, IsAllowSaveAndLoad, description: "Save The Input For Future Use."); this.AddCustomFormFunction(customFormFunction, typeof(IAllowSaveAndLoad)); customFormFunction = new CustomFormFunction("LOADREQUEST", LoadButtonLabel, LoadObject, AreSavedRequests, description: "Load Saved Input Into The Form, Edit Saved Inputs, Or Generate A Bat Executable To Automate Process Execution"); this.AddCustomFormFunction(customFormFunction, typeof(IAllowSaveAndLoad)); LoadRequestButtons(); }
public static void AddCustomFormFunction(this ModuleBase module, CustomFormFunction customFormFunction, Type type) { //okay this one is autmatically created by the unity container //but iteratively add and resolve 2 items and verify they are retained in the resolved list var customFormFunctions = (CustomFormFunctions)module.ApplicationController.ResolveInstance(typeof(CustomFormFunctions), type.AssemblyQualifiedName); customFormFunctions.AddFunction(customFormFunction); module.ApplicationController.RegisterInstance(typeof(CustomFormFunctions), type.AssemblyQualifiedName, customFormFunctions); }
private void LoadRequestButtons() { Func <RecordEntryFormViewModel, IEnumerable <CustomFormFunction> > getSavedRequestFuncs = (r) => { var results = new List <CustomFormFunction>(); var settingsManager = ApplicationController.ResolveType(typeof(ISettingsManager)) as ISettingsManager; if (settingsManager == null) { throw new NullReferenceException("settingsManager"); } if (r is ObjectEntryViewModel) { var type = r.RecordType; var savedSettings = settingsManager.Resolve <SavedSettings>(Type.GetType(type)); if (savedSettings != null && savedSettings.SavedRequests.Any()) { var i = 0; foreach (var item in savedSettings.SavedRequests) { if (item is IAllowSaveAndLoad) { var savedRequest = (IAllowSaveAndLoad)item; results.Add(new CustomFormFunction("SAVEDREQUEST" + 1, savedRequest.Name, (r2) => { ApplicationController.DoOnAsyncThread(() => { try { r.LoadingViewModel.IsLoading = true; LoadSavedObject(item, (ObjectEntryViewModel)r); } finally { r.LoadingViewModel.IsLoading = false; } }); })); } } } } return(results); }; var customFormFunction = new CustomFormFunction("LOADREQUESTDROPDOWN", "Load Saved Item", getSavedRequestFuncs); this.AddCustomFormFunction(customFormFunction, typeof(IAllowSaveAndLoad)); }
private void AddPortalDataButtonToRequestFormGrid() { var customFormFunction = new CustomFormFunction("ADDPORTALDATA", "Add Portal Types", (r) => { try { r.GetBooleanFieldFieldViewModel(nameof(InstanceComparerRequest.Data)).Value = true; var typesGrid = r.GetEnumerableFieldViewModel(nameof(InstanceComparerRequest.DataComparisons)); var typesToAdd = new[] { "adx_contentsnippet", "adx_entityform", "adx_entityformmetadata", "adx_entitylist", "adx_entitypermission", "adx_pagetemplate", "adx_publishingstate", "adx_sitemarker", "adx_sitesetting", "adx_webfile", "adx_weblink", "adx_weblinkset", "adx_webpage", "adx_webpageaccesscontrolrule", "adx_webrole", "adx_webtemplate", }; var typesGridService = typesGrid.GetRecordService(); foreach (var item in typesToAdd.Reverse()) { var newRecord = typesGridService.NewRecord(typeof(InstanceComparerRequest.InstanceCompareDataCompare).AssemblyQualifiedName); newRecord.SetField(nameof(InstanceComparerRequest.InstanceCompareDataCompare.RecordType), new RecordType(item, item), typesGridService); typesGrid.InsertRecord(newRecord, 0); } } catch (Exception ex) { r.ApplicationController.ThrowException(ex); } }, (r) => true); this.AddCustomFormFunction(customFormFunction, typeof(InstanceComparerRequest)); }
/// <summary> /// add a button on the import csv form to download csv templates /// </summary> private void AddDownloadTemplateFormFunction() { var customFormFunction = new CustomFormFunction("DOWNLOADCSVTEMPLATES", "Download Templates", DownloadTemplates, (re) => { return(true); }); this.AddCustomFormFunction(customFormFunction, typeof(ImportCsvsRequest)); }