Exemplo n.º 1
0
        private async Task createNewViewIfNeeded(Windows.UI.Core.DispatchedHandler initAction)
        {
            if (Window.Current.Content == null)
            {
                await Window.Current.Dispatcher.RunAsync(Windows.UI.Core.CoreDispatcherPriority.Normal, initAction);

                return;
            }
            var newViewId = 0;
            var newView   = Windows.ApplicationModel.Core.CoreApplication.CreateNewView();
            var init      = newView.Dispatcher.RunAsync(Windows.UI.Core.CoreDispatcherPriority.Normal, initAction);
            await newView.Dispatcher.RunAsync(Windows.UI.Core.CoreDispatcherPriority.Normal, () =>
            {
                var newAppView           = ApplicationView.GetForCurrentView();
                newViewId                = newAppView.Id;
                newAppView.Consolidated += (sender, e) =>
                {
                    ViewModel.ViewModelLocator.ClearForView(newViewId);
                    Window window = null;
                    if (WindowDictionary.TryRemove(newViewId, out window))
                    {
                        window.Content = null;
                    }
                };
            });

            await ApplicationViewSwitcher.TryShowAsStandaloneAsync(newViewId);

            await init;
        }
Exemplo n.º 2
0
        protected override void OnWindowCreated(WindowCreatedEventArgs args)
        {
            base.OnWindowCreated(args);
            var window = args.Window;

            WindowDictionary.TryAdd(ApplicationView.GetApplicationViewIdForWindow(window.CoreWindow), window);
        }
Exemplo n.º 3
0
        private void ReloadWindowData(WindowDictionary windows)
        {
            windows_view.Items.Clear();
              windows_view.SmallImageList = new ImageList();
              foreach (Window window in windows.Values)
              {
            string dimensions = string.Format("{0},{1},{2},{3}",
            window.Rect.left,
            window.Rect.top,
            window.Rect.right,
            window.Rect.bottom);

            if (!windows_view.SmallImageList.Images.ContainsKey(window.ProcessId.ToString()))
            {
              windows_view.SmallImageList.Images.Add(window.ProcessId.ToString(), window.Icon);
            }

            ListViewItem item = new ListViewItem(window.Title, window.ProcessId.ToString());
            item.SubItems.Add(window.Handle.ToString());
            item.SubItems.Add(window.ProcessId.ToString());
            item.SubItems.Add(window.ModuleFilename);
            item.SubItems.Add(window.Class);
            item.SubItems.Add(window.Visible ? "Yes" : "No");
            item.SubItems.Add(dimensions);
            item.SubItems.Add(window.ZOrder.ToString());
            windows_view.Items.Add(item);
              }
        }