Exemplo n.º 1
0
        /// -----------------------------------------------------------------------------------
        /// <summary>
        /// Clean up any resources being used.
        /// </summary>
        /// <param name="disposing"><c>true</c> to release both managed and unmanaged
        /// resources; <c>false</c> to release only unmanaged resources.
        /// </param>
        /// -----------------------------------------------------------------------------------
        protected override void Dispose(bool disposing)
        {
            //Debug.WriteLineIf(!disposing, "****************** " + GetType().Name + " 'disposing' is false. ******************");
            // Must not be run more than once.
            if (IsDisposed)
            {
                return;
            }

            if (disposing)
            {
                if (m_browser != null)
                {
#if Old
                    SHDocVw.WebBrowser_V1 axDocumentV1 = m_browser.GetOcx() as SHDocVw.WebBrowser_V1;
                    if (axDocumentV1 != null)
                    {
                        axDocumentV1.BeforeNavigate -= new SHDocVw.DWebBrowserEvents_BeforeNavigateEventHandler(OnBeforeNavigate);
                    }
#endif
                    m_browser.Dispose();
                }
                if (components != null)
                {
                    components.Dispose();
                }
            }
            m_url     = null;
            m_browser = null;

            base.Dispose(disposing);
        }
Exemplo n.º 2
0
        private void btn_buscar_Click(object sender, EventArgs e)
        {
            if (txt_buscarCancion.Text != "")
            {
                // esto supone que ha agregado una instancia de WebBrowser y la ha denominado webBrowser en su formulario
                SHDocVw.WebBrowser_V1 axBrowser = (SHDocVw.WebBrowser_V1)navegador.ActiveXInstance;

                // escuchar nuevas ventanas
                axBrowser.NewWindow += axBrowser_NewWindow;

                grilla.Rows.Clear();
                btn_nuevaBusqueda.Visible = true;

                navegador.Document.GetElementById("find_songs").SetAttribute("value", txt_buscarCancion.Text);
                navegador.Document.GetElementById("search_button").InvokeMember("click");

                navegador.DocumentCompleted += Navegador_DocumentCompleted;

                txt_buscarCancion.Enabled = false;
            }
            else
            {
                txt_buscarCancion.Focus();
            }
        }
Exemplo n.º 3
0
        /// -----------------------------------------------------------------------------------
        /// <summary>
        /// Initializes a new instance of the <see cref="HtmlControl"/> class.
        /// </summary>
        /// -----------------------------------------------------------------------------------
        public HtmlControl()
        {
            // This call is required by the Windows.Forms Form Designer.
            InitializeComponent();
#if Old
            //link up to before navigate so that we know when the user clicked on something
            //note: this old version of before navigate is being used because of a bug in the.net framework.
            //win this bug is fixed, we should look at switching to using BeforeNavigate2

            //need to get hold of the ActiveX object and then grab this old interface:
            SHDocVw.WebBrowser_V1 axDocumentV1 = m_browser.GetOcx() as SHDocVw.WebBrowser_V1;
            axDocumentV1.BeforeNavigate += new SHDocVw.DWebBrowserEvents_BeforeNavigateEventHandler(OnBeforeNavigate);
#endif
            base.AccNameDefault = "HtmlControl"; // default accessibility name
#if !__MonoCS__                                  // FWNX-254
            m_browser.AccessibleName = "SHDocVw.WebBrowser_V1";
            // no right context menu needed:
            m_browser.IsWebBrowserContextMenuEnabled = false;
            // no need to allow the user to drag and drop a web page on the control:
            m_browser.AllowWebBrowserDrop = false;
#else
            // no right-click context menu needed
            this.m_browser.NoDefaultContextMenu = true;
#endif
        }
Exemplo n.º 4
0
 public Form1()
 {
     InitializeComponent();
     // this assumes that you've added an instance of WebBrowser and named it webBrowser to your form
     SHDocVw.WebBrowser_V1 axBrowser = (SHDocVw.WebBrowser_V1)webBrowser.ActiveXInstance;
     // listen for new windows
     axBrowser.NewWindow += axBrowser_NewWindow;
 }
