コード例 #1
0
 private void CreateNewiFolder()
 {
     DomainInformation[] domains = domainController.GetDomains();
        if (domains.Length <= 0) return;
        string domainID = domains[0].ID;
        DomainInformation defaultDomain = domainController.GetDefaultDomain();
        if (defaultDomain != null)
     domainID = defaultDomain.ID;
        CreateDialog cd = new CreateDialog(this, domains, domainID, Util.LastCreatedPath, ifws);
        cd.TransientFor = this;
        int rc = 0;
        do
        {
     rc = cd.Run();
     cd.Hide();
     if (rc == (int)ResponseType.Ok)
     {
      try
      {
       string selectedFolder = cd.iFolderPath.Trim();
       string selectedDomain = cd.DomainID;
       if (selectedFolder == String.Empty)
       {
        iFolderMsgDialog dg = new iFolderMsgDialog(
     this,
     iFolderMsgDialog.DialogType.Warning,
     iFolderMsgDialog.ButtonSet.Ok,
     "",
     Util.GS("Invalid folder specified"),
     Util.GS("An invalid folder was specified."));
        dg.Run();
        dg.Hide();
        dg.Destroy();
        continue;
       }
       string parentDir = System.IO.Path.GetDirectoryName( selectedFolder );
       if ( ( parentDir == null ) || ( parentDir == String.Empty ) )
       {
        iFolderMsgDialog dg = new iFolderMsgDialog(
     this,
     iFolderMsgDialog.DialogType.Warning,
     iFolderMsgDialog.ButtonSet.Ok,
     "",
     Util.GS("Invalid folder specified"),
     Util.GS("An invalid folder was specified"));
        dg.Run();
        dg.Hide();
        dg.Destroy();
        continue;
       }
       string name = selectedFolder.Substring(parentDir.Length + 1);
       if (name == null || name == String.Empty)
       {
        iFolderMsgDialog dg = new iFolderMsgDialog(
     this,
     iFolderMsgDialog.DialogType.Warning,
     iFolderMsgDialog.ButtonSet.Ok,
     "",
     Util.GS("Invalid folder specified"),
     Util.GS("The folder you've specified is invalid.  Please remove the trailing separator character (/) and try again."));
        dg.Run();
        dg.Hide();
        dg.Destroy();
        continue;
       }
       selectedFolder = ParseAndReplaceTildeInPath(selectedFolder);
       iFolderHolder ifHolder = null;
       try
       {
        ifHolder =
     ifdata.CreateiFolder(selectedFolder,
       selectedDomain);
       }
       catch(Exception e)
       {
        if (DisplayCreateOrSetupException(e))
        {
     cd.iFolderPath = selectedFolder;
     continue;
        }
       }
       if(ifHolder == null)
        throw new Exception("Simias returned null");
       rc = 0;
       Util.LastCreatedPath = ifHolder.iFolder.UnManagedPath;
       if(ClientConfig.Get(ClientConfig.KEY_SHOW_CREATION,
       "true") == "true")
       {
        iFolderCreationDialog dlg =
     new iFolderCreationDialog(ifHolder.iFolder);
        dlg.TransientFor = this;
        int createRC;
        do
        {
     createRC = dlg.Run();
     if(createRC == (int)Gtk.ResponseType.Help)
     {
      Util.ShowHelp("myifolders.html", this);
     }
        }while(createRC != (int)Gtk.ResponseType.Ok);
        dlg.Hide();
        if(dlg.HideDialog)
        {
     ClientConfig.Set(
      ClientConfig.KEY_SHOW_CREATION, "false");
        }
        cd.Destroy();
        cd = null;
       }
      }
      catch (Exception e)
      {
       Console.WriteLine(e.Message);
       continue;
      }
     }
        }
        while(rc == (int)ResponseType.Ok);
 }
