Esempio n. 1
0
        /// <summary>
        /// validate page
        /// </summary>
        /// <param name="currentIndex">current index</param>
        internal override int ValidatePage(int currentIndex)
        {
            // TODO:
            AccountWizard wiz = (AccountWizard)this.Parent;

            return(base.ValidatePage(currentIndex));
        }
Esempio n. 2
0
 internal override void ActivatePage(int previousIndex)
 {
     base.ActivatePage (previousIndex);
        wizard = (AccountWizard)this.Parent;
        serverAddress.Text = wizard.ServerPage.ServerAddress;
        username.Text = wizard.IdentityPage.Username;
        rememberPassword.Text = wizard.IdentityPage.RememberPassword ? Resource.GetString("YesText") : Resource.GetString("NoText");
        defaultAccount.Text = wizard.ServerPage.DefaultServer ? Resource.GetString("YesText") : Resource.GetString("NoText");
 }
Esempio n. 3
0
        internal override void ActivatePage(int previousIndex)
        {
            base.ActivatePage(previousIndex);

            wizard                = (AccountWizard)this.Parent;
            serverAddress.Text    = wizard.ServerPage.ServerAddress;
            username.Text         = wizard.IdentityPage.Username;
            rememberPassword.Text = wizard.IdentityPage.RememberPassword ? Resource.GetString("YesText") : Resource.GetString("NoText");
            defaultAccount.Text   = wizard.ServerPage.DefaultServer ? Resource.GetString("YesText") : Resource.GetString("NoText");
        }
Esempio n. 4
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);
 }
Esempio n. 5
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));
             }
 }
Esempio n. 6
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();
      }
     }
        }
 }
Esempio n. 7
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();
 }
Esempio n. 8
0
        /// <summary>
        /// Download iFolder
        /// </summary>
        /// <param name="defaultiFolder"></param>
        private bool DownloadiFolder(iFolderWeb defaultiFolder)
        {
            bool status = false;

            if (defaultiFolder.encryptionAlgorithm == null || defaultiFolder.encryptionAlgorithm == "")
            {
                // unencrypted...
                status = true;
            }
            else
            {
                // encrypted.. Check for passphrase
                string passphrasecheck = null;
                passphrasecheck = simws.GetPassPhrase(domainInfo.ID);
                if (passphrasecheck == null || passphrasecheck == "")
                {
                    VerifyPassphraseDialog vpd = new VerifyPassphraseDialog(domainInfo.ID, this.simws);
                    vpd.ShowDialog();
                    status = vpd.PassphraseStatus;
                }
                else
                {
                    status = true;
                }
            }
            if (status == true)
            {
                try
                {
                    string        downloadpath = this.LocationEntry.Text;
                    DirectoryInfo di           = new DirectoryInfo(downloadpath);
                    if (di.Name == defaultiFolder.Name)
                    {
                        downloadpath = Directory.GetParent(this.LocationEntry.Text).ToString();
                        di           = new DirectoryInfo(downloadpath);
                    }

                    di.Create();
                    iFolderWeb ifolder = null;
                    if (System.IO.Directory.Exists(Path.Combine(downloadpath, defaultiFolder.Name)))
                    {
                        MyMessageBox mmb = new MyMessageBox(resManager.GetString("selectoption"), resManager.GetString("alreadyexists"), String.Empty, MyMessageBoxButtons.OKCancel, MyMessageBoxIcon.Question, MyMessageBoxDefaultButton.Button1);
                        if (mmb.ShowDialog() == DialogResult.OK)
                        {
                            ifolder = this.ifws.MergeiFolder(defaultiFolder.DomainID, defaultiFolder.ID, Path.Combine(downloadpath, defaultiFolder.Name));
                        }
                        else
                        {
                            return(false);
                        }
                    }
                    else
                    {
                        ifolder = this.ifws.AcceptiFolderInvitation(defaultiFolder.DomainID, defaultiFolder.ID, downloadpath);
                    }
                    AccountWizard wiz = (AccountWizard)this.Parent;
                    if (ifolder != null && wiz != null)
                    {
                        wiz.GlobalProps.AddiFolderToAcceptediFolders(ifolder, null, downloadpath);
                    }
                    wiz.UpdateDisplay(ifolder, Path.Combine(downloadpath, ifolder.Name));
                }
                catch (Exception ex)
                {
                    DisplayErrorMesg(ex);
                    return(false);
                }
                return(true);
            }
            else
            {
                return(status);
            }
        }