コード例 #1
0
 protected virtual void OnItemConfliting(object sender, ItemConflictingEventArgs ev)
 {
     if (ItemConflicting != null)
     {
         ItemConflicting(sender, ev);
     }
 }
コード例 #2
0
ファイル: SyncApplication.cs プロジェクト: 0anion0/IBN
        protected virtual void OnItemConflicting(object sender, ItemConflictingEventArgs args)
        {
            EventHandler <ItemConflictingEventArgs> tmp = ItemConflicting;

            if (tmp != null)
            {
                tmp(this, args);
            }
        }
コード例 #3
0
 private static void ItemConflicting(object sender, ItemConflictingEventArgs e)
 {
     switch (e.DestinationChange.ChangeKind)
     {
     default:
         e.SetResolutionAction(ConflictResolutionAction.Merge);
         break;
     }
 }
コード例 #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);
        }
コード例 #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;
            }
        }
コード例 #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);
        }
コード例 #7
0
ファイル: SyncEngine.cs プロジェクト: fuzzysb/nsync
        /// <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);
        }
コード例 #8
0
ファイル: UIController.cs プロジェクト: 0anion0/IBN
        /// <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);
        }
コード例 #9
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);
 }
コード例 #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());
 }
コード例 #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);
 }
コード例 #12
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);
        }
コード例 #13
0
 private void OnFileSystemItemConflicting(object sender, ItemConflictingEventArgs ev)
 {
     throw new NotImplementedException();
 }
コード例 #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()));
 }
コード例 #15
0
ファイル: SyncManager.cs プロジェクト: nghiemhd/Libs
 // 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());
     }
 }
コード例 #16
0
ファイル: UIController.cs プロジェクト: 0anion0/IBN
        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;
        }
コード例 #17
0
ファイル: Preview.cs プロジェクト: fuzzysb/nsync
 /// <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);
 }
コード例 #18
0
 private static void Program_RemoteItemConflicting(object sender, ItemConflictingEventArgs e)
 {
     // display conflict type
     Console.WriteLine(e.SourceChange.ChangeKind.ToString());
 }
コード例 #19
0
ファイル: SyncApplication.cs プロジェクト: alex765022/IBN
 protected virtual void OnItemConflicting(object sender, ItemConflictingEventArgs args)
 {
     EventHandler<ItemConflictingEventArgs> tmp = ItemConflicting;
     if (tmp != null)
     {
         tmp(this, args);
     }
 }
コード例 #20
0
ファイル: MyProviderFactory.cs プロジェクト: alex765022/IBN
 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);
 }
コード例 #21
0
 private static void Program_ItemConflicting(object sender, ItemConflictingEventArgs e)
 {
 }
コード例 #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());
 }