private void btnUnInstallCustom_Click(object sender, EventArgs e)
        {
            try
            {
                WriteOutput("Unpublishing Packages", true);
                ServiceGate.ServiceGate client = new ServiceGate.ServiceGate
                {
                    CookieContainer = new System.Net.CookieContainer()
                };
                client.UnpublishAllPackagesCompleted += Client_UnpublishAllPackagesCompleted;
                client.Url = string.Format("http://localhost/{0}/api/ServiceGate.asmx", txtInstance.Text);
                LoginResult   lr       = client.Login(txtACUser.Text, txtACPass.Text);
                List <string> packages = new List <string>();
                IsPublishing = true;

                client.UnpublishAllPackagesAsync();

                while (IsPublishing)
                {
                    Application.DoEvents();
                }
                WriteOutput("Unpublishing Packages Complete", true);
            }
            catch (Exception ex)
            {
                WriteOutput(ex.Message);
                IsPublishing = false;
            }
        }
        private void btnInstallCustom_Click(object sender, EventArgs e)
        {
            WriteOutput("Publishing Packages", true);
            try
            {
                ServiceGate.ServiceGate client = new ServiceGate.ServiceGate
                {
                    CookieContainer = new System.Net.CookieContainer()
                };
                client.PublishPackagesCompleted += Client_PublishPackagesCompleted;
                client.Url = string.Format("http://localhost/{0}/api/ServiceGate.asmx", txtInstance.Text);
                LoginResult   lr       = client.Login(txtACUser.Text, txtACPass.Text);
                List <string> packages = new List <string>();
                foreach (CustomizationItem item in cboCustom.CheckedItems)
                {
                    var fi = new FileInfo(item.Path);
                    File.Copy(item.Path, ErpPath + @"\mods\" + fi.Name, true);
                    packages.Add(fi.Name);
                    client.UploadPackage(fi.Name, System.IO.File.ReadAllBytes(item.Path), true);
                }
                IsPublishing = true;

                client.PublishPackagesAsync(packages.ToArray(), true);
                while (IsPublishing)
                {
                    Application.DoEvents();
                }
            }
            catch (Exception ex)
            {
                WriteOutput(ex.Message);
                IsPublishing = false;
            }
            WriteOutput("Publishing Packages Complete", true);
        }