iReaperBrowserForm.cs :  » Network-Clients » iReaper » IReaper » Browser » C# / CSharp Open Source

Home
C# / CSharp Open Source
1.2.6.4 mono .net core
2.2.6.4 mono core
3.Aspect Oriented Frameworks
4.Bloggers
5.Build Systems
6.Business Application
7.Charting Reporting Tools
8.Chat Servers
9.Code Coverage Tools
10.Content Management Systems CMS
11.CRM ERP
12.Database
13.Development
14.Email
15.Forum
16.Game
17.GIS
18.GUI
19.IDEs
20.Installers Generators
21.Inversion of Control Dependency Injection
22.Issue Tracking
23.Logging Tools
24.Message
25.Mobile
26.Network Clients
27.Network Servers
28.Office
29.PDF
30.Persistence Frameworks
31.Portals
32.Profilers
33.Project Management
34.RSS RDF
35.Rule Engines
36.Script
37.Search Engines
38.Sound Audio
39.Source Control
40.SQL Clients
41.Template Engines
42.Testing
43.UML
44.Web Frameworks
45.Web Service
46.Web Testing
47.Wiki Engines
48.Windows Presentation Foundation
49.Workflows
50.XML Parsers
C# / C Sharp
C# / C Sharp by API
C# / CSharp Tutorial
C# / CSharp Open Source » Network Clients » iReaper 
iReaper » IReaper » Browser » iReaperBrowserForm.cs
using System;
using System.Threading;
using System.IO;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
using WeifenLuo.WinFormsUI.Docking;
using System.Net;

namespace IReaper.Browser{
    public partial class iReaperBrowserForm : iReaperDockContent
    {
        System.ComponentModel.ComponentResourceManager resources;
        private TabContextMenu tabContextMenu = new TabContextMenu();

        public iReaperBrowserForm()
        {
            InitializeComponent();
            this.iReaperWebBrowser.DocumentTitleChanged += new EventHandler(UpdateTabTitle);
            resources = new System.ComponentModel.ComponentResourceManager(typeof(iReaperBrowserForm));
            this.TabPageContextMenu = tabContextMenu;
            tabContextMenu.Context = this;
            this.browserToolStrip1.WbForm = this;
            this.browserToolStrip1.UrlCombo.KeyUp += new KeyEventHandler(UrlCombo_KeyUp);
        }

        void UrlCombo_KeyUp(object sender, KeyEventArgs e)
        {
            if (e.KeyCode == Keys.Return)
            {
                e.Handled = true;
                GoNavigate();
            }
        }

        /// <summary>
        /// 
        /// </summary>
        public void LoadWelcomeWeb()
        {
            this.iReaperWebBrowser.Navigate("http://go.microsoft.com/fwlink/?LinkID=78110&clcid=0x804");
            this.iReaperWebBrowser.DocumentCompleted += new WebBrowserDocumentCompletedEventHandler(delegate(object obj,WebBrowserDocumentCompletedEventArgs e)
            {
                if (!this.IsDisposed)
                {
                    this.Show();
                    this.Activate();
                    //msdn
                    this.browserToolStrip1.UrlCombo.Text = this.iReaperWebBrowser.Url.AbsoluteUri;
                }
            } );
            this.iReaperWebBrowser.NavigationError += new EventHandler(delegate(object sender, EventArgs e)
            {
                this.Close();
            });
            
        }

        protected override void OnLoad(EventArgs e)
        {
            //
            BrowserManager.RegisterBrowser(this);
            Core.CoreData[CoreDataType.ActiveWebBrowser] = this;
            base.OnLoad(e);
        }

        /// <summary>
        /// TabTextDocumentTitle
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void UpdateTabTitle(object sender, EventArgs e)
        {
            this.TabText = this.iReaperWebBrowser.DocumentTitle;
        }

        /// <summary>
        /// Url
        /// </summary>
        public Uri Url
        {
            set 
            {
                if (value == null || !value.IsAbsoluteUri)
                { return; }
                this.TabText = value.AbsoluteUri;
                this.iReaperWebBrowser.Url = value;
                this.browserToolStrip1.UrlCombo.Text = value.AbsoluteUri;
            }
            get
            {
                return this.iReaperWebBrowser.Url;
            }
        }

        /// <summary>
        /// 
        /// </summary>
        /// <param name="icon"></param>
        private void IconChanged(Icon icon)
        {
            this.Icon = icon;
        }

        /// <summary>
        /// 
        /// 
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void CheckQuit(object sender, EventArgs e)
        {
            this.Close();
        }

        /// <summary>
        /// 
        /// </summary>
        public void GoBack()
        {
            this.iReaperWebBrowser.GoBack();
        }

        /// <summary>
        /// 
        /// </summary>
        public void GoForward()
        {
            this.iReaperWebBrowser.GoForward();
        }

        /// <summary>
        /// 
        /// </summary>
        public void RefreshBrowser()
        {
            this.iReaperWebBrowser.Refresh();
        }

        /// <summary>
        /// 
        /// </summary>
        public void Stop()
        {
            this.iReaperWebBrowser.Stop();
        }

        /// <summary>
        /// 
        /// </summary>
        public void GoNavigate()
        {
            string tempUrl = "";
            if (this.browserToolStrip1.UrlCombo.Text.IndexOf("://") == -1)
            {
                tempUrl = "http://" + this.browserToolStrip1.UrlCombo.Text;
            }
            else
            {
                tempUrl = this.browserToolStrip1.UrlCombo.Text;
            }
            this.Url = new Uri(tempUrl, UriKind.Absolute);
        }

        /// <summary>
        /// Windows Live ID
        /// </summary>
        /// <param name="url"></param>
        /// <param name="postedData"></param>
        public void NavigateWithPostedAuthenInfo(string url, byte[] postedData)
        {
            this.iReaperWebBrowser.Navigate(url, "_self", postedData, "Content-Type: application/x-www-form-urlencoded");
        }

        private void UpdateUrl(object sender, WebBrowserNavigatingEventArgs e)
        {
            this.browserToolStrip1.UrlCombo.Text = e.Url.AbsoluteUri;
        }
    }
}
www.java2v.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.