Example #1
0
        private void btnTestConnection_Click(object sender, RoutedEventArgs e)
        {
            try
            {
                X1 x = new X1(ConsoleContext.GetConsoleEMG(), new Guid("5a49b80c-4c34-d189-ca94-a591580f1995"), "Project Connector");
                x.CheckLicense();

                credsControl.SetCredentials();

                Type            type        = Type.GetTypeFromProgID("Microsoft.EnterpriseManagement.ServiceManager.ProjectServer.Adapter.ProjectAdapter");
                object          inst        = Activator.CreateInstance(type);
                IProjectAdapter projAdapter = (IProjectAdapter)inst;

                if (data.IsO365)
                {
                    projAdapter.Connect(data.PwaUrl, credsControl.UserName, PasswordHepler.ConvertSecureStringToString(credsControl.Password));
                }
                else
                {
                    projAdapter.Connect(data.PwaUrl, credsControl.UserName, PasswordHepler.ConvertSecureStringToString(credsControl.Password), credsControl.Domain);
                }
                var success = projAdapter.IsConnected();

                using (new WaitCursor())
                {
                    if (success)
                    {
                        MessageBox.Show(ServiceManagerLocalization.GetStringFromManagementPack("strConnectSuccess"), ServiceManagerLocalization.GetStringFromManagementPack("strConnectorTitle"),
                                        MessageBoxButton.OK, MessageBoxImage.Information);
                        this.IsNextButtonEnabled = true;
                    }
                    else
                    {
                        MessageBox.Show(ServiceManagerLocalization.GetStringFromManagementPack("strConnectFailed"), ServiceManagerLocalization.GetStringFromManagementPack("strConnectorTitle"),
                                        MessageBoxButton.OK, MessageBoxImage.Error);
                    }
                }
            }
            catch (Exception ex)
            {
                ConsoleContextHelper.Instance.ShowErrorDialog(ex, ex.Message, ConsoleFramework.ConsoleJobExceptionSeverity.Error);
            }
        }
        string checkLicense()
        {
            IX1 x = new X1(emg, emoSettings.Id, "Project Connector");

            return(x.CheckLicense());
        }
        string checkLicense()
        {
            IX1 x = new X1(emg, new Guid("5a49b80c-4c34-d189-ca94-a591580f1995"), "Project Connector");

            return(x.CheckLicense());
        }
Example #4
0
        void checkLicense()
        {
            X1 x = new X1(ConsoleContext.GetConsoleEMG(), new Guid("5a49b80c-4c34-d189-ca94-a591580f1995"), "Project Connector");

            x.CheckLicense();
        }