コード例 #1
0
ファイル: AppDomainDesignHost.cs プロジェクト: yaram/Eto
        public void Init(string platformType, string initializeAssembly, string mainAssembly, IEnumerable <string> references)
        {
            if (Platform.Instance == null)
            {
                var refs = new[] { Path.GetDirectoryName(typeof(AppDomainProxy).Assembly.Location), mainAssembly };
                resolver = AssemblyResolver.Register(refs.Union(references));

                var plat = Activator.CreateInstance(Type.GetType(platformType)) as Platform;
                Platform.Initialize(plat);
                if (!string.IsNullOrEmpty(initializeAssembly))
                {
                    plat.LoadAssembly(initializeAssembly);
                }
                var app = new Application();
                app.Attach();
                app.Terminating += App_Terminating;

                app.UnhandledException += App_UnhandledException;

                AppDomain.CurrentDomain.DomainUnload += CurrentDomain_DomainUnload;
            }

            designPanel = new DesignPanel();
            designPanel.MainAssembly = mainAssembly;
            designPanel.References   = references.ToList();
        }
コード例 #2
0
ファイル: AppDomainDesignHost.cs プロジェクト: picoe/Eto
		public void Init(string platformType, string initializeAssembly, string mainAssembly, IEnumerable<string> references)
		{
			if (Platform.Instance == null)
			{
				var refs = new[] { Path.GetDirectoryName(typeof(AppDomainProxy).Assembly.Location), mainAssembly };
				resolver = AssemblyResolver.Register(refs.Union(references));

				var plat = Activator.CreateInstance(Type.GetType(platformType)) as Platform;
				Platform.Initialize(plat);
				if (!string.IsNullOrEmpty(initializeAssembly))
				{
					plat.LoadAssembly(initializeAssembly);
				}
				var app = new Application();
				app.Attach();
				app.Terminating += App_Terminating;

				app.UnhandledException += App_UnhandledException;

				AppDomain.CurrentDomain.DomainUnload += CurrentDomain_DomainUnload;
			}

			designPanel = new DesignPanel();
			designPanel.MainAssembly = mainAssembly;
			designPanel.References = references.ToList();
		}
コード例 #3
0
        public PreviewEditorView(Control editor, string mainAssembly, IEnumerable <string> references, Func <string> getCode)
        {
            //Size = new Size (200, 200);
            Editor           = editor;
            MainAssemblyPath = mainAssembly;
            this.getCode     = getCode;

            if (EnableAppDomains)
            {
                designPanel = new AppDomainDesignHost();
            }
            else
            {
                designPanel = new InProcessDesignPanel();
            }

            designPanel.MainAssembly = mainAssembly;
            designPanel.References   = references;

            designPanel.ControlCreated = () => FinishProcessing(null);
            designPanel.Error          = FinishProcessing;

            designPanelHolder         = new Panel();
            designPanelHolder.Content = designPanel.GetContainer();

            designPanel.ContainerChanged = () => designPanelHolder.Content = designPanel.GetContainer();

            Orientation = Orientation.Vertical;
            FixedPanel  = SplitterFixedPanel.None;

            errorPanel = new Panel {
                Padding = new Padding(5), Visible = false, BackgroundColor = new Color(Colors.Red, .4f)
            };

            Panel1 = new StackLayout
            {
                HorizontalContentAlignment = HorizontalAlignment.Stretch,
                Items =
                {
                    new StackLayoutItem(designPanelHolder, expand: true),
                    errorPanel
                }
            };
            Panel2           = editor;
            RelativePosition = lastPosition;

            timer = new UITimer {
                Interval = RefreshTime
            };
            timer.Elapsed += Timer_Elapsed;

            errorTimer = new UITimer {
                Interval = ErrorDisplayTime
            };
            errorTimer.Elapsed += ErrorTimer_Elapsed;
        }
コード例 #4
0
 protected override void Dispose(bool disposing)
 {
     if (disposing)
     {
         designPanelHolder.Content = null;
         designPanel.Dispose();
         designPanel = null;
     }
     base.Dispose(disposing);
 }
コード例 #5
0
ファイル: AppDomainDesignHost.cs プロジェクト: zzlvff/Eto
        public void HookupEvents(AppDomainEventSink eventSink)
        {
            GetThemeColor = eventSink.GetThemeColor;

            designPanel = new DesignPanel();
            designPanel.MainAssembly = mainAssembly;
            designPanel.References   = references;

            designPanel.Error          = eventSink.Error;
            designPanel.ControlCreated = eventSink.ControlCreated;
        }
コード例 #6
0
ファイル: PreviewEditorView.cs プロジェクト: picoe/Eto
		public PreviewEditorView(Control editor, string mainAssembly, IEnumerable<string> references, Func<string> getCode)
		{
			//Size = new Size (200, 200);
			Editor = editor;
			MainAssemblyPath = mainAssembly;
			this.getCode = getCode;

			if (EnableAppDomains)
				designPanel = new AppDomainDesignHost();
			else
				designPanel = new InProcessDesignPanel();

			designPanel.MainAssembly = mainAssembly;
			designPanel.References = references;

			designPanel.ControlCreated = () => FinishProcessing(null);
			designPanel.Error = FinishProcessing;

			designPanelHolder = new Panel();
			designPanelHolder.Content = designPanel.GetContainer();

			designPanel.ContainerChanged = () => designPanelHolder.Content = designPanel.GetContainer();

			Orientation = Orientation.Vertical;
			FixedPanel = SplitterFixedPanel.None;
			RelativePosition = lastPosition;

			errorPanel = new Panel { Padding = new Padding(5), Visible = false, BackgroundColor = new Color(Colors.Red, .4f) };

			Panel1 = new StackLayout
			{
				HorizontalContentAlignment = HorizontalAlignment.Stretch,
				Items =
				{
					new StackLayoutItem(designPanelHolder, expand: true),
					errorPanel
				}
			};
			Panel2 = editor;

			timer = new UITimer { Interval = RefreshTime };
			timer.Elapsed += Timer_Elapsed;

			errorTimer = new UITimer { Interval = ErrorDisplayTime };
			errorTimer.Elapsed += ErrorTimer_Elapsed;
		}
コード例 #7
0
        public void Init(string platformType, string initializeAssembly, string mainAssembly, IEnumerable <string> references)
        {
            if (Platform.Instance == null)
            {
                resolver = AssemblyResolver.Register(references.Union(new[] { mainAssembly, Path.GetDirectoryName(typeof(AppDomainProxy).Assembly.Location) }));

                var plat = Activator.CreateInstance(Type.GetType(platformType)) as Platform;
                Platform.Initialize(plat);
                if (!string.IsNullOrEmpty(initializeAssembly))
                {
                    plat.LoadAssembly(initializeAssembly);
                }
                new Application().Attach();
            }

            designPanel = new DesignPanel();
            designPanel.MainAssembly = mainAssembly;
            designPanel.References   = references.ToList();
        }
コード例 #8
0
ファイル: PreviewEditorView.cs プロジェクト: picoe/Eto
		protected override void Dispose(bool disposing)
		{
			if (disposing)
			{
				designPanelHolder.Content = null;
				designPanel.Dispose();
				designPanel = null;
			}
			base.Dispose(disposing);
		}