Example #1
0
 /// <summary>
 /// Loads the service apps.
 /// </summary>
 /// <param name="isViewVisible">If set to <c>true</c> show messages.</param>
 public void LoadServiceApps(bool isViewVisible)
 {
     this.TryExecute(
         () =>
     {
         IServiceAppClient client = this.factory.Create <IServiceAppClient>();
         this.View.BindServiceApps(client.GetInstalledServiceApps());
         this.View.SetStatusMessage(null);
     },
         () =>
     {
         this.View.BindServiceApps(new List <ServiceApp>());
     },
         isViewVisible);
 }
Example #2
0
        /// <summary>
        /// Exports the service application list.
        /// </summary>
        /// <param name="extension">The extension.</param>
        /// <returns>
        /// The exported list
        /// </returns>
        /// <exception cref="System.NotSupportedException">Thrown when the supplied extension has not export method defined.</exception>
        public string ExportServiceAppList(string extension)
        {
            IServiceAppClient  client         = this.factory.Create <IServiceAppClient>();
            IList <ServiceApp> serviceAppList = client.GetInstalledServiceApps();

            string exportContents;
            ServiceAppListExporter listExporter = new ServiceAppListExporter();

            if (extension.Contains("txt"))
            {
                exportContents = listExporter.ExportTabDelimited(serviceAppList);
            }
            else if (extension.Contains("csv"))
            {
                exportContents = listExporter.ExportCsv(serviceAppList);
            }
            else
            {
                throw new NotSupportedException(string.Format("The {0} extension is not supported."));
            }

            return(exportContents);
        }