Beispiel #1
0
        /// <summary>
        /// resolve the conflict in the path
        /// </summary>
        /// <param name="o"></param>
        /// <param name="args"></param>
        private void SaveHandler(object o, EventArgs args)
        {
            string path = null;

            if (EnableConflictBin.Active == true)
            {
                if (DirectoryPath.Text == String.Empty)
                {
                    iFolderMsgDialog dialog = new iFolderMsgDialog(
                        this,
                        iFolderMsgDialog.DialogType.Error,
                        iFolderMsgDialog.ButtonSet.Ok,
                        "",
                        Util.GS("Path field is Empty"),
                        Util.GS("Specify a valid path for the Conflict Bin"));
                    dialog.Run();
                    dialog.Hide();
                    dialog.Destroy();
                    return;
                }

                try
                {
                    if (!Directory.Exists(DirectoryPath.Text))
                    {
                        Directory.CreateDirectory(DirectoryPath.Text);
                    }
                }
                catch
                {
                    iFolderMsgDialog dialog = new iFolderMsgDialog(
                        this,
                        iFolderMsgDialog.DialogType.Error,
                        iFolderMsgDialog.ButtonSet.Ok,
                        "",
                        Util.GS("Invalid Conflict Bin Directory"),
                        Util.GS("Specify a valid path for the Conflict Bin"));
                    dialog.Run();
                    dialog.Hide();
                    dialog.Destroy();
                    return;
                }

                path = System.IO.Path.GetFullPath(DirectoryPath.Text);

                if (!path.EndsWith(Util.GS("/")))
                {
                    path = path + Util.GS("/");
                }
            }

            if (LocalVersion.Active == true)
            {
                ResolveSelectedConflicts(true, path);
            }
            else
            {
                ResolveSelectedConflicts(false, path);
            }
        }
 public bool ReSetPassphrase(string DomainID, string OldPassphrase, string NewPassphrase, string RAName, string RAPublicKey)
 {
     try
        {
     Status status = simws.ReSetPassPhrase (DomainID, OldPassphrase, NewPassphrase, RAName, RAPublicKey);
        if(status.statusCode != StatusCodes.Success)
        {
     return false;
        }
        else
     return true;
        }
        catch(Exception ex)
        {
                         iFolderMsgDialog dialog = new iFolderMsgDialog(
                                                                null,
                                                                iFolderMsgDialog.DialogType.Error,
                                                                iFolderMsgDialog.ButtonSet.None,
                                                                Util.GS("Unable to reset the passphrase"),
                                                                Util.GS(ex.Message),
                                                                Util.GS("Please try again"));
                         dialog.Run();
                         dialog.Hide();
                         dialog.Destroy();
                         dialog = null;
     return false;
        }
 }
 public void RemoveDomain(string domainID, bool deleteiFoldersOnServer)
 {
     try
        {
     simws.LeaveDomain(domainID, !deleteiFoldersOnServer);
        }
        catch(Exception e)
        {
     iFolderMsgDialog dg = new iFolderMsgDialog(
      null,
      iFolderMsgDialog.DialogType.Error,
      iFolderMsgDialog.ButtonSet.Ok,
      "",
      Util.GS("Unable to remove the account"),
      Util.GS("iFolder encountered a problem removing the account.  Please restart iFolder and try again."),
      e.Message);
     dg.Run();
     dg.Hide();
     dg.Destroy();
        }
 }
Beispiel #4
0
        ///<summary>
        /// Show password verify dialog
        ///</summary>
        ///<param name="DomainID">ID of the domain</param>
        ///<param name="simws">Reference to simias web service</param>
        ///<returns>Status else false</returns>
        private static bool ShowVerifyDialog(string DomainID, SimiasWebService simws)
        {
            bool   status = false;
            int    result;
            Status passPhraseStatus    = null;
            VerifyPassPhraseDialog vpd = new VerifyPassPhraseDialog();

            // vpd.TransientFor = this;
            try
            {
                do
                {
                    result = vpd.Run();
                    vpd.Hide();
                    // Verify PassPhrase..  If correct store passphrase and set a local property..
                    if (result == (int)ResponseType.Ok)
                    {
                        passPhraseStatus = simws.ValidatePassPhrase(DomainID, vpd.PassPhrase);
                    }
                    if (passPhraseStatus != null)
                    {
                        if (passPhraseStatus.statusCode == StatusCodes.PassPhraseInvalid)                  // check for invalid passphrase
                        {
                            // Display an error Message
                            Console.WriteLine("Invalid Passphrase");
                            iFolderMsgDialog dialog = new iFolderMsgDialog(
                                null,
                                iFolderMsgDialog.DialogType.Error,
                                iFolderMsgDialog.ButtonSet.None,
                                Util.GS("Invalid Passphrase"),
                                Util.GS("The Passphrase entered is invalid"),
                                Util.GS("Please re-enter the passphrase"));
                            dialog.Run();
                            dialog.Hide();
                            dialog.Destroy();
                            dialog           = null;
                            passPhraseStatus = null;
                        }
                        else if (passPhraseStatus.statusCode == StatusCodes.Success)
                        {
                            break;
                        }
                    }
                }while(result != (int)ResponseType.Cancel && result != (int)ResponseType.DeleteEvent);
                if (result == (int)ResponseType.Cancel || result == (int)ResponseType.DeleteEvent)
                {
                    try
                    {
                        simws.StorePassPhrase(DomainID, "", CredentialType.None, false);
                        status = false;
                    }
                    catch (Exception e)
                    {
                        return(false);
                    }
                }
                else if (passPhraseStatus != null && passPhraseStatus.statusCode == StatusCodes.Success)
                {
                    try
                    {
                        simws.StorePassPhrase(DomainID, vpd.PassPhrase, CredentialType.Basic, vpd.ShouldSavePassPhrase);
                        status = true;
                    }
                    catch (Exception ex)
                    {
                        return(false);
                    }
                }
            }
            catch (Exception e)
            {
                return(false);
            }
            return(status);
        }
Beispiel #5
0
        ///<summary>
        /// Display enter passphrase dialog
        ///</summary>
        ///<param name="DomainID">ID of the domain</param>
        ///<param name="simws">Reference to simias web service</param>
        ///<returns>Status else false</returns>
        private static bool ShowEnterPassPhraseDialog(string DomainID, SimiasWebService simws)
        {
            bool status = false;
            int  result;
            EnterPassPhraseDialog epd = new EnterPassPhraseDialog(DomainID, simws);

            try
            {
                do
                {
                    result = epd.Run();
                    epd.Hide();
                    if (result == (int)ResponseType.Cancel || result == (int)ResponseType.DeleteEvent)
                    {
                        break;
                    }
                    if (epd.PassPhrase != epd.RetypedPassPhrase)
                    {
                        Console.WriteLine("PassPhrases do not match");
                        // show an error message
                        iFolderMsgDialog dialog = new iFolderMsgDialog(
                            null,
                            iFolderMsgDialog.DialogType.Error,
                            iFolderMsgDialog.ButtonSet.None,
                            Util.GS("PassPhrase mismatch"),
                            Util.GS("The PassPhrase and retyped Passphrase are not same"),
                            Util.GS("Enter the passphrase again"));
                        dialog.Run();
                        dialog.Hide();
                        dialog.Destroy();
                        dialog = null;
                    }
                    else
                    {
                        break;
                    }
                }while(result != (int)ResponseType.Cancel);
                if (result == (int)ResponseType.Cancel || result == (int)ResponseType.DeleteEvent)
                {
                    status = false;
                    simws.StorePassPhrase(DomainID, "", CredentialType.None, false);
                }

                else if (epd.PassPhrase == epd.RetypedPassPhrase)
                {
                    // Check the recovery agent
                    string publicKey        = "";
                    Status passPhraseStatus = simws.SetPassPhrase(DomainID, epd.PassPhrase, epd.RecoveryAgent, publicKey);
                    if (passPhraseStatus.statusCode == StatusCodes.Success)
                    {
                        status = true;
                        simws.StorePassPhrase(DomainID, epd.PassPhrase, CredentialType.Basic, epd.ShouldSavePassPhrase);
                    }
                    else
                    {
                        // error setting the passphrase
                        status = false;
                        iFolderMsgDialog dialog = new iFolderMsgDialog(
                            null,
                            iFolderMsgDialog.DialogType.Error,
                            iFolderMsgDialog.ButtonSet.None,
                            Util.GS("Error setting the Passphrase"),
                            Util.GS("Unable to set the passphrase"),
                            Util.GS("Try again"));
                        dialog.Run();
                        dialog.Hide();
                        dialog.Destroy();
                        dialog = null;
                    }
                }
            }
            catch (Exception ex)
            {
                iFolderMsgDialog dialog = new iFolderMsgDialog(
                    null,
                    iFolderMsgDialog.DialogType.Error,
                    iFolderMsgDialog.ButtonSet.None,
                    Util.GS("Unable to set the passphrase"),
                    Util.GS(ex.Message),
                    Util.GS("Please enter the passphrase again"));
                dialog.Run();
                dialog.Hide();
                dialog.Destroy();
                dialog = null;
                return(false);
            }
            return(status);
        }
Beispiel #6
0
        private static void RemoveSelectedFolderHandler(string path)
        {
            iFolderMsgDialog dialog = new iFolderMsgDialog(
                null,
                iFolderMsgDialog.DialogType.Question,
                iFolderMsgDialog.ButtonSet.YesNo,
                "",
                Util.GS("Revert this iFolder back to a normal folder?"),
                Util.GS("The folder will still be on your computer, but it will no longer synchronize with the iFolder Server."));

            CheckButton deleteFromServerCB;

            iFolderWeb ifolder  = ifws.GetiFolderByLocalPath(path);
            bool       IsMaster = (ifolder.CurrentUserID == ifolder.OwnerID);

            if (IsMaster)
            {
                deleteFromServerCB = new CheckButton(Util.GS("Also _delete this iFolder from the server"));
            }
            else
            {
                deleteFromServerCB = new CheckButton(Util.GS("Also _remove my membership from this iFolder"));
            }

            deleteFromServerCB.Sensitive = simws.GetDomainInformation(ifolder.DomainID).Authenticated;
            dialog.ExtraWidget           = deleteFromServerCB;

            int rc = dialog.Run();

            dialog.Hide();
            dialog.Destroy();
            if (rc == -8)
            {
                try
                {
                    if (ifolder != null)
                    {
                        ifws.RevertiFolder(ifolder.ID);
                        if (deleteFromServerCB.Active)
                        {
                            if (IsMaster)
                            {
                                ifws.DeleteiFolder(ifolder.DomainID, ifolder.ID);
                            }
                            else
                            {
                                ifws.DeclineiFolderInvitation(ifolder.DomainID, ifolder.ID);
                            }
                        }
                    }
                }
                catch (Exception e)
                {
                    iFolderExceptionDialog ied =
                        new iFolderExceptionDialog(
                            null,
                            e);
                    ied.Run();
                    ied.Hide();
                    ied.Destroy();
                }
            }
        }