Exemplo n.º 1
0
        private void EventCommandStart(object sender, BeforeExecutedEventArgs e)
        {
            try
            {
                var uiapp     = (UIApplication)sender;
                var activeDoc = uiapp.ActiveUIDocument.Document;

                if (activeDoc.IsFamilyDocument)
                {
                    return;
                }
                _purgeSettings           = new EventSettings(activeDoc);
                _purgeSettings.SizeStart = _purgeSettings.GetFileSize();
                _purgeSettings.StartTime = DateTime.Now;
                _purgeStarted            = true;

                if (string.IsNullOrEmpty(_purgeSettings.DocCentralPath))
                {
                    return;
                }
                if (_purgeSettingsDictionary.ContainsKey(_purgeSettings.DocCentralPath))
                {
                    _purgeSettingsDictionary.Remove(_purgeSettings.DocCentralPath);
                }
                _purgeSettingsDictionary.Add(_purgeSettings.DocCentralPath, _purgeSettings);
            }
            catch (Exception ex)
            {
                Log.AppendLog(LogMessageType.EXCEPTION, ex.Message);
            }
        }
Exemplo n.º 2
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);
            }
        }
Exemplo n.º 3
0
        private void EventDocOpen(object sender, DocumentOpenedEventArgs e)
        {
            try
            {
                if (e.Document.IsFamilyDocument)
                {
                    return;
                }

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

                if (_openSettings.OpenDetached)
                {
                    _openSettings.SizeEnd = _openSettings.SizeStart;
                    _openSettings.EndTime = DateTime.Now;
                    WriteRecord(_openSettings, "OPEN-DETACHED");
                }
                else if (!string.IsNullOrEmpty(_openSettings.DocCentralPath))
                {
                    if (_openSettingsDictionary.ContainsKey(_openSettings.DocCentralPath))
                    {
                        _openSettingsDictionary.Remove(_openSettings.DocCentralPath);
                    }
                    _openSettingsDictionary.Add(_openSettings.DocCentralPath, _openSettings);
                }

                if (!_openSettings.IsRecordable)
                {
                    //warning message
                }
            }
            catch (Exception ex)
            {
                Log.AppendLog(LogMessageType.EXCEPTION, ex.Message);
            }
        }