Ejemplo n.º 1
0
 protected virtual void OnItemConfliting(object sender, ItemConflictingEventArgs ev)
 {
     if (ItemConflicting != null)
     {
         ItemConflicting(sender, ev);
     }
 }
Ejemplo n.º 2
0
        protected virtual void OnItemConflicting(object sender, ItemConflictingEventArgs args)
        {
            EventHandler <ItemConflictingEventArgs> tmp = ItemConflicting;

            if (tmp != null)
            {
                tmp(this, args);
            }
        }
Ejemplo n.º 3
0
 private static void ItemConflicting(object sender, ItemConflictingEventArgs e)
 {
     switch (e.DestinationChange.ChangeKind)
     {
     default:
         e.SetResolutionAction(ConflictResolutionAction.Merge);
         break;
     }
 }
Ejemplo n.º 4
0
        private ConflictResolutionAction GetConflictResolutionAction(ItemConflictingEventArgs args)
        {
            ConflictResolutionAction retVal = ConflictResolutionAction.SkipChange;

            if (_syncConflictResForm != null)
            {
                _syncConflictResForm.CurrentConflicting = args;

                Func <IWin32Window, DialogResult> functor = _syncConflictResForm.ShowDialog;
                DialogResult result = (DialogResult)_syncConflictResForm.Invoke(functor, _syncItemForm);
                if (result != DialogResult.Cancel)
                {
                    retVal = _syncConflictResForm.SelectedAction;
                }
            }
            return(retVal);
        }
Ejemplo n.º 5
0
        private void LocalItemConflicting(object sender, ItemConflictingEventArgs e)
        {
            switch (e.DestinationChange.ChangeKind)
            {
            case ChangeKind.Deleted:
                e.SetResolutionAction(ConflictResolutionAction.SourceWins);
                break;

            case ChangeKind.UnknownItem:
                e.SetResolutionAction(ConflictResolutionAction.SourceWins);
                break;

            case ChangeKind.Update:
                e.SetResolutionAction(ConflictResolutionAction.Merge);
                break;
            }
        }
Ejemplo n.º 6
0
        /// <summary>
        /// Called when [sync item conflicting].
        /// </summary>
        /// <param name="sender">The sender.</param>
        /// <param name="e">The <see cref="Microsoft.Synchronization.ItemConflictingEventArgs"/> instance containing the event data.</param>
        protected virtual void OnSyncItemConflicting(object sender, ItemConflictingEventArgs e)
        {
            if (_syncApp.CurrentProcessedSyncType == null)
            {
                throw new NullReferenceException("CurrentProcessedSyncType");
            }

            string debugStr = string.Format("Item conflict detected: source data - {0}, destination data - {1}",
                                            e.SourceChangeData != null ? e.SourceChangeData.ToString() : "unknow",
                                            e.DestinationChangeData != null ? e.DestinationChangeData.ToString() : "unknow");

            DebugAssistant.Log(debugStr);

            ConflictResolutionAction resolution = GetConflictResolutionAction(e);

            e.SetResolutionAction(resolution);
        }
Ejemplo n.º 7
0
        /// <summary>
        /// This method is called when there are conflicting items during synchronization
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="args"></param>
        private void OnItemConflicting(object sender, ItemConflictingEventArgs args)
        {
            IFileDataRetriever localfileDataRetriever;
            IFileDataRetriever remotefileDataRetriever;

            try
            {
                localfileDataRetriever  = ((IFileDataRetriever)args.SourceChangeData);
                remotefileDataRetriever = ((IFileDataRetriever)args.DestinationChangeData);
            }
            catch (Exception e)
            {
                if (e.Message.ToString().Contains(nsync.Properties.Resources.excludingFileTypesException))
                {
                    return;
                }
                else
                {
                    throw;
                }
            }

            localfileDataRetriever  = ((IFileDataRetriever)args.SourceChangeData);
            remotefileDataRetriever = ((IFileDataRetriever)args.DestinationChangeData);

            // Handling for renaming conflicts
            if (localfileDataRetriever.FileData.RelativePath != remotefileDataRetriever.FileData.RelativePath)
            {
                if (!errorMessageForSummaryReport.Contains(localfileDataRetriever.AbsoluteSourceFilePath) && !errorMessageForSummaryReport.Contains(remotefileDataRetriever.AbsoluteSourceFilePath))
                {
                    errorMessageForSummaryReport.Add(localfileDataRetriever.AbsoluteSourceFilePath);
                    errorMessageForSummaryReport.Add(remotefileDataRetriever.AbsoluteSourceFilePath);
                }
            }

            // Setting latest change wins policy
            args.SetResolutionAction(ConflictResolutionAction.Merge);
        }
