示例#1
0
        /// <summary>
        /// To handle if the selection is changed in conflict tree display
        /// </summary>
        /// <param name="o"></param>
        /// <param name="args"></param>
        private void OnEnhancedConflictSelectionChanged(object o, EventArgs args)
        {
            bool bHasFileConflict = false;

            OnConflictSelectionChanged(o, args);

            TreeSelection tSelect      = ConflictTreeView.Selection;
            int           selectedRows = tSelect.CountSelectedRows();

            if (selectedRows > 0)
            {
                EnableEnhancedConflictControls();
                TreeModel      tModel;
                ConflictHolder ch = null;

                Array treePaths = tSelect.GetSelectedRows(out tModel);

                foreach (TreePath tPath in treePaths)
                {
                    TreeIter iter;
                    if (ConflictTreeStore.GetIter(out iter, tPath))
                    {
                        ch = (ConflictHolder)tModel.GetValue(iter, 0);
                        if (!ch.IsNameConflict)
                        {
                            bHasFileConflict = true;
                        }
                    }
                }

                if (selectedRows == 1)
                {
                    if (bHasFileConflict)
                    {
                        EnableEnhancedConflictControls();
                    }
                    else
                    {
                        ActionFrame.Sensitive = false;
                    }
                }
                else
                {
                    // We're dealing with multiple selections here
                    if (bHasFileConflict)
                    {
                        EnableEnhancedConflictControls();
                    }
                    else
                    {
                        ActionFrame.Sensitive = false;
                    }
                }
            }
        }
示例#2
0
        /// <summary>
        /// Gets the selected Items and resolves the conflict based on whether local wins or server wins
        /// </summary>
        /// <param name="localChangesWin">who has higher priority</param>
        /// <param name="conflictBinPath">path of the conflict bin </param>
        private void ResolveSelectedConflicts(bool localChangesWin, string conflictBinPath)
        {
            TreeModel tModel;

            Queue iterQueue = GetSelectedItemsInQueue(out tModel);

            if (iterQueue.Count > 0)
            {
                // Now that we have all of the TreeIters, loop and
                // remove them all
                while (iterQueue.Count > 0)
                {
                    TreeIter iter = (TreeIter)iterQueue.Dequeue();

                    ConflictHolder ch = (ConflictHolder)tModel.GetValue(iter, 0);
                    if (!ch.IsNameConflict)
                    {
                        try
                        {
                            if (null != conflictBinPath)
                            {
                                ifws.ResolveEnhancedFileConflict(
                                    ch.FileConflict.iFolderID,
                                    ch.FileConflict.ConflictID,
                                    localChangesWin,
                                    conflictBinPath);
                            }
                            else
                            {
                                ifws.ResolveEnhancedFileConflict(
                                    ch.FileConflict.iFolderID,
                                    ch.FileConflict.ConflictID,
                                    localChangesWin,
                                    string.Empty);
                            }

                            ConflictTreeStore.Remove(ref iter);
                        }
                        catch
                        {}
                    }
                }
                UpdateFields(null, false);
                EnableEnhancedConflictControls();
            }
        }