예제 #1
0
        private void LoadLayout(string layoutName)
        {
            if (AssociatedObject == null)
            {
                return;
            }

            if (UserInterfaceLayoutRepository == null)
            {
                AssociatedObject.LoadLayout(StringResources.XmlOriginalLayout);
                return;
            }

            _userInterfaceLayoutModel = UserInterfaceLayoutRepository.FindSingle(model => model.LayoutName == layoutName);
            if (_userInterfaceLayoutModel == null)
            {
                return;
            }

            PropertyInfo pi = _userInterfaceLayoutModel.GetType().GetProperty(LayoutDataPropertyName);

            if (pi == null)
            {
                return;
            }

            string layoutData = pi.GetValue(_userInterfaceLayoutModel, null) as string;

            if (layoutData == null)
            {
                return;
            }

            try
            {
                AssociatedObject.LoadLayout(layoutData);
            }
            catch (Exception)
            {
                Dev2Logger.Log.Info("Invalid user interface layout file encountered, reverting to default layout.");
            }
        }