Ejemplo n.º 8
0
        /// <summary>
        /// Called when [sync item conflicting].
        /// </summary>
        /// <param name="sender">The sender.</param>
        /// <param name="e">The <see cref="Microsoft.Synchronization.ItemConflictingEventArgs"/> instance containing the event data.</param>
        protected virtual void OnSyncItemConflicting(object sender, ItemConflictingEventArgs e)
        {
            if (_syncApp.CurrentProcessedSyncType == null)
            {
                throw new NullReferenceException("CurrentProcessedSyncType");
            }

            string debugStr = string.Format("Item conflict detected: source data - {0}, destination data - {1}",
                                            e.SourceChangeData != null ? e.SourceChangeData.ToString() : "unknow",
                                            e.DestinationChangeData != null ? e.DestinationChangeData.ToString() : "unknow");
            DebugAssistant.Log(debugStr);

            ConflictResolutionAction resolution = GetConflictResolutionAction(e);
            e.SetResolutionAction(resolution);
        }
 /// <summary>
 /// This method is called when there are conflicting items during synchronization
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="args"></param>
 private static void OnItemConflicting(object sender, ItemConflictingEventArgs args)
 {
     // Currently, latest change wins
     args.SetResolutionAction(ConflictResolutionAction.Merge);
 }
Ejemplo n.º 10
0
 private static void OnItemConflicting(object sender, ItemConflictingEventArgs args)
 {
     args.SetResolutionAction(ConflictResolutionAction.Merge);
     Console.WriteLine("Concurrency conflict detected form item {0}", args.DestinationChange.ItemId.ToString());
 }
Ejemplo n.º 11
0
 static void DestinationCallbacks_ItemConflicting(object sender, ItemConflictingEventArgs e)
 {
     Console.Write("Event Item conflicting: source data - {0}, ", e.SourceChangeData != null ? e.SourceChangeData.ToString() : null);
     Console.WriteLine("destination data - {0}", e.DestinationChangeData != null ? e.DestinationChangeData.ToString() : null);
     e.SetResolutionAction(ConflictResolutionAction.Merge);
 }
        /// <summary>
        /// This method is called when there are conflicting items during synchronization
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="args"></param>
        private void OnItemConflicting(object sender, ItemConflictingEventArgs args)
        {
            IFileDataRetriever localfileDataRetriever;
            IFileDataRetriever remotefileDataRetriever;

            try
            {
                localfileDataRetriever = ((IFileDataRetriever)args.SourceChangeData);
                remotefileDataRetriever = ((IFileDataRetriever)args.DestinationChangeData);
            }
            catch (Exception e)
            {
                if (e.Message.ToString().Contains(nsync.Properties.Resources.excludingFileTypesException))
                    return;
                else
                    throw;
            }

            localfileDataRetriever = ((IFileDataRetriever)args.SourceChangeData);
            remotefileDataRetriever = ((IFileDataRetriever)args.DestinationChangeData);

            // Handling for renaming conflicts
            if(localfileDataRetriever.FileData.RelativePath != remotefileDataRetriever.FileData.RelativePath)
            {
                if (!errorMessageForSummaryReport.Contains(localfileDataRetriever.AbsoluteSourceFilePath) && !errorMessageForSummaryReport.Contains(remotefileDataRetriever.AbsoluteSourceFilePath))
                {
                    errorMessageForSummaryReport.Add(localfileDataRetriever.AbsoluteSourceFilePath);
                    errorMessageForSummaryReport.Add(remotefileDataRetriever.AbsoluteSourceFilePath);
                }
            }

            // Setting latest change wins policy
            args.SetResolutionAction(ConflictResolutionAction.Merge);
        }