Exemplo n.º 5
0
 public void AttachEvent(SHDocVw.WebBrowser_V1 control, string handler)
 {
     switch (handler)
     {
     case WebView.OpenNewWindowEvent:
         control.NewWindow += WebBrowserV1_NewWindow;
         break;
     }
 }
Exemplo n.º 6
0
        private void webBrowser1_DocumentCompleted(object sender, WebBrowserDocumentCompletedEventArgs e)
        {
            try
            {
                if (webBrowser1.ReadyState == WebBrowserReadyState.Complete)
                {
                    if (webBrowser1.Url.ToString() == "http://intranet.cougarautomation.net/Cats/Movements/MyMovements.aspx")
                    {
                        Web_V1 = (SHDocVw.WebBrowser_V1)webBrowser1.ActiveXInstance;

                        HTMLDocument movements = new HTMLDocument();
                        movements = (HTMLDocument)Web_V1.Document;


                        if (thisWeek)
                        {
                            htmlMonInput = (HTMLInputElement)movements.all.item("ContentPlaceHolder1_TextBoxThisMonday", 0);
                            htmlTueInput = (HTMLInputElement)movements.all.item("ContentPlaceHolder1_TextBoxThisTuesday", 0);
                            htmlWedInput = (HTMLInputElement)movements.all.item("ContentPlaceHolder1_TextBoxThisWednesday", 0);
                            htmlThuInput = (HTMLInputElement)movements.all.item("ContentPlaceHolder1_TextBoxThisThursday", 0);
                            htmlFriInput = (HTMLInputElement)movements.all.item("ContentPlaceHolder1_TextBoxThisFriday", 0);
                        }
                        else
                        {
                            htmlMonInput = (HTMLInputElement)movements.all.item("ContentPlaceHolder1_TextBoxNextMonday", 0);
                            htmlTueInput = (HTMLInputElement)movements.all.item("ContentPlaceHolder1_TextBoxNextTuesday", 0);
                            htmlWedInput = (HTMLInputElement)movements.all.item("ContentPlaceHolder1_TextBoxNextWednesday", 0);
                            htmlThuInput = (HTMLInputElement)movements.all.item("ContentPlaceHolder1_TextBoxNextThursday", 0);
                            htmlFriInput = (HTMLInputElement)movements.all.item("ContentPlaceHolder1_TextBoxNextFriday", 0);
                        }

                        setDayText(htmlMonInput, mondayInput);
                        setDayText(htmlTueInput, tuesdayInput);
                        setDayText(htmlWedInput, wednesdayInput);
                        setDayText(htmlThuInput, thursdayInput);
                        setDayText(htmlFriInput, fridayInput);

                        submitButton = (HTMLInputElement)movements.all.item("ContentPlaceHolder1_ButtonAccept", 0);

                        okButton.Enabled       = true;
                        mondayInput.Enabled    = true;
                        tuesdayInput.Enabled   = true;
                        wednesdayInput.Enabled = true;
                        thursdayInput.Enabled  = true;
                        fridayInput.Enabled    = true;
                    }
                }
            } catch (Exception exception)
            {
                MessageBox.Show("Unable to connect to movements page, please check your connection");
                this.Close();
            }
        }
        private void webBrowser1_DocumentCompleted(object sender, WebBrowserDocumentCompletedEventArgs e)
        {
            try
            {
                if (webBrowser1.ReadyState == WebBrowserReadyState.Complete)
                {
                    if (webBrowser1.Url.ToString() == "http://intranet.cougarautomation.net/Timesheet/Timesheet.aspx")
                    {
                        Web_V1 = (SHDocVw.WebBrowser_V1)webBrowser1.ActiveXInstance;

                        timesheet = (HTMLDocument)Web_V1.Document;

                        bookingsTable = (HTMLTable)timesheet.all.item("ContentPlaceHolder1_GridViewSessions", 0);

                        if (bookingsTable != null)
                        {
                            bookingsTableInnerHTML = bookingsTable.innerHTML;
                        }
                        else
                        {
                            bookingsTableInnerHTML = "";
                        }

                        if (!thisMonth)
                        {
                            var anchorElements = timesheet.getElementsByTagName("a");

                            foreach (HTMLAnchorElement item in anchorElements)
                            {
                                if (item.title == "Go to the previous month")
                                {
                                    item.click();
                                }
                            }

                            timer1.Start();
                        }
                        else
                        {
                            HTMLInputElement monthRadioButton = (HTMLInputElement)timesheet.all.item("ContentPlaceHolder1_RadioButtonListSessions_2", 0);
                            monthRadioButton.click();
                            timer1.Start();
                        }
                    }
                }
            } catch (Exception exception)
            {
                MessageBox.Show("Unable to connect to timesheet page, please check your connection");
            }
        }