コード例 #2
0
 private void CreateNewiFolder()
 {
     DomainInformation[] domains = domainController.GetDomains();
        if (domains.Length <= 0) return;
        string domainID = domains[0].ID;
        DomainInformation defaultDomain = domainController.GetDefaultDomain();
        if (defaultDomain != null)
     domainID = defaultDomain.ID;
        CreateDialog cd = new CreateDialog(this, domains, domainID, Util.LastCreatedPath, ifws);
        cd.TransientFor = this;
        int rc = 0;
        do
        {
     rc = cd.Run();
     cd.Hide();
     if (rc == (int)ResponseType.Ok)
     {
      try
      {
       string selectedFolder = cd.iFolderPath.Trim();
       string selectedDomain = cd.DomainID;
       bool SSL = cd.ssl;
       string algorithm = cd.EncryptionAlgorithm;
       if (selectedFolder == String.Empty)
       {
        iFolderMsgDialog dg = new iFolderMsgDialog(
     this,
     iFolderMsgDialog.DialogType.Warning,
     iFolderMsgDialog.ButtonSet.Ok,
     "",
     Util.GS("Invalid folder specified"),
     Util.GS("An invalid folder was specified."));
        dg.Run();
        dg.Hide();
        dg.Destroy();
        continue;
       }
       string parentDir = System.IO.Path.GetDirectoryName( selectedFolder );
       if ( ( parentDir == null ) || ( parentDir == String.Empty ) )
       {
        iFolderMsgDialog dg = new iFolderMsgDialog(
     this,
     iFolderMsgDialog.DialogType.Warning,
     iFolderMsgDialog.ButtonSet.Ok,
     "",
     Util.GS("Invalid folder specified"),
     Util.GS("An invalid folder was specified"));
        dg.Run();
        dg.Hide();
        dg.Destroy();
        continue;
       }
       if(ifws.GetLimitPolicyStatus(selectedDomain) != 1 )
                                         {
                                                 iFolderMsgDialog dg = new iFolderMsgDialog(
                                                         this,
                                                         iFolderMsgDialog.DialogType.Warning,
                                                         iFolderMsgDialog.ButtonSet.Ok,
                                                         "",
                                                         Util.GS("Error"),
                                                         Util.GS("Folder could not be created as you are exceeding the limit of ifolders set by your Administrator."));
                                                 dg.Run();
                                                 dg.Hide();
                                                 dg.Destroy();
                                                 continue;
                                         }
       string name = selectedFolder.Substring(parentDir.Length + 1);
       if (name == null || name == String.Empty)
       {
        iFolderMsgDialog dg = new iFolderMsgDialog(
     this,
     iFolderMsgDialog.DialogType.Warning,
     iFolderMsgDialog.ButtonSet.Ok,
     "",
     Util.GS("Invalid folder specified"),
     Util.GS("The folder you've specified is invalid.  Please remove the trailing separator character (/) and try again."));
        dg.Run();
        dg.Hide();
        dg.Destroy();
        continue;
       }
       selectedFolder = ParseAndReplaceTildeInPath(selectedFolder);
       iFolderHolder ifHolder = null;
       try
       {
        if( algorithm != null)
        {
     bool passPhraseStatus = false;
     bool passphraseStatus = false;
     DomainInformation domainInfo = domainController.GetDomain(selectedDomain);
     if( !domainInfo.Authenticated)
     {
      DisplayLoginMesg();
      continue;
     }
     try
     {
                       passphraseStatus = simws.IsPassPhraseSet(selectedDomain);
     }
     catch(Exception)
     {
      DisplayLoginMesg();
      continue;
     }
     if(passphraseStatus == true)
     {
      string passphrasecheck = simws.GetPassPhrase(selectedDomain);
      if( passphrasecheck == null || passphrasecheck =="")
      {
       Debug.PrintLine(" passphrase not entered at login");
       passPhraseStatus = ShowVerifyDialog(selectedDomain, simws);
      }
      else
      {
       passPhraseStatus = true;
      }
     }
     else
     {
      passPhraseStatus = ShowEnterPassPhraseDialog(selectedDomain, simws);
     }
     if( passPhraseStatus == false)
     {
      continue;
     }
        }
        ifHolder = ifdata.CreateiFolder(selectedFolder, selectedDomain, SSL, algorithm);
       }
       catch(Exception e)
       {
        if (DisplayCreateOrSetupException(e))
        {
     cd.iFolderPath = selectedFolder;
     continue;
        }
       }
       if(ifHolder == null)
        throw new Exception("Simias returned null");
       rc = 0;
       Util.LastCreatedPath = ifHolder.iFolder.UnManagedPath;
       if((bool)ClientConfig.Get(ClientConfig.KEY_SHOW_CREATION))
       {
        iFolderCreationDialog dlg =
     new iFolderCreationDialog(ifHolder.iFolder);
        dlg.TransientFor = this;
        int createRC;
        do
        {
     createRC = dlg.Run();
     if(createRC == (int)Gtk.ResponseType.Help)
     {
      Util.ShowHelp("myifolders.html", this);
     }
        }while(createRC != (int)Gtk.ResponseType.Ok);
        dlg.Hide();
        if(dlg.HideDialog)
        {
     ClientConfig.Set(
      ClientConfig.KEY_SHOW_CREATION, false);
        }
        cd.Destroy();
        cd = null;
       }
      }
      catch (Exception e)
      {
       Debug.PrintLine(e.Message);
       continue;
      }
     }
        }
        while(rc == (int)ResponseType.Ok);
     UpdateServerInfoForSelectedDomain();
 }