Some examples:
public static IAzApplication AddApplication(IAzAuthorizationStore store, string applicationName)
{
if (applicationName == null || applicationName.Length == 0)
{
throw new ArgumentNullException("applicationName", "Application name can not be null or empty.");
}
if (store == null)
{
throw new ArgumentNullException("store", "Store can not be null.");
}
IAzApplication app = store.CreateApplication(applicationName, null);
app.Submit(0, null);
return app;
}
Here is how to remove that application:
public static void RemoveApplication(IAzAuthorizationStore store, string applicationName)
{
if (applicationName == null || applicationName.Length == 0)
{
throw new ArgumentNullException("applicationName", "Application name can not be null or empty.");
}
if (store == null)
{
throw new ArgumentNullException("store", "Store can not be null.");
}
store.DeleteApplication(applicationName , null);
store.Submit(0, null);
}
How about just getting the application:
public static IAzApplication GetApplication(string storeUrl, string applicationName)
{
if (applicationName == null || applicationName.Length == 0)
{
throw new ArgumentNullException("applicationName", "Application name can not be null or empty.");
}
if (storeUrl == null || storeUrl.Length == 0)
{
throw new ArgumentNullException("storeUrl", "Store URL can not be null or empty.");
}
//http://www.box.net/shared/ubs0oebs0l to get storehelper
IAzAuthorizationStore store = StoreHelper.GetStore(storeUrl);
return store.OpenApplication(applicationName, null);
}
What about getting application names from the store?
public static string[] GetApplicationNames(IAzAuthorizationStore store)
{
if (store == null)
{
throw new ArgumentNullException("store", "Store can not be null.");
}
ArrayList applicationNames = new ArrayList();
foreach (IAzApplication app in store.Applications)
{
applicationNames.Add(app.Name);
}
return (string[])applicationNames.ToArray(typeof(string));
}
No comments:
Post a Comment