Beispiel #1
0
 public ServerDetails(SimiasWebService simiasWebService, iFolderWebService ifolderWebService, Domain domain)
 {
     InitializeComponent();
        this.simiasWebService = simiasWebService;
        ifWebService = ifolderWebService;
        this.domain = domain;
 }
 internal override int ValidatePage(int currentIndex)
 {
     DomainInformation[] domains;
     DomainInformation selectedDomainInfo = null;
     domains = this.simiasWebService.GetDomains(true);
     Status passPhraseStatus = null;
     if (this.newPassphrase.Text != this.confirmPassphrase.Text)
     {
         MessageBox.Show(TrayApp.Properties.Resources.passphraseNotEqualError, TrayApp.Properties.Resources.resetPassphraseError,MessageBoxButtons.OK,MessageBoxIcon.Error);
         return currentIndex;
     }
     foreach (DomainInformation di in domains)
     {
         if (di.Authenticated && di.ID == wizard.DomainSelectionPage.SelectedDomain.ID)
         {
             selectedDomainInfo = (DomainInformation)di;
         }
     }
     bool result = false;
     Domain domain = new Domain(selectedDomainInfo);
     try
     {
         Status status = this.simiasWebService.LogoutFromRemoteDomain(domain.ID);
         if (status.statusCode == StatusCodes.Success)
         {
             status = this.simiasWebService.LoginToRemoteDomain(domain.ID, this.password.Text);
             if (status.statusCode != StatusCodes.Success)
             {
                 MessageBox.Show(Resources.loginError,TrayApp.Properties.Resources.authenticateError,MessageBoxButtons.OK,MessageBoxIcon.Error);
                 return -999;
             }
             result = true;
         }
     }
     catch (Exception)
     {
         MessageBox.Show(Resources.loginError, TrayApp.Properties.Resources.authenticateError, MessageBoxButtons.OK, MessageBoxIcon.Error);
             return -999;
     }
     if (result)
     {
         string memberUID = selectedDomainInfo.MemberUserID;
         try
         {
             this.simiasWebService.ExportRecoverImport(selectedDomainInfo.ID, memberUID, this.newPassphrase.Text);
             this.simiasWebService.StorePassPhrase(selectedDomainInfo.ID,
                                                       this.newPassphrase.Text,
                                                       CredentialType.Basic,
                                                      this.simiasWebService.GetRememberOption(selectedDomainInfo.ID));
         }
         catch (Exception )
         {
            MessageBox.Show(Resources.recoveryError,
              Resources.resetPassphraseError,MessageBoxButtons.OK,MessageBoxIcon.Error);
              return -999;
         }
     }
         currentIndex = wizard.MaxPages - 4;
         return base.ValidatePage(currentIndex);
 }
Beispiel #3
0
 public void UpdateDomainStatus(Domain domain)
 {
     foreach (ListViewItem lvi in accounts.Items)
     {
         Domain d = (Domain)lvi.Tag;
         if (d.ID.Equals(domain.ID))
         {
             lvi.Tag = domain;
             lvi.Checked = domain.DomainInfo.Authenticated;
             break;
         }
     }
     if (UpdateDomain != null)
     {
         UpdateDomain(this, new DomainConnectEventArgs(domain.DomainInfo));
     }
 }
Beispiel #4
0
 public void RemoveDomainFromList(DomainInformation domainInfo, string defaultDomainID)
 {
     ListViewItem lvitem = null;
     Domain defaultDomain = null;
     try
     {
         foreach (ListViewItem lvi in accounts.Items)
         {
             Domain d = (Domain)lvi.Tag;
             if (d.ID.Equals(domainInfo.ID))
             {
                 lvitem = lvi;
             }
             else if ((defaultDomainID != null) && d.ID.Equals(defaultDomainID))
             {
                 defaultDomain = d;
             }
         }
         if (lvitem != null)
         {
             lvitem.Remove();
         }
         if (defaultDomain != null)
         {
             if ((currentDefaultDomain != null) && !currentDefaultDomain.ID.Equals(defaultDomainID))
             {
                 currentDefaultDomain.DomainInfo.IsDefault = false;
             }
             currentDefaultDomain = defaultDomain;
         }
     }
     catch { }
 }
