예제 #1
0
        private void axWebBrowser1_DocumentComplete(object sender, AxSHDocVw.DWebBrowserEvents2_DocumentCompleteEvent e)
        {
            switch(Task)
            {
                case 1:

                    HTMLDocument myDoc = new HTMLDocumentClass();
                    myDoc = (HTMLDocument) axWebBrowser1.Document;

                    // a quick look at the google html source reveals:
                    // <INPUT maxLength="256" size="55" name="q">
                    //
                    HTMLInputElement otxtSearchBox = (HTMLInputElement) myDoc.all.item("q", 0);

                    otxtSearchBox.value = "intel corp";

                    // google html source for the I'm Feeling Lucky Button:
                    // <INPUT type=submit value="I'm Feeling Lucky" name=btnI>
                    //
                    HTMLInputElement btnSearch = (HTMLInputElement) myDoc.all.item("btnI", 0);
                    btnSearch.click();

                    Task++;
                    break;

                case 2:

                    // continuation of automated tasks...
                    break;
            }
        }
예제 #2
0
 private void axWebBrowser1_DocumentComplete(object sender, AxSHDocVw.DWebBrowserEvents2_DocumentCompleteEvent e)
 {
     doc = (mshtml.HTMLDocument)axWebBrowser1.Document;
     mshtml.HTMLDocumentEvents2_Event iEvent;
     iEvent = (mshtml.HTMLDocumentEvents2_Event) doc;
     iEvent.oncontextmenu+=new mshtml.HTMLDocumentEvents2_oncontextmenuEventHandler(ContextMenuEventHandler);
 }
예제 #3
0
        public Pandora(AxSHDocVw.AxWebBrowser browser)
        {
            this.browser = browser;
            this.radioSize = new Size(0, 0);

            this.located = false;
            this.hwndPandora = 0;

            ThreadPool.QueueUserWorkItem(new WaitCallback(this.LocateRadio));
        }
예제 #4
0
        private void axWebBrowser1_DocumentComplete(object sender, AxSHDocVw.DWebBrowserEvents2_DocumentCompleteEvent e)
        {
            try
            {
                string str=axWebBrowser2.LocationURL;
                SHDocVw.IWebBrowser2 doc=e.pDisp as SHDocVw.IWebBrowser2;

                if (doc==(sender as AxSHDocVw.AxWebBrowser).GetOcx())
                {
                    if(str.IndexOf("slideshow.php") > 0)  // these are dependent on file(.php) names of manage Content.
                    {
            //						if(!(ClientUI.getInstance().tabControlWebContent.SelectedTab.Title == ClientUI.getInstance().tabPageWebPresentations.Title) )
            //							ClientUI.getInstance().tabControlWebContent.SelectedTab = ClientUI.getInstance().tabPageWebPresentations;
                    }
                    else
                        if(str.IndexOf("premquestions.php") > 0)
                    {
            //						if(!(ClientUI.getInstance().tabControlWebContent.SelectedTab.Title == ClientUI.getInstance().tabPageWebContentPolls.Title))
            //							ClientUI.getInstance().tabControlWebContent.SelectedTab = ClientUI.getInstance().tabPageWebContentPolls;
                    }
                    else if(str.IndexOf("dmquestions.php") > 0)
                    {
            //						if(!(ClientUI.getInstance().tabControlWebContent.SelectedTab.Title == ClientUI.getInstance().tabPageWebContentPolls.Title))
            //							ClientUI.getInstance().tabControlWebContent.SelectedTab = ClientUI.getInstance().tabPageWebContentPolls;
                    }

                    else if(str.IndexOf("webshare.php") > 0)
                    {
            //						if(!(ClientUI.getInstance().tabControlWebContent.SelectedTab.Title == ClientUI.getInstance().tabPageWebContentBookmarks.Title) )
            //							ClientUI.getInstance().tabControlWebContent.SelectedTab = ClientUI.getInstance().tabPageWebContentBookmarks;
                    }
                    else
                        if(str.IndexOf("uploads.php") > 0)
                    {

            //						if(!(ClientUI.getInstance().tabControlWebContent.SelectedTab.Title == ClientUI.getInstance().tabPageWebFiles.Title) )
            //							ClientUI.getInstance().tabControlWebContent.SelectedTab = ClientUI.getInstance().tabPageWebFiles;
                    }
                    else
                        if(str.IndexOf("postmquestions.php") > 0)
                    {
            //						if(!(ClientUI.getInstance().tabControlWebContent.SelectedTab.Title == ClientUI.getInstance().tabPageWebEvaluation.Title) )
            //							ClientUI.getInstance().tabControlWebContent.SelectedTab = ClientUI.getInstance().tabPageWebEvaluation;
                    }
                }
            }
            catch(Exception exp)
            {
                WebMeeting.Client.ClientUI.getInstance().ShowExceptionMessage("ManageContents ===>ManageContentinfo.cs line==> 239",exp,null,false);
            }
            //			doc = (mshtml.HTMLDocument)axWebBrowser1.Document;
            //			mshtml.HTMLDocumentEvents2_Event iEvent;
            //			iEvent = (mshtml.HTMLDocumentEvents2_Event) doc;
            //			iEvent.oncontextmenu+=new mshtml.HTMLDocumentEvents2_oncontextmenuEventHandler(ContextMenuEventHandler);
        }
예제 #5
0
        private void axWebBrowser1_CommandStateChange(object sender, AxSHDocVw.DWebBrowserEvents2_CommandStateChangeEvent e)
        {
            const uint CSC_NAVIGATEFORWARD = 0x00000001;
            const uint CSC_NAVIGATEBACK = 0x00000002;

            switch ((uint)e.command) {
                case CSC_NAVIGATEFORWARD:
                    toolGoForward.Enabled = e.enable;
                    break;
                case CSC_NAVIGATEBACK:
                    toolGoBack.Enabled = e.enable;
                    break;
            }
        }
