コード例 #1
0
        private void PrevalueSource_Deleted(object sender, FieldPreValueSourceEventArgs e)
        {
            if (uSync8BackOffice.eventsPaused || e.FieldPreValueSource == null)
            {
                return;
            }

            var filename = GetPath(Path.Combine(rootFolder, this.DefaultFolder), (FieldPreValueSource)e.FieldPreValueSource, DefaultConfig.GuidNames, DefaultConfig.UseFlatStructure);

            var attempt = serializer.SerializeEmpty((FieldPreValueSource)e.FieldPreValueSource, SyncActionType.Delete, string.Empty);

            if (attempt.Success)
            {
                syncFileService.SaveXElement(attempt.Item, filename);
                this.CleanUp((FieldPreValueSource)e.FieldPreValueSource, filename, Path.Combine(rootFolder, DefaultFolder));
            }
        }
コード例 #2
0
        private void PrevalueSource_Saved(object sender, FieldPreValueSourceEventArgs e)
        {
            if (uSync8BackOffice.eventsPaused)
            {
                return;
            }

            try
            {
                var attempts = this.Export((FieldPreValueSource)e.FieldPreValueSource,
                                           Path.Combine(rootFolder, this.DefaultFolder), this.DefaultConfig);

                foreach (var attempt in attempts.Where(x => x.Success))
                {
                    this.CleanUp((FieldPreValueSource)e.FieldPreValueSource, attempt.FileName, Path.Combine(rootFolder, this.DefaultFolder));
                }
            }
            catch (Exception ex)
            {
                logger.Warn <PreValueHandler>(ex, "uSync Save error");
            }
        }