コード例 #1
0
ファイル: PageToImage.cs プロジェクト: jim-deng-git/Ask
        private void setBitmap()
        {
            using (System.Windows.Forms.WebBrowser wb = new System.Windows.Forms.WebBrowser()) {
                wb.ScrollBarsEnabled = false;
                wb.Width = width;
                wb.Navigate(url);
                //确保页面被解析完全
                while (wb.ReadyState != System.Windows.Forms.WebBrowserReadyState.Complete) {
                    System.Windows.Forms.Application.DoEvents();
                    System.Threading.Thread.Sleep(100);
                }
                System.Threading.Thread.Sleep(1000);

                height = wb.Document.Body.ScrollRectangle.Height + 50;
                wb.Height = height;

                bitmap = new System.Drawing.Bitmap(width, height);
                wb.DrawToBitmap(bitmap, new System.Drawing.Rectangle(0, 0, width, height));
                wb.Dispose();
            }
        }
コード例 #2
0
 private void UserControl_Unloaded(object sender, RoutedEventArgs e)
 {
     webBrowser.Dispose();
     webBrowser = null;
 }
コード例 #3
0
        /// <summary>
        /// Code will receive messages from the floor
        /// Invoke appropriate content projection based on the tile ID passed
        /// </summary>
        /// <param name="val"></param>
        public void OnMessageReceived(string val)
        {
            try
            {
                //Check for reset
                if (val.Equals("Reset"))
                {
                    //Update the previous entry
                    Utilities.TelemetryWriter.UpdatePreviousEntry();

                    //Reset the system
                    ResetUI();
                }
                //Check for System start
                //Check for System start
                else if (val.StartsWith("System Start"))
                {
                    //Load the telemetry Data
                    Utilities.TelemetryWriter.RetrieveTelemetryData();

                    //The floor has asked the screen to start the system
                    //Get the User Name
                    Globals.UserName = val.Split(':')[1];

                    //Get the person identity for the session
                    personName = String.IsNullOrEmpty(Globals.UserName) ? Convert.ToString(Guid.NewGuid()) : Globals.UserName;

                    Utilities.TelemetryWriter.AddTelemetryRow(rippleData.Floor.SetupID, personName, "Unlock", val, "Unlock");

                    //Set the system state
                    Globals.currentAppState = RippleSystemStates.UserDetected;

                    //Play the Intro Content
                    ProjectIntroContent(rippleData.Screen.ScreenContents["IntroVideo"]);
                }
                //Check for gestures
                else if (val.StartsWith("Gesture"))
                {
                    OnGestureInput(val.Split(':')[1]);
                }
                //Check for HTMl messages
                else if (val.StartsWith("HTML"))
                {
                    OnHTMLMessagesReceived(val.Split(':')[1]);
                }
                //Check for options- TODO need to figure out
                else if (val.StartsWith("Option"))
                {
                    //Do nothing
                }
                //Check if a content - tile mapping or in general content tag exists
                else
                {
                    if (rippleData.Screen.ScreenContents.ContainsKey(val) && rippleData.Screen.ScreenContents[val].Type != ContentType.Nothing)
                    {
                        //Set the system state
                        Globals.currentAppState = RippleSystemStates.OptionSelected;

                        ProjectContent(rippleData.Screen.ScreenContents[val]);

                        RippleCommonUtilities.LoggingHelper.LogTrace(1, "In Message Received {0} {1}:{2}", Utilities.TelemetryWriter.telemetryData.Tables[0].Rows.Count, Utilities.TelemetryWriter.telemetryData.Tables[0].Rows[Utilities.TelemetryWriter.telemetryData.Tables[0].Rows.Count - 1].ItemArray[6], DateTime.Now);

                        //Update the end time for the previous
                        Utilities.TelemetryWriter.UpdatePreviousEntry();

                        //Insert the new entry
                        Utilities.TelemetryWriter.AddTelemetryRow(rippleData.Floor.SetupID, personName, ((currentTile = GetFloorTileForID(val)) == null)?"Unknown":currentTile.Name, val, (val == "Tile0") ? "Start" : "Option");
                    }
                    else
                    {
                        //Stop any existing projections
                        DocumentPresentation.HelperMethods.StopPresentation();
                        FullScreenContentGrid.Children.Clear();
                        ContentGrid.Children.Clear();

                        //Set focus for screen window also
                        Utilities.Helper.ClickOnScreenToGetFocus();

                        //Stop any existing videos
                        loopVideo                     = false;
                        VideoControl.Source           = null;
                        FullScreenVideoControl.Source = null;

                        //Clean the images
                        fullScreenImgElement.Source = null;
                        imgElement.Source           = null;

                        //Clear the header text
                        TitleLabel.Text = "";

                        //Dispose the objects
                        if (browserElement != null)
                        {
                            browserElement.Dispose();
                        }
                        browserElement = null;

                        if (host != null)
                        {
                            host.Dispose();
                        }
                        host = null;

                        if (helper != null)
                        {
                            helper.PropertyChanged -= helper_PropertyChanged;
                        }
                        helper = null;

                        currentScreenContent = ContentType.Nothing;

                        ShowText("No content available for this option, Please try some other tile option", "No Content");
                    }
                }
            }
            catch (Exception ex)
            {
                //Do nothing
                RippleCommonUtilities.LoggingHelper.LogTrace(1, "Went wrong in On message received for Screen {0}", ex.Message);
            }
        }
コード例 #4
0
ファイル: AppLinkPackage.cs プロジェクト: Code0987/Newgen
 /// <summary>
 /// Called when [stop].
 /// </summary>
 /// <remarks>...</remarks>
 protected override void OnStop() {
     if (browser != null && !browser.IsDisposed)
         browser.Dispose();
 }
コード例 #5
0
 //Nastane po úplném načtení stránky
 private void WebBrowser_DocumentCompleted(object sender, System.Windows.Forms.WebBrowserDocumentCompletedEventArgs e)
 {
     wbTimer.Stop();
     ResolveLink();
     webBrowser.Dispose();
 }
コード例 #6
0
ファイル: InternetExplorer.cs プロジェクト: raear/html-zoning
 /// <summary>
 /// Performs application-defined tasks associated with freeing, releasing, or resetting unmanaged resources
 /// </summary>
 public override void Dispose()
 {
     _winFormsBrowser.Dispose();
 }