Пример #1
0
        private void app_DocumentOpening(object sender, DocumentOpeningEventArgs e)
        {
//      try
//      {
//        var temp = new List<ModelPath>();
//
//        var modelPath = ModelPathUtils.ConvertUserVisiblePathToModelPath(@"RSN://" + e.PathName);


//        var trans = new TransmissionData(TransmissionData.ReadTransmissionData(modelPath));
//        foreach (var refId in trans.GetAllExternalFileReferenceIds())
//        {
//          var extRef = trans.GetLastSavedReferenceData(refId);
//
//          if (extRef.ExternalFileReferenceType == ExternalFileReferenceType.RevitLink)
//          {
//            var path = extRef.GetPath();
//            temp.Add(path);
//          }
//        }
            Globals.data = Path.GetFileNameWithoutExtension(e.PathName);

//      }
//        catch (Exception exception)
//      {
//        Console.WriteLine(exception);
//        throw;
//      }
        }
Пример #2
0
        private static void OnDocumentOpening(object source, DocumentOpeningEventArgs args)
        {
            if (args.DocumentType != DocumentType.Project)
            {
                return;
            }

            OpenTime["from"] = DateTime.UtcNow;
        }
        /// <summary>
        /// Assigns event handlers for DialogBoxShowing and FailuresProcessing if we're in debug mode
        /// journal playback
        /// </summary>
        private void ActivateSwallowers(object o, DocumentOpeningEventArgs e)
        {
            currDocName = Path.GetFileNameWithoutExtension(e.PathName);
            warningsNum = 0;
            popupsNum   = 0;

            // And we'll only want to add them if the journal is actually running in permissive mode
            if (!journalChecked && CheckJournalingMode())
            {
                dialogHandler               = new EventHandler <DialogBoxShowingEventArgs>(DismissAllDialogs);
                warningsHandler             = new EventHandler <FailuresProcessingEventArgs>(DismissAllWarnings);
                closingHandler              = new EventHandler <DocumentClosingEventArgs>(PopulateReport);
                uiCtrlApp.DialogBoxShowing += dialogHandler;
                uiCtrlApp.ControlledApplication.FailuresProcessing += warningsHandler;
                uiCtrlApp.ControlledApplication.DocumentClosing    += closingHandler;
                journalChecked = true;
            }
        }
Пример #4
0
        private static void OnDocumentOpening(object source, DocumentOpeningEventArgs args)
        {
            try
            {
                var pathName = args.PathName;
                if (string.IsNullOrEmpty(pathName) || args.DocumentType != DocumentType.Project)
                {
                    return;
                }

                var fileInfo    = BasicFileInfo.Extract(pathName);
                var centralPath = fileInfo.CentralPath;
                Log.Initialize("HOK_Tools", string.IsNullOrEmpty(centralPath) ? string.Empty : centralPath);
            }
            catch (Exception ex)
            {
                Log.AppendLog(LogMessageType.EXCEPTION, ex.Message);
            }
        }
Пример #5
0
        private void CollectConfigurationOnOpening(object source, DocumentOpeningEventArgs args)
        {
            try
            {
                string pathName = args.PathName;
                if (!string.IsNullOrEmpty(pathName) && args.DocumentType == DocumentType.Project)
                {
                    BasicFileInfo fileInfo = BasicFileInfo.Extract(pathName);
                    if (fileInfo.IsWorkshared)
                    {
                        if (!socketOn)
                        {
                            ConnectSocket();
                        }

                        string centralPath = fileInfo.CentralPath;
                        if (!string.IsNullOrEmpty(centralPath))
                        {
                            //serch for config
                            LogUtil.AppendLog(centralPath + " Opening.");
                            Configuration configFound = ServerUtil.GetConfigurationByCentralPath(centralPath);
                            if (null != configFound)
                            {
                                //check if the single session should be activated
                                if (SingleSessionMonitor.CancelOpening(centralPath, configFound))
                                {
                                    if (args.Cancellable)
                                    {
                                        SingleSessionWindow ssWindow = new SingleSessionWindow(centralPath);
                                        if ((bool)ssWindow.ShowDialog())
                                        {
                                            args.Cancel();
                                            return;
                                        }
                                    }
                                }

                                if (configDictionary.ContainsKey(centralPath))
                                {
                                    configDictionary.Remove(centralPath);
                                }
                                configDictionary.Add(centralPath, configFound);

                                Project projectFound = ServerUtil.GetProjectByConfigurationId(configFound._id);
                                if (null != projectFound)
                                {
                                    if (projectDictionary.ContainsKey(centralPath))
                                    {
                                        projectDictionary.Remove(centralPath);
                                    }
                                    projectDictionary.Add(centralPath, projectFound);
                                }

                                LogUtil.AppendLog("Configuration Found: " + configFound._id);
                            }
                            else
                            {
                                //not a seed file, just check if the single session is activated
                                if (SingleSessionMonitor.SingleSessionActivated)
                                {
                                    SingleSessionWindow ssWindow = new SingleSessionWindow(centralPath);
                                    if ((bool)ssWindow.ShowDialog())
                                    {
                                        args.Cancel();
                                        return;
                                    }
                                }
                            }
                        }
                    }
                }
            }
            catch (Exception ex)
            {
                string message = ex.Message;
                LogUtil.AppendLog("CollectConfigurationOnOpening:" + ex.Message);
            }
        }
Пример #6
0
 internal void OnOpening(object sender, DocumentOpeningEventArgs e)
 {
     running = true;
 }
 public static void OnOpening(object sender, DocumentOpeningEventArgs e)
 {
 }
Пример #8
0
 private void m_app_DocumentOpening(object sender, DocumentOpeningEventArgs e)
 {
     DisplayEvent("Document opening");
 }