private void uploadFile(OpenFileDialog dialog, IEnumerable <string> assemblyNames)
        {
            string selectedFileName;

            byte[] fileBuffer = null;
            try
            {
                using (FileStream strm = dialog.File.OpenRead())
                {
                    selectedFileName = dialog.File.Name;
                    // remove the .xap extension
                    if (selectedFileName.EndsWith(".xap", StringComparison.OrdinalIgnoreCase))
                    {
                        selectedFileName = selectedFileName.Substring(0, selectedFileName.Length - 4);
                    }
                    using (BinaryReader rdr = new BinaryReader(strm))
                    {
                        fileBuffer = rdr.ReadBytes((int)strm.Length);
                    }
                }

                if (fileBuffer != null)
                {
                    Extension extension = new Extension()
                    {
                        Name       = selectedFileName,
                        Url        = string.Format("{0}/{1}.xap", BuilderApplication.Instance.ExtensionsRepositoryBaseUrl, selectedFileName),
                        Assemblies = new List <ESRI.ArcGIS.Mapping.Builder.Common.Assembly>(),
                    };
                    ObservableCollection <string> assemblies = new ObservableCollection <string>();
                    if (assemblyNames != null)
                    {
                        foreach (string assemblyInExtension in assemblyNames)
                        {
                            if (!AssemblyManager.IsBuiltInAssembly(assemblyInExtension))
                            {
                                assemblies.Add(assemblyInExtension);
                                extension.Assemblies.Add(new ESRI.ArcGIS.Mapping.Builder.Common.Assembly()
                                {
                                    Name = assemblyInExtension
                                });
                            }
                        }
                    }
                    showHideProgressIndicator(false);
                    byte[] msgBody = fileBuffer.ToArray();
                    ApplicationBuilder.ApplicationBuilderClient client = WCFProxyFactory.CreateApplicationBuilderProxy();
                    client.UploadExtensionLibraryCompleted += client_UploadExtensionLibraryCompleted;
                    client.UploadExtensionLibraryAsync(selectedFileName, msgBody, assemblies, extension);
                }
            }
            catch (Exception ex)
            {
                Logger.Instance.LogError(ex);
            }
        }