示例#1
0
 /// <summary>
 /// Sends a force build request to the remote server.
 /// </summary>
 public void ForceBuild()
 {
     client.ProcessSingleAction(p =>
     {
         client.ForceBuild(p.Name);
     }, InnerProject);
 }
示例#2
0
        /// <summary>
        /// Initialise the server.
        /// </summary>
        /// <param name="client"></param>
        /// <param name="watcher"></param>
        /// <param name="fetchVersion">Whether the version number should be fetched or not.</param>
        private void InitialiseServer(CruiseServerClientBase client, IServerWatcher watcher, bool fetchVersion)
        {
            this.watcher         = watcher;
            this.watcher.Update += OnWatcherUpdate;
            this.client          = client;

            if (fetchVersion)
            {
                try
                {
                    client.ProcessSingleAction(s =>
                    {
                        version = new Version(client.GetServerVersion());
                    }, client);
                }
                catch
                {
                    // This means there will be no version for the server
                }
            }
        }
示例#3
0
        /// <summary>
        /// Attempt to retrieve a snapshot from the remote server.
        /// </summary>
        private void RetrieveSnapshot()
        {
            // Retrieve the snapshot
            ServerUpdateArgs args;

            try
            {
                CruiseServerSnapshot snapshot = null;
                try
                {
                    client.ProcessSingleAction <object>(o =>
                    {
                        snapshot = client.GetCruiseServerSnapshot();
                    }, null);
                }
                catch (NotImplementedException)
                {
                    // This is an older style server, try fudging the snapshot
                    snapshot = new CruiseServerSnapshot
                    {
                        ProjectStatuses = client.GetProjectStatus()
                    };
                }
                args = new ServerUpdateArgs(snapshot);
            }
            catch (Exception error)
            {
                args = new ServerUpdateArgs(error);
            }

            // Fire the update
            if (Update != null)
            {
                Update(this, args);
            }
        }