private void OnConnectToServerButton(object o, EventArgs args) { AddAccountWizard aaw = new AddAccountWizard(simws); aaw.TransientFor = this; if (!Util.RegisterModalWindow(aaw)) { try { Util.CurrentModalWindow.Present(); } catch{} aaw.Destroy(); return; } aaw.ShowAll(); }
private void ShowAddAccountWizard() { bool status = false; const string assemblyName = "plugins/Novell.AutoAccount.AutoAccountCreator"; const string autoAccountClass = "Novell.AutoAccount.AutoAccount"; const string autoAccountCreateAccountsMethod = "CreateAccounts"; const string autoAccountPrefMethod = "SetPreferences"; const string autoAccountFilePath = "AutoAccountFilePath"; string filePathValue; System.Object[] args = new System.Object[1]; System.Object[] prefArgs = new System.Object[1]; try { Assembly idAssembly = Assembly.Load( assemblyName ); if ( idAssembly != null ) { Type type = idAssembly.GetType( autoAccountClass ); if( null != type ) { args[0] = simws; System.Object autoAccount = Activator.CreateInstance(type,args); MethodInfo method = type.GetMethod(autoAccountCreateAccountsMethod); status = (Boolean)method.Invoke(autoAccount, null); iFolderWindow.log.Info("Account Creation Status {0}", status); if( status ) { method = type.GetMethod( autoAccountPrefMethod ); prefArgs[0] = ifws; method.Invoke(autoAccount, prefArgs); PropertyInfo info = type.GetProperty(autoAccountFilePath); filePathValue = (string)info.GetValue( autoAccount, null ); iFolderWindow.log.Debug("File path value is {0}", filePathValue ); System.IO.FileInfo fileInfo = new System.IO.FileInfo(filePathValue); if( File.Exists(filePathValue+".backup")) { File.Delete(filePathValue+".backup"); } fileInfo.MoveTo(filePathValue+".backup"); } } } } catch( Exception e ) { iFolderWindow.log.Info("Error: {0}", e.Message); iFolderWindow.log.Debug("Exception type {0}\nStackTrace {1}", e.GetType(), e.StackTrace); } DomainInformation[] domains = null; if(null != domainController) domains = domainController.GetDomains(); if(!status) { if(null != domains && domains.Length < 1) { iFolderWindow.log.Debug("Starting account wizard from client..."); AddAccountWizard aaw = new AddAccountWizard(simws); if (!Util.RegisterModalWindow(aaw)) { try { Util.CurrentModalWindow.Present(); } catch{} aaw.Destroy(); return; } aaw.ShowAll(); } else { iFolderWindow.log.Debug("Domain count is greater than or equal to 1 now..."); } } else { if(null != domains && domains.Length >= 1) Util.ShowiFolderWindow(); } }