コード例 #1
0
 public IdeaCCM(IntegrationBase integrationBase)
 {
     this._integrationBase = integrationBase;
     _integrationBase.EventHandlerCore.ObjectSelected += EventHandlerCore_ObjectSelected;
     // TODO missing _integrationBase.EventHandlerCore.ObjectSelected += EventHandlerCore_ObjectSelected in destructor
     _selectedObjects = new List <DtObject>();
 }
コード例 #2
0
        public bool LoadContent(IntegrationBase intBase)
        {
            IntBase = intBase;
            if (intBase.CurrentProject == null || intBase.CurrentProject.Id == Guid.Empty)
            {
                return(false);
            }
            List <DtoDivision> divisions = intBase.ApiCore.Divisions.GetProjectDivisions(intBase.CurrentProject.Id);

            // Test
            //List<DtoDivision> toDelete = divisions.Where(d => d.Name.Contains("create new Division")).ToList();

            //for (int i = 0; i < toDelete.Count; i++)
            //{
            //    bool deleted = intBase.ApiCore.Divisions.DeleteDtoDivision(toDelete[i].Id);
            //}

            foreach (DtoDivision division in divisions)
            {
                ViewDivs.Add(division);
            }

            DtoDivision newDivision = new DtoDivision {
                Name = "<create new Division>"
            };

            ViewDivs.Add(newDivision);

            ModelView.SelectedItem = newDivision;

            return(true);
        }
コード例 #3
0
        public static string GetDivisonNames(DtoProject project, IntegrationBase integrationBase)
        {
            string result = "";

            List <DtoDivision> divisionList = integrationBase.ApiCore.Projects.GetDivisions(project.Id);

            if (divisionList != null && divisionList.Count > 0)
            {
                StringBuilder sb = new StringBuilder();
                for (int i = 0; i < divisionList.Count; i++)
                {
                    DtoDivision division = divisionList[i];
                    sb.Append(division.Name);
                    if (sb.Length > 0 && i < divisionList.Count - 1)
                    {
                        sb.Append("\r\n");
                    }

                    if (divisionList.Count > 6 && i == 5)
                    {
                        sb.Append("...");
                        break;
                    }
                }

                result = sb.ToString();
            }

            return(result);
        }
コード例 #4
0
        /// <summary>
        /// Get a dictionary of all DtoAttributeTopologies.
        /// </summary>
        /// <param name="integrationBase"></param>
        /// <param name="tenant"></param>
        /// <returns></returns>
        public static Dictionary <Guid, DtoAttributeTopology> ReadAttributeTopology(IntegrationBase integrationBase, bool tenant = false)
        {
            DtoAttributeTopology topology = integrationBase.ApiCore.GetAttributes(tenant);

            Dictionary <Guid, DtoAttributeTopology> dictionary = new Dictionary <Guid, DtoAttributeTopology>();

            WalkToTree(topology, ref dictionary);

            return(dictionary);
        }
コード例 #5
0
        /// <summary>
        /// Load controls.
        /// </summary>
        /// <param name="integrationBase"></param>
        /// <param name="parent"></param>
        public void LoadContent(IntegrationBase integrationBase)
        {
            _traceCodeTime   = new TraceCodeTime("LoadContent", "IssueContentControl");
            _integrationBase = integrationBase;

            _integrationBase.EventHandlerCore.IssueViewSelected += EventHandlerCore_IssueViewSelected;
            _integrationBase.EventHandlerCore.ProjectChanged    += EventHandlerCore_ProjectChanged;

            _listControl      = new IssueListControl(integrationBase);
            IssueList.Content = _listControl;

            _detailsControl = new IssueDetailsControl(integrationBase);
            _detailsControl.LoadCompleted += _detailsControl_LoadCompleted;
            IssueDetails.Content           = _detailsControl;
        }
コード例 #6
0
        public void LoadContent(IntegrationBase integrationBase, WPFWindows.Window parent)
        {
            _integrationBase = integrationBase;
            _integrationBase.EventHandlerCore.DataLoaded += EventHandlerCore_DataLoaded;
            _parentWindow = parent;

            _webViewer = new WebViewer(integrationBase);
            NavigateToControl();

            _model = GetConnectionsModel(false);

            if (_model != null)
            {
                DeleteModelAndObject.IsEnabled = true;
                if (_savedDtoConnectionsId != null && _savedDtoConnectionsId != Guid.Empty)
                {
                    DeleteConnection.IsEnabled = true;
                    CreateConnection.IsEnabled = false;
                }
            }

            BimExplorer.Content = _webViewer;
        }
