Пример #1
0
 /// <summary>
 /// Gets the service application details.
 /// </summary>
 /// <param name="appName">Name of the application.</param>
 public void GetServiceAppDetails(string appName)
 {
     this.TryExecute(
         () =>
     {
         IServiceAppClient client = this.factory.Create <IServiceAppClient>();
         this.View.SelectServiceApp(client.GetServiceApp(appName));
     },
         true);
 }
Пример #2
0
        /// <summary>
        /// Starts the service application.
        /// </summary>
        /// <param name="serviceApp">The service app to start.</param>
        public void StartServiceApp(ServiceApp serviceApp)
        {
            this.TryExecute(
                () =>
            {
                IServiceAppClient client = this.factory.Create <IServiceAppClient>();
                client.StartServiceApp(serviceApp.Name);
            },
                true);

            this.LoadServiceApps();
        }
Пример #3
0
        /// <summary>
        /// Removes the service application.
        /// </summary>
        /// <param name="appName">Name of the application.</param>
        public void RemoveServiceApp(string appName)
        {
            this.TryExecute(
                () =>
            {
                IServiceAppClient client = this.factory.Create <IServiceAppClient>();
                client.RemoveServiceApp(appName);
            },
                true);

            this.LoadServiceApps();
            this.View.SelectServiceApp(null);
        }
Пример #4
0
        /// <summary>
        /// Adds or Updates the service application.
        /// </summary>
        /// <param name="serviceApp">The service application.</param>
        public void UpdateServiceApp(ServiceApp serviceApp)
        {
            this.TryExecute(
                () =>
            {
                IServiceAppClient client = this.factory.Create <IServiceAppClient>();
                client.UpdateServiceApp(serviceApp);
            },
                true);

            this.LoadServiceApps();
            this.GetServiceAppDetails(serviceApp.Name);
        }
Пример #5
0
        /// <summary>
        /// Runs the service application
        /// </summary>
        /// <param name="serviceApp">The service application.</param>
        public void RunServiceApp(ServiceApp serviceApp)
        {
            this.TryExecute(
                () =>
            {
                IServiceAppClient client = this.factory.Create <IServiceAppClient>();
                client.RunServiceApp(serviceApp.Name);
                Thread.Sleep(2000);     // artificial wait just to allow the async tasks a little bit of time to update
            },
                true);

            this.LoadServiceApps();
        }
Пример #6
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);
 }
Пример #7
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);
        }