예제 #6
0
        public void StartSubclass(IntPtr hWnd,AxSHDocVw.AxWebBrowser browser)
        {
            // delegate for the new wndproc
            newWndProc = new Win32.USER32.Win32WndProc(MyWndProc);

            if(oldWndProc.ToInt32() != 0)
                Win32.USER32.SetWindowLong(hWnd, Win32.USER32.GWL_WNDPROC, newWndProc);
            else
                oldWndProc = Win32.USER32.SetWindowLong(hWnd, Win32.USER32.GWL_WNDPROC, newWndProc);

            if(browser!= null)
            {
                browserControl = browser;
            }
        }
        private void axWebBrowser1_TitleChange(object sender, AxSHDocVw.DWebBrowserEvents2_TitleChangeEvent e)
        {
            System.Windows.Forms.SaveFileDialog SvgFileDia = new SaveFileDialog();
            string str = (string ) e.text;
            string filePath = e.text ;

            if(strOpenedPage=="")
                return;
            if(locktoexecute==true)
                return;
            //MessageBox.Show(str);
            if( (filePath.IndexOf("&") < 0  && filePath.IndexOf(".php") < 0))//&&  nCountOpenFiles==2)
            {
                //MessageBox.Show(strOpenedPage,"CompassNav");
                if(strOpenedPage=="dmquestion")
                {
                    changeTitleofPage();
                    Client.ClientUI.getInstance().CreateNewPollingWindowFrmMangeContent(null,null,false,str);
                    return;
                }
                else if(strOpenedPage=="webshare")
                {
                    changeTitleofPage();
                    Client.ClientUI.getInstance().shareBrowserForWebFiles(str);
                    return;
                }
                else if(strOpenedPage=="uploads")
                {
                    changeTitleofPage();
                    SvgFileDia.FileName=System.IO.Path.GetFileName(str);
                    if( SvgFileDia.ShowDialog()==DialogResult.OK)
                    {
                        if(SvgFileDia.CheckPathExists)
                        {
                            WebMeeting.Client.ManageContent.frmDownloader frm=new WebMeeting.Client.ManageContent.frmDownloader(filePath,SvgFileDia.FileName);
                            frm.Show();
                        }
                    }
                    return;
                }

                string fileName = filePath.Substring( filePath.LastIndexOf("/")+1);
                nCountOpenFiles=0;
                changeTitleofPage();
                //string uploadPath = WebMeeting.Client.DocumentSharingEx.createUploadFullPath_MangCont(fileName);
                try
                {
            //					WebMeeting.Client.ManageContent.frmDownloader frm=new WebMeeting.Client.ManageContent.frmDownloader(filePath ,uploadPath,true);
            //					frm.DownComp +=new WebMeeting.Client.ManageContent.DownloadingComplete(this.startSlideShow);
            //					frm.TopMost=true;
            //					frm.Owner=ClientUI.getInstance();
            //					frm.ShowDialog();
                    prevFileName = filePath;
                    //MessageBox.Show(filePath);
                    ClientUI.getInstance().ShareMyDocumentByContentManagement(filePath);
                    filePath = filePath.Substring( filePath.LastIndexOf("/")+1 );
                }
                catch(Exception exp)
                {
                    //frmDownload.Close();
                    WebMeeting.Client.ClientUI.getInstance().ShowExceptionMessage("ManageContents ===>ManageContentWebPresentation.cs line==> 458",exp,"Error downloading " +  exp.Message.ToString(),true);

                }

                //					filePath = filePath.Substring( filePath.LastIndexOf("/")+1 );
                //
                //					//MessageBox.Show("sharing: " + Application.StartupPath + "\\Downloaded\\" + fileName);
                //					//ClientUI.getInstance().ShareMyDocumentByContentManagement(filePath);
                //					ClientUI.getInstance().ShareMyDocumentByContentManagement(uploadPath);
            }
            else
            {
                //		if(nCountOpenFiles==2)nCountOpenFiles=0;
                //		nCountOpenFiles+=1;
            }
            flagToUnique = !flagToUnique ;
            //}

            //flagToUnique = !flagToUnique ;
        }
        private void axLunchWebsite(object sender, AxSHDocVw.DWebBrowserEvents2_BeforeNavigate2Event e)
        {
            try
            {
                string str=e.uRL.ToString();

                if(str=="javascript:check();")
                    return;
                if (Regex.IsMatch(str,"www.compassnav.com"))
                {
                    if(str.IndexOf(".php") < 0)
                    {
                        object oUrl;
                        object ojunk= new object();
                        axWebBrowser1.Stop();
                        oUrl="http://www.compassnav.com/application/webshare.php";
                        axWebBrowser1.Navigate2(ref oUrl,ref ojunk,ref ojunk,ref ojunk,ref ojunk);
                        //System.Windows.Forms.MessageBox.Show(e.uRL.ToString());
                        StopNavigation=true;
                        Client.ClientUI.getInstance().shareBrowserForWebFiles(str);
                        //Client.ClientUI. shareBrowserForWebFiles(str);

                    }
                    else
                        StopNavigation=false;

                }
                else
                {
                    object oUrl;
                    object ojunk= new object();
                    axWebBrowser1.Stop();
                    oUrl="http://www.compassnav.com/application/webshare.php";
                    axWebBrowser1.Navigate2(ref oUrl,ref ojunk,ref ojunk,ref ojunk,ref ojunk);
                    //System.Windows.Forms.MessageBox.Show(e.uRL.ToString());
                    StopNavigation=true;
                    Client.ClientUI.getInstance().shareBrowserForWebFiles(str);
                    //Client.ClientUI. shareBrowserForWebFiles(str);
                }

            }
            catch(Exception exp)
            {
            WebMeeting.Client.ClientUI.getInstance().ShowExceptionMessage("ManageContents ===>ManageContentWebPresentation.cs line==> 388",exp,null,false);
            }
            //
        }
        private void axWebBrowser1_DownloadComplete(object sender,  AxSHDocVw.DWebBrowserEvents2_DocumentCompleteEvent e)
        {
            try
            {
                //MessageBox.Show(axWebBrowser1.Handle.ToString());
                menuHook.StartSubclass(menuHook.IEFromhWnd(axWebBrowser1.Handle),axWebBrowser1);

                string str=axWebBrowser1.LocationURL;
                SHDocVw.IWebBrowser2 doc=e.pDisp as SHDocVw.IWebBrowser2;

                if (doc==(sender as AxSHDocVw.AxWebBrowser).GetOcx())
                {
                    if(str.IndexOf("slideshow.php") > 0)  // these are dependent on file(.php) names of manage Content.
                    {
                        strOpenedPage="slideshow";
            //						if(!(ClientUI.getInstance().tabControlWebContent.SelectedTab.Title == ClientUI.getInstance().tabPageWebPresentations.Title) )
            //							ClientUI.getInstance().tabControlWebContent.SelectedTab = ClientUI.getInstance().tabPageWebPresentations;
                    }
                    else if(str.IndexOf("premquestions.php") > 0)
                    {
                        strOpenedPage="pre-question";
            //						if(!(ClientUI.getInstance().tabControlWebContent.SelectedTab.Title == ClientUI.getInstance().tabPageWebContentPolls.Title))
            //							ClientUI.getInstance().tabControlWebContent.SelectedTab = ClientUI.getInstance().tabPageWebContentPolls;
                    }
                    //else if(str.IndexOf("webshare.php") > 0)
                    else if(str.IndexOf("webshare.php") > 0)
                    {
                        strOpenedPage="webshare";
            //						if(!(ClientUI.getInstance().tabControlWebContent.SelectedTab.Title == ClientUI.getInstance().tabPageWebContentBookmarks.Title) )
            //							ClientUI.getInstance().tabControlWebContent.SelectedTab = ClientUI.getInstance().tabPageWebContentBookmarks;
                    }
                    else if(str.IndexOf("dmquestions.php") > 0)
                    {
                        strOpenedPage="dmquestion";
            //						if(!(ClientUI.getInstance().tabControlWebContent.SelectedTab.Title == ClientUI.getInstance().tabPageWebContentPolls.Title))
            //							ClientUI.getInstance().tabControlWebContent.SelectedTab = ClientUI.getInstance().tabPageWebContentPolls;
                    }
                    else
                        if(str.IndexOf("uploads.php") > 0)
                    {
                        strOpenedPage="uploads";
            //						if(!(ClientUI.getInstance().tabControlWebContent.SelectedTab.Title == ClientUI.getInstance().tabPageWebFiles.Title) )
            //							ClientUI.getInstance().tabControlWebContent.SelectedTab = ClientUI.getInstance().tabPageWebFiles;
                    }
                    else
                        if(str.IndexOf("postmquestions.php") > 0)
                    {
                        strOpenedPage="postquestion";
            //						if(!(ClientUI.getInstance().tabControlWebContent.SelectedTab.Title == ClientUI.getInstance().tabPageWebEvaluation.Title) )
            //							ClientUI.getInstance().tabControlWebContent.SelectedTab = ClientUI.getInstance().tabPageWebEvaluation;
                    }
                }
            }
            catch(Exception exp)
            {
            WebMeeting.Client.ClientUI.getInstance().ShowExceptionMessage("ManageContents ===>ManageContentWebPresentations.cs line==> 298",exp,null,false);
            }
            //			else
            //			{
            //				ClientUI.getInstance().tabControlWebContent.SelectedTab = ClientUI.getInstance().tabPageWebInfo;
            //			}
        }
