示例#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();
            }
        }
示例#3
0
        /// <summary>
        /// Gets the current conflict holder
        /// </summary>
        /// <returns>conflict holder</returns>
        private ConflictHolder GetCurrentConflictHolder()
        {
            TreeModel tModel;
            Queue     iterQueue = GetSelectedItemsInQueue(out tModel);

            if (iterQueue.Count == 1)
            {
                TreeIter iter = (TreeIter)iterQueue.Dequeue();

                ConflictHolder ch = (ConflictHolder)tModel.GetValue(iter, 0);
                if (!ch.IsNameConflict)
                {
                    return(ch);
                }
            }
            return(null);
        }
示例#4
0
        /// <summary>
        /// Open the server file conflict holder
        /// </summary>
        /// <param name="o"></param>
        /// <param name="args"></param>
        private void ServerOpenHandler(object o, EventArgs args)
        {
            ConflictHolder ch = GetCurrentConflictHolder();

            if (ch != null)
            {
                try
                {
                    string ServerFullPath = ch.FileConflict.ServerFullPath;
                    int    i = ServerFullPath.IndexOf(' ');
                    if (i != -1)
                    {
                        string[] words = ServerFullPath.Split(' ');
                        ServerFullPath = string.Join("\\ ", words);
                    }
                    System.Diagnostics.Process.Start(ServerFullPath);
                }
                catch (Exception oe)
                {
                    Console.WriteLine("File open error: {0}", oe.Message);
                }
            }
        }