예제 #1
0
 protected override void WndProc(ref Message m)
 {
     switch (m.Msg)
        {
     case WM_QUERYENDSESSION:
     {
      this.shutdown_msg = true;
      break;
     }
        }
     if (m.Msg == this.appRestart)
     {
         if (this.simiasWebService != null && !wizardRunning)
         {
             DomainInformation[] domains;
             domains = this.simiasWebService.GetDomains(false);
             if (domains.Length.Equals(0))
             {
                 if (globalProperties.Visible)
                     globalProperties.Hide();
                 AccountWizard accountWizard = new AccountWizard(ifWebService, simiasWebService, simiasManager, true, this.preferences, this.globalProperties);
                 accountWizard.EnterpriseConnect += new Novell.Wizard.AccountWizard.EnterpriseConnectDelegate(preferences_EnterpriseConnect);
                 wizardRunning = true;
                 DialogResult result = accountWizard.ShowDialog();
                 wizardRunning = false;
                 if (result == DialogResult.OK)
                 {
                     preferences_DisplayiFolderDialog(this, new EventArgs());
                 }
                 else
                     globalProperties.Hide();
             }
             else
             {
                 if (globalProperties.Visible)
                 {
                     globalProperties.Activate();
                 }
                 else
                 {
                     globalProperties.Show();
                 }
             }
         }
     }
        base.WndProc (ref m);
 }
예제 #2
0
 private void menuProperties_Click(object sender, System.EventArgs e)
 {
     if (!wizardRunning)
        {
     DomainInformation[] domains;
     domains = this.simiasWebService.GetDomains(false);
     if (domains.Length.Equals(0))
     {
      if (globalProperties.Visible)
       globalProperties.Hide();
      AccountWizard accountWizard = new AccountWizard(ifWebService, simiasWebService, simiasManager, true, this.preferences, this.globalProperties);
             accountWizard.EnterpriseConnect += new Novell.Wizard.AccountWizard.EnterpriseConnectDelegate(preferences_EnterpriseConnect);
      wizardRunning = true;
      DialogResult result = accountWizard.ShowDialog();
      wizardRunning = false;
      if ( result == DialogResult.OK )
      {
       preferences_DisplayiFolderDialog( this, new EventArgs() );
      }
     }
     else
     {
      if (globalProperties.Visible)
      {
       globalProperties.Activate();
      }
      else
      {
       globalProperties.Show();
      }
     }
        }
 }