コード例 #7
0
        /// <summary>
        /// Load start properties and controls.
        /// </summary>
        /// <param name="integrationBase"></param>
        /// <param name="parent"></param>
        public void LoadContent(IntegrationBase integrationBase)
        {
            _integrationBase = integrationBase;

            _integrationBase.EventHandlerCore.IssueViewSelected += EventHandlerCore_IssueViewSelected;
            _integrationBase.EventHandlerCore.IssueSelected     += EventHandlerCore_IssueSelected;
            _integrationBase.EventHandlerCore.ObjectSelected    += EventHandlerCore_ObjectSelected;
            _integrationBase.EventHandlerCore.ProjectChanged    += EventHandlerCore_ProjectChanged;
            _integrationBase.EventHandlerCore.DataLoaded        += EventHandlerCore_DataLoaded;

            _webViewer = new WebViewer(integrationBase);

            _webViewer.NavigateToControl(integrationBase.CurrentProject.Id);
            _webViewer.LoadCompleted += webViewer_LoadCompleted;

            BimExplorer.Content = _webViewer;

            _listControl = new IssueListControl(integrationBase);
            _listControl.LoadCompleted += listControl_LoadCompleted;
            IssueList.Content           = _listControl;

            _detailsControl      = new IssueDetailsControl(integrationBase);
            IssueDetails.Content = _detailsControl;
        }
コード例 #8
0
        /// <summary>
        /// Load start properties.
        /// </summary>
        /// <param name="integrationBase"></param>
        /// <param name="parent"></param>
        public void LoadContent(IntegrationBase integrationBase, Window parent)
        {
            _integrationBase = integrationBase;
            _parentWindow    = parent;

            if (_integrationBase.CurrentProject != null)
            {
                DtoProject project = _integrationBase.ApiCore.Projects.GetProject(_integrationBase.CurrentProject.Id);

                ProjectModels = ExtensionsClass.GetDivisonNames(project, _integrationBase);
            }

            Dictionary <DbLayer, Dictionary <Type, List <DtObject> > > layerTypeObjectsDictionary = ExtensionsClass.ReadLayerTypeObjectsDictionary(_integrationBase);

            List <Type> types = ExtensionsClass.GetTypes(layerTypeObjectsDictionary, parent);

            if (types.Count > 0)
            {
                SelectedItem = types[0];
                HasObjects   = true;
            }

            ObjectTypes = types;
        }
コード例 #9
0
 public PluginFactory(IHistoryLog log, IntegrationBase intBase)
 {
     this.log = log;
     this._integrationBase = intBase;
 }
コード例 #10
0
        public MainWindow()
        {
            InitializeComponent();

            DataContext = this;

            _contentControlHasContent = Visibility.Collapsed;

            CultureInfoTextBox.ParentCultureInfo = CultureInfo.CurrentCulture;

            SystemEvents.UserPreferenceChanged += SystemEvents_UserPreferenceChanged;

            // Logging

            string loggingPath = Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData) + @"\Nemetschek\bim+";

            if (!Directory.Exists(loggingPath))
            {
                DirectoryInfo directoryInfo = Directory.CreateDirectory(loggingPath);
            }

            if (Directory.Exists(loggingPath))
            {
                string fileName  = Path.Combine(loggingPath, "AllplanBimplusDemo.Log");
                bool   existFile = File.Exists(fileName);

                try
                {
                    var fileStream = existFile
                        ? new FileStream(fileName, FileMode.Append)
                        : new FileStream(fileName, FileMode.Create);

                    _streamWriter = new StreamWriter(fileStream)
                    {
                        AutoFlush = true
                    };
                }
                catch (Exception)
                {
                    MessageBoxHelper.ShowInformation("The log file could not be opened.", this);
                }

                if (_streamWriter != null)
                {
                    DateTime dateTime = DateTime.UtcNow;
                    string   output   = $"Start: {dateTime}";
                    _streamWriter.WriteLine(output);
                }
            }

            Guid clientId = LoginSettings.GetClientId();

            _integrationBase = new IntegrationBase(clientId, _testApplicationId, _streamWriter)
            {
                UseSignalRCore     = true,
                SignalRAppCode     = "AllplanBimplusDemo",
                SignalRLogFileName = "AllplanBimplusDemo"
            };

            // Connect with remember me.
            bool ok = _integrationBase.ConnectWithRememberMeAndClientId();

            if (ok)
            {
                AfterLogin();
            }

            // Set UILanguage.
            BimPlusUserControl.SetWebBrowserRuntimeUILanguage(new CultureInfo("en-GB"));
            //BimPlusUserControl.SetWebBrowserRuntimeUILanguage(new CultureInfo("de-DE"));

            // "de-DE" and "en-GB" are supported for the login.
            _integrationBase.TranslationCultureInfo = CultureInfo.CreateSpecificCulture("en-GB");
            //_integrationBase.TranslationCultureInfo = CultureInfo.CreateSpecificCulture("de-DE");

            BimPlusUserControl.EnableCache = true;

            _applicationSettings = new ApplicationSettings();
            _applicationSettings.SetLogger(_integrationBase.Logger);
            _applicationSettings.LoadSettings();
        }