Exemplo n.º 8
0
 public WB(bool isConsole = false)
 {
     firstNavigating  = true;
     isConsoleVersion = isConsole;
     //new_title = true;
     needExec   = new NeedExec();
     webBrowser = new WebBrowser();
     webBrowser.ScriptErrorsSuppressed = true;
     //intrpr = new diplomWorkTranslator.Interpretator(path_to_intrpr_prog);
     webBrowser.DocumentCompleted += new WebBrowserDocumentCompletedEventHandler(this.webBrowser_documentCompleted);
     //webBrowser.Navigating += new WebBrowserNavigatingEventHandler(this.webBrowser_navigating);
     webBrowser.Navigated            += new WebBrowserNavigatedEventHandler(this.webBrowser_navigated);
     webBrowser.DocumentTitleChanged += new EventHandler(title_changed);
     //webBrowser.NewWindow += new System.ComponentModel.CancelEventHandler(cancel_load_new_window);
     Web_V1            = (SHDocVw.WebBrowser_V1) this.webBrowser.ActiveXInstance;
     Web_V1.NewWindow += new SHDocVw.DWebBrowserEvents_NewWindowEventHandler(Web_V1_NewWindow);
     exit_run          = 0;
 }
Exemplo n.º 9
0
        public MainWindow()
        {
            InitializeComponent();
            dgExtractedFiles.ItemsSource         = extractedFiles;
            NetworkChange.NetworkAddressChanged += AddressCallbackChange;

            // Deals with new windows created by browser.
            WebBrowser = (webBrowserHost.Child as System.Windows.Forms.WebBrowser);
            axBrowser  = (SHDocVw.WebBrowser_V1)WebBrowser.ActiveXInstance;
            // listen for new windows
            axBrowser.NewWindow          += axBrowser_NewWindow;
            WebBrowser.DocumentCompleted += webBrowser_DocumentCompleted;

            Logger = new Logger(rtbLogger);


            //FrmPortfolioAnalysisSettings.ConfigFileUpdated += new EventHandler()
        }
Exemplo n.º 10
0
        public Main()
        {
            InitializeComponent();
            embeddedVideoScreen.ScriptErrorsSuppressed = true;

            if (args.Count() == 2)
            {
                searchBox.Text = args[1].ToString();
            }

            try
            {
                // this assumes that you've added an instance of WebBrowser and named it webBrowser to your form
                SHDocVw.WebBrowser_V1 window = (SHDocVw.WebBrowser_V1)embeddedVideoScreen.ActiveXInstance;
                // listen for new windows
                window.NewWindow += window_NewWindow;
            }
            catch
            {
                //empty.
            }
        }
