예제 #1
0
        private void Button_TakeLeft_Click(object sender, RoutedEventArgs e)
        {
            try
            {
                var note = _repo.FindNoteByID(_noteID);
                if (note == null)
                {
                    LoggerSingleton.Inst.Warn("ConflictWindow", "Note not found", $"Could not update note {_noteID}, because it no longer exists in the repository");
                    Close();
                    return;
                }

                if (note.Text != _dataLeft.Item1)
                {
                    note.Text = _dataLeft.Item1;
                }
                if (note.Title != _dataLeft.Item2)
                {
                    note.Title = _dataLeft.Item2;
                }
                if (!note.Tags.UnorderedCollectionEquals(_dataLeft.Item3))
                {
                    note.Tags.Synchronize(_dataLeft.Item3);
                }
                if (note.Path != _dataLeft.Item4)
                {
                    note.Path = _dataLeft.Item4;
                }

                note.SetRemoteDirty("Data updated in ConflictWindow [TakeLeft]");
                _repo.SyncNow();

                Close();
            }
            catch (Exception ex)
            {
                LoggerSingleton.Inst.Error("ConflictWindow", "Error in conflict resolution", ex);
            }
        }