/// <summary> /// Method to "check into" mission control. It posts all initial data, and stores all needed references. /// </summary> /// <param name="doc"></param> public void CheckIn(Document doc) { try { var centralPath = FileInfoUtil.GetCentralFilePath(doc); // (Konrad) We can publish a file path to the DB. // That will make it easier to create Configurations. // Valid file is: // - not detached // - not a family // - is workshared // - is saved on the network, revit server or bim 360 server if (!doc.IsDetached && !doc.IsFamilyDocument && doc.IsWorkshared && FilePathItem.IsValidFilePath(centralPath)) { if (!ServerUtilities.Post(new FilePathItem(centralPath, doc.Application.VersionNumber), "filepaths/add", out FilePathItem unused)) { Log.AppendLog(LogMessageType.ERROR, "Failed to publish File Path: " + centralPath); } } // (Konrad) Get Configuration/Project. if (!ServerUtilities.GetByCentralPath(centralPath, "configurations/centralpath", out Configuration configFound)) { DisableMissionControl(); return; } if (!ServerUtilities.Get("projects/configid/" + configFound.Id, out Project projectFound)) { DisableMissionControl(); return; } if (MissionControlSetup.Configurations.ContainsKey(centralPath)) { MissionControlSetup.Configurations.Remove(centralPath); } MissionControlSetup.Configurations.Add(centralPath, configFound); if (MissionControlSetup.Projects.ContainsKey(centralPath)) { MissionControlSetup.Projects.Remove(centralPath); } MissionControlSetup.Projects.Add(centralPath, projectFound); // (Konrad) This might be a good time to let users know that Mission Control is ready to go. AppCommand.CommunicatorHandler.Status = Status.Success; AppCommand.CommunicatorHandler.Message = "Successfully connected to Mission Control!"; AppCommand.CommunicatorHandler.Request.Make(RequestId.ReportStatus); AppCommand.CommunicatorEvent.Raise(); // (Konrad) Register Updaters that are in the config file. CommunicatorUtilities.LaunchCommunicator(); ApplyConfiguration(doc); #if RELEASE2015 || RELEASE2016 || RELEASE2017 // (Konrad) We are not going to process warnings here. #else CollectWarnings(doc); #endif EnableMissionControl(); Log.AppendLog(LogMessageType.INFO, "Mission Control check in succeeded."); } catch (Exception ex) { Log.AppendLog(LogMessageType.EXCEPTION, ex.Message); } }