Exemplo n.º 11
0
        public static void fillAllMovements(SHDocVw.WebBrowser_V1 Web_V1)
        {
            HTMLDocument movements = new HTMLDocument();

            movements = (HTMLDocument)Web_V1.Document;

            HTMLInputElement thisMonBox = (HTMLInputElement)movements.all.item("ContentPlaceHolder1_TextBoxThisMonday", 0);
            HTMLInputElement thisTueBox = (HTMLInputElement)movements.all.item("ContentPlaceHolder1_TextBoxThisTuesday", 0);
            HTMLInputElement thisWedBox = (HTMLInputElement)movements.all.item("ContentPlaceHolder1_TextBoxThisWednesday", 0);
            HTMLInputElement thisThuBox = (HTMLInputElement)movements.all.item("ContentPlaceHolder1_TextBoxThisThursday", 0);
            HTMLInputElement thisFriBox = (HTMLInputElement)movements.all.item("ContentPlaceHolder1_TextBoxThisFriday", 0);

            HTMLInputElement nextMonBox = (HTMLInputElement)movements.all.item("ContentPlaceHolder1_TextBoxNextMonday", 0);
            HTMLInputElement nextTueBox = (HTMLInputElement)movements.all.item("ContentPlaceHolder1_TextBoxNextTuesday", 0);
            HTMLInputElement nextWedBox = (HTMLInputElement)movements.all.item("ContentPlaceHolder1_TextBoxNextWednesday", 0);
            HTMLInputElement nextThuBox = (HTMLInputElement)movements.all.item("ContentPlaceHolder1_TextBoxNextThursday", 0);
            HTMLInputElement nextFriBox = (HTMLInputElement)movements.all.item("ContentPlaceHolder1_TextBoxNextFriday", 0);

            HTMLInputElement nextMon2Box = (HTMLInputElement)movements.all.item("ContentPlaceHolder1_TextBoxNextMonday2", 0);
            HTMLInputElement nextTue2Box = (HTMLInputElement)movements.all.item("ContentPlaceHolder1_TextBoxNextTuesday2", 0);
            HTMLInputElement nextWed2Box = (HTMLInputElement)movements.all.item("ContentPlaceHolder1_TextBoxNextWednesday2", 0);
            HTMLInputElement nextThu2Box = (HTMLInputElement)movements.all.item("ContentPlaceHolder1_TextBoxNextThursday2", 0);
            HTMLInputElement nextFri2Box = (HTMLInputElement)movements.all.item("ContentPlaceHolder1_TextBoxNextFriday2", 0);

            HTMLInputElement nextMon3Box = (HTMLInputElement)movements.all.item("ContentPlaceHolder1_TextBoxNextMonday3", 0);
            HTMLInputElement nextTue3Box = (HTMLInputElement)movements.all.item("ContentPlaceHolder1_TextBoxNextTuesday3", 0);
            HTMLInputElement nextWed3Box = (HTMLInputElement)movements.all.item("ContentPlaceHolder1_TextBoxNextWednesday3", 0);
            HTMLInputElement nextThu3Box = (HTMLInputElement)movements.all.item("ContentPlaceHolder1_TextBoxNextThursday3", 0);
            HTMLInputElement nextFri3Box = (HTMLInputElement)movements.all.item("ContentPlaceHolder1_TextBoxNextFriday3", 0);

            List <HTMLInputElement> movementInputs = new List <HTMLInputElement>();

            movementInputs.Add(thisMonBox);
            movementInputs.Add(thisTueBox);
            movementInputs.Add(thisWedBox);
            movementInputs.Add(thisThuBox);
            movementInputs.Add(thisFriBox);
            movementInputs.Add(nextMonBox);
            movementInputs.Add(nextTueBox);
            movementInputs.Add(nextWedBox);
            movementInputs.Add(nextThuBox);
            movementInputs.Add(nextFriBox);
            movementInputs.Add(nextMon2Box);
            movementInputs.Add(nextTue2Box);
            movementInputs.Add(nextWed2Box);
            movementInputs.Add(nextThu2Box);
            movementInputs.Add(nextFri2Box);
            movementInputs.Add(nextMon3Box);
            movementInputs.Add(nextTue3Box);
            movementInputs.Add(nextWed3Box);
            movementInputs.Add(nextThu3Box);
            movementInputs.Add(nextFri3Box);

            foreach (var item in movementInputs)
            {
                if (string.IsNullOrEmpty(item.value))
                {
                    item.value = "IN";
                }
            }

            HTMLInputElement submit = (HTMLInputElement)movements.all.item("ContentPlaceHolder1_ButtonAccept", 0);

            submit.click();
        }