Beispiel #5
0
 public bool logoutFromDomain(Domain domain)
 {
     bool result = false;
     if (domain != null)
     {
         DomainAuthentication domainAuth = new DomainAuthentication("iFolder", domain.ID, null);
         Status authStatus = domainAuth.Logout(simiasManager.WebServiceUri, simiasManager.DataPath);
         if (authStatus != null && authStatus.statusCode == StatusCodes.Success)
         {
             result = true;
             domain.DomainInfo.Authenticated = false;
             if (this.simiasWebService.GetRememberOption(domain.ID) == false)
             {
                 this.simiasWebService.StorePassPhrase(domain.ID, "", CredentialType.None, false);
             }
             FormsTrayApp.globalProp().updateifListViewDomainStatus(domain.DomainInfo.ID, false);
             (FormsTrayApp.globalProp()).RemoveDomainFromUIList(domain.DomainInfo.ID, null);
             FormsTrayApp.globalProp().UpdateiFolderStatus(domain.DomainInfo.Authenticated, domain.DomainInfo.ID);
         }
     }
     return result;
 }
Beispiel #6
0
 public bool loginToDomain(Domain domain)
 {
     bool result = false;
     if (domain != null)
     {
         Connecting connecting = new Connecting(this.ifWebService, simiasWebService, simiasManager, domain.DomainInfo);
         if (connecting.ShowDialog() == DialogResult.OK)
         {
             result = true;
         }
         if (!result)
         {
             ServerInfo serverInfo = new ServerInfo(this.ifWebService, simiasManager, domain.DomainInfo, connecting.Password);
             serverInfo.ShowDialog();
             result = serverInfo.DomainInfo.Authenticated;
             serverInfo.Dispose();
         }
         connecting.Dispose();
     }
     if (result)
     {
         domain.DomainInfo.Authenticated = true;
         FormsTrayApp.globalProp().updateifListViewDomainStatus(domain.DomainInfo.ID, true);
         FormsTrayApp.globalProp().AddDomainToUIList(domain.DomainInfo);
         FormsTrayApp.globalProp().UpdateiFolderStatus(domain.DomainInfo.Authenticated, domain.DomainInfo.ID);
     }
     return result;
 }
Beispiel #7
0
 public void AddDomainToList(DomainInformation domainInfo)
 {
     Domain domain = null;
     foreach (ListViewItem lvi in accounts.Items)
     {
         Domain d = (Domain)lvi.Tag;
         if (d.ID.Equals(domainInfo.ID))
         {
             domain = d;
             break;
         }
     }
     if (domain == null)
     {
         domain = new Domain(domainInfo);
         if (domainInfo.IsDefault)
         {
             if ((currentDefaultDomain != null) && !currentDefaultDomain.ID.Equals(domainInfo.ID))
             {
                 currentDefaultDomain.DomainInfo.IsDefault = false;
             }
             currentDefaultDomain = domain;
             if (ChangeDefaultDomain != null)
             {
                 ChangeDefaultDomain(this, new DomainConnectEventArgs(currentDefaultDomain.DomainInfo));
             }
         }
         ListViewItem lvi = new ListViewItem(
             new string[] { string.Empty, domain.Name,
       domainInfo.MemberName });
         lvi.Checked = domainInfo.Authenticated;
         lvi.Tag = domain;
         lvi.Selected = domainInfo.IsDefault;
         accounts.Items.Add(lvi);
     }
 }
Beispiel #8
0
 private void removeAccount_Click(object sender, System.EventArgs e)
 {
     ListViewItem lvi = accounts.SelectedItems[0];
     Domain domain = (Domain)lvi.Tag;
     if (domain == null)
     {
         newAccountLvi = null;
         lvi.Remove();
         updatePassword = updateEnabled = updateHost = false;
         addAccount.Enabled = true;
     }
     else
     {
         RemoveAccount removeAccount = new RemoveAccount(domain.DomainInfo);
         if (removeAccount.ShowDialog() == DialogResult.Yes)
         {
             try
             {
                 simiasWebService.LeaveDomain(domain.ID, !removeAccount.RemoveAll);
                 lvi.Remove();
                 string defaultDomainID = null;
                 if (domain.Equals(currentDefaultDomain))
                 {
                     defaultDomainID = simiasWebService.GetDefaultDomainID();
                 }
                 if (RemoveDomain != null)
                 {
                     RemoveDomain(this, new DomainRemoveEventArgs(domain.DomainInfo, defaultDomainID));
                 }
                 if (defaultDomainID != null)
                 {
                     foreach (ListViewItem item in accounts.Items)
                     {
                         Domain d = (Domain)item.Tag;
                         if (d.ID.Equals(defaultDomainID))
                         {
                             currentDefaultDomain = d;
                             break;
                         }
                     }
                 }
                 updatePassword = updateEnabled = updateHost = false;
             }
             catch (Exception ex)
             {
                 MyMessageBox mmb = new MyMessageBox(resourceManager.GetString("removeAccountError"), resourceManager.GetString("accountErrorTitle"), ex.Message, MyMessageBoxButtons.OK, MyMessageBoxIcon.Error);
                 mmb.ShowDialog();
                 mmb.Dispose();
             }
         }
         DomainInformation[] domains;
         System.Threading.Thread.Sleep(2000);
         domains = this.simiasWebService.GetDomains(false);
         if (domains.Length.Equals(0))
         {
             if (((GlobalProperties)FormsTrayApp.globalProp()).Visible)
                 ((GlobalProperties)FormsTrayApp.globalProp()).Hide();
         }
         removeAccount.Dispose();
     }
 }