예제 #10
0
        private void axWebBrowser2_TitleChange(object sender, AxSHDocVw.DWebBrowserEvents2_TitleChangeEvent e)
        {
            try
            {
                string str = (string ) e.text;

                if(str.IndexOf("slideshow.php") > 0)  // these are dependent on file(.php) names of manage Content.
                {
            //					ClientUI.getInstance().tabControlWebContent.SelectedTab = ClientUI.getInstance().tabPageWebPresentations;
                }
                else
                    if(str.IndexOf("premquestions.php") > 0)
                {
            //					ClientUI.getInstance().tabControlWebContent.SelectedTab = ClientUI.getInstance().tabPageWebContentPolls;
                }
                else
                    if(str.IndexOf("webshare.php") > 0)
                {
            //					ClientUI.getInstance().tabControlWebContent.SelectedTab = ClientUI.getInstance().tabPageWebContentBookmarks;
                }
                else if(str.IndexOf("dmquestions.php") > 0)
                {
            //					if(!(ClientUI.getInstance().tabControlWebContent.SelectedTab.Title == ClientUI.getInstance().tabPageWebContentPolls.Title))
            //						ClientUI.getInstance().tabControlWebContent.SelectedTab = ClientUI.getInstance().tabPageWebContentPolls;
                }

                else
                    if(str.IndexOf("uploads.php") > 0)
                {
            //					ClientUI.getInstance().tabControlWebContent.SelectedTab = ClientUI.getInstance().tabPageWebFiles;
                }
                else
                    if(str.IndexOf("postmquestions.php") > 0)
                {
            //					ClientUI.getInstance().tabControlWebContent.SelectedTab = ClientUI.getInstance().tabPageWebEvaluation;
                }
                else
                {
            //					ClientUI.getInstance().tabControlWebContent.SelectedTab = ClientUI.getInstance().tabPageWebInfo;
                }
            }
            catch(Exception exp)
            {
            WebMeeting.Client.ClientUI.getInstance().ShowExceptionMessage("ManageContents ===>ManageContentinfo.cs line==> 368",exp,null,false);
            }
        }
예제 #11
0
 private void axWebBrowser1_NavigateComplete2(object sender, AxSHDocVw.DWebBrowserEvents2_NavigateComplete2Event e)
 {
     if(!annotationsEnabled)
     {
         chkShowThumbNails.Checked = true;
         chkThumbNail.Checked =this.m_bIsAllowedToAddAnnotations;
     }
 }
예제 #12
0
 private void ctlRaagaBrowser_NavigateComplete2(object sender, AxSHDocVw.DWebBrowserEvents2_NavigateComplete2Event e)
 {
 }
예제 #13
0
        private void axWebBrowser1_TitleChange(object sender,  AxSHDocVw.DWebBrowserEvents2_TitleChangeEvent e)
        {
            string str = (string ) e.text;
            //Trace.WriteLine("Selected Question" + str);
            if(str.IndexOf(".php") < 0)
            {
                //Trace.WriteLine("Title Change");
                changeTitleofPage();

                Client.ClientUI.getInstance().CreateNewPollingWindowFrmMangeContent(null,null,false,str);
                //Client.ClientUI.getInstance().pollingTabControl.Enabled=true;
            //	Trace.WriteLine("Selected Question" + str);

            }
            //			if(str.IndexOf("slideshow.php") > 0)  // these are dependent on file(.php) names of manage Content.
            //			{
            //				//if(!(ClientUI.getInstance().tabControlWebContent.SelectedTab.Title == ClientUI.getInstance().tabPageWebPresentations.Title) )
            //					ClientUI.getInstance().tabControlWebContent.SelectedTab = ClientUI.getInstance().tabPageWebPresentations;
            //			}
            //			else
            //				if(str.IndexOf("premquestions.php") > 0)
            //			{
            //				//if(!(ClientUI.getInstance().tabControlWebContent.SelectedTab.Title == ClientUI.getInstance().tabPageWebContentPolls.Title))
            //					ClientUI.getInstance().tabControlWebContent.SelectedTab = ClientUI.getInstance().tabPageWebContentPolls;
            //			}
            //			else
            //				if(str.IndexOf("webshare.php") > 0)
            //			{
            //				//if(!(ClientUI.getInstance().tabControlWebContent.SelectedTab.Title == ClientUI.getInstance().tabPageWebContentBookmarks.Title) )
            //					ClientUI.getInstance().tabControlWebContent.SelectedTab = ClientUI.getInstance().tabPageWebContentBookmarks;
            //			}
            //			else
            //				if(str.IndexOf("uploads.php") > 0)
            //			{
            //
            //				//if(!(ClientUI.getInstance().tabControlWebContent.SelectedTab.Title == ClientUI.getInstance().tabPageWebFiles.Title) )
            //					ClientUI.getInstance().tabControlWebContent.SelectedTab = ClientUI.getInstance().tabPageWebFiles;
            //			}
            //			else
            //				if(str.IndexOf("postmquestions.php") > 0)
            //			{
            //				//if(!(ClientUI.getInstance().tabControlWebContent.SelectedTab.Title == ClientUI.getInstance().tabPageWebEvaluation.Title) )
            //					ClientUI.getInstance().tabControlWebContent.SelectedTab = ClientUI.getInstance().tabPageWebEvaluation;
            //			}
            //			else
            //			{
            //				ClientUI.getInstance().tabControlWebContent.SelectedTab = ClientUI.getInstance().tabPageWebInfo;
            //			}

            //menuHook.StartSubclass(menuHook.IEFromhWnd(axWebBrowser1.Handle),axWebBrowser1);
        }