Ejemplo n.º 13
0
 private void OnFileSystemItemConflicting(object sender, ItemConflictingEventArgs ev)
 {
     throw new NotImplementedException();
 }
Ejemplo n.º 14
0
 private void OnDbItemConflicting(object sender, ItemConflictingEventArgs ev)
 {
     FotoShoutUtils.Log.LogManager.Error(_logger, string.Format("Item conflict: {0}, {1}, {2}, {3}.", ev.SourceChange.ToString(), ev.SourceChangeData.ToString(), ev.DestinationChange.ToString(), ev.DestinationChangeData.ToString()));
 }
Ejemplo n.º 15
0
 // By default, conflicts are resolved in favor of the last writer. In this example,
 // the change from the source in the first session (replica 1), will always
 // win the conflict.
 private void OnItemConflicting(object sender, ItemConflictingEventArgs args)
 {
     args.SetResolutionAction(ConflictResolutionAction.SourceWins);
     //Console.WriteLine("-- Concurrency conflict detected for item " + args.DestinationChange.ItemId.ToString());
     if (logger != null)
     {
         logger.Info("-- Concurrency conflict detected for item " + args.DestinationChange.ItemId.ToString());
     }
 }
Ejemplo n.º 16
0
        private ConflictResolutionAction GetConflictResolutionAction(ItemConflictingEventArgs args)
        {
            ConflictResolutionAction retVal = ConflictResolutionAction.SkipChange;
            if (_syncConflictResForm != null)
            {
                _syncConflictResForm.CurrentConflicting = args;

                Func<IWin32Window, DialogResult> functor = _syncConflictResForm.ShowDialog;
                DialogResult result = (DialogResult)_syncConflictResForm.Invoke(functor, _syncItemForm);
                if (result != DialogResult.Cancel)
                {
                    retVal = _syncConflictResForm.SelectedAction;
                }

            }
            return retVal;
        }
Ejemplo n.º 17
0
 /// <summary>
 /// This method is called when there are conflicting items during synchronization
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="args"></param>
 private static void OnItemConflicting(object sender, ItemConflictingEventArgs args)
 {
     // Currently, latest change wins
     args.SetResolutionAction(ConflictResolutionAction.Merge);
 }
 private static void Program_RemoteItemConflicting(object sender, ItemConflictingEventArgs e)
 {
     // display conflict type
     Console.WriteLine(e.SourceChange.ChangeKind.ToString());
 }
Ejemplo n.º 19
0
 protected virtual void OnItemConflicting(object sender, ItemConflictingEventArgs args)
 {
     EventHandler<ItemConflictingEventArgs> tmp = ItemConflicting;
     if (tmp != null)
     {
         tmp(this, args);
     }
 }
Ejemplo n.º 20
0
 static void DestinationCallbacks_ItemConflicting(object sender, ItemConflictingEventArgs e)
 {
     Console.Write("Event Item conflicting: source data - {0}, ", e.SourceChangeData != null ? e.SourceChangeData.ToString() : null);
     Console.WriteLine("destination data - {0}", e.DestinationChangeData != null ? e.DestinationChangeData.ToString() : null);
     e.SetResolutionAction(ConflictResolutionAction.Merge);
 }
Ejemplo n.º 21
0
 private static void Program_ItemConflicting(object sender, ItemConflictingEventArgs e)
 {
 }
Ejemplo n.º 22
0
 static void destCallbacks_ItemConflicting(object sender, ItemConflictingEventArgs e)
 {
     e.SetResolutionAction(ConflictResolutionAction.SourceWins);
     Console.WriteLine("-- Concurrency conflict detected for item " + e.DestinationChange.ItemId.ToString());
 }