Beispiel #9
0
 private void Preferences_Closing(object sender, System.ComponentModel.CancelEventArgs e)
 {
     if (!successful && DialogResult.Equals(DialogResult.OK))
     {
         e.Cancel = true;
     }
     else if (!shutdown)
     {
         e.Cancel = true;
         currentDefaultDomain = null;
         newAccountLvi = null;
         addAccount.Enabled = true;
         details.Enabled = removeAccount.Enabled = false;
         updatePassword = updateEnabled = updateHost = false;
         Hide();
     }
 }
Beispiel #10
0
 private void details_Click(object sender, System.EventArgs e)
 {
     ListViewItem lvi = accounts.SelectedItems[0];
     Domain domain = (Domain)lvi.Tag;
     if (domain != null)
     {
         ServerDetails serverDetails = new ServerDetails(this.simiasWebService, this.ifWebService, domain);
         if (serverDetails.ShowDialog() == DialogResult.OK)
         {
             if (serverDetails.EnableChanged || serverDetails.AddressChanged)
             {
             }
             if (serverDetails.DefaultChanged)
             {
                 if (currentDefaultDomain != null)
                 {
                     currentDefaultDomain.DomainInfo.IsDefault = false;
                 }
                 currentDefaultDomain = domain;
                 if (ChangeDefaultDomain != null)
                 {
                     ChangeDefaultDomain(this, new DomainConnectEventArgs(currentDefaultDomain.DomainInfo));
                 }
             }
         }
         serverDetails.Dispose();
     }
 }
 internal override int ValidatePage(int currentIndex)
 {
     DomainInformation[] domains;
     DomainInformation selectedDomainInfo = null;
     domains = this.simiasWebService.GetDomains(true);
     Status passPhraseStatus = null;
     foreach (DomainInformation di in domains)
     {
         if (di.Authenticated && di.ID == wizard.DomainSelectionPage.SelectedDomain.ID)
         {
             selectedDomainInfo = (DomainInformation)di;
         }
     }
     bool result = false;
     Domain domain = new Domain(selectedDomainInfo);
     try
     {
         Status status = this.simiasWebService.LogoutFromRemoteDomain(domain.ID);
         if (status.statusCode == StatusCodes.Success)
         {
             status = this.simiasWebService.LoginToRemoteDomain(domain.ID, this.password.Text);
             if (status.statusCode != StatusCodes.Success)
             {
                 MessageBox.Show(Resources.authenticateError);
                 return -999;
             }
             result = true;
         }
     }
     catch (Exception e)
     {
             return -999;
     }
     if (result)
     {
         string memberUID = selectedDomainInfo.MemberUserID;
         string publicKey = null;
         try
         {
             publicKey = this.ifolderWebService.GetDefaultServerPublicKey(selectedDomainInfo.ID, memberUID);
             this.simiasWebService.ExportRecoverImport(selectedDomainInfo.ID, memberUID, this.newPassphrase.Text);
             passPhraseStatus = null;
             passPhraseStatus = this.simiasWebService.SetPassPhrase(selectedDomainInfo.ID, this.newPassphrase.Text, "DEFAULT", publicKey);
             result = true;
         }
         catch (Exception ex)
         {
             MyMessageBox mmb = new MyMessageBox(Resources.recoveryError,
              Resources.resetPassphraseError, null, MyMessageBoxButtons.OK);
             mmb.ShowDialog();
             if (mmb.DialogResult == DialogResult.OK)
             {
                 return -999;
             }
         }
     }
     if (passPhraseStatus.statusCode != StatusCodes.Success)
     {
         MyMessageBox mmb = new MyMessageBox(Resources.recoveryError,
                 Resources.resetPassphraseError, null, MyMessageBoxButtons.OK);
         mmb.ShowDialog();
         if (mmb.DialogResult == DialogResult.OK)
         {
             return currentIndex;
         }
     }
         currentIndex = wizard.MaxPages - 4;
         return base.ValidatePage(currentIndex);
 }