예제 #14
0
        private void browser2_BeforeNavigate2(object sender, AxSHDocVw.DWebBrowserEvents2_BeforeNavigate2Event e)
        {
            string url = (string)e.uRL;

            Debug.WriteLine("browser2_BeforeNavigate2: " + url);

            try
            {
                if (url.StartsWith("javascript:"))
                {
                    string[] scripts = url.Split(';');

                    foreach (string script in scripts)
                    {
                        if (script.LastIndexOf("PandoraStarted") > 0)
                        {
                            //loaded = true;
                            //loginTime = DateTime.Now;

                            if (pandora == null)
                            {
                                pandora = new Pandora(browser);
                                browserTimer.Start();
                            }
                        }
                        else if (script.LastIndexOf("SongPlayed") > 0)
                        {
                            Debug.WriteLine("Play");

                            const string SONG_NAME_MARK = "songName:unescape";
                            const string ARTIST_NAME_MARK = "artistName:unescape";
                            const string SONG_URL_MARK = "songURL:unescape";
                            const string ART_URL_MARK = "artURL:unescape";
                            const string END_MARK = "}";

                            int songMark = script.IndexOf(SONG_NAME_MARK) + SONG_NAME_MARK.Length;
                            int songMarkLength = script.LastIndexOf(ARTIST_NAME_MARK) - songMark;
                            int artistMark = script.IndexOf(ARTIST_NAME_MARK) + ARTIST_NAME_MARK.Length;
                            int artistMarkLength = script.LastIndexOf(SONG_URL_MARK) - artistMark;
                            int songUrlMark = script.IndexOf(SONG_URL_MARK) + SONG_URL_MARK.Length;
                            int songUrlMarkLength = script.LastIndexOf(ART_URL_MARK) - songUrlMark;
                            int artUrlMark = script.IndexOf(ART_URL_MARK) + ART_URL_MARK.Length;
                            int artUrlMarkLength = script.LastIndexOf(END_MARK) - artUrlMark;

                            string songNamePart = script.Substring(songMark, songMarkLength);
                            string artistNamePart = script.Substring(artistMark, artistMarkLength);
                            string songUrlPart = script.Substring(songUrlMark, songUrlMarkLength);
                            string artUrlPart = script.Substring(artUrlMark, artUrlMarkLength);

                            string songName = songNamePart.Substring(songNamePart.IndexOf("'") + 1, songNamePart.LastIndexOf("'") - songNamePart.IndexOf("'") - 1);
                            string artistName = artistNamePart.Substring(artistNamePart.IndexOf("'") + 1, artistNamePart.LastIndexOf("'") - artistNamePart.IndexOf("'") - 1);
                            string songUrl = songUrlPart.Substring(songNamePart.IndexOf("'") + 1, songUrlPart.LastIndexOf("'") - songUrlPart.IndexOf("'") - 1);
                            string artUrl = artUrlPart.Substring(artUrlPart.IndexOf("'") + 1, artUrlPart.LastIndexOf("'") - artUrlPart.IndexOf("'") - 1);

                            songName = HttpUtility.UrlDecode(songName.Replace("%25%32%37", "%27").Replace("%22", "\"")).Replace("%22", "\"");
                            artistName = HttpUtility.UrlDecode(artistName.Replace("%25%32%37", "%27").Replace("%22", "\"")).Replace("%22", "\"");
                            songUrl = HttpUtility.UrlDecode(songUrl);
                            artUrl = HttpUtility.UrlDecode(artUrl);

                            refreshMessenger = !paused;
                            refreshXfire = !paused;
                            refreshSkype = !paused;
                            refreshG15 = !paused;
                            OnPlayStart();

                            ++continuesPlayCounter;

                            memoryTimer.Interval = MEMORYTIMER_DELAY;
                            memoryTimer.Start();

                            if (taskbarNotifier != null && taskbarNotifier.Visible)
                            {
                                taskbarNotifier.Hide();
                            }

                            if (!paused)
                            {
                                playedLength += (int)(DateTime.Now - playedStartTime).TotalSeconds;

                                SubmitSongToLastFM(song.Artist, song.Name, playedLength);

                                playedLength = 0;
                            }

                            playedStartTime = DateTime.Now;

                            paused = false;

                            song = new Song(string.Empty, songName, artistName, songUrl, artUrl);

                            Debug.WriteLine(song.Name + " ~by~ " + song.Artist);

                            submittedToLastFm = false;
                            menuLastFmSubmit.Enabled = true;

                            RefreshPlayer(true);
                        }
                        else if (script.LastIndexOf("SongPaused") > 0)
                        {
                            Debug.WriteLine("Pause");
                            playedLength += (int)(DateTime.Now - playedStartTime).TotalSeconds;
                            this.menuPlayerPlayPause.Text = "Play";

                            paused = true;
                            refreshMessenger = false;
                            refreshXfire = false;
                            refreshSkype = false;
                            refreshG15 = false;

                            RefreshPlayer(false);

                            memoryTimer.Interval = MEMORYTIMER_PAUSE;
                            memoryTimer.Start();
                        }
                        else if (script.LastIndexOf("StationPlayed") > 0)
                        {
                            const string STATION_NAME_MARK = "stationName:unescape";
                            const string STATION_ID_MARK = "stationId:unescape";
                            const string IS_SHARED_MARK = "isShared:";

                            int stationNameMark = script.IndexOf(STATION_NAME_MARK) + STATION_NAME_MARK.Length;
                            int stationNameMarkLength = script.LastIndexOf(STATION_ID_MARK) - stationNameMark;
                            int stationIdMark = script.IndexOf(STATION_ID_MARK) + STATION_ID_MARK.Length;
                            int stationIdMarkLength = script.LastIndexOf(IS_SHARED_MARK) - stationIdMark;

                            string stationNamePart = script.Substring(stationNameMark, stationNameMarkLength);
                            string stationIdPart = script.Substring(stationIdMark, stationIdMarkLength);

                            string stationName = stationNamePart.Substring(stationNamePart.IndexOf("'") + 1, stationNamePart.LastIndexOf("'") - stationNamePart.IndexOf("'") - 1);
                            string stationIdText = stationIdPart.Substring(stationIdPart.IndexOf("'") + 1, stationIdPart.LastIndexOf("'") - stationIdPart.IndexOf("'") - 1);

                            stationName = HttpUtility.UrlDecode(stationName.Replace("%25%32%37", "%27"));

                            if (currentStationCode != stationIdText)
                            {
                                Station currentStation = null;

                                foreach (Station station in stations)
                                {
                                    if (station.Code.Equals(stationIdText))
                                    {
                                        currentStation = station;
                                        break;
                                    }
                                }

                                if (currentStation != null)
                                {
                                    foreach (MenuItem menuItem in menuPlayerStations.MenuItems)
                                    {
                                        if (menuItem.Text.Equals(currentStation.Name))
                                        {
                                            title = "Playing ... " + currentStation.Name;
                                            ShowMessage(title);
                                            menuItem.Checked = true;
                                        }
                                        else
                                        {
                                            menuItem.Checked = false;
                                        }
                                    }
                                }

                                currentStationCode = stationIdText;
                            }
                        }
                    }
                }
            }
            catch (Exception ex)
            {
                Debug.WriteLine(ex.Message);
                Debug.WriteLine(ex.StackTrace);
            }
        }
