private void ActivatePackage()
        {
            //Don't allow them to load a package without first saving
            //the ActivePackage if its dirty.
            if (ActivePackage != null && IsActivePackageDirty)
            {
                ErrorWindow dirtyPackageWindow =
                    new ErrorWindow("You have unsaved changes to the Active Package. Please save before loading another package.");
                dirtyPackageWindow.Owner = Application.Current.MainWindow;
                dirtyPackageWindow.ShowDialog();
                return;
            }

            if (SelectedPackage != null)
            {
                ActivePackage = SelectedPackage;

                //Readies the Files DataGrid
                SearchAndPopulateFiles();

                //Readies the Web Resources DataGrid
                LoadWebResourceInfos();
            }
        }
        private void ActivatePackage()
        {
            //Don't allow them to load a package without first saving
            //the ActivePackage if its dirty.
            if (ActivePackage != null && IsActivePackageDirty)
            {
                ErrorWindow dirtyPackageWindow =
                    new ErrorWindow("You have unsaved changes to the Active Package. Please save before loading another package.");
                dirtyPackageWindow.Owner = Application.Current.MainWindow;
                dirtyPackageWindow.ShowDialog();
                return;              
            }

            if (SelectedPackage != null)
            {
                ActivePackage = SelectedPackage;

                //Readies the Files DataGrid 
                SearchAndPopulateFiles();

                //Readies the Web Resources DataGrid
                LoadWebResourceInfos();
            }
        }
        private void InstantiateService()
        {
            ServerConnection.Configuration config = new ServerConnection.Configuration();
            try
            {
                if (SelectedConfiguration == null)
                {
                    throw new Exception("Please choose a configuration.");
                }

                //Get the Password
                string         password = String.Empty;
                PasswordWindow pw       = new PasswordWindow();
                pw.Owner = Application.Current.MainWindow;
                bool?submitted = pw.ShowDialog();
                if (submitted.Value)
                {
                    password = pw.GetPassword();
                }
                else
                {
                    ErrorWindow needPassword = new ErrorWindow("You need to supply a Password and Submit. Try again.");
                    needPassword.Owner = Application.Current.MainWindow;
                    needPassword.ShowDialog();
                    return;
                }


                _serverConnect = new ConsolelessServerConnection();
                ConsolelessServerConnection.Configuration _config = new ConsolelessServerConnection.Configuration();
                _config = _serverConnect.GetServerConfiguration(
                    SelectedConfiguration.Attribute("server").Value,
                    SelectedConfiguration.Attribute("orgName").Value,
                    SelectedConfiguration.Attribute("userName").Value,
                    password,
                    SelectedConfiguration.Attribute("domain").Value);

                _serviceProxy = ServerConnection.GetOrganizationProxy(config);


                // This statement is required to enable early-bound type support.
                _serviceProxy.ServiceConfiguration.CurrentServiceEndpoint.Behaviors
                .Add(new ProxyTypesBehavior());

                // The OrganizationServiceContext is an object that wraps the service
                // proxy and allows creating/updating multiple records simultaneously.
                _orgContext = new OrganizationServiceContext(_serviceProxy);

                //Set the ActiveConnection
                ActiveConfiguration = SelectedConfiguration;

                //If all worked, retrieve the solutions.
                LoadSolutions();
            }
            catch (Exception e)
            {
                StringBuilder sb = new StringBuilder();
                sb.AppendLine(e.Message);
                sb.AppendLine();
                sb.AppendLine("Please fix the Connection information and try again.");
                ErrorWindow errorWindow = new ErrorWindow(sb.ToString());
                errorWindow.Owner = Application.Current.MainWindow;
                var x = errorWindow.ShowDialog();
            }
        }
        private void InstantiateService()
        {
            try
            {
                if (SelectedConfiguration == null)
                    throw new Exception("Please choose a configuration.");

                //Get the Password
                string password = String.Empty;
                PasswordWindow pw = new PasswordWindow();
                pw.Owner = Application.Current.MainWindow;
                bool? submitted = pw.ShowDialog();
                if (submitted.Value)
                {
                    password = pw.GetPassword();
                }
                else
                {
                    ErrorWindow needPassword = new ErrorWindow("You need to supply a Password and Submit. Try again.");
                    needPassword.Owner = Application.Current.MainWindow;
                    needPassword.ShowDialog();
                    return;
                }
                

                _serverConnect = new ConsolelessServerConnection();
                ConsolelessServerConnection.Configuration _config = new ConsolelessServerConnection.Configuration();
                _config = _serverConnect.GetServerConfiguration(
                    SelectedConfiguration.Attribute("server").Value,
                    SelectedConfiguration.Attribute("orgName").Value,
                    SelectedConfiguration.Attribute("userName").Value, 
                    password,
                    SelectedConfiguration.Attribute("domain").Value);

                _serviceProxy = new OrganizationServiceProxy(_config.OrganizationUri,
                    _config.HomeRealmUri,
                    _config.Credentials,
                    _config.DeviceCredentials);

                // This statement is required to enable early-bound type support.
                _serviceProxy.ServiceConfiguration.CurrentServiceEndpoint.Behaviors
                    .Add(new ProxyTypesBehavior());

                // The OrganizationServiceContext is an object that wraps the service
                // proxy and allows creating/updating multiple records simultaneously.
                _orgContext = new OrganizationServiceContext(_serviceProxy);

                //Set the ActiveConnection
                ActiveConfiguration = SelectedConfiguration;

                //If all worked, retrieve the solutions.
                LoadSolutions();

            }
            catch (Exception e)
            {
                StringBuilder sb = new StringBuilder();
                sb.AppendLine(e.Message);
                sb.AppendLine();
                sb.AppendLine("Please fix the Connection information and try again.");
                ErrorWindow errorWindow = new ErrorWindow(sb.ToString());
                errorWindow.Owner = Application.Current.MainWindow;
                var x = errorWindow.ShowDialog();
            }
        }