Beispiel #12
0
 public ServerDetails(iFolderWebService ifolderWebService, Domain selectedDomain)
 {
     InitializeComponent();
        ifWebService = ifolderWebService;
        this.selectedDomain = selectedDomain;
 }
 public void InitializeServerList()
 {
     servers.Items.Clear();
        Domain domain = new Domain(resourceManager.GetString("showAll"));
        servers.Items.Add(domain);
        servers.SelectedItem = domain;
        domainList = Path.Combine(
     Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData),
     "domain.list");
        XmlDocument domainsDoc = new XmlDocument();
        try
        {
     if (!File.Exists(domainList))
     {
      domainsDoc.LoadXml("<domains></domains>");
     }
     else
     {
      domainsDoc.Load(domainList);
      XmlNode node = domainsDoc.SelectSingleNode("/domains");
      if (node == null)
      {
       XmlElement element = domainsDoc.CreateElement("domains");
       domainsDoc.AppendChild(element);
      }
      else
      {
       node.RemoveAll();
      }
     }
        }
        catch
        {
     domainsDoc.LoadXml("<domains></domains>");
        }
        saveXmlFile(domainsDoc);
 }
 public void AddDomainToList(DomainInformation domainInfo)
 {
     Domain domain = null;
        foreach (Domain d in servers.Items)
        {
     if (d.ID.Equals(domainInfo.ID))
     {
      domain = d;
     }
        }
        if (domain == null)
        {
     domain = new Domain(domainInfo);
     servers.Items.Add(domain);
        }
        if (domainInfo.IsDefault)
        {
     if (defaultDomain != null)
     {
      defaultDomain.DomainInfo.IsDefault = false;
     }
     defaultDomain = domain;
        }
        addDomainToFile(domainInfo);
 }
 private void refreshiFolders(Domain domain)
 {
     Cursor.Current = Cursors.WaitCursor;
        iFolderView.Items.Clear();
        iFolderView.SelectedItems.Clear();
        menuShare.Visible = menuActionShare.Enabled = toolBarShare.Enabled =
     menuProperties.Visible = menuActionProperties.Enabled =
     menuRevert.Visible = menuActionRevert.Enabled =
     menuSyncNow.Visible = menuActionSync.Enabled = toolBarSync.Enabled =
     menuOpen.Visible = menuActionOpen.Enabled =
     menuSeparator1.Visible = menuSeparator2.Visible =
     menuResolve.Visible = menuActionResolve.Visible = toolBarResolve.Enabled =
     menuAccept.Visible = menuActionAccept.Visible = toolBarSetup.Enabled =
     menuActionSeparator2.Visible =
     menuRemove.Visible = menuActionRemove.Visible =
     menuActionSeparator2.Visible = false;
        menuRefresh.Visible = menuCreate.Visible = true;
        Array oldValues = Array.CreateInstance(typeof(ListViewItem), ht.Count);
        ht.Values.CopyTo(oldValues, 0);
        lock(ht)
        {
     ht.Clear();
        }
        iFolderView.BeginUpdate();
        try
        {
     iFolderWeb[] ifolderArray = domain.ShowAll ?
      ifWebService.GetAlliFolders() :
      ifWebService.GetiFoldersForDomain(domain.ID);
     foreach (iFolderWeb ifolder in ifolderArray)
     {
      iFolderState state = iFolderState.Normal;
      if (!ifolder.IsSubscription)
      {
       foreach (ListViewItem lvi in oldValues)
       {
        iFolderObject oldiFolder = (iFolderObject)lvi.Tag;
        if (oldiFolder.iFolderWeb.ID.Equals(ifolder.ID))
        {
     state = oldiFolder.iFolderState;
     break;
        }
       }
      }
      addiFolderToListView(new iFolderObject(ifolder, state));
     }
        }
        catch (Exception ex)
        {
     Novell.iFolderCom.MyMessageBox mmb = new MyMessageBox(resourceManager.GetString("iFolderError"), resourceManager.GetString("iFolderErrorTitle"), ex.Message, MyMessageBoxButtons.OK, MyMessageBoxIcon.Information);
     mmb.ShowDialog();
        }
        iFolderView.EndUpdate();
        Cursor.Current = Cursors.Default;
 }
 private void refreshAll(Domain domain)
 {
     refreshiFolders(domain);
        if (domain.ShowAll)
        {
     foreach (Domain d in servers.Items)
     {
      if (!d.ShowAll)
      {
       try
       {
        ifWebService.SynciFolderNow(d.DomainInfo.POBoxID);
       }
       catch {}
      }
     }
        }
        else
        {
     try
     {
      ifWebService.SynciFolderNow(domain.DomainInfo.POBoxID);
     }
     catch {}
        }
 }