예제 #15
0
        private void browser2_DocumentComplete(object sender, AxSHDocVw.DWebBrowserEvents2_DocumentCompleteEvent e)
        {
            try
            {
                IHTMLDocument2 document = (IHTMLDocument2)browser2.Document;
                IHTMLElement element = (IHTMLElement)document.all.item("version", 0);

                latestVersion = element.innerText;

                int currentVersionNumber = int.Parse(Manager.CurrentVersion.Replace(".", ""));
                int latestVersionNumber = int.Parse(latestVersion.Replace(".", ""));
                int lastNewVersionNumber = int.Parse(configuration.NewVersion.Replace(".", ""));

                if (latestVersionNumber > lastNewVersionNumber)
                {
                    configuration.NewVersion = latestVersion;
                    configuration.NewVersionReport = true;
                    configuration.Save();
                }

                latestVersionNumber = latestVersionNumber * (int)Math.Pow(10, 4 - latestVersion.Split(new char[] {'.'}).Length);

                if (currentVersionNumber == latestVersionNumber)
                {
                    isLatestVersion = true;
                }
                else if (currentVersionNumber > latestVersionNumber)
                {
                    isBetaVersion = true;

                    IHTMLElement betaElement = (IHTMLElement)document.all.item("betaVersion", 0);

                    if (betaElement != null)
                    {
                        int latestBetaVersionNumber = int.Parse(betaElement.innerText.Replace(".", ""));

                        if (latestBetaVersionNumber > currentVersionNumber)
                        {
                            if (MessageBox.Show(
                                "New BETA " + betaElement.innerText + " is available." + Environment.NewLine + Environment.NewLine +
                                "Do you want to download the new BETA now?", "OpenPandora", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes)
                            {
                                Shell32.ShellExecute(0, "Open", INSTALLER_BETA_URL, "", Application.StartupPath, 1);
                                this.Close();
                            }
                        }
                    }
                }
                else if (configuration.NewVersionReport)
                {
                    if (MessageBox.Show(
                        "New version " + latestVersion + " is available." + Environment.NewLine + Environment.NewLine +
                        "Do you want to download the new version now?", "OpenPandora", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes)
                    {
                        Shell32.ShellExecute(0, "Open", INSTALLER_URL, "", Application.StartupPath, 1);
                        this.Close();
                    }
                    else
                    {
                        if (MessageBox.Show(
                            "New version " + latestVersion + " is available." + Environment.NewLine + Environment.NewLine +
                            "Remind you later?", "OpenPandora", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.No)
                        {
                            configuration.NewVersionReport = false;
                            configuration.Save();
                        }
                    }
                }

                loaded2 = true;

                //browser2.Refresh2();

                //RefreshPlayer(false);
                ApplyConfiguration(configuration, true, true);
            }
            catch (Exception ex)
            {
                Debug.WriteLine(ex.Message);
                Debug.WriteLine(ex.StackTrace);
            }
        }
예제 #16
0
        private void browser_DocumentComplete(object sender, AxSHDocVw.DWebBrowserEvents2_DocumentCompleteEvent e)
        {
            try
            {
                string urlText = HttpUtility.UrlDecode(e.uRL as string);
                Debug.WriteLine("browser_DocumentComplete: " + urlText);

                if (urlText == "http://www.pandora.com/restricted")
                {
                    MessageBox.Show(this, "We are sorry, but Pandora blocked you from using their service.\nOnly users from inside U.S. are allowed.", "OpenPandora", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                    Shell32.ShellExecute(0, "Open", urlText, "", Application.StartupPath, 1);
                    this.Close();
                }
                else if (urlText.StartsWith(@"res://C:\WINDOWS\system32\shdoclc.dll/navcancl.htm"))
                {
                    Debug.WriteLine("Refreshing player in 15 seconds");
                    browserRefreshTimer.Interval = 15000;
                    browserRefreshTimer.Start();
                }
                else if (!loaded)
                {
                    Debug.WriteLine("Radio: timer");
                    browserTimer.Start();
                }
            }
            catch (Exception ex)
            {
                Debug.WriteLine(ex.Message);
                Debug.WriteLine(ex.StackTrace);
            }
        }
예제 #17
0
        private void browser_NewWindow3(object sender, AxSHDocVw.DWebBrowserEvents2_NewWindow3Event e)
        {
            try
            {
                if (e.bstrUrl.StartsWith("http://www.pandora.com/?cmd=mini") || e.bstrUrl.StartsWith("http://www.pandora.com/?cmd=indexmini"))
                {
                    // prevent opening pandora mini player
                }
                else
                {
                    Debug.WriteLine("new window: " + e.bstrUrl + " | " + e.bstrUrlContext);

                    Shell32.ShellExecute(0, "Open", e.bstrUrl, "", Application.StartupPath, 1);
                }

                e.cancel = true;
            }
            catch (Exception ex)
            {
                Debug.WriteLine(ex.Message);
                Debug.WriteLine("Url: " + e.bstrUrl);
                Debug.WriteLine(ex.StackTrace);
            }
        }
예제 #18
0
        private void browser_BeforeNavigate2(object sender, AxSHDocVw.DWebBrowserEvents2_BeforeNavigate2Event e)
        {
            try
            {
                string urlText = HttpUtility.UrlDecode(e.uRL as string);

                Debug.WriteLine("browser_BeforeNavigate2: " + urlText);

                if (urlText.StartsWith("res://ieframe.dll/navcancl.htm"))
                {
                    textMessageCode = 1;
                    textMessageTimer.Start();
                    e.cancel = true;
                    return;
                }

                try
                {
                    if (!loaded && browserTimer != null)
                    {
                        Debug.WriteLine("Radio: timer");
                        browserTimer.Interval = 10000;
                        browserTimer.Start();
                    }
                }
                catch (Exception ex)
                {
                    Debug.WriteLine(ex.Message);
                    Debug.WriteLine(ex.StackTrace);
                }

                if (PandoraTuner.IsTunerUrl(urlText))
                {
                    PandoraTuner tuner = new PandoraTuner(urlText);

                    if (tuner.ContainsCreateStation ||
                        tuner.ContainsDeleteStation ||
                        tuner.ContainsLogin ||
                        tuner.ContainsOpen ||
                        tuner.ContainsPause ||
                        tuner.ContainsSharedStation ||
                        tuner.ContainsSkip ||
                        tuner.ContainsStation)
                    {
                        continuesPlayCounter = 0;
                    }

                    if ((loginTime - DateTime.Now).TotalHours == 6)
                    {
                        loginTime = DateTime.Now;
                        Manager.Login(listenerID);
                    }

                    if (tuner.ContainsRegistration)
                    {
                        ResizeFromContent(radioSize);
                    }

                    if (tuner.ContainsLogin)
                    {
                        loaded = true;
                        loginTime = DateTime.Now;

                        if (pandora == null)
                        {
                            pandora = new Pandora(browser);
                        }

                        panelBrowser.BringToFront();
                    }

                    if (tuner.ContainsPlay)
                    {
                        /*OnPlayStart();

                        ++continuesPlayCounter;

                        memoryTimer.Interval = MEMORYTIMER_DELAY;
                        memoryTimer.Start();

                        if (taskbarNotifier != null && taskbarNotifier.Visible)
                        {
                            taskbarNotifier.Hide();
                        }

                        if (!paused)
                        {
                            playedLength += (int)(DateTime.Now - playedStartTime).TotalSeconds;

                            SubmitSongToLastFM(song.Artist, song.Name, playedLength);

                            playedLength = 0;
                        }

                        playedStartTime = DateTime.Now;*/
                    }
                    else if (tuner.ContainsPause)
                    {
                        /*playedLength += (int)(DateTime.Now - playedStartTime).TotalSeconds;
                        this.menuPlayerPlayPause.Text = "Play";

                        paused = true;
                        refreshMessenger = false;
                        refreshXfire = false;
                        refreshSkype = false;

                        RefreshPlayer(false);

                        memoryTimer.Interval = MEMORYTIMER_PAUSE;
                        memoryTimer.Start();*/
                    }

                    if (tuner.ContainsLogout)
                    {
                        RestartPlayer();
                    }

                    if (tuner.ContainsUser)
                    {
                        authToken = tuner.AuthToken;
                        listenerID = tuner.ListenerID;

                        Manager.Login(listenerID);
                        LoadStations();
                        ResizeFromContent(new Size(radioSize.Width, radioSize.Height - 200));
                    }

                    if (tuner.ContainsCreateStation)
                    {
                        LoadStations();
                    }

                    if (!tuner.ContainsDeleteStation && deleteStation)
                    {
                        if (tuner.ContainsStation)
                        {
                            LoadStations();
                        }

                        deleteStation = false;
                    }

                    if (tuner.ContainsDeleteStation)
                    {
                        deleteStation = true;
                    }

                    if (!tuner.ContainsSharedStation && sharedStation)
                    {
                        if (tuner.ContainsStation)
                        {
                            LoadStations();
                        }

                        sharedStation = false;
                    }

                    if (tuner.ContainsSharedStation)
                    {
                        sharedStation = true;
                    }

                    if (tuner.ContainsAds)
                    {
                        if (isPayingUser != tuner.IsPayingUser)
                        {
                            isPayingUser = tuner.IsPayingUser;

                            configuration.PayingUser = tuner.IsPayingUser;
                            configuration.Save();
                        }
                    }

                    if (tuner.ContainsOpen)
                    {
                        lastBookmark = DateTime.Now;
                    }

                    if (tuner.ContainsSkip)
                    {
                        Debug.WriteLine("Skip");
                    }

                    if (configuration.PartyMode && continuesPlayCounter > 30)
                    {
                        Debug.WriteLine("Party !!!!!!!!!!!!!!!!!");
                        pandora.NextTrack();

                        continuesPlayCounter = 0;
                    }
                }
            }
            catch (Exception ex)
            {
                Debug.WriteLine(ex.Message);
                Debug.WriteLine(ex.StackTrace);
            }
        }
예제 #19
0
파일: MainForm.cs 프로젝트: ctsyolin/ieunit
 private void browserMain_CommandStateChange(object sender, AxSHDocVw.DWebBrowserEvents2_CommandStateChangeEvent e) {
     const int CSC_NAVIGATEFORWARD = 1;
     const int CSC_NAVIGATEBACK = 2;
     if ( e.command.Equals(CSC_NAVIGATEFORWARD) ) {
         this.btnForward.Enabled = e.enable;
     } else if ( e.command.Equals(CSC_NAVIGATEBACK) ) {
         this.btnBack.Enabled = e.enable;
     }
 }
예제 #20
0
파일: Form1.cs 프로젝트: DirkViljoen/eSalon
        private void htmlEditor_NavigateComplete2(object sender, AxSHDocVw.DWebBrowserEvents2_NavigateComplete2Event e)
        {
            System.Text.StringBuilder s = new System.Text.StringBuilder();
            s.Append( "<div>This sample demonstrates how to send html email.</div><div>&nbsp;</div>" );
            s.Append( "<div>From: [$from]</div>" );
            s.Append( "<div>To: [$to]</div>" );
            s.Append( "<div>Subject: [$subject]</div><div>&nbsp;</div>" );
            s.Append( "<div>If no sever address was specified, the email will be delivered to the recipient's server directly," );
            s.Append( "However, if you don't have a static IP address, ");
            s.Append( "many anti-spam filters will mark it as a junk-email.</div><div>&nbsp;</div>" );
            s.Append( "<div>If \"Digitial Signature\" was checked, please make sure you have the certificate for the sender address installed on " );
            s.Append( "Local User Certificate Store.</div><div>&nbsp;</div>" );
            s.Append( "<div>If \"Encrypt\" was checked, please make sure you have the certificate for recipient address installed on the Local User Certificate Store.</div>" );

            m_htmlDoc.body.innerHTML = s.ToString();
        }
예제 #21
0
        private void ctlRaagaBrowser_BeforeNavigate2(object sender, AxSHDocVw.DWebBrowserEvents2_BeforeNavigate2Event e)
        {
            //
            //Does songs listed in this page(Either movie / Playlist...)
            try
            {

            }
            catch(Exception _e)
            {
                frmException frm = new frmException();
                frm.ExceptionDialogTitle = "Song list setection problem ";
                frm.ErrorMessage = _e.Message;
                frm.StrackTrace = _e.StackTrace;
                if (frm.ShowDialog() == DialogResult.OK)
                {
                    frm.Dispose();
                    frm = null;
                }
            }

            #region Old Code
            /*
            try
            {
                //

                //Someone has clicked a "submit" button in the page
                if ((e.uRL.ToString().IndexOf("secnew/authenNew.asp") >= 0) &&
                    (m_Cookies.SessionID != ""))
                {
                    //Get the Key1=Value1&Key2=Value2 like posted data string
                    string sPostedData =
                        System.Text.ASCIIEncoding.UTF8.GetString((Byte[])e.postData);

                    MessageBox.Show("Headers :" + e.headers.ToString());
                    MessageBox.Show("Cookies :" + ((IHTMLDocument2)ctlRaagaBrowser.Document).cookie);

                    //Split the posted string by "&"
                    if (sPostedData.Length > 0)
                    {
                        string[] arrPostedData = sPostedData.Split(new char[]{'&'});

                        string sLogIn =
                            arrPostedData[0].Substring(arrPostedData[0].IndexOf("=") + 1);
                        string sPassword =
                            arrPostedData[1].Substring(arrPostedData[1].IndexOf("=") + 1);

                        if ((sLogIn.Trim() != "") && (sPassword.Trim() != ""))
                        {

                            //Post the HTTP data by ourselves
                            //
                            //Use .NET smart client classes like WebRequest or WebResponse
                            //for the obvious solution
                            string sHTMLResponse =
                                Common.Utility.PostToURLAndGetResponse(
                                URLs.RAAGA_HOME + "/secnew/authenNew.asp",
                                sPostedData,
                                m_Cookies);

                            //
                            //Parse...Parse...Parse
                            //
                            //While looking for signature I found 'tHead' class
                            //in the playlists.Simple. Look fo.r <form></form> and if
                            //it has a 'tHead' in it it's playlist row
                            int iFormStartTag = -1;
                            int	iFormEndTag = -1;
                            int	iIndex = 0;
                            string sInnerFormHTML = "";
                            string sPlayListHTML = "";
                            do
                            {
                                iFormStartTag = sHTMLResponse.IndexOf(
                                    Signatures.HTMLFormTag,
                                    iIndex);

                                if (iFormStartTag >= 0)
                                {
                                    iFormEndTag = sHTMLResponse.IndexOf(
                                        Signatures.HTMLFormEndTag,
                                        iFormStartTag);
                                }

                                if ((iFormStartTag > 0) && (iFormEndTag > 0))
                                {
                                    sInnerFormHTML =
                                        sHTMLResponse.Substring(
                                        iFormStartTag,
                                        iFormEndTag - iFormStartTag);

                                    if (sInnerFormHTML.Length > 0)
                                    {
                                        //If it's the <form> block we're looking for
                                        if (sInnerFormHTML.IndexOf(
                                            Signatures.RaagaPlayList) > 0)
                                        {
                                            //Yes!!!
                                            sPlayListHTML += sInnerFormHTML;
                                            iIndex = iFormEndTag + 3;
                                        }
                                    }

                                }

                            }
                            while((iFormEndTag != -1) &&
                                (iFormEndTag != sHTMLResponse.Length));

                            //Create a tempfile and dump the HTML to it
                            FileStream fs = new FileStream(
                                Application.StartupPath + @"/HTMLPages/playlist_LIST.htm",
                                FileMode.OpenOrCreate,
                                FileAccess.ReadWrite,
                                FileShare.ReadWrite);

                            StreamReader sr = new StreamReader(fs);

                            string sNewFileContent =
                                sr.ReadToEnd().Replace(
                                "[RaagaPlayListForms]",
                                sPlayListHTML.Trim());
                            sr.Close();

                            //Write back to the HTML
                            StreamWriter sw = new StreamWriter(fs);
                            sw.Write(sNewFileContent);
                            sw.Close();

                            fs.Close();

                            //Don't let the iexplorer to post the values,We'll aqapost it later
                            e.cancel = true;

                            NavigateToUrl(
                                Application.StartupPath + @"/HTMLPages/playlist_LIST.htm");
                        }

                    }

                }
                else if (e.uRL.ToString() == URLs.RAAGA_LOGIN_REFERER)
                {
                    e.cancel = true;

                    //MessageBox.Show("Headers :" + ((IHTMLDocument2)ctlRaagaBrowser.Document).h
                    MessageBox.Show("Cookies :" + ((IHTMLDocument2)ctlRaagaBrowser.Document).cookie);

                    //Get the ASP session ID(may be ASP 3.0)
                    //
                    //Get the cookie collection
                    /*
                    IHTMLDocument2 doc = (IHTMLDocument2)ctlRaagaBrowser.Document;
                    string sCookie = doc.cookie;
                    if (sCookie.Trim() != "")
                    {
                        if (sCookie.IndexOf(";") >= 0)
                        {
                            //More than one cookie
                            m_SessionID = "";

                        }
                        else
                        {
                            //One cookie - and that got to be ASP SESSION ID
                            m_SessionID = sCookie;
                        }
                    }

                }
                else
                {
                    e.cancel = false;

                }
            }
            catch(Exception _e)
            {
                e.cancel = true;

                frmException frm = new frmException();
                frm.ExceptionDialogTitle = "Raaga.com navigational problem ";
                frm.ErrorMessage = _e.Message;
                frm.StrackTrace = _e.StackTrace;
                if (frm.ShowDialog() == DialogResult.OK)
                {
                    frm.Dispose();
                    frm = null;
                }
            }
            */
            #endregion
        }
예제 #22
0
 private void ctlRaagaJukebox_NewWindow2(object sender, AxSHDocVw.DWebBrowserEvents2_NewWindow2Event e)
 {
     try
     {
         //No popup here
         e.cancel = true;
     }
     catch(Exception _e)
     {
         frmException frm = new frmException();
         frm.ExceptionDialogTitle = "Raaga.com navigational problem ";
         frm.ErrorMessage = _e.Message;
         frm.StrackTrace = _e.StackTrace;
         if (frm.ShowDialog() == DialogResult.OK)
         {
             frm.Dispose();
             frm = null;
         }
     }
 }
예제 #23
0
        private void ctlRaagaBrowser_DocumentComplete(object sender, AxSHDocVw.DWebBrowserEvents2_DocumentCompleteEvent e)
        {
            try
            {
                //Either movie/playlist
                if (((e.uRL.ToString().IndexOf("movie") >= 0) && (e.uRL.ToString().IndexOf("movies") == -1)) ||
                    (e.uRL.ToString().IndexOf("viewPL") >= 0))
                {
                    IHTMLDocument2 doc = ((IHTMLDocument2)this.ctlRaagaBrowser.Document);
                    if (doc != null)
                    {
                        //
                        //Get the forms : Raaga songs listed in a form named "raaga"
                        IHTMLFormElement2 oSongForm = null;
                        oSongForm = ((IHTMLFormElement2)doc.forms.item("raaga",0));
                        if (oSongForm != null)
                        {
                            //
                            //If the form called "raaga" is present execute following
                            //script
                            doc.parentWindow.execScript(Signatures.SongListJS,"JavaScript");
                            m_SongsNo = doc.title == "" ? 0 : int.Parse(doc.title);
                            lblSongs.Text = "1/" + m_SongsNo.ToString();
                            lblSongs.Refresh();

                            //
                            //Also attach a IDispatch handler to receive
                            //javascript events in a IE-COM way
                            doc.onclick = this;
                        }

                    }
                }

            }
            catch(Exception _e)
            {
                frmException frm = new frmException();
                frm.ExceptionDialogTitle = "Song list setection problem ";
                frm.ErrorMessage = _e.Message;
                frm.StrackTrace = _e.StackTrace;
                if (frm.ShowDialog() == DialogResult.OK)
                {
                    frm.Dispose();
                    frm = null;
                }
            }
        }
예제 #24
0
 /// <summary>
 /// Constructor.
 /// </summary>
 /// <param name="theAxWebBrowser">The web browser activeX control.</param>
 public ValidationResultsManager(AxSHDocVw.AxWebBrowser theAxWebBrowser)
 {
     _AxWebBrowser = theAxWebBrowser;
 }
예제 #25
0
        private void ctlRaagaBrowser_NewWindow2(object sender, AxSHDocVw.DWebBrowserEvents2_NewWindow2Event e)
        {
            try
            {
                m_wndChild = new frmNewWindowJukeBox(this);
                e.ppDisp = m_wndChild.RaagaJukebox.Application;
                m_wndChild.RaagaJukebox.RegisterAsBrowser = true;
                m_wndChild.Hide();
                //frm.Show();

            }
            catch(Exception _e)
            {
                frmException frm = new frmException();
                frm.ExceptionDialogTitle = "Raaga.com navigational problem ";
                frm.ErrorMessage = _e.Message;
                frm.StrackTrace = _e.StackTrace;
                if (frm.ShowDialog() == DialogResult.OK)
                {
                    frm.Dispose();
                    frm = null;
                }
            }
        }
예제 #26
0
        private static Size GetRadioSize(AxSHDocVw.AxWebBrowser browser)
        {
            IHTMLDocument2 document = (IHTMLDocument2)browser.Document;

            if (document == null)
            {
                Debug.WriteLine("Radio Size: document not loaded");

                return new Size(0, 0);
            }

            IHTMLElement element = (IHTMLElement)document.all.item("radio", 0);

            if (element == null)
            {
                Debug.WriteLine("Radio Size: missing");

                return new Size(0, 0);
            }

            return new Size(element.offsetWidth, element.offsetHeight);
        }
예제 #27
0
 private void axWebBrowser2_DocumentComplete(object sender, AxSHDocVw.DWebBrowserEvents2_DocumentCompleteEvent e)
 {
     menuHook.StartSubclass(menuHook.IEFromhWnd(axWebBrowser2.Handle),axWebBrowser2);
 }
예제 #28
0
        private void ctlRaagaJukebox_DocumentComplete(object sender, AxSHDocVw.DWebBrowserEvents2_DocumentCompleteEvent e)
        {
            try
            {
                if (e.uRL.ToString().IndexOf("playerV31/index.asp") >= 0)
                {
                    Uri PlayerUrl = new Uri(e.uRL.ToString());
                    if (PlayerUrl.Query.IndexOf("bhcp") >= 0)
                    {
                        //
                        //Go to the next track
                        //Simulate javascript::Next() API possibly exposed by
                        //the player
                        IHTMLDocument2 docPlayer = ((IHTMLDocument2)ctlRaagaJukebox.Document);

                        if (docPlayer != null)
                        {
                            this.Size = new Size(482,292);
                            this.Size = new Size(480,290);

                            //
                            //Get the first frame window
                            object oIndex = 0;
                            IHTMLWindow2 framePlayer =
                                (IHTMLWindow2)docPlayer.parentWindow.frames.item(ref oIndex);
                            if ((framePlayer != null) && (m_bToggle == true))
                            {
            #if DEBUG && TRACE_DUMP
                                using (RaagaHacker.Debug.frmDump dump = new RaagaHacker.Debug.frmDump())
                                {
                                    dump.Dump = framePlayer.document.body.parentElement.outerHTML;
                                    dump.ShowDialog();
                                }
            #endif

                                //register the above function as a RealOne control's ontitlechange
                                //listner
            //                                string sJSTitleChange = @" if (raaga_ply != null)
            //                                                            {
            //                                                                raaga_ply.attachEvent('OnTitleChange',OnTitleChange);
            //                                                            }
            //                                                            function OnTitleChange(ClipTitle)
            //                                                            {
            //                                                                document.title = ClipTitle;
            //                                                            }";
            //                                framePlayer.execScript(sJSTitleChange, "JavaScript");

                                //
                                //First audio clip is potentially a dirty add clip.
                                //So ignore it
                                //framePlayer.execScript("if (raaga_ply != null) {raaga_ply.DoNextEntry();}", "JavaScript");

                            }

                        }
                    }

                }
                else
                {
                    if ((e.uRL.ToString().IndexOf("ads1.asp") >= 0) ||
                        (e.uRL.ToString().ToLower().IndexOf("raagaads.asp") >= 0))
                    {
                        IHTMLDocument2 docPlayer = ((IHTMLDocument2)ctlRaagaJukebox.Document);

                        if (docPlayer != null)
                        {
                            this.Size = new Size(482,292);
                            this.Size = new Size(480,290);

                            //
                            //Get the first frame window
                            object oIndex = 0;
                            IHTMLWindow2 framePlayer =
                                (IHTMLWindow2)docPlayer.parentWindow.frames.item(ref oIndex);
                            if (framePlayer != null)
                            {
                                if (m_bToggle == true)
                                {
                                    //Save the frame-player
                                    m_wndPlayer = framePlayer;

            #if DEBUG && TRACE_DUMP
                                    using (RaagaHacker.Debug.frmDump dump = new RaagaHacker.Debug.frmDump())
                                    {
                                        dump.Dump = framePlayer.document.body.parentElement.outerHTML;
                                        dump.ShowDialog();
                                    }
            #endif

                                    //
                                    //First audio clip is potentially a dirty add clip.
                                    //So ignore it

                                    //register the above function as a RealOne control's ontitlechange
                                    //listner
                                    string sJSTitleChange = @"if (raaga_ply != null)
                                                            {
                                                                raaga_ply.attachEvent('OnTitleChange',OnTitleChange);
                                                            }
                                                            function OnTitleChange(ClipTitle)
                                                            {
                                                                document.title = ClipTitle;
                                                            }";
                                    framePlayer.execScript(sJSTitleChange, "JavaScript");

                                    //
                                    //The DoNextEntry() API is asynchronous - means it returns
                                    //immediately. So the call to get the current clip title
                                    //proved futile.
                                    m_bToggle = false;

                                    framePlayer.execScript("if (raaga_ply != null) {raaga_ply.DoNextEntry();}", "JavaScript");

                                }
                                else
                                {
                                    if (m_bGotSongInfo == false)
                                    {

                                    }
                                }

                            }

                        }
                    }
                    else
                    {
                        if (e.uRL.ToString().IndexOf(URLs.RAAGA_ADD_TO_PLAYLIST) >= 0)
                        {
                            this.ShowDialog();
                        }

                    }
                }
            }
            catch(Exception _e)
            {
                if (Globals.GetInstance().SuppressError == false)
                {
                    frmException frm = new frmException();
                    frm.ExceptionDialogTitle = "Raaga Jukebox Manipulation Problem ";
                    frm.ErrorMessage = _e.Message;
                    frm.StrackTrace = _e.StackTrace;
                    if (frm.ShowDialog() == DialogResult.OK)
                    {
                        frm.Dispose();
                        frm = null;
                    }
                }
            }
        }
예제 #29
0
        /// <summary>
        /// Handles the command state change, to determine if the Back and Forward are enabled or disabled.
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        public void CommandStateChange(object sender, AxSHDocVw.DWebBrowserEvents2_CommandStateChangeEvent e)
        {
            switch(e.command)
            {
                case 1:
                    _ForwardEnabled = e.enable;
                    break;

                case 2:
                    _BackEnabled = e.enable;
                    break;

                default:
                    // Do nothing.
                    break;
            }
        }
예제 #30
0
        //Fires when document's title changes
        private void ctlRaagaJukebox_TitleChange(object sender, AxSHDocVw.DWebBrowserEvents2_TitleChangeEvent e)
        {
            try
            {
                //Add skipped !!!!
                if (m_bToggle == false)
                {
                    IHTMLWindow2 framePlayer = m_wndPlayer;

                    if (framePlayer != null)
                    {
                        //
                        //Save the previous recording
                        if (m_isRecording == true)
                        {
                            //Stop the recording
                            m_isRecording = false;
                            Stop();

                            //
                            //Do the saving...(mp3/wav etc)
                            if (m_sCurrentSongInfo != null)
                            {
                                //
                                //Do the saving...(mp3/wav etc)
                                FormatConverter converter = new FormatConverter();
                                converter.Convert(m_sCurrentMusicRecordingPath + "\\" +
                                        m_sCurrentSongInfo.SongTitle + ".wav",m_sCurrentSongInfo);

                                m_sCurrentSongInfo = null;
                            }
                        }

                        //Finished the playlist...close the window
                        if (m_CurrentSongIndex >= m_wndParent.SongsCount)
                        {
                            //Disable the Raaga player volume control
                            m_wndParent.PlayerVolume = -1;
                            Stop();
                            this.Close();
                        }
                        else
                        {
                            //Un-register the TitleChange event-hadler
                            ctlRaagaJukebox.TitleChange -=
                                new AxSHDocVw.DWebBrowserEvents2_TitleChangeEventHandler(
                                    this.ctlRaagaJukebox_TitleChange);

                            //Get the volume and update the parent UI
                            framePlayer.execScript("if (raaga_ply != null) { document.title = raaga_ply.GetVolume(); }", "JavaScript");
                            m_wndParent.PlayerVolume = int.Parse(framePlayer.document.title.Trim());

                            //
                            //No way to get javascript string to C# string
                            framePlayer.execScript(
                                "if (raaga_ply != null) { document.title = raaga_ply.GetEntryTitle(raaga_ply.GetCurrentEntry()); }",
                                "JavaScript");
                            string sClipTitle = framePlayer.document.title;

                            SongInfo si = ClipInfoParser.GetClipInfo(sClipTitle);
                            m_sCurrentSongInfo = si;

                            string s = "";
                            s += "Song :" + si.SongTitle + "\r\n";
                            s += "Artist :" + si.Artist + "\r\n";
                            s += "Composer/Director :" + si.MusicComposer + "\r\n";
                            s += "Album/Film :" + si.Album + "\r\n";
                            //MessageBox.Show(s);

                            //
                            //Register the .NET event-handler again sothat
                            //on clipchange(on-document-title change) it fires again
                            ctlRaagaJukebox.TitleChange +=
                                new AxSHDocVw.DWebBrowserEvents2_TitleChangeEventHandler(
                                this.ctlRaagaJukebox_TitleChange);

                            //
                            //Add embedded between subsequent songs have no title/album
                            m_isRecording = true;

                            if ((si != null) && (si.Album.Trim() != ""))
                            {
                                //
                                //Detect adds in between(Ad Signatures in Beta 2.)
                                string[] AdSignatures = new string[] { "xoom", "citibank", "rupee", "money", "ford" };
                                if ((si.SongTitle.ToLower().IndexOf(AdSignatures[0]) >= 0) ||
                                    (si.SongTitle.ToLower().IndexOf(AdSignatures[1]) >= 0) ||
                                    (si.SongTitle.ToLower().IndexOf(AdSignatures[2]) >= 0) ||
                                    (si.SongTitle.ToLower().IndexOf(AdSignatures[3]) >= 0) ||
                                    (si.SongTitle.ToLower().IndexOf(AdSignatures[4]) >= 0))
                                {
                                    framePlayer.execScript("if (raaga_ply != null) { raaga_ply.DoNextEntry(); }", "JavaScript");
                                    m_isRecording = false;
                                    m_sCurrentSongInfo = null;
                                }
                                else
                                {
                                    //
                                    //Show songinfo/index in main window
                                    if (m_wndParent != null)
                                    {
                                        m_wndParent.DisplaySongInfo(m_sCurrentSongInfo, m_CurrentSongIndex);
                                        m_CurrentSongIndex++;
                                    }

                                    //
                                    //Core : Record the music
                                    m_lCumulativeBytesCount = 0;
                                    string MusicFolder = "";
                                    if (Globals.GetInstance().AutomaticGenreDetection == true)
                                    {
                                        if (Directory.Exists(
                                            Globals.GetInstance().MusicDirectory + "\\" +
                                            m_sCurrentSongInfo.Album) == false)
                                        {

                                            Directory.CreateDirectory(
                                                Globals.GetInstance().MusicDirectory + "\\" +
                                                m_sCurrentSongInfo.Album);
                                        }

                                        MusicFolder =
                                            Globals.GetInstance().MusicDirectory + "\\" +
                                            m_sCurrentSongInfo.Album;

                                    }
                                    else
                                    {
                                        //Assorted is selceted
                                        if (Directory.Exists(
                                            Globals.GetInstance().MusicDirectory + "\\" +
                                            Globals.GetInstance().AssortedDirectory) == false)
                                        {
                                            Directory.CreateDirectory(
                                                Globals.GetInstance().MusicDirectory + "\\" +
                                                Globals.GetInstance().AssortedDirectory);
                                        }

                                        MusicFolder =
                                            Globals.GetInstance().MusicDirectory + "\\" +
                                            Globals.GetInstance().AssortedDirectory;

                                    }

                                    m_isRecording = true;
                                    m_sCurrentMusicRecordingPath =
                                        MusicFolder;
                                    Start(MusicFolder + "\\" +
                                        m_sCurrentSongInfo.SongTitle + ".wav");

                                }

                            }
                        }

                    }

                }

            }
            catch(Exception _e)
            {
                Stop();

                if (Globals.GetInstance().SuppressError == false)
                {
                    frmException frm = new frmException();
                    frm.ExceptionDialogTitle = "Raaga.com recording problem ";
                    frm.ErrorMessage = _e.Message;
                    frm.StrackTrace = _e.StackTrace;
                    if (frm.ShowDialog() == DialogResult.OK)
                    {
                        frm.Dispose();
                        frm = null;
                    }
                }
            }
        }