Inheritance: IDisposable
Ejemplo n.º 1
0
        protected override void OnStartup(StartupEventArgs e)
        {
            MainWindow = Shell.Instance;
            MainWindow.Show();
            ShutdownMode = ShutdownMode.OnMainWindowClose;

            Task.Factory.StartNew(() =>
            {
                while (true)
                {
                    using (var engine = CreateEngine())
                        using (var watcher = new WatcherThread(engine))
                        {
                            Shell.Instance.IsAttached = true;
                            Minimap minimap           = null;
                            OverlayWindow overlay     = null;
                            Execute.OnUIThread(() =>
                            {
                                Canvas canvas = new Canvas();
                                overlay       = OverlayWindow.Create(engine.Process, canvas);
                                overlay.Show();
                                minimap = new Minimap(canvas);
                            });
                            watcher.AddTask(minimap.Update);
                            watcher.Start();
                            engine.Process.WaitForExit();
                            Execute.OnUIThread(() => overlay.Close());
                        }
                    Shell.Instance.IsAttached = false;
                    //Execute.OnUIThread(() => MainWindow.Close());
                }
            }, TaskCreationOptions.LongRunning);
        }
Ejemplo n.º 2
0
		protected override void OnStartup(StartupEventArgs e)
		{
			MainWindow = Shell.Instance;
			MainWindow.Show();
			ShutdownMode = ShutdownMode.OnMainWindowClose;

			Task.Factory.StartNew(() =>
			{
				while (true)
				{
					using (var engine = CreateEngine())
					using (var watcher = new WatcherThread(engine))
					{
						Shell.Instance.IsAttached = true;
						Minimap minimap = null;
						OverlayWindow overlay = null;
						Execute.OnUIThread(() =>
						{
							Canvas canvas = new Canvas();
							overlay = OverlayWindow.Create(engine.Process, canvas);
							overlay.Show();
							minimap = new Minimap(canvas);
						});
						watcher.AddTask(minimap.Update);
						watcher.Start();
						engine.Process.WaitForExit();
						Execute.OnUIThread(() => overlay.Close());
					}
					Shell.Instance.IsAttached = false;
					//Execute.OnUIThread(() => MainWindow.Close());
				}
			}, TaskCreationOptions.LongRunning);
		}