예제 #3
0
 public void PostSimiasStart()
 {
     bool accountPrompt = false;
             try
             {
                 globalProperties.InitializeServerList();
                 DomainInformation[] domains;
                 domains = this.simiasWebService.GetDomains(false);
                 foreach (DomainInformation dw in domains)
                 {
                     try
                     {
                         if (dw.IsSlave)
                         {
                             preferences.AddDomainToList(dw);
                             if (this.simiasWebService.GetRememberOption(dw.ID) == false)
                                 this.simiasWebService.StorePassPhrase(dw.ID, "", CredentialType.None, false);
                         }
                         BeginInvoke(globalProperties.addDomainToListDelegate, new object[] { dw });
                         preferences.SetProxyForDomain(dw.HostUrl, false);
                     }
                     catch { }
                 }
                 if (domains.Length.Equals(0))
                 {
                     this.NoAccounts = true;
                     accountPrompt = true;
                 }
             }
             catch { }
             if (worker == null)
             {
                 worker = new Thread(new ThreadStart(eventThreadProc));
                 worker.Name = "FormsTaryApp Event";
                 worker.IsBackground = true;
                 worker.Priority = ThreadPriority.BelowNormal;
                 worker.Start();
             }
             shellNotifyIcon.Text = resourceManager.GetString("iFolderServices");
             shellNotifyIcon.Icon = trayIcon;
             try
             {
                 if (accountPrompt == false)
                 {
                     if ((!Preferences.HideiFolderInTray && RegularStart) || ShowWindow )
                     {
                         this.globalProperties.Show();
                     }
                     updateOverlayIcons();
                     string iFolderKey = @"SOFTWARE\Novell\iFolder";
                     RegistryKey regKey = Registry.CurrentUser.CreateSubKey(iFolderKey);
                     int Migration = (int)regKey.GetValue("MigrationPrompt", (int)1);
                     if (Migration == 1)
                     {
                         if (iFolder2Present() == true)
                         {
                             bool migrate = MigrationPrompt();
                             if (migrate == true)
                             {
                                 Novell.FormsTrayApp.MigrationWindow migrationWindow = new MigrationWindow(this.ifWebService, this.simiasWebService);
                                 migrationWindow.ShowDialog(this);
                             }
                         }
                     }
                 }
                 if (accountPrompt)
                 {
                     bool status = false;
                     string filePathValue;
                     System.Object[] args = new System.Object[5];
                     try
                     {
                         Assembly idAssembly = Assembly.LoadFrom(AutoAccountConstants.assemblyName);
                         if (idAssembly != null)
                         {
                             Type type = idAssembly.GetType(AutoAccountConstants.autoAccountClass);
                             if (null != type)
                             {
                                 args[0] = ifWebService;
                                 args[1] = simiasWebService;
                                 args[2] = simiasManager;
                                 args[3] = globalProperties;
                                 args[4] = this;
                                 System.Object autoAccount = Activator.CreateInstance(type, args);
                                 MethodInfo method = type.GetMethod(AutoAccountConstants.autoAccountCreateAccountsMethod);
                                 status = (bool)method.Invoke(autoAccount, null);
                                 if (status)
                                 {
                                     method = type.GetMethod(AutoAccountConstants.autoAccountPrefMethod);
                                     method.Invoke(autoAccount, null);
                                     PropertyInfo info = type.GetProperty(AutoAccountConstants.autoAccountFilePath);
                                     filePathValue = (string)info.GetValue(autoAccount, null);
                                     FormsTrayApp.log.Debug("File path value is {0}", filePathValue);
                                     System.IO.FileInfo fileInfo = new System.IO.FileInfo(filePathValue);
                                     System.IO.FileInfo backupFileInfo = new System.IO.FileInfo(filePathValue + ".backup");
                                     if(File.Exists(filePathValue + ".backup"))
                                     {
                                         backupFileInfo.Delete();
                                     }
                                     fileInfo.MoveTo(filePathValue + ".backup");
                                 }
                             }
                         }
                     }
                     catch (Exception ex)
                     {
                         FormsTrayApp.log.Info("Error: {0}", ex.Message);
                         FormsTrayApp.log.Debug("Exception Type {0}", ex.GetType());
                         FormsTrayApp.log.Debug("StackTrace {0}", ex.StackTrace);
                     }
                     if (!status)
                     {
                         DomainInformation[] domains;
                         domains = this.simiasWebService.GetDomains(false);
                         if (domains.Length.Equals(0))
                         {
                             AccountWizard accountWizard = new AccountWizard(ifWebService, simiasWebService, simiasManager, true, this.preferences, this.globalProperties);
                             accountWizard.EnterpriseConnect += new Novell.Wizard.AccountWizard.EnterpriseConnectDelegate(preferences_EnterpriseConnect);
                             wizardRunning = true;
                             DialogResult result = accountWizard.ShowDialog();
                             wizardRunning = false;
                             if (result == DialogResult.OK)
                             {
                                 preferences_DisplayiFolderDialog(this, new EventArgs());
                             }
                         }
                     }
                     else if (!wizardRunning)
                     {
                         if (globalProperties.Visible)
                         {
                             globalProperties.Activate();
                         }
                         else
                         {
                             DomainInformation[] domains;
                             domains = this.simiasWebService.GetDomains(false);
                             if (!domains.Length.Equals(0))
                                 globalProperties.Show();
                         }
                     }
                 }
             }
             catch (Exception e1)
             {
                 MessageBox.Show(string.Format("Exception: {0}--{1}", e1.Message, e1.StackTrace));
             }
 }
예제 #4
0
 private void addAccount_Click(object sender, System.EventArgs e)
 {
     AccountWizard accountWizard = new AccountWizard(ifWebService, simiasWebService, simiasManager, accounts.Items.Count == 0, this, (GlobalProperties)FormsTrayApp.globalProp());
     accountWizard.EnterpriseConnect += new Novell.Wizard.AccountWizard.EnterpriseConnectDelegate(accountWizard_EnterpriseConnect);
     if (accountWizard.ShowDialog() == DialogResult.OK)
     {
         if (DisplayiFolderDialog != null)
         {
             DisplayiFolderDialog(this, new EventArgs());
         }
     }
     accountWizard.Dispose();
     this.Focus();
 }