Example #1
0
 public ExpressionViewCustomSerializer(ExpressionView view)
     : base((View)view)
 {
 }
Example #2
0
		private void InitView()
		{
			PropertyView newView = null;
			if (_component.FunctionParameters.SourceType == SourceType.Equation)
			{
				newView = new EquationView();
				((EquationView)newView).Component = _component;
			}
			else
			{
				newView = new ExpressionView();
				((ExpressionView)newView).Component = _component;
			}

			this.panel1.Controls.Add(newView);
			newView.Dock = DockStyle.Fill;
			if (_currentView != null)
			{
				_currentView.SaveData();
				_currentView.Dispose();
				_currentView = null;
			}
			_currentView = newView;
		}
Example #3
0
        private void AttachPalettes(Workspace newWorkspace)
        {
            Workspace workspace = this.ActiveWorkspace as Workspace;

            if (workspace != null)
            {
                foreach (Microsoft.VisualStudio.PlatformUI.Shell.View view in workspace.WindowProfile.FindAll((Predicate <ViewElement>)(v => v is Microsoft.VisualStudio.PlatformUI.Shell.View)))
                {
                    if (this.paletteRegistry[view.Name] != null)
                    {
                        view.Content = (object)null;
                    }
                }
            }
            using (ViewManager.Instance.DeferActiveViewChanges())
            {
                foreach (PaletteRegistryEntry paletteRegistryEntry in (IEnumerable <PaletteRegistryEntry>) this.paletteRegistry.PaletteRegistryEntries)
                {
                    Microsoft.VisualStudio.PlatformUI.Shell.View view = newWorkspace.FindPalette(paletteRegistryEntry.Name) ?? Microsoft.VisualStudio.PlatformUI.Shell.View.Create(newWorkspace.WindowProfile, paletteRegistryEntry.Name, paletteRegistryEntry.ViewProperties.ViewType);
                    ExpressionView expressionView = view as ExpressionView;
                    if (expressionView == null || !paletteRegistryEntry.ViewProperties.ViewType.IsAssignableFrom(view.GetType()))
                    {
                        expressionView = Microsoft.VisualStudio.PlatformUI.Shell.View.Create(newWorkspace.WindowProfile, paletteRegistryEntry.Name, paletteRegistryEntry.ViewProperties.ViewType) as ExpressionView;
                        foreach (PropertyInfo propertyInfo in view.GetType().GetProperties(BindingFlags.Instance | BindingFlags.Public))
                        {
                            PropertyInfo property = expressionView.GetType().GetProperty(propertyInfo.Name, BindingFlags.Instance | BindingFlags.Public);
                            if (property != (PropertyInfo)null && property.CanWrite && property.Name != "Parent")
                            {
                                object obj = propertyInfo.GetValue((object)view, (object[])null);
                                property.SetValue((object)expressionView, obj, (object[])null);
                            }
                        }
                        expressionView.Detach();
                        expressionView.IsDesiredVisible = view.IsVisible;
                        IList <ViewElement> list = (IList <ViewElement>)view.Parent.Children;
                        int index = list.IndexOf((ViewElement)view);
                        list[index] = (ViewElement)expressionView;
                    }
                    expressionView.Content = (object)paletteRegistryEntry.Content;
                    expressionView.Title   = (object)paletteRegistryEntry.Caption;
                    if (double.IsNaN(expressionView.FloatingLeft) || double.IsNaN(expressionView.FloatingTop))
                    {
                        Size?defaultFloatSize = paletteRegistryEntry.ViewProperties.DefaultFloatSize;
                        if (defaultFloatSize.HasValue && defaultFloatSize.HasValue)
                        {
                            expressionView.FloatingWidth  = defaultFloatSize.Value.Width;
                            expressionView.FloatingHeight = defaultFloatSize.Value.Height;
                            FloatSite ancestor = ExtensionMethods.FindAncestor <FloatSite>((ViewElement)expressionView);
                            if (ancestor != null)
                            {
                                bool flag = true;
                                foreach (ViewElement viewElement in ancestor.FindAll((Predicate <ViewElement>)(value => value != expressionView)))
                                {
                                    if (!double.IsNaN(viewElement.FloatingLeft) && !double.IsNaN(viewElement.FloatingTop))
                                    {
                                        flag = false;
                                        break;
                                    }
                                }
                                if (flag)
                                {
                                    ancestor.FloatingWidth  = expressionView.FloatingWidth;
                                    ancestor.FloatingHeight = expressionView.FloatingHeight;
                                }
                            }
                        }
                    }
                    paletteRegistryEntry.ViewProperties.Apply(expressionView);
                }
            }
            foreach (ViewElement viewElement in Enumerable.ToArray <ViewElement>(newWorkspace.WindowProfile.FindAll((Predicate <ViewElement>)(v =>
            {
                Microsoft.VisualStudio.PlatformUI.Shell.View view = v as Microsoft.VisualStudio.PlatformUI.Shell.View;
                if (view != null)
                {
                    return(view.Content == null);
                }
                return(false);
            }))))
            {
                viewElement.Detach();
            }
        }