Beispiel #1
0
        public void Save()
        {
            Configuration config = m_conflictRuleViewModel.AppViewModel.Config;

            if ((bool)updateConfigRadioButton.IsChecked)
            {
                // save config
                config.UniqueId = Guid.NewGuid().ToString();
                SessionGroupConfigurationManager saver = new SessionGroupConfigurationManager(config);
                int configId = saver.TrySave();

                // set rule
                m_conflictRuleViewModel.SelectedResolutionAction = m_conflictRuleViewModel.ResolutionActions.First(x => x.ReferenceName.Equals(new WITUnmappedWITConflictUpdateWITMappingAction().ReferenceName));
                ObservableDataField updatedConfigIdDataField = m_conflictRuleViewModel.ObservableDataFields.First(x => string.Equals(x.FieldName, Constants.DATAKEY_UPDATED_CONFIGURATION_ID));
                updatedConfigIdDataField.FieldValue = configId.ToString();
                ObservableDataField mapToDataField = m_conflictRuleViewModel.ObservableDataFields.First(x => string.Equals(x.FieldName, WITUnmappedWITConflictUpdateWITMappingAction.DATAKEY_MAP_TO));
                mapToDataField.FieldValue = newWorkItemTypeTextBox.Text;
            }
            else if ((bool)newValueRadioButton.IsChecked)
            {
                // undo config changes
                m_customSettings.SerializedContent = m_oldCustomSettings;
                m_customSettings.Save();

                // select resolution action
                m_conflictRuleViewModel.SelectedResolutionAction = m_conflictRuleViewModel.ResolutionActions.First(x => x.ReferenceName.Equals(new WITUnmappedWITConflictExcludeWITInSessionFilter().ReferenceName));

                // update config
                m_filterItem.FilterString = newValueTextBox.Text;

                // save config
                config.UniqueId = Guid.NewGuid().ToString();
                SessionGroupConfigurationManager saver = new SessionGroupConfigurationManager(config);
                int configId = saver.TrySave();

                // set data fields
                ObservableDataField updatedConfigIdDataField = m_conflictRuleViewModel.ObservableDataFields.First(x => string.Equals(x.FieldName, Constants.DATAKEY_UPDATED_CONFIGURATION_ID));
                updatedConfigIdDataField.FieldValue = configId.ToString();
            }
            else if ((bool)retryRadioButton.IsChecked)
            {
                // undo config changes
                m_customSettings.SerializedContent = m_oldCustomSettings;
                m_customSettings.Save();

                // select resolution action
                m_conflictRuleViewModel.SelectedResolutionAction = m_conflictRuleViewModel.ResolutionActions.First(x => x.ReferenceName.Equals(new ManualConflictResolutionAction().ReferenceName));
            }

            m_conflictRuleViewModel.AppViewModel.ShellViewModel.RefreshConfigViewModel();
        }
Beispiel #2
0
 protected void UndoXmlChanges()
 {
     // undo config changes
     m_customSettings.SerializedContent = m_cachedCustomSettings;
     m_customSettings.Save();
 }