Exemplo n.º 12
0
        private void webBrowser1_DocumentCompleted(object sender, WebBrowserDocumentCompletedEventArgs e)
        {
            try
            {
                if (webBrowser1.ReadyState == WebBrowserReadyState.Complete)
                {
                    if (webBrowser1.Url.ToString() == "http://intranet.cougarautomation.net/Timesheet/Timesheet.aspx")
                    {
                        Web_V1 = (SHDocVw.WebBrowser_V1)webBrowser1.ActiveXInstance;

                        timesheet = (HTMLDocument)Web_V1.Document;

                        selectedTechnology = Properties.Settings.Default.lastBookedTechnology;

                        if (!String.IsNullOrEmpty(selectedTechnology))
                        {
                            //This lets us know that we need to update the technology after we have selected the project.
                            technologyComboUpdateRequired = true;
                        }

                        initaliseElements();

                        string lastBookedRadioButton = Properties.Settings.Default.lastBookedRadioButton;
                        if (!String.IsNullOrEmpty(lastBookedRadioButton) && lastBookedRadioButton != "team")
                        {
                            //This lets us know that we need to update the radio button after we have selected the project.
                            lastBookedRadioButtonUpdateRequired = true;
                            if (lastBookedRadioButton == "all")
                            {
                                allRadioButton.Checked = true;
                            }
                            else if (lastBookedRadioButton == "region")
                            {
                                regionRadioButton.Checked = true;
                            }
                        }
                        else
                        {
                            teamRadioButton.Checked = true;
                        }

                        projectComboBox.Items.Clear();
                        foreach (var item in projectList.options)
                        {
                            projectComboBox.Items.Add(item.innerText);
                        }
                        lastProject = Properties.Settings.Default.lastBookedProject;

                        if (!String.IsNullOrEmpty(lastProject))
                        {
                            if (projectComboBox.Items.Contains(lastProject))
                            {
                                projectComboBox.SelectedItem = lastProject;
                            }
                            else
                            {
                                MessageBox.Show(lastProject + " is no longer in project list");
                            }
                        }
                        else
                        {
                            if (projectComboBox.Items.Count > 0)
                            {
                                projectComboBox.SelectedIndex = 0;
                            }
                        }

                        codeComboBox.Items.Clear();
                        foreach (var item in codeList.options)
                        {
                            codeComboBox.Items.Add(item.innerText);
                        }
                        lastCode = Properties.Settings.Default.lastBookedCode;

                        if (!String.IsNullOrEmpty(lastCode) && codeComboBox.Items.Contains(lastCode))
                        {
                            codeComboBox.SelectedItem = lastCode;
                        }
                        else
                        {
                            if (codeComboBox.Items.Count > 0)
                            {
                                codeComboBox.SelectedIndex = 0;
                            }
                        }

                        lastDesc = Properties.Settings.Default.lastBookedDesc;

                        if (!String.IsNullOrEmpty(lastDesc))
                        {
                            descTextBox.Text = lastDesc;
                        }

                        extensionComboBox.Items.Clear();
                        foreach (var item in extensionList.options)
                        {
                            extensionComboBox.Items.Add(item.innerText);
                        }
                        lastExtension = Properties.Settings.Default.lastBookedExtension;

                        if (!String.IsNullOrEmpty(lastExtension) && extensionComboBox.Items.Contains(lastExtension))
                        {
                            extensionComboBox.SelectedItem = lastExtension;
                        }
                        else
                        {
                            if (extensionComboBox.Items.Count > 0)
                            {
                                extensionComboBox.SelectedIndex = 0;
                            }
                        }


                        lastHours = Properties.Settings.Default.lastBookedHours;

                        if (!String.IsNullOrEmpty(lastHours))
                        {
                            hoursTextBox.Text = lastHours;
                        }

                        lastBookedOT = Properties.Settings.Default.lastBookedOvertime;


                        if (lastBookedOT == "1")
                        {
                            Overtime1radioButton.Checked = true;
                        }
                        else if (lastBookedOT == "1.5")
                        {
                            overtime15radioButton.Checked = true;
                        }
                        else if (lastBookedOT == "2")
                        {
                            overtimer2radioButton.Checked = true;
                        }
                        else
                        {
                            normalRadioButton.Checked = true;
                        }
                    }
                }
            }
            catch (Exception exception)
            {
                MessageBox.Show("Unable to connect to timesheet page, please check your connection");
                this.Close();
            }
        }
Exemplo n.º 13
0
 private void WebBrowserNewWindow(Object sender, CancelEventArgs e)
 {
     browserV1AceCounter            = (SHDocVw.WebBrowser_V1)browser.ActiveXInstance;
     browserV1AceCounter.NewWindow += Web_V1_NewWindow;
 }