コード例 #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 OnIconViewDragDataReceived(object o, DragDataReceivedArgs args)
 {
     bool bFolderCreated = false;
        switch (args.Info)
        {
     case (uint) DragTargetType.iFolderID:
      string ifolderID =
       System.Text.Encoding.UTF8.GetString(args.SelectionData.Data);
      iFolderHolder holder = ifdata.GetAvailableiFolder(ifolderID);
      if (holder != null)
       DownloadiFolder(holder, true);
      break;
     case (uint) DragTargetType.UriList:
      UriList uriList = new UriList(args.SelectionData);
      if (uriList.Count == 1)
      {
       string path = null;
       try
       {
        path = uriList.ToLocalPaths()[0];
       }
       catch
       {
        return;
       }
       DomainInformation[] domains = domainController.GetDomains();
       if (domains.Length <= 0) return;
       string domainID = domains[0].ID;
       DomainInformation defaultDomain = domainController.GetDefaultDomain();
       if (defaultDomain != null)
        domainID = defaultDomain.ID;
       DragCreateDialog cd = new DragCreateDialog(this, domains, domainID, path, 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;
      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;
      }
      iFolderHolder ifHolder = null;
      try
      {
       if( algorithm != null)
       {
        DomainInformation domainInfo = domainController.GetDomain(selectedDomain);
        if( !domainInfo.Authenticated)
        {
     DisplayLoginMesg();
     continue;
        }
        bool passPhraseStatus = false;
        bool passphraseStatus = false;
        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))
       {
        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);
      }
      break;
     default:
      break;
        }
        Gtk.Drag.Finish (args.Context, bFolderCreated, false, args.Time);
 }
コード例 #3
0
 private void OnIconViewDragDataReceived(object o, DragDataReceivedArgs args)
 {
     Console.WriteLine("OnIconViewDragDataReceived: {0}", (DragTargetType)args.Info);
        bool bFolderCreated = false;
        switch (args.Info)
        {
     case (uint) DragTargetType.iFolderID:
      string ifolderID =
       System.Text.Encoding.UTF8.GetString(args.SelectionData.Data);
      iFolderHolder holder = ifdata.GetAvailableiFolder(ifolderID);
      if (holder != null)
       DownloadiFolder(holder);
      break;
     case (uint) DragTargetType.UriList:
      UriList uriList = new UriList(args.SelectionData);
      if (uriList.Count == 1)
      {
       string path = uriList.ToLocalPaths()[0];
        DomainInformation[] domains = domainController.GetDomains();
        if (domains.Length <= 0) return;
        string domainID = domains[0].ID;
        DomainInformation defaultDomain = domainController.GetDefaultDomain();
        if (defaultDomain != null)
     domainID = defaultDomain.ID;
        DragCreateDialog cd = new DragCreateDialog(this, domains, domainID, path);
        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;
       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;
       }
       iFolderHolder ifHolder = null;
       try
       {
        ifHolder =
     ifdata.CreateiFolder(selectedFolder,
       selectedDomain);
       }
       catch(Exception e)
       {
        if (DisplayCreateOrSetupException(e))
        {
     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);
      }
      break;
     default:
      break;
        }
        Gtk.Drag.Finish (args.Context, bFolderCreated, false, args.Time);
 }
コード例 #4
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();
 }