コード例 #1
0
ファイル: iFolderComponent.cs プロジェクト: lulzzz/ifolder
        /// <summary>
        /// Checks if the specified path is an iFolder.
        /// </summary>
        /// <param name="path">The path to test.</param>
        /// <param name="hasConflicts">This parameter returns <b>true</b> if the path is an iFolder and the iFolder contains conflicts.</param>
        /// <returns>This method returns <b>true</b> if the specified path is an iFolder; otherwise <b>false</b>.</returns>
        public bool IsiFolder([MarshalAs(UnmanagedType.LPWStr)] string path, out bool hasConflicts)
        {
            iFolderWeb ifolder = null;

            hasConflicts = false;
            try
            {
                connectToWebService();
                if (ifWebService != null)
                {
                    ifolder = ifWebService.GetiFolderByLocalPath(path);
                    if (ifolder != null)
                    {
                        hasConflicts = ifolder.HasConflicts;
                    }
                }
            }
            catch (WebException e)
            {
                ifWebService = null;
                if (e.Status == WebExceptionStatus.ProtocolError)
                {
                    LocalService.ClearCredentials();
                }
            }
            catch (Exception e)
            {
                System.Diagnostics.Debug.WriteLine("Caught exception - " + e.Message);
            }

            return(ifolder != null);
        }
コード例 #2
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();
                }
            }
        }