Пример #1
0
        private void RenderInPreviewWindow(object sender, SelectionChangedEventArgs e)
        {
            ListView cb = (ListView)sender;

            if (cb.SelectedValue != null)
            {
                Prototype2.ControlBase ctl = (Prototype2.ControlBase)cb.SelectedValue;
                LaunchPreviewWindow(ctl);
            }
        }
Пример #2
0
        private void LaunchPreviewWindow(Prototype2.ControlBase fe)
        {
            if (IsNoWindows())
            {
                App.BuildDevicesList();
                ClearPreviewPane();
                SelControl = fe;
                ShowPreviewContent();
                App.RenderStaticWindowContent(fe);
                txt_description.Text = fe.Description;
                txt_name.Text        = fe.WindowName;

                Ghost.Wrapper.Control ghstWrapper = new Ghost.Wrapper.Control(App.MasterStaticWindowTemplate, HVCCPages.AllPages);
                PreviewPanel.Children.Add(ghstWrapper);
            }
        }
Пример #3
0
        private void CreateScreenShots()
        {
            try
            {
                WindowsPanel.Visibility  = Visibility.Hidden;
                ScenarioPanel.Visibility = Visibility.Hidden;
                ClearPreviewPane();
                HidePreviewContent();

                Settings.IsStaticPresentation = true;
                Settings.IsGhostApp           = false;

                App.MasterWindowTemplate = new HVCC.Prototype2.WindowMaster();

                WindowLaunchTimer          = new DispatcherTimer();
                WindowLaunchTimer.Interval = TimeSpan.FromSeconds(.1);

                if (!Directory.Exists(ScreenShotDirectoryPath))
                {
                    Directory.CreateDirectory(ScreenShotDirectoryPath);
                }

                int nWindows = 0;
                int nDialogs = 0;
                Prototype2.ControlBase curCtl = null;

                WindowLaunchTimer.Tick += delegate
                {
                    if (nWindows < HVCCPages.Windows.Count)
                    {
                        curCtl = (Prototype2.ControlBase)HVCCPages.Windows[nWindows];
                        App.RenderWindowContent(curCtl);
                        ScreenShotTimer.Start();
                        nWindows++;
                    }
                    else
                    {
                        if (nDialogs < HVCCPages.Dialogs.Count)
                        {
                            curCtl = (Prototype2.ControlBase)HVCCPages.Dialogs[nDialogs];
                            App.RenderWindowContent(curCtl);
                            ScreenShotTimer.Start();
                            nDialogs++;
                        }
                        else
                        {
                            WindowsPanel.Visibility  = Visibility.Visible;
                            ScenarioPanel.Visibility = Visibility.Visible;
                            CloseAllWindows();
                            nWindows = 0;
                            nDialogs = 0;
                            Process.Start(ScreenShotDirectoryPath);
                            Ghost.Imaging.Capture.CombineImagesInDirectory(ScreenShotDirectoryPath, "all");
                            WindowLaunchTimer.Stop();
                        }
                    }

                    ScreenShotTimer.Tick += delegate
                    {
                        Ghost.Imaging.Capture.CaptureControlImageAndSave(App.MasterWindowTemplate, ScreenShotDirectoryPath + curCtl.WindowName);
                        ScreenShotTimer.Stop();
                    };
                };

                HVCC.Prototype2.PrototypeWindow wndw = new HVCC.Prototype2.PrototypeWindow(App.MasterWindowTemplate);
                wndw.Closed     += new EventHandler(wndw_Closed);
                wndw.WindowStyle = WindowStyle.None;
                wndw.Topmost     = true;
                wndw.Show();
                WindowLaunchTimer.Start();
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message + "\n\n" + ex.Source + "\n\n" + ex.StackTrace);
                throw ex;
            }
        }