コード例 #11
0
 internal void LoadContent(IntegrationBase integrationBase, Window parent)
 {
     _integrationBase = integrationBase;
 }
コード例 #12
0
        public static Dictionary <DbLayer, Dictionary <Type, List <DtObject> > > ReadLayerTypeObjectsDictionary(IntegrationBase integrationBase)
        {
            string         caption        = "Read layer.";
            ProgressWindow progressWindow = new ProgressWindow();

            progressWindow.Text = caption;

            progressWindow.Show();

            Dictionary <DbLayer, Dictionary <Type, List <DtObject> > > layerTypeObjectsDictionary = null;

            try
            {
                layerTypeObjectsDictionary = GetLayerTypeObjectsDictionary(integrationBase);
            }
            finally
            {
                progressWindow.Hide();
                progressWindow = null;
            }

            return(layerTypeObjectsDictionary);
        }
コード例 #13
0
        private static Dictionary <DbLayer, Dictionary <Type, List <DtObject> > > GetLayerTypeObjectsDictionary(IntegrationBase integrationBase)
        {
            DtoProject project = integrationBase.ApiCore.Projects.GetDtoProject(integrationBase.CurrentProject.Id);

            Dictionary <DbLayer, Dictionary <Type, List <DtObject> > > layerTypeObjectsDictionary = new Dictionary <DbLayer, Dictionary <Type, List <DtObject> > >();

            List <DtoProjectDiscipline> disciplines = new List <DtoProjectDiscipline>();

            try
            {
                if (project.Disciplines != null && project.Disciplines.FirstOrDefault() != null)
                {
                    foreach (DtoProjectDiscipline discipline in project.Disciplines)
                    {
                        if (disciplines.FirstOrDefault(d => d.DisciplineId == discipline.DisciplineId) == null)
                        {
                            disciplines.Add(discipline);
                        }
                    }
                }

                List <DtoElementType> existingTypes = new List <DtoElementType>();
                Dictionary <Type, List <DtObject> > typeObjectDict = new Dictionary <Type, List <DtObject> >();
                layerTypeObjectsDictionary = new Dictionary <DbLayer, Dictionary <Type, List <DtObject> > >();

                using (new TraceCodeTime("Load elements", "Import types"))
                {
                    using (new TraceCodeTime("GetProjectElementTypes", "Import types"))
                    {
                        existingTypes = integrationBase.ApiCore.Projects.GetProjectElementTypes(integrationBase.CurrentProject.Id);
                    }

                    foreach (DtoElementType elementType in existingTypes)
                    {
                        Type type = DbObjectList.GetType(elementType.Type);

                        DbLayer layer = DbLayerHandler.GetLayer(DbObjectList.Discpline(elementType.Id));

                        if (!layerTypeObjectsDictionary.ContainsKey(layer))
                        {
                            layerTypeObjectsDictionary.Add(layer, new Dictionary <Type, List <DtObject> >());
                        }

                        if (!layerTypeObjectsDictionary[layer].ContainsKey(type))
                        {
                            layerTypeObjectsDictionary[layer].Add(type, new List <DtObject>());
                        }
                    }
                }
            }
            catch (Exception)
            {
            }

            return(layerTypeObjectsDictionary);
        }