Exemplo n.º 1
0
            private void CreateAndShowContent()
            {
                Dispatcher = Dispatcher.CurrentDispatcher;
                VisualTargetPresentationSource source = new VisualTargetPresentationSource(_hostVisual);
                _resetEvent.Set();
                source.RootVisual = _createContent();
                DesiredSize = source.DesiredSize;
                _invalidateMeasure();

                Dispatcher.Run();
                source.Dispose();
            }
Exemplo n.º 2
0
        static void Main(string[] args)
        {
            if (args.Length != 1)
            {
                Console.Error.WriteLine("Usage: PluginHost name");
                return;
            }

            try
            {
                Console.WriteLine("Host starting: ARGS: " + args[0]);
                AppDomain.CurrentDomain.UnhandledException += CurrentDomain_UnhandledException;
                AppDomain.CurrentDomain.DomainUnload += CurrentDomain_DomainUnload;
                var name = args[0];
                int bits = IntPtr.Size * 8;
                Console.WriteLine("Starting PluginHost {0}, {1} bit", name, bits );

                Dispatcher = Dispatcher.CurrentDispatcher;

                var serverProvider = new BinaryServerFormatterSinkProvider { TypeFilterLevel = TypeFilterLevel.Full };
                var clientProvider = new BinaryClientFormatterSinkProvider();
                var properties = new Hashtable();
                properties["portName"] = name;

                var channel = new IpcChannel(properties, clientProvider, serverProvider);
                ChannelServices.RegisterChannel(channel, false);

                RemotingConfiguration.RegisterWellKnownServiceType(
                    typeof(PluginLoader), "PluginLoader", WellKnownObjectMode.Singleton);

                SignalReady(name);

                Dispatcher.Run();
            }
            catch (Exception ex)
            {
                ShowException(ex);
            }
            Console.ReadKey();
        }
        /// <summary>
        /// Thread entry point for WiX Toolset UX.
        /// </summary>
        protected override void Run()
        {
            Engine.Log(LogLevel.Verbose, "Running the ESME Bootstrapper.");
            Model = new Model(this);
            Dispatcher = Dispatcher.CurrentDispatcher;
            var backgroundColorString = Engine.StringVariables["BackgroundColor"];
            var progressBarColorString = Engine.StringVariables["ProgressBarColor"];
            var convertedBackgroundColorObject = ColorConverter.ConvertFromString(backgroundColorString);
            var convertedProgressBarColorObject = ColorConverter.ConvertFromString(progressBarColorString);
            var backgroundColor = (Color)(convertedBackgroundColorObject ?? Colors.LightSeaGreen);
            var progressBarColor = (Color)(convertedProgressBarColorObject ?? Color.FromArgb(0xFF, 0x00, 0x8E, 0x91));
            var viewModel = new RootViewModel
            {
                BundleLongName = Engine.StringVariables["BundleLongName"],
                BundleShortName = Engine.StringVariables["BundleShortName"],
                ProductLongName = Engine.StringVariables["ProductLongName"],
                ProductShortName = Engine.StringVariables["ProductShortName"],
                ProductFullVersion = Engine.StringVariables["ProductFullVersion"],
                ButtonBackgroundBrush = new SolidColorBrush(backgroundColor),
                ProgressBarBrush = new SolidColorBrush(progressBarColor),
            };
            // Populate the view models with the latest data. This is where Detect is called.
            viewModel.Refresh();

            // Create a Window to show UI.
            if (Model.Command.Display == Display.Passive ||
                Model.Command.Display == Display.Full)
            {
                Engine.Log(LogLevel.Verbose, "Creating a UI.");
                View = new RootView(viewModel);
                View.Show();
            }
            Dispatcher.Run();

            Engine.Quit(0);
        }
Exemplo n.º 4
0
 public void StartDispatcher()
 {
     this.Dispatcher = null;
     _thread = new Thread(() =>
     {
         this.Dispatcher = Dispatcher.CurrentDispatcher;
         Dispatcher.Run();
     });
     _thread.SetApartmentState(ApartmentState.STA);
     _thread.IsBackground = true;
     _thread.Start();
     while (this.Dispatcher == null) //waitinig while dispatcher starts
         Thread.Sleep(1);
 }
			private void CreateAndShowContent()
			{
				this.Dispatcher = Dispatcher.CurrentDispatcher;
				var source = new VisualTargetPresentationSource( _hostVisual );
				this._sync.Set();
				source.RootVisual = _createContent();
				this.DesiredSize = source.DesiredSize;
				this._invalidateMeasure();

				Dispatcher.Run();
				source.Dispose();
			}
            /// <summary>
            /// Creates and show content.
            /// </summary>
            private void _CreateAndShowContent()
            {
                Dispatcher = Dispatcher.CurrentDispatcher;
                var source = new VisualTargetPresentationSource(_hostVisual);
                _sync.Set();
                source.RootVisual = _createContent();
                DesiredSize = source.DesiredSize;
                _rootVisual = source.RootVisual as Control;
                Debug.Assert(null != _rootVisual);
                _invalidateMeasure();

                Dispatcher.Run();
                source.Dispose();
            }