Beispiel #1
0
        /// <summary>
        /// Handler for Document Synchronizing event.
        /// </summary>
        private static void OnDocumentSynchronizing(object source, DocumentSynchronizingWithCentralEventArgs args)
        {
            try
            {
                IsSynching = true; // disables DTM Tool
                FailureProcessor.IsSynchronizing = true;
                if (args.Document == null)
                {
                    return;
                }

                var doc         = args.Document;
                var centralPath = FileInfoUtil.GetCentralFilePath(doc);
                if (string.IsNullOrEmpty(centralPath))
                {
                    return;
                }

                SynchTime["from"] = DateTime.UtcNow;
            }
            catch (Exception ex)
            {
                Log.AppendLog(LogMessageType.EXCEPTION, ex.Message);
            }
        }
Beispiel #2
0
        private void OnDocumentSynchronizingWithCentral(object sender, DocumentSynchronizingWithCentralEventArgs e)
        {
            tempPath = Path.GetDirectoryName(BasicFileInfo.Extract(e.Document.PathName).CentralPath) + @"\tracker\";
            try{
                var path = tempPath + documentName + "_" + username;

                if (!File.Exists(path))
                {
                    var di = Directory.CreateDirectory(Path.GetDirectoryName(path));
                    di.Attributes = FileAttributes.Directory | FileAttributes.Hidden;
                }
                if (deletedList.Count > 0)
                {
                    using (var tw = new StreamWriter(path, true, System.Text.Encoding.GetEncoding(1251)))
                    {
                        deletedList.ForEach((item) =>
                        {
                            tw.WriteLine(item.ToString());
                        });
                    }
                }
                deletedList.Clear();
                addedList.Clear();
            }
            catch {
            }
        }
Beispiel #3
0
        private void EventSwcStart(object sender, DocumentSynchronizingWithCentralEventArgs e)
        {
            try
            {
                if (e.Document.IsFamilyDocument)
                {
                    return;
                }

                _syncSettings           = new EventSettings(e.Document);
                _syncSettings.SizeStart = _syncSettings.GetFileSize();
                _syncSettings.StartTime = DateTime.Now;

                if (string.IsNullOrEmpty(_syncSettings.DocCentralPath))
                {
                    return;
                }

                if (_syncSettingsDictionary.ContainsKey(_syncSettings.DocCentralPath))
                {
                    _syncSettingsDictionary.Remove(_syncSettings.DocCentralPath);
                }
                _syncSettingsDictionary.Add(_syncSettings.DocCentralPath, _syncSettings);
            }
            catch (Exception ex)
            {
                Log.AppendLog(LogMessageType.EXCEPTION, ex.Message);
            }
        }
        public static void OnDocumentSyncStart(object sender, DocumentSynchronizingWithCentralEventArgs args)
        {
            var syncOptions         = args.Options;
            var syncDocument        = args.Document;
            var syncCentralLocation = args.Location;

            // do stuff with the info you have
        }
Beispiel #5
0
        private static void OnDocumentSynchronizingWithCentral(object sender, DocumentSynchronizingWithCentralEventArgs e)
        {
            FailureProcessor.IsSynchronizing = true;

            var doc = e.Document;

            if (doc == null)
            {
                return;
            }

            try
            {
                SchemaUtils.SaveSchema(doc);
            }
            catch (Exception ex)
            {
                _logger.Fatal(ex);
            }
        }
 public void NotifyModelSyncing(object sender, DocumentSynchronizingWithCentralEventArgs args)
 {
     // send notification to db
 }
        public static void synch(object sender, DocumentSynchronizingWithCentralEventArgs args)
        {
            Document doc = args.Document;

            doc.CollectData();
        }
Beispiel #8
0
 private void m_app_DocumentSavingToCentral(object sender, DocumentSynchronizingWithCentralEventArgs e)
 {
     DisplayEvent("Document saving to central");
 }