void AddStorage(StorageEnum kind) { IStorageConfigurationForm configForm; switch (kind) { case StorageEnum.Hdd: configForm = new HddStorageForm(null); break; case StorageEnum.Ftp: configForm = new FtpStorageForm(null); break; case StorageEnum.Network: configForm = new NetworkStorageForm(null); break; default: throw new NotImplementedException(kind.ToString()); } if (configForm.ShowDialog() == DialogResult.OK) { StorageBase storage = configForm.Storage; AddStorageToListView(storage, kind); } configForm.Dispose(); }
public ActionResult Exercise(string id, StorageEnum storage) { var metaDataAgent = GetMetaDataAgent(storage); metaDataAgent.LoadContent(new[] { id }); var userState = (string?)Session[id]; // An empty string user state means the content item has been submitted, but the content type does not support state. var visible = userState != ""; var contentItem = metaDataAgent.GetContentItem(id); var model = new ExerciseViewModel { Id = id, Visible = visible, Title = contentItem.Title, H5PMetaDataAgent = metaDataAgent, State = userState, Storage = storage }; return(View(model)); }
void AddStorageToListView(StorageBase storage, StorageEnum kind) { var listValue = new ListViewItem { Tag = storage, Group = storagesListView.Groups[(int)kind], Text = storage.StorageName, ImageIndex = (int)kind, ToolTipText = storage.Hint }; storagesListView.Items.Add(listValue); }
private async Task <IEnumerable <string> > GetContentItems(StorageEnum storage) { switch (storage) { case StorageEnum.File: return(GetContentItemsFile()); case StorageEnum.Azure: return(await GetContentItemsAzure()); default: throw new ArgumentOutOfRangeException(nameof(storage)); } }
/// <summary> /// Initializes a new instance of the <see cref="Cube" /> class. /// </summary> /// <param name="BaseQuery">The query that defines the records to base this cube on (required).</param> /// <param name="ResolveTableName">The name of the table to resolve this cube to. I.e. all the counts in the cube will be counts of entities from this table (required).</param> /// <param name="Storage">How the results of the cube will be returned (required).</param> /// <param name="Dimensions">The dimensions to build the cube with. This can be one or more variables, queries, etc. (required).</param> /// <param name="Measures">The measures to build the cube with. This can be one or more aggregations to calculate for the specified dimensions such as counts, sums, means, etc. (required).</param> public Cube(Query BaseQuery = default(Query), string ResolveTableName = default(string), StorageEnum Storage = default(StorageEnum), List <Dimension> Dimensions = default(List <Dimension>), List <Measure> Measures = default(List <Measure>)) { // to ensure "BaseQuery" is required (not null) if (BaseQuery == null) { throw new InvalidDataException("BaseQuery is a required property for Cube and cannot be null"); } else { this.BaseQuery = BaseQuery; } // to ensure "ResolveTableName" is required (not null) if (ResolveTableName == null) { throw new InvalidDataException("ResolveTableName is a required property for Cube and cannot be null"); } else { this.ResolveTableName = ResolveTableName; } // to ensure "Storage" is required (not null) if (Storage == null) { throw new InvalidDataException("Storage is a required property for Cube and cannot be null"); } else { this.Storage = Storage; } // to ensure "Dimensions" is required (not null) if (Dimensions == null) { throw new InvalidDataException("Dimensions is a required property for Cube and cannot be null"); } else { this.Dimensions = Dimensions; } // to ensure "Measures" is required (not null) if (Measures == null) { throw new InvalidDataException("Measures is a required property for Cube and cannot be null"); } else { this.Measures = Measures; } }
private H5PStorageAgent GetStorageAgent(StorageEnum storage) { switch (storage) { case StorageEnum.File: var storagePath = Server.MapPath("~/Content"); return(new H5PFileStorageAgent(storagePath)); case StorageEnum.Azure: var connectionString = ConfigurationManager.ConnectionStrings["StorageConnection"].ConnectionString; return(new H5PAzureStorageAgent(connectionString, "h5ptest")); default: throw new ArgumentOutOfRangeException(nameof(storage)); } }
public async Task <ActionResult> Index(StorageEnum storage = StorageEnum.File) { var model = new IndexViewModel { Storage = storage }; model.ContentItems = await GetContentItems(storage); model.Storages = Enum.GetValues(typeof(StorageEnum)).Cast <StorageEnum>().Select(v => new SelectListItem { Text = v.ToString(), Value = v.ToString() }).ToList(); return(View(model)); }
public static string GetValue(StorageEnum storageEnum) { return(Preferences.Get(storageEnum.ToString(), "EMPTY")); }
public static void SetValue(StorageEnum storageEnum, string value) { Preferences.Set(storageEnum